- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- File List
- File Members

# CMenuItem.hpp

Go to the documentation of this file.

    00001 #ifndef __CMenuItem__
    00002 #define __CMenuItem__
    00003
    00004 #include <Basics/CString.hpp>
    00005 #include <Basics/CCountedObject.hpp>
    00006 #include "../Graphics/IImage.hpp"
    00007 #include "../Basics/CAlphaColour.hpp"
    00008
    00009 //  ===========================================================================
    00010
    00011 using Exponent::Basics::CString;
    00012 using Exponent::Basics::CCountedObject;
    00013 using Exponent::GUI::Graphics::IImage;
    00014 using Exponent::GUI::Basics::CAlphaColour;
    00015
    00016 //  ===========================================================================
    00017
    00018 namespace Exponent
    00019 {
    00020     namespace GUI
    00021     {
    00022         namespace Controls
    00023         {
    00041             class CMenuItem : public CCountedObject
    00042             {
    00044                 EXPONENT_CLASS_DECLARATION;
    00047 //  ===========================================================================
    00048
    00049             public:
    00050
    00051 //  ===========================================================================
    00052
    00057                 enum EMenuItemTypes
    00058                 {
    00059                     e_menuItemNormal = 0,
    00060                     e_menuItemHtmlLink,
    00061                     e_menuItemSeperator,
    00062                     e_menuItemSelectable,
    00063                     e_subMenuHolder,
    00064                     e_verticalSeperator,
    00065                 };
    00066
    00067 //  ===========================================================================
    00068
    00076                 CMenuItem(const CString &text, const long identifier, const EMenuItemTypes type = e_menuItemNormal, const bool enabled = true);
    00077
    00081                 virtual ~CMenuItem();
    00082
    00083 //  ===========================================================================
    00084
    00089                 virtual void setText(const CString &text) { m_text = text; }
    00090
    00095                 virtual void setId(const long id) { m_id = id; }
    00096
    00101                 virtual void setType(const EMenuItemTypes type) { m_type = type; }
    00102
    00107                 virtual void enable(const bool enabled = true) { m_isEnabled = enabled; }
    00108
    00113                 virtual void setIndex(const long index) { m_index = index; }
    00114
    00120                 virtual void setImages(IImage *normalImage, IImage *rolloverImage)
    00121                 {
    00122                     EXCHANGE_COUNTED_OBJECTS(m_normalImage, normalImage);
    00123                     EXCHANGE_COUNTED_OBJECTS(m_rolloverImage, rolloverImage);
    00124                 }
    00125
    00126 //  ===========================================================================
    00127
    00132                 virtual const CString &getText() const { return m_text; }
    00133
    00138                 virtual long getId() const { return m_id; }
    00139
    00144                 virtual EMenuItemTypes getType() const { return m_type; }
    00145
    00150                 virtual bool isEnabled() const { return m_isEnabled; }
    00151
    00156                 virtual long getIndex() const { return m_index; }
    00157
    00162                 virtual IImage *getNormalImage() const { return m_normalImage; }
    00163
    00168                 virtual IImage *getRolloverImage() const { return m_rolloverImage; }
    00169
    00174                 void setTextColour(const CAlphaColour &colour) { m_textColour = colour; }
    00175
    00180                 const CAlphaColour &getTextColour() const { return m_textColour; }
    00181
    00188                 void overrideTextColour(const bool override) { m_overrideTextColour = override; }
    00189
    00194                 bool overrideTextColour() const { return m_overrideTextColour; }
    00195
    00196 //  ===========================================================================
    00197
    00198             protected:
    00199
    00200 //  ===========================================================================
    00201
    00202                 CString m_text;
    00203                 long m_id;
    00204                 long m_index;
    00205                 EMenuItemTypes m_type;
    00206                 bool m_isEnabled;
    00207                 IImage *m_normalImage;
    00208                 IImage *m_rolloverImage;
    00209                 CAlphaColour m_textColour;
    00210                 bool m_overrideTextColour;
    00211             };
    00212         }
    00213     }
    00214 }
    00215 #endif  // End of CMenuItem.hpp