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 "CEGUIRenderCache.h"
00037
00038
00039 namespace CEGUI
00040 {
00045 class CEGUIEXPORT ListboxItem
00046 {
00047 public:
00048
00049
00050
00051 static const colour DefaultSelectionColour;
00052
00053
00054
00055
00056
00061 ListboxItem(const String& text, uint item_id = 0, void* item_data = 0, bool disabled = false, bool auto_delete = true);
00062
00063
00068 virtual ~ListboxItem(void) {}
00069
00070
00071
00072
00073
00084 const String& getText(void) const {return d_itemText;}
00085 const String& getTooltipText(void) const {return d_tooltipText;}
00086
00097 uint getID(void) const {return d_itemID;}
00098
00099
00110 void* getUserData(void) const {return d_itemData;}
00111
00112
00120 bool isSelected(void) const {return d_selected;}
00121
00122
00130 bool isDisabled(void) const {return d_disabled;}
00131
00132
00143 bool isAutoDeleted(void) const {return d_autoDelete;}
00144
00145
00155 const Window* getOwnerWindow() const {return d_owner;}
00156
00157
00165 ColourRect getSelectionColours(void) const {return d_selectCols;}
00166
00167
00175 const Image* getSelectionBrushImage(void) const {return d_selectBrush;}
00176
00177
00178
00179
00180
00194 void setText(const String& text) {d_itemText = text;}
00195
00196 void setTooltipText(const String& text) {d_tooltipText = text;}
00197
00211 void setID(uint item_id) {d_itemID = item_id;}
00212
00213
00227 void setUserData(void* item_data) {d_itemData = item_data;}
00228
00229
00240 void setSelected(bool setting) {d_selected = setting;}
00241
00242
00253 void setDisabled(bool setting) {d_disabled = setting;}
00254
00268 void setAutoDeleted(bool setting) {d_autoDelete = setting;}
00269
00270
00282 void setOwnerWindow(const Window* owner) {d_owner = owner;}
00283
00284
00295 void setSelectionColours(const ColourRect& cols) {d_selectCols = cols;}
00296
00297
00317 void setSelectionColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
00318
00319
00330 void setSelectionColours(colour col) {setSelectionColours(col, col, col, col);}
00331
00332
00343 void setSelectionBrushImage(const Image* image) {d_selectBrush = image;}
00344
00345
00359 void setSelectionBrushImage(const String& imageset, const String& image);
00360
00361
00362
00363
00364
00372 virtual Size getPixelSize(void) const = 0;
00373
00374
00391 virtual void draw(const Vector3& position, float alpha, const Rect& clipper) const = 0;
00392
00393 virtual void draw(RenderCache& cache,const Rect& targetRect, float zBase, float alpha, const Rect* clipper) const = 0;
00394
00395
00396
00397
00402 virtual bool operator<(const ListboxItem& rhs) const {return d_itemText < rhs.getText();}
00403
00404
00409 virtual bool operator>(const ListboxItem& rhs) const {return d_itemText > rhs.getText();}
00410
00411
00412 protected:
00413
00414
00415
00421 ColourRect getModulateAlphaColourRect(const ColourRect& cols, float alpha) const;
00422
00423
00429 colour calculateModulatedAlphaColour(colour col, float alpha) const;
00430
00431
00432
00433
00434
00435 String d_itemText;
00436 String d_tooltipText;
00437 uint d_itemID;
00438 void* d_itemData;
00439 bool d_selected;
00440 bool d_disabled;
00441 bool d_autoDelete;
00442 const Window* d_owner;
00443 ColourRect d_selectCols;
00444 const Image* d_selectBrush;
00445 };
00446
00447 }
00448
00449
00450 #endif // end of guard _CEGUIListboxItem_h_