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
00033
00034 namespace CEGUI
00035 {
00040 class CEGUIBASE_API ListboxItem
00041 {
00042 public:
00043
00044
00045
00046 static const colour DefaultSelectionColour;
00047
00048
00049
00050
00051
00056 ListboxItem(const String& text, uint item_id = 0, void* item_data = NULL, bool disabled = false, bool auto_delete = true);
00057
00058
00063 virtual ~ListboxItem(void) {}
00064
00065
00066
00067
00068
00079 const String& getText(void) const {return d_itemText;}
00080
00081
00092 uint getID(void) const {return d_itemID;}
00093
00094
00105 void* getUserData(void) const {return d_itemData;}
00106
00107
00115 bool isSelected(void) const {return d_selected;}
00116
00117
00125 bool isDisabled(void) const {return d_disabled;}
00126
00127
00138 bool isAutoDeleted(void) const {return d_autoDelete;}
00139
00140
00150 const Window* getOwnerWindow(const Window* owner) {return d_owner;}
00151
00152
00160 ColourRect getSelectionColours(void) const {return d_selectCols;}
00161
00162
00170 const Image* getSelectionBrushImage(void) const {return d_selectBrush;}
00171
00172
00173
00174
00175
00189 void setText(const String& text) {d_itemText = text;}
00190
00191
00205 void setID(uint item_id) {d_itemID = item_id;}
00206
00207
00221 void setUserData(void* item_data) {d_itemData = item_data;}
00222
00223
00234 void setSelected(bool setting) {d_selected = setting;}
00235
00236
00247 void setDisabled(bool setting) {d_disabled = setting;}
00248
00262 void setAutoDeleted(bool setting) {d_autoDelete = setting;}
00263
00264
00276 void setOwnerWindow(const Window* owner) {d_owner = owner;}
00277
00278
00289 void setSelectionColours(const ColourRect& cols) {d_selectCols = cols;}
00290
00291
00311 void setSelectionColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
00312
00313
00324 void setSelectionColours(colour col) {setSelectionColours(col, col, col, col);}
00325
00326
00337 void setSelectionBrushImage(const Image* image) {d_selectBrush = image;}
00338
00339
00353 void setSelectionBrushImage(const String& imageset, const String& image);
00354
00355
00356
00357
00358
00366 virtual Size getPixelSize(void) const = 0;
00367
00368
00385 virtual void draw(const Vector3& position, float alpha, const Rect& clipper) const = 0;
00386
00387
00388
00389
00390
00395 virtual bool operator<(const ListboxItem& rhs) const {return d_itemText < rhs.getText();}
00396
00397
00402 virtual bool operator>(const ListboxItem& rhs) const {return d_itemText > rhs.getText();}
00403
00404
00405 protected:
00406
00407
00408
00414 ColourRect getModulateAlphaColourRect(const ColourRect& cols, float alpha) const;
00415
00416
00422 colour calculateModulatedAlphaColour(colour col, float alpha) const;
00423
00424
00425
00426
00427
00428 String d_itemText;
00429 uint d_itemID;
00430 void* d_itemData;
00431 bool d_selected;
00432 bool d_disabled;
00433 bool d_autoDelete;
00434 const Window* d_owner;
00435 ColourRect d_selectCols;
00436 const Image* d_selectBrush;
00437 };
00438
00439 }
00440
00441
00442 #endif // end of guard _CEGUIListboxItem_h_