00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _CEGUIListboxItem_h_
00031 #define _CEGUIListboxItem_h_
00032
00033 #include "../CEGUIBase.h"
00034 #include "../CEGUIString.h"
00035 #include "../CEGUIColourRect.h"
00036 #include "../CEGUITextUtils.h"
00037
00038 #if defined(_MSC_VER)
00039 # pragma warning(push)
00040 # pragma warning(disable : 4251)
00041 #endif
00042
00043
00044 namespace CEGUI
00045 {
00050 class CEGUIEXPORT ListboxItem
00051 {
00052 public:
00053
00054
00055
00056 static const colour DefaultSelectionColour;
00057
00058
00059
00060
00061
00066 ListboxItem(const String& text, uint item_id = 0, void* item_data = 0, bool disabled = false, bool auto_delete = true);
00067
00068
00073 virtual ~ListboxItem(void);
00074
00075
00076
00077
00078
00089 const String& getTooltipText(void) const {return d_tooltipText;}
00090
00091 const String& getText(void) const {return d_textLogical;}
00092
00094 const String& getTextVisual() const;
00095
00106 uint getID(void) const {return d_itemID;}
00107
00108
00119 void* getUserData(void) const {return d_itemData;}
00120
00121
00129 bool isSelected(void) const {return d_selected;}
00130
00131
00139 bool isDisabled(void) const {return d_disabled;}
00140
00141
00152 bool isAutoDeleted(void) const {return d_autoDelete;}
00153
00154
00164 const Window* getOwnerWindow() const {return d_owner;}
00165
00166
00174 ColourRect getSelectionColours(void) const {return d_selectCols;}
00175
00176
00184 const Image* getSelectionBrushImage(void) const {return d_selectBrush;}
00185
00186
00187
00188
00189
00203 virtual void setText(const String& text);
00204
00205 void setTooltipText(const String& text) {d_tooltipText = text;}
00206
00220 void setID(uint item_id) {d_itemID = item_id;}
00221
00222
00236 void setUserData(void* item_data) {d_itemData = item_data;}
00237
00238
00249 void setSelected(bool setting) {d_selected = setting;}
00250
00251
00262 void setDisabled(bool setting) {d_disabled = setting;}
00263
00277 void setAutoDeleted(bool setting) {d_autoDelete = setting;}
00278
00279
00291 void setOwnerWindow(const Window* owner) {d_owner = owner;}
00292
00293
00304 void setSelectionColours(const ColourRect& cols) {d_selectCols = cols;}
00305
00306
00326 void setSelectionColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
00327
00328
00339 void setSelectionColours(colour col) {setSelectionColours(col, col, col, col);}
00340
00341
00352 void setSelectionBrushImage(const Image* image) {d_selectBrush = image;}
00353
00354
00368 void setSelectionBrushImage(const String& imageset, const String& image);
00369
00370
00371
00372
00373
00381 virtual Size getPixelSize(void) const = 0;
00382
00383
00400 virtual void draw(GeometryBuffer& buffer, const Rect& targetRect,
00401 float alpha, const Rect* clipper) const = 0;
00402
00403
00404
00405
00410 virtual bool operator<(const ListboxItem& rhs) const {return getText() < rhs.getText();}
00411
00412
00417 virtual bool operator>(const ListboxItem& rhs) const {return getText() > rhs.getText();}
00418
00419
00420 protected:
00421
00422
00423
00429 ColourRect getModulateAlphaColourRect(const ColourRect& cols, float alpha) const;
00430
00431
00437 colour calculateModulatedAlphaColour(colour col, float alpha) const;
00438
00439
00440
00441
00442
00443 String d_textLogical;
00445 BiDiVisualMapping* d_bidiVisualMapping;
00447 mutable bool d_bidiDataValid;
00448 String d_tooltipText;
00449 uint d_itemID;
00450 void* d_itemData;
00451 bool d_selected;
00452 bool d_disabled;
00453 bool d_autoDelete;
00454 const Window* d_owner;
00455 ColourRect d_selectCols;
00456 const Image* d_selectBrush;
00457 };
00458
00459 }
00460
00461 #if defined(_MSC_VER)
00462 # pragma warning(pop)
00463 #endif
00464
00465 #endif // end of guard _CEGUIListboxItem_h_