Crazy Eddies GUI System  0.7.6
CEGUIListboxTextItem.h
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 #include "../CEGUIDefaultRenderedStringParser.h"
00035 
00036 // Start of CEGUI namespace section
00037 namespace CEGUI
00038 {
00043 class CEGUIEXPORT ListboxTextItem : public ListboxItem
00044 {
00045 public:
00046         /*************************************************************************
00047                 Constants
00048         *************************************************************************/
00049         static const colour     DefaultTextColour;                      
00050 
00051 
00052         /*************************************************************************
00053                 Construction and Destruction
00054         *************************************************************************/
00059         ListboxTextItem(const String& text, uint item_id = 0, void* item_data = 0, bool disabled = false, bool auto_delete = true);
00060 
00061 
00066         virtual ~ListboxTextItem(void) {}
00067 
00068 
00069         /*************************************************************************
00070                 Accessor methods
00071         *************************************************************************/
00082         Font*   getFont(void) const;
00083 
00084 
00092         ColourRect      getTextColours(void) const              {return d_textCols;}
00093 
00094 
00095         /*************************************************************************
00096                 Manipulator methods
00097         *************************************************************************/
00108     void setFont(Font* font);
00109 
00110 
00121         void    setFont(const String& font_name);
00122 
00123 
00134         void    setTextColours(const ColourRect& cols)                  {d_textCols = cols;}
00135 
00136 
00156         void    setTextColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
00157 
00158 
00169         void    setTextColours(colour col)              {setTextColours(col, col, col, col);}
00170 
00180     void setTextParsingEnabled(const bool enable);
00181 
00183     bool isTextParsingEnabled() const;
00184 
00185     // base class overrides
00186     void setText(const String& text);
00187 
00188 
00189         /*************************************************************************
00190                 Required implementations of pure virtuals from the base class.
00191         *************************************************************************/
00192     Size getPixelSize(void) const;
00193     void draw(GeometryBuffer& buffer, const Rect& targetRect, float alpha, const Rect* clipper) const;
00194 
00195 protected:
00196     void parseTextString() const;
00197 
00198         /*************************************************************************
00199                 Implementation Data
00200         *************************************************************************/
00201         ColourRect      d_textCols;                     
00202         Font*           d_font;                         
00203 
00204     static BasicRenderedStringParser d_stringParser;
00206     mutable RenderedString  d_renderedString;
00208     mutable bool d_renderedStringValid;
00210     static DefaultRenderedStringParser d_noTagsStringParser;
00212     bool d_textParsingEnabled;
00213 };
00214 
00215 } // End of  CEGUI namespace section
00216 
00217 
00218 #endif  // end of guard _CEGUIListboxTextItem_h_