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 #ifndef _CEGUIListboxItem_h_
00027 #define _CEGUIListboxItem_h_
00028
00029 #include "CEGUIBase.h"
00030 #include "CEGUIString.h"
00031 #include "CEGUIColourRect.h"
00032 #include "CEGUIRenderCache.h"
00033
00034
00035 namespace CEGUI
00036 {
00041 class CEGUIEXPORT ListboxItem
00042 {
00043 public:
00044
00045
00046
00047 static const colour DefaultSelectionColour;
00048
00049
00050
00051
00052
00057 ListboxItem(const String& text, uint item_id = 0, void* item_data = NULL, bool disabled = false, bool auto_delete = true);
00058
00059
00064 virtual ~ListboxItem(void) {}
00065
00066
00067
00068
00069
00080 const String& getText(void) const {return d_itemText;}
00081 const String& getTooltipText(void) const {return d_tooltipText;}
00082
00093 uint getID(void) const {return d_itemID;}
00094
00095
00106 void* getUserData(void) const {return d_itemData;}
00107
00108
00116 bool isSelected(void) const {return d_selected;}
00117
00118
00126 bool isDisabled(void) const {return d_disabled;}
00127
00128
00139 bool isAutoDeleted(void) const {return d_autoDelete;}
00140
00141
00151 const Window* getOwnerWindow(const Window* owner) {return d_owner;}
00152
00153
00161 ColourRect getSelectionColours(void) const {return d_selectCols;}
00162
00163
00171 const Image* getSelectionBrushImage(void) const {return d_selectBrush;}
00172
00173
00174
00175
00176
00190 void setText(const String& text) {d_itemText = text;}
00191
00192 void setTooltipText(const String& text) {d_tooltipText = text;}
00193
00207 void setID(uint item_id) {d_itemID = item_id;}
00208
00209
00223 void setUserData(void* item_data) {d_itemData = item_data;}
00224
00225
00236 void setSelected(bool setting) {d_selected = setting;}
00237
00238
00249 void setDisabled(bool setting) {d_disabled = setting;}
00250
00264 void setAutoDeleted(bool setting) {d_autoDelete = setting;}
00265
00266
00278 void setOwnerWindow(const Window* owner) {d_owner = owner;}
00279
00280
00291 void setSelectionColours(const ColourRect& cols) {d_selectCols = cols;}
00292
00293
00313 void setSelectionColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
00314
00315
00326 void setSelectionColours(colour col) {setSelectionColours(col, col, col, col);}
00327
00328
00339 void setSelectionBrushImage(const Image* image) {d_selectBrush = image;}
00340
00341
00355 void setSelectionBrushImage(const String& imageset, const String& image);
00356
00357
00358
00359
00360
00368 virtual Size getPixelSize(void) const = 0;
00369
00370
00387 virtual void draw(const Vector3& position, float alpha, const Rect& clipper) const = 0;
00388
00389 virtual void draw(RenderCache& cache,const Rect& targetRect, float zBase, float alpha, const Rect* clipper) const = 0;
00390
00391
00392
00393
00398 virtual bool operator<(const ListboxItem& rhs) const {return d_itemText < rhs.getText();}
00399
00400
00405 virtual bool operator>(const ListboxItem& rhs) const {return d_itemText > rhs.getText();}
00406
00407
00408 protected:
00409
00410
00411
00417 ColourRect getModulateAlphaColourRect(const ColourRect& cols, float alpha) const;
00418
00419
00425 colour calculateModulatedAlphaColour(colour col, float alpha) const;
00426
00427
00428
00429
00430
00431 String d_itemText;
00432 String d_tooltipText;
00433 uint d_itemID;
00434 void* d_itemData;
00435 bool d_selected;
00436 bool d_disabled;
00437 bool d_autoDelete;
00438 const Window* d_owner;
00439 ColourRect d_selectCols;
00440 const Image* d_selectBrush;
00441 };
00442
00443 }
00444
00445
00446 #endif // end of guard _CEGUIListboxItem_h_