Crazy Eddie's GUI System  0.8.7
ListboxTextItem.h
1 /***********************************************************************
2  created: 12/6/2004
3  author: Paul D Turner
4 
5  purpose: Interface for list box text items
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIListboxTextItem_h_
30 #define _CEGUIListboxTextItem_h_
31 #include "./ListboxItem.h"
32 #include "../BasicRenderedStringParser.h"
33 #include "../DefaultRenderedStringParser.h"
34 
35 // Start of CEGUI namespace section
36 namespace CEGUI
37 {
42 class CEGUIEXPORT ListboxTextItem : public ListboxItem
43 {
44 public:
45  /*************************************************************************
46  Constants
47  *************************************************************************/
48  static const Colour DefaultTextColour;
49 
50 
51  /*************************************************************************
52  Construction and Destruction
53  *************************************************************************/
58  ListboxTextItem(const String& text, uint item_id = 0, void* item_data = 0, bool disabled = false, bool auto_delete = true);
59 
60 
65  virtual ~ListboxTextItem(void) {}
66 
67 
68  /*************************************************************************
69  Accessor methods
70  *************************************************************************/
81  const Font* getFont(void) const;
82 
83 
91  ColourRect getTextColours(void) const {return d_textCols;}
92 
93 
94  /*************************************************************************
95  Manipulator methods
96  *************************************************************************/
107  void setFont(Font* font);
108 
109 
120  void setFont(const String& font_name);
121 
122 
133  void setTextColours(const ColourRect& cols) {d_textCols = cols;}
134 
135 
155  void setTextColours(Colour top_left_colour, Colour top_right_colour, Colour bottom_left_colour, Colour bottom_right_colour);
156 
157 
168  void setTextColours(Colour col) {setTextColours(col, col, col, col);}
169 
179  void setTextParsingEnabled(const bool enable);
180 
182  bool isTextParsingEnabled() const;
183 
184  // base class overrides
185  void setText(const String& text);
186  bool handleFontRenderSizeChange(const Font* const font);
187 
188 
189  /*************************************************************************
190  Required implementations of pure virtuals from the base class.
191  *************************************************************************/
192  Sizef getPixelSize(void) const;
193  void draw(GeometryBuffer& buffer, const Rectf& targetRect, float alpha, const Rectf* clipper) const;
194 
195 protected:
196  void parseTextString() const;
197 
198  /*************************************************************************
199  Implementation Data
200  *************************************************************************/
203  static BasicRenderedStringParser d_stringParser;
208  mutable bool d_renderedStringValid;
213 };
214 
215 } // End of CEGUI namespace section
216 
217 
218 #endif // end of guard _CEGUIListboxTextItem_h_
CEGUI::GeometryBuffer
Abstract class defining the interface for objects that buffer geometry for later rendering.
Definition: GeometryBuffer.h:44
CEGUI::Font
Class that encapsulates a typeface.
Definition: Font.h:62
CEGUI::ListboxTextItem::setTextColours
void setTextColours(Colour top_left_colour, Colour top_right_colour, Colour bottom_left_colour, Colour bottom_right_colour)
Set the colours used for text rendering.
CEGUI::ListboxTextItem::handleFontRenderSizeChange
bool handleFontRenderSizeChange(const Font *const font)
Perform any updates needed because the given font's render size has changed.
CEGUI::ListboxTextItem::setTextParsingEnabled
void setTextParsingEnabled(const bool enable)
Set whether the the ListboxTextItem will have it's text parsed via the BasicRenderedStringParser or n...
CEGUI::ListboxTextItem::ListboxTextItem
ListboxTextItem(const String &text, uint item_id=0, void *item_data=0, bool disabled=false, bool auto_delete=true)
base class constructor
CEGUI::ListboxTextItem::setTextColours
void setTextColours(const ColourRect &cols)
Set the colours used for text rendering.
Definition: ListboxTextItem.h:133
CEGUI::ListboxTextItem::getTextColours
ColourRect getTextColours(void) const
Return the current colours used for text rendering.
Definition: ListboxTextItem.h:91
CEGUI::ListboxTextItem::d_textParsingEnabled
bool d_textParsingEnabled
boolean that specifies whether text parsing is enabled for the item.
Definition: ListboxTextItem.h:212
CEGUI::ListboxTextItem::~ListboxTextItem
virtual ~ListboxTextItem(void)
base class destructor
Definition: ListboxTextItem.h:65
CEGUI
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
CEGUI::ListboxTextItem::d_noTagsStringParser
static DefaultRenderedStringParser d_noTagsStringParser
Parser used when parsing is off. Basically just does linebreaks.
Definition: ListboxTextItem.h:210
CEGUI::ListboxTextItem::d_textCols
ColourRect d_textCols
Colours used for rendering the text.
Definition: ListboxTextItem.h:201
CEGUI::RenderedString
Class representing a rendered string of entities.
Definition: RenderedString.h:52
CEGUI::ListboxTextItem::d_renderedStringValid
bool d_renderedStringValid
boolean used to track when item state changes (and needs re-parse)
Definition: ListboxTextItem.h:208
CEGUI::ColourRect
Class that holds details of colours for the four corners of a rectangle.
Definition: ColourRect.h:45
CEGUI::ListboxTextItem::getPixelSize
Sizef getPixelSize(void) const
Return the rendered pixel size of this list box item.
CEGUI::ListboxTextItem::isTextParsingEnabled
bool isTextParsingEnabled() const
return whether text parsing is enabled for this ListboxTextItem.
CEGUI::ListboxTextItem::d_font
Font * d_font
Definition: ListboxTextItem.h:202
CEGUI::ListboxTextItem::setFont
void setFont(Font *font)
Set the font to be used by this ListboxTextItem.
CEGUI::ListboxTextItem::draw
void draw(GeometryBuffer &buffer, const Rectf &targetRect, float alpha, const Rectf *clipper) const
Draw the list box item in its current state.
CEGUI::ListboxTextItem::setText
void setText(const String &text)
set the text string for this list box item.
CEGUI::ListboxTextItem::setTextColours
void setTextColours(Colour col)
Set the colours used for text rendering.
Definition: ListboxTextItem.h:168
CEGUI::ListboxTextItem::DefaultTextColour
static const Colour DefaultTextColour
Default text colour.
Definition: ListboxTextItem.h:48
CEGUI::ListboxTextItem
Class used for textual items in a list box.
Definition: ListboxTextItem.h:43
CEGUI::Size< float >
CEGUI::String
String class used within the GUI system.
Definition: String.h:64
CEGUI::ListboxTextItem::setFont
void setFont(const String &font_name)
Set the font to be used by this ListboxTextItem.
CEGUI::DefaultRenderedStringParser
Effectively a 'null' parser that returns a RenderedString representation that will draw the input tex...
Definition: DefaultRenderedStringParser.h:41
CEGUI::ListboxTextItem::getFont
const Font * getFont(void) const
Return a pointer to the font being used by this ListboxTextItem.
CEGUI::Colour
Class representing colour values within the system.
Definition: Colour.h:46
CEGUI::Rect< float >
CEGUI::ListboxTextItem::d_renderedString
RenderedString d_renderedString
RenderedString drawn by this item.
Definition: ListboxTextItem.h:206
CEGUI::BasicRenderedStringParser
Basic RenderedStringParser class that offers support for the following tags:
Definition: BasicRenderedStringParser.h:65
CEGUI::ListboxItem
Base class for list box items.
Definition: ListboxItem.h:53