Crazy Eddie's GUI System  0.8.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
ListboxTextItem.h
1 /***********************************************************************
2  filename: CEGUIListboxTextItem.h
3  created: 12/6/2004
4  author: Paul D Turner
5 
6  purpose: Interface for list box text items
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIListboxTextItem_h_
31 #define _CEGUIListboxTextItem_h_
32 #include "./ListboxItem.h"
33 #include "../BasicRenderedStringParser.h"
34 #include "../DefaultRenderedStringParser.h"
35 
36 // Start of CEGUI namespace section
37 namespace CEGUI
38 {
43 class CEGUIEXPORT ListboxTextItem : public ListboxItem
44 {
45 public:
46  /*************************************************************************
47  Constants
48  *************************************************************************/
49  static const Colour DefaultTextColour;
50 
51 
52  /*************************************************************************
53  Construction and Destruction
54  *************************************************************************/
59  ListboxTextItem(const String& text, uint item_id = 0, void* item_data = 0, bool disabled = false, bool auto_delete = true);
60 
61 
66  virtual ~ListboxTextItem(void) {}
67 
68 
69  /*************************************************************************
70  Accessor methods
71  *************************************************************************/
82  const Font* getFont(void) const;
83 
84 
92  ColourRect getTextColours(void) const {return d_textCols;}
93 
94 
95  /*************************************************************************
96  Manipulator methods
97  *************************************************************************/
108  void setFont(Font* font);
109 
110 
121  void setFont(const String& font_name);
122 
123 
134  void setTextColours(const ColourRect& cols) {d_textCols = cols;}
135 
136 
156  void setTextColours(Colour top_left_colour, Colour top_right_colour, Colour bottom_left_colour, Colour bottom_right_colour);
157 
158 
169  void setTextColours(Colour col) {setTextColours(col, col, col, col);}
170 
180  void setTextParsingEnabled(const bool enable);
181 
183  bool isTextParsingEnabled() const;
184 
185  // base class overrides
186  void setText(const String& text);
187  bool handleFontRenderSizeChange(const Font* const font);
188 
189 
190  /*************************************************************************
191  Required implementations of pure virtuals from the base class.
192  *************************************************************************/
193  Sizef getPixelSize(void) const;
194  void draw(GeometryBuffer& buffer, const Rectf& targetRect, float alpha, const Rectf* clipper) const;
195 
196 protected:
197  void parseTextString() const;
198 
199  /*************************************************************************
200  Implementation Data
201  *************************************************************************/
204 
209  mutable bool d_renderedStringValid;
214 };
215 
216 } // End of CEGUI namespace section
217 
218 
219 #endif // end of guard _CEGUIListboxTextItem_h_