source: OGRE/trunk/ogrenew/Dependencies/include/CEGUI/elements/CEGUIListboxTextItem.h @ 657

Revision 657, 6.0 KB checked in by mattausch, 18 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
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
32namespace CEGUI
33{
34/*!
35\brief
36        Class used for textual items in a list box.
37*/
38class CEGUIEXPORT ListboxTextItem : public ListboxItem
39{
40public:
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        /*!
171        \brief
172                Return the rendered pixel size of this list box item.
173
174        \return
175                Size object describing the size of the list box item in pixels.
176        */
177        virtual Size    getPixelSize(void) const;
178
179
180        /*!
181        \brief
182                Draw the list box item in its current state.
183
184        \param position
185                Vecor3 object describing the upper-left corner of area that should be rendered in to for the draw operation.
186
187        \param alpha
188                Alpha value to be used when rendering the item (between 0.0f and 1.0f).
189
190        \param clipper
191                Rect object describing the clipping rectangle for the draw operation.
192
193        \return
194                Nothing.
195        */
196        virtual void    draw(const Vector3& position, float alpha, const Rect& clipper) const;
197
198
199protected:
200        /*************************************************************************
201                Implementation Data
202        *************************************************************************/
203        ColourRect              d_textCols;                     //!< Colours used for rendering the text.
204        const Font*             d_font;                         //!< Font used for rendering text.
205};
206
207} // End of  CEGUI namespace section
208
209
210#endif  // end of guard _CEGUIListboxTextItem_h_
Note: See TracBrowser for help on using the repository browser.