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 | Crazy Eddie's GUI System (http://www.cegui.org.uk)
|
---|
10 | Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
|
---|
11 |
|
---|
12 | This library is free software; you can redistribute it and/or
|
---|
13 | modify it under the terms of the GNU Lesser General Public
|
---|
14 | License as published by the Free Software Foundation; either
|
---|
15 | version 2.1 of the License, or (at your option) any later version.
|
---|
16 |
|
---|
17 | This library is distributed in the hope that it will be useful,
|
---|
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | Lesser General Public License for more details.
|
---|
21 |
|
---|
22 | You should have received a copy of the GNU Lesser General Public
|
---|
23 | License along with this library; if not, write to the Free Software
|
---|
24 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
25 | *************************************************************************/
|
---|
26 | #ifndef _CEGUIListboxTextItem_h_
|
---|
27 | #define _CEGUIListboxTextItem_h_
|
---|
28 | #include "elements/CEGUIListboxItem.h"
|
---|
29 |
|
---|
30 |
|
---|
31 | // Start of CEGUI namespace section
|
---|
32 | namespace CEGUI
|
---|
33 | {
|
---|
34 | /*!
|
---|
35 | \brief
|
---|
36 | Class used for textual items in a list box.
|
---|
37 | */
|
---|
38 | class CEGUIEXPORT ListboxTextItem : public ListboxItem
|
---|
39 | {
|
---|
40 | public:
|
---|
41 | /*************************************************************************
|
---|
42 | Constants
|
---|
43 | *************************************************************************/
|
---|
44 | static const colour DefaultTextColour; //!< Default text colour.
|
---|
45 |
|
---|
46 |
|
---|
47 | /*************************************************************************
|
---|
48 | Construction and Destruction
|
---|
49 | *************************************************************************/
|
---|
50 | /*!
|
---|
51 | \brief
|
---|
52 | base class constructor
|
---|
53 | */
|
---|
54 | ListboxTextItem(const String& text, uint item_id = 0, void* item_data = NULL, bool disabled = false, bool auto_delete = true);
|
---|
55 |
|
---|
56 |
|
---|
57 | /*!
|
---|
58 | \brief
|
---|
59 | base class destructor
|
---|
60 | */
|
---|
61 | virtual ~ListboxTextItem(void) {}
|
---|
62 |
|
---|
63 |
|
---|
64 | /*************************************************************************
|
---|
65 | Accessor methods
|
---|
66 | *************************************************************************/
|
---|
67 | /*!
|
---|
68 | \brief
|
---|
69 | Return a pointer to the font being used by this ListboxTextItem
|
---|
70 |
|
---|
71 | This method will try a number of places to find a font to be used. If no font can be
|
---|
72 | found, NULL is returned.
|
---|
73 |
|
---|
74 | \return
|
---|
75 | Font to be used for rendering this item
|
---|
76 | */
|
---|
77 | const Font* getFont(void) const;
|
---|
78 |
|
---|
79 |
|
---|
80 | /*!
|
---|
81 | \brief
|
---|
82 | Return the current colours used for text rendering.
|
---|
83 |
|
---|
84 | \return
|
---|
85 | ColourRect object describing the currently set colours
|
---|
86 | */
|
---|
87 | ColourRect getTextColours(void) const {return d_textCols;}
|
---|
88 |
|
---|
89 |
|
---|
90 | /*************************************************************************
|
---|
91 | Manipulator methods
|
---|
92 | *************************************************************************/
|
---|
93 | /*!
|
---|
94 | \brief
|
---|
95 | Set the font to be used by this ListboxTextItem
|
---|
96 |
|
---|
97 | \param font
|
---|
98 | Font to be used for rendering this item
|
---|
99 |
|
---|
100 | \return
|
---|
101 | Nothing
|
---|
102 | */
|
---|
103 | void setFont(const Font* font) {d_font = font;}
|
---|
104 |
|
---|
105 |
|
---|
106 | /*!
|
---|
107 | \brief
|
---|
108 | Set the font to be used by this ListboxTextItem
|
---|
109 |
|
---|
110 | \param font_name
|
---|
111 | String object containing the name of the Font to be used for rendering this item
|
---|
112 |
|
---|
113 | \return
|
---|
114 | Nothing
|
---|
115 | */
|
---|
116 | void setFont(const String& font_name);
|
---|
117 |
|
---|
118 |
|
---|
119 | /*!
|
---|
120 | \brief
|
---|
121 | Set the colours used for text rendering.
|
---|
122 |
|
---|
123 | \param cols
|
---|
124 | ColourRect object describing the colours to be used.
|
---|
125 |
|
---|
126 | \return
|
---|
127 | Nothing.
|
---|
128 | */
|
---|
129 | void setTextColours(const ColourRect& cols) {d_textCols = cols;}
|
---|
130 |
|
---|
131 |
|
---|
132 | /*!
|
---|
133 | \brief
|
---|
134 | Set the colours used for text rendering.
|
---|
135 |
|
---|
136 | \param top_left_colour
|
---|
137 | Colour (as ARGB value) to be applied to the top-left corner of each text glyph rendered.
|
---|
138 |
|
---|
139 | \param top_right_colour
|
---|
140 | Colour (as ARGB value) to be applied to the top-right corner of each text glyph rendered.
|
---|
141 |
|
---|
142 | \param bottom_left_colour
|
---|
143 | Colour (as ARGB value) to be applied to the bottom-left corner of each text glyph rendered.
|
---|
144 |
|
---|
145 | \param bottom_right_colour
|
---|
146 | Colour (as ARGB value) to be applied to the bottom-right corner of each text glyph rendered.
|
---|
147 |
|
---|
148 | \return
|
---|
149 | Nothing.
|
---|
150 | */
|
---|
151 | void setTextColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
|
---|
152 |
|
---|
153 |
|
---|
154 | /*!
|
---|
155 | \brief
|
---|
156 | Set the colours used for text rendering.
|
---|
157 |
|
---|
158 | \param col
|
---|
159 | colour value to be used when rendering.
|
---|
160 |
|
---|
161 | \return
|
---|
162 | Nothing.
|
---|
163 | */
|
---|
164 | void setTextColours(colour col) {setTextColours(col, col, col, col);}
|
---|
165 |
|
---|
166 |
|
---|
167 | /*************************************************************************
|
---|
168 | Required implementations of pure virtuals from the base class.
|
---|
169 | *************************************************************************/
|
---|
170 | Size getPixelSize(void) const;
|
---|
171 | void draw(const Vector3& position, float alpha, const Rect& clipper) const;
|
---|
172 | void draw(RenderCache& cache,const Rect& targetRect, float zBase, float alpha, const Rect* clipper) const;
|
---|
173 |
|
---|
174 | protected:
|
---|
175 | /*************************************************************************
|
---|
176 | Implementation Data
|
---|
177 | *************************************************************************/
|
---|
178 | ColourRect d_textCols; //!< Colours used for rendering the text.
|
---|
179 | const Font* d_font; //!< Font used for rendering text.
|
---|
180 | };
|
---|
181 |
|
---|
182 | } // End of CEGUI namespace section
|
---|
183 |
|
---|
184 |
|
---|
185 | #endif // end of guard _CEGUIListboxTextItem_h_
|
---|