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

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::GUI::Controls::CMenuItem Class Reference

Inheritance diagram for Exponent::GUI::Controls::CMenuItem:

List of all members.

## Detailed Description

A representation of a menu item. Each menu item can have an image, a string, a sub menu item. You can also disable the item.

Date:
  12/04/2005

Author:
  Paul Chana

Version:
  1.0.0 Initial version

Note:
  All contents of this source code are copyright 2005 Exp Digital Uk.
  This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
  with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
  Certain sections of this code may come from other sources. They are credited where applicable.
  If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk

Id
  CMenuItem.hpp,v 1.8 2007/02/08 21:07:54 paul Exp

Definition at line 41 of file CMenuItem.hpp.

## Public Types

- enum EMenuItemTypes {
  e_menuItemNormal = 0,
  e_menuItemHtmlLink,
  e_menuItemSeperator,
  e_menuItemSelectable,
  e_subMenuHolder,
  e_verticalSeperator
  }
    Types of menu item. More...

## Public Member Functions

- CMenuItem (const CString &text, const long identifier, const EMenuItemTypes type=e_menuItemNormal, const bool enabled=true)
- virtual void enable (const bool enabled=true)
- virtual long getId () const
- virtual long getIndex () const
- virtual IImage * getNormalImage () const
- virtual IImage * getRolloverImage () const
- virtual const CString & getText () const
- const CAlphaColour & getTextColour () const
- virtual EMenuItemTypes getType () const
- virtual bool isEnabled () const
- bool overrideTextColour () const
- void overrideTextColour (const bool override)
- virtual void setId (const long id)
- virtual void setImages (IImage *normalImage, IImage *rolloverImage)
- virtual void setIndex (const long index)
- virtual void setText (const CString &text)
- void setTextColour (const CAlphaColour &colour)
- virtual void setType (const EMenuItemTypes type)
- virtual ~CMenuItem ()

## Protected Attributes

- long m_id
- long m_index
- bool m_isEnabled
- IImage * m_normalImage
- bool m_overrideTextColour
- IImage * m_rolloverImage
- CString m_text
- CAlphaColour m_textColour
- EMenuItemTypes m_type

## Member Enumeration Documentation

enum Exponent::GUI::Controls::CMenuItem::EMenuItemTypes

Types of menu item.

Enumerator:

  e_menuItemNormal | A simple string -> possibly with an icon
  e_menuItemHtmlLink | A string that links to a web page
  e_menuItemSeperator | A serperator -> a full line accross the menu window
  e_menuItemSelectable | Item is an on off button
  e_subMenuHolder | Holds sub menus
  e_verticalSeperator | Vertical seperating bar

Definition at line 57 of file CMenuItem.hpp.

## Constructor & Destructor Documentation

Exponent::GUI::Controls::CMenuItem::CMenuItem | ( | const CString & | text,
|  | const long | identifier,
|  | const EMenuItemTypes | type = `e_menuItemNormal`,
|  | const bool | enabled = `true` |
| ) |  |  |

Construction

Parameters:

  | text | The string to display
  | identifier | The identifier to use
  | type | The type of menu item
  | enabled | If false menuis disabled, else enabled

virtual Exponent::GUI::Controls::CMenuItem::~CMenuItem | ( |  | ) | `[virtual]`

Destruction

## Member Function Documentation

virtual void Exponent::GUI::Controls::CMenuItem::enable | ( | const bool | enabled = `true` | ) | `[inline, virtual]`

Enable the unit

Parameters:

  | enabled | If false menuis disabled, else enabled

Definition at line 107 of file CMenuItem.hpp.

References m_isEnabled.

virtual long Exponent::GUI::Controls::CMenuItem::getId | ( |  | ) | const`[inline, virtual]`

Get the id

Return values:

  | long | The menu unique id

Definition at line 138 of file CMenuItem.hpp.

References m_id.

virtual long Exponent::GUI::Controls::CMenuItem::getIndex | ( |  | ) | const`[inline, virtual]`

Get the index

Return values:

  | long | The local menu index of this item

Definition at line 156 of file CMenuItem.hpp.

References m_index.

virtual IImage* Exponent::GUI::Controls::CMenuItem::getNormalImage | ( |  | ) | const`[inline, virtual]`

Get the normal image

Return values:

  | IImage* | The normal image

Definition at line 162 of file CMenuItem.hpp.

References m_normalImage.

virtual IImage* Exponent::GUI::Controls::CMenuItem::getRolloverImage | ( |  | ) | const`[inline, virtual]`

Get the rollover image

Return values:

  | IImage* | The rollover image

Definition at line 168 of file CMenuItem.hpp.

References m_rolloverImage.

virtual const CString& Exponent::GUI::Controls::CMenuItem::getText | ( |  | ) | const`[inline, virtual]`

Get the text

Return values:

  | const | CString& The string being displayed

Definition at line 132 of file CMenuItem.hpp.

References m_text.

const CAlphaColour& Exponent::GUI::Controls::CMenuItem::getTextColour | ( |  | ) | const`[inline]`

Get the text colour

Return values:

  | const | CAlphaColour & The colour to be used to draw this menu item

Definition at line 180 of file CMenuItem.hpp.

References m_textColour.

virtual EMenuItemTypes Exponent::GUI::Controls::CMenuItem::getType | ( |  | ) | const`[inline, virtual]`

Get the type

Return values:

  | EMenuItemTypes | The type of menu item

Definition at line 144 of file CMenuItem.hpp.

References m_type.

virtual bool Exponent::GUI::Controls::CMenuItem::isEnabled | ( |  | ) | const`[inline, virtual]`

is the menu item enabled?

Return values:

  | bool | True if menu is enabled, false otheriwse

Definition at line 150 of file CMenuItem.hpp.

References m_isEnabled.

bool Exponent::GUI::Controls::CMenuItem::overrideTextColour | ( |  | ) | const`[inline]`

Chck if text colours should be overridden

Return values:

  | bool | True if text colour can be overridden, false otherwise

Definition at line 194 of file CMenuItem.hpp.

References m_overrideTextColour.

void Exponent::GUI::Controls::CMenuItem::overrideTextColour | ( | const bool | override | ) | `[inline]`

Should the colour be overwridden? If this is true, then m_textColour is used for drawing, else default colours of the menu window are used

See also:
  CMenuWindow

  CMenuItemDisplay

Parameters:

  | override | If true text is drawn with text col

Definition at line 188 of file CMenuItem.hpp.

References m_overrideTextColour.

virtual void Exponent::GUI::Controls::CMenuItem::setId | ( | const long | id | ) | `[inline, virtual]`

Set the id

Parameters:

  | id | The identifier to use

Definition at line 95 of file CMenuItem.hpp.

References m_id.

virtual void Exponent::GUI::Controls::CMenuItem::setImages | ( | IImage * | normalImage,
|  | IImage * | rolloverImage |
| ) |  |  | `[inline, virtual]`

Set the images

Parameters:

  | normalImage | The icon to use when mouse is not over or down
  | rolloverImage | THe icon to use when mouse is over or down

Definition at line 120 of file CMenuItem.hpp.

References EXCHANGE_COUNTED_OBJECTS, m_normalImage, and m_rolloverImage.

virtual void Exponent::GUI::Controls::CMenuItem::setIndex | ( | const long | index | ) | `[inline, virtual]`

Set the index

Parameters:

  | index | The local menu index

Definition at line 113 of file CMenuItem.hpp.

References m_index.

virtual void Exponent::GUI::Controls::CMenuItem::setText | ( | const CString & | text | ) | `[inline, virtual]`

Set the text

Parameters:

  | text | The string to display

Definition at line 89 of file CMenuItem.hpp.

References m_text.

void Exponent::GUI::Controls::CMenuItem::setTextColour | ( | const CAlphaColour & | colour | ) | `[inline]`

Set the text colour

Parameters:

  | colour | The colour to use for text

Definition at line 174 of file CMenuItem.hpp.

References m_textColour.

virtual void Exponent::GUI::Controls::CMenuItem::setType | ( | const EMenuItemTypes | type | ) | `[inline, virtual]`

Set the type

Parameters:

  | type | The type of menu item

Definition at line 101 of file CMenuItem.hpp.

References m_type.

## Member Data Documentation

long Exponent::GUI::Controls::CMenuItem::m_id`[protected]`

The identifier of the menu

Definition at line 203 of file CMenuItem.hpp.

Referenced by getId(), and setId().

long Exponent::GUI::Controls::CMenuItem::m_index`[protected]`

The index within this menu

Definition at line 204 of file CMenuItem.hpp.

Referenced by getIndex(), and setIndex().

bool Exponent::GUI::Controls::CMenuItem::m_isEnabled`[protected]`

Is the item enabled?

Definition at line 206 of file CMenuItem.hpp.

Referenced by enable(), and isEnabled().

IImage* Exponent::GUI::Controls::CMenuItem::m_normalImage`[protected]`

The normal image

Definition at line 207 of file CMenuItem.hpp.

Referenced by getNormalImage(), and setImages().

bool Exponent::GUI::Controls::CMenuItem::m_overrideTextColour`[protected]`

Is m_textCOlour valid?

Definition at line 210 of file CMenuItem.hpp.

Referenced by overrideTextColour().

IImage* Exponent::GUI::Controls::CMenuItem::m_rolloverImage`[protected]`

The image to use on rollover..

Definition at line 208 of file CMenuItem.hpp.

Referenced by getRolloverImage(), and setImages().

CString Exponent::GUI::Controls::CMenuItem::m_text`[protected]`

The display string

Definition at line 202 of file CMenuItem.hpp.

Referenced by getText(), and setText().

CAlphaColour Exponent::GUI::Controls::CMenuItem::m_textColour`[protected]`

Colour of the text to draw

Definition at line 209 of file CMenuItem.hpp.

Referenced by getTextColour(), and setTextColour().

EMenuItemTypes Exponent::GUI::Controls::CMenuItem::m_type`[protected]`

The type of menu item

Definition at line 205 of file CMenuItem.hpp.

Referenced by getType(), and setType().