00001 /*********************************************************************** 00002 filename: CEGUIListboxTextItem.h 00003 created: 12/6/2004 00004 author: Paul D Turner 00005 00006 purpose: Interface for list box text items 00007 *************************************************************************/ 00008 /*************************************************************************** 00009 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining 00012 * a copy of this software and associated documentation files (the 00013 * "Software"), to deal in the Software without restriction, including 00014 * without limitation the rights to use, copy, modify, merge, publish, 00015 * distribute, sublicense, and/or sell copies of the Software, and to 00016 * permit persons to whom the Software is furnished to do so, subject to 00017 * the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be 00020 * included in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00023 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00024 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00025 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00026 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00027 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00028 * OTHER DEALINGS IN THE SOFTWARE. 00029 ***************************************************************************/ 00030 #ifndef _CEGUIListboxTextItem_h_ 00031 #define _CEGUIListboxTextItem_h_ 00032 #include "CEGUIListboxItem.h" 00033 #include "../CEGUIBasicRenderedStringParser.h" 00034 00035 // Start of CEGUI namespace section 00036 namespace CEGUI 00037 { 00042 class CEGUIEXPORT ListboxTextItem : public ListboxItem 00043 { 00044 public: 00045 /************************************************************************* 00046 Constants 00047 *************************************************************************/ 00048 static const colour DefaultTextColour; 00049 00050 00051 /************************************************************************* 00052 Construction and Destruction 00053 *************************************************************************/ 00058 ListboxTextItem(const String& text, uint item_id = 0, void* item_data = 0, bool disabled = false, bool auto_delete = true); 00059 00060 00065 virtual ~ListboxTextItem(void) {} 00066 00067 00068 /************************************************************************* 00069 Accessor methods 00070 *************************************************************************/ 00081 Font* getFont(void) const; 00082 00083 00091 ColourRect getTextColours(void) const {return d_textCols;} 00092 00093 00094 /************************************************************************* 00095 Manipulator methods 00096 *************************************************************************/ 00107 void setFont(Font* font); 00108 00109 00120 void setFont(const String& font_name); 00121 00122 00133 void setTextColours(const ColourRect& cols) {d_textCols = cols;} 00134 00135 00155 void setTextColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour); 00156 00157 00168 void setTextColours(colour col) {setTextColours(col, col, col, col);} 00169 00170 // base class overrides 00171 void setText(const String& text); 00172 00173 00174 /************************************************************************* 00175 Required implementations of pure virtuals from the base class. 00176 *************************************************************************/ 00177 Size getPixelSize(void) const; 00178 void draw(GeometryBuffer& buffer, const Rect& targetRect, float alpha, const Rect* clipper) const; 00179 00180 protected: 00181 void parseTextString() const; 00182 00183 /************************************************************************* 00184 Implementation Data 00185 *************************************************************************/ 00186 ColourRect d_textCols; 00187 Font* d_font; 00188 00189 static BasicRenderedStringParser d_stringParser; 00191 mutable RenderedString d_renderedString; 00193 mutable bool d_renderedStringValid; 00194 }; 00195 00196 } // End of CEGUI namespace section 00197 00198 00199 #endif // end of guard _CEGUIListboxTextItem_h_