00001 #ifndef NODE_TEXT_H 00002 #define NODE_TEXT_H 00003 00004 /* 00005 00006 GLT OpenGL C++ Toolkit (LGPL) 00007 Copyright (C) 2000-2002 Nigel Stewart 00008 00009 Email: nigels.com@gmail.com 00010 WWW: http://www.nigels.com/glt/ 00011 00012 This library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU Lesser General Public 00014 License as published by the Free Software Foundation; either 00015 version 2.1 of the License, or (at your option) any later version. 00016 00017 This library is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 Lesser General Public License for more details. 00021 00022 You should have received a copy of the GNU Lesser General Public 00023 License along with this library; if not, write to the Free Software 00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 00026 */ 00027 00033 #include <iosfwd> 00034 #include <string> 00035 00036 #include <glt/viewport.h> 00037 #include <glt/color.h> 00038 #include <glt/font.h> 00039 00040 #include <node/shapes.h> 00041 #include <node/fade.h> 00042 00048 class GltTextOverlay : public GltShape 00049 { 00050 public: 00052 GltTextOverlay(const GltFont &font,const GltViewport &window); 00054 GltTextOverlay(const GltTextOverlay &overlay); 00056 ~GltTextOverlay(); 00057 00058 virtual void draw() const; 00059 00061 std::wstring &text(); 00063 const std::wstring &text() const; 00064 00066 GltColor &fadeColor(); 00067 00069 bool &border(); 00071 GltColor &borderColor(); 00073 bool &shadow(); 00075 GltColor &shadowColor(); 00076 00078 int &spacing(); 00080 int &margin(); 00082 GltHorizontalAlignment &alignHorizontal(); 00084 GltVerticalAlignment &alignVertical(); 00085 00086 // /// Calculate the (pixel) dimensions of a string of text 00087 // static void stringDimensions(const std::wstring &str,int &width,int &height); 00088 00089 private: 00090 00091 const GltFont &_font; 00092 const GltViewport &_window; 00093 00094 std::wstring _text; 00095 GltFadeViewport _textFade; 00096 bool _textShadow; 00097 GltColor _textShadowColor; 00098 GltHorizontalAlignment _textAlignHorizontal; 00099 GltVerticalAlignment _textAlignVertical; 00100 00101 int _spacing; 00102 int _margin; 00103 }; 00104 00105 #endif