Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUIListboxItem.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIListboxItem.h
00003         created:        8/6/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface to base class for list items
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUIListboxItem_h_
00027 #define _CEGUIListboxItem_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIString.h"
00031 #include "CEGUIColourRect.h"
00032 
00033 // Start of CEGUI namespace section
00034 namespace CEGUI
00035 {
00040 class CEGUIBASE_API ListboxItem
00041 {
00042 public:
00043         /*************************************************************************
00044                 Constants
00045         *************************************************************************/
00046         static const colour     DefaultSelectionColour;         
00047 
00048 
00049         /*************************************************************************
00050                 Construction and Destruction
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                 Accessors
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                 Manipulators
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                 Abstract portion of interface
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                 Operators
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                 Implementation methods
00408         *************************************************************************/
00414         ColourRect getModulateAlphaColourRect(const ColourRect& cols, float alpha) const;
00415 
00416 
00422         colour calculateModulatedAlphaColour(colour col, float alpha) const;
00423 
00424 
00425         /*************************************************************************
00426                 Implementation Data
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 } // End of  CEGUI namespace section
00440 
00441 
00442 #endif  // end of guard _CEGUIListboxItem_h_

Generated on Wed Feb 16 12:41:06 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1