00001 /* 00002 * The Mana World 00003 * Copyright (C) 2006 The Mana World Development Team 00004 * 00005 * This file is part of The Mana World. 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef TEXTPREVIEW_H 00023 #define TEXTPREVIEW_H 00024 00025 #include <guichan/color.hpp> 00026 #include <guichan/font.hpp> 00027 #include <guichan/widget.hpp> 00028 00032 class TextPreview : public gcn::Widget 00033 { 00034 public: 00035 TextPreview(const std::string &text); 00036 00042 inline void setTextColor(const gcn::Color *color) 00043 { 00044 mTextColor = color; 00045 } 00046 00052 inline void useTextAlpha(bool alpha) 00053 { 00054 mTextAlpha = alpha; 00055 } 00056 00063 inline void setTextBGColor(const gcn::Color *color) 00064 { 00065 mTextBGColor = color; 00066 } 00067 00073 inline void setBGColor(const gcn::Color *color) 00074 { 00075 mBGColor = color; 00076 } 00077 00083 inline void setFont(gcn::Font *font) 00084 { 00085 mFont = font; 00086 } 00087 00093 inline void setShadow(bool shadow) 00094 { 00095 mShadow = shadow; 00096 } 00097 00103 inline void setOutline(bool outline) 00104 { 00105 mOutline = outline; 00106 } 00107 00113 void draw(gcn::Graphics *graphics); 00114 00121 void setOpaque(bool opaque) { mOpaque = opaque; } 00122 00127 bool isOpaque() const { return mOpaque; } 00128 00129 private: 00130 gcn::Font *mFont; 00131 std::string mText; 00132 const gcn::Color *mTextColor; 00133 const gcn::Color *mBGColor; 00134 const gcn::Color *mTextBGColor; 00135 static float mAlpha; 00136 bool mTextAlpha; 00137 bool mOpaque; 00138 bool mShadow; 00139 bool mOutline; 00140 }; 00141 00142 #endif