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

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

# Exponent::GUI::Controls::CRolloverButton Class Reference

Inheritance diagram for Exponent::GUI::Controls::CRolloverButton:

List of all members.

## Detailed Description

A rollover button with 3 states.

A rollover button has 3 states:
Mouse off (mouse not inside the area)
Mover over (mouse inside area but not down)
Mouse down (mouse inside area and down)
And event is fired when the mouse has been down then released ie - It is a momentary button

Date:
  28/03/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
  CRolloverButton.hpp,v 1.7 2007/02/08 21:07:54 paul Exp

Definition at line 38 of file CRolloverButton.hpp.

## Public Types

- enum ERolloverState {
  e_mouseOff = 0,
  e_mouseOver,
  e_mouseDown
  }
    Rollover state enumerator. More...

## Public Member Functions

- CRolloverButton (IControlRoot *root, const long uniqueId, const CRect &area, IActionListener *listener=NULL)
- virtual void drawControl (CGraphics &graphics)
- virtual void handleLeftButtonDown (CMouseEvent &event)
- virtual void handleLeftButtonUp (CMouseEvent &event)
- virtual void handleMouseLeavingArea (CMouseEvent &event)
- virtual void handleMouseMovement (CMouseEvent &event)
- virtual void setDownImage (IImage *theImage)
- void setLabelText (const CString &text)
- virtual void setOverImage (IImage *theImage)
- virtual void useCursorChange (const bool use=true)
- virtual ~CRolloverButton ()

## Protected Attributes

- bool m_cursorChange
- IImage * m_downImage
- CString m_labelText
- bool m_mouseIsDown
- IImage * m_overImage
- ERolloverState m_state

## Member Enumeration Documentation

enum Exponent::GUI::Controls::CRolloverButton::ERolloverState

Rollover state enumerator.

Enumerator:

  e_mouseOff | Mouse is not within control
  e_mouseOver | Mouse is over area
  e_mouseDown | Mouse is clicked in area

Definition at line 54 of file CRolloverButton.hpp.

## Constructor & Destructor Documentation

Exponent::GUI::Controls::CRolloverButton::CRolloverButton | ( | IControlRoot * | root,
|  | const long | uniqueId,
|  | const CRect & | area,
|  | IActionListener * | listener = `NULL` |
| ) |  |  |

Construction

Parameters:

  | root | The root control that this control is being added to
  | uniqueId | The unique Identifier of this control or CCONTROL_NO_ID_REQUIRED if no id is required
  | area | The area of this control relative to the root controls top left
  | listener | The action listener

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

Destruction

## Member Function Documentation

virtual void Exponent::GUI::Controls::CRolloverButton::drawControl | ( | CGraphics & | graphics | ) | `[virtual]`

Draw the controls

Parameters:

  | graphics | The graphics context

Reimplemented from Exponent::GUI::Controls::CControl.

virtual void Exponent::GUI::Controls::CRolloverButton::handleLeftButtonDown | ( | CMouseEvent & | event | ) | `[virtual]`

Handle left button being clicked

Parameters:

  | event | The event to handle

Reimplemented from Exponent::GUI::Controls::CControl.

Reimplemented in Exponent::GUI::Controls::CRepeatingButton.

virtual void Exponent::GUI::Controls::CRolloverButton::handleLeftButtonUp | ( | CMouseEvent & | event | ) | `[virtual]`

Handle left button being released

Parameters:

  | event | The event to handle

Reimplemented from Exponent::GUI::Controls::CControl.

Reimplemented in Exponent::GUI::Controls::CRepeatingButton.

virtual void Exponent::GUI::Controls::CRolloverButton::handleMouseLeavingArea | ( | CMouseEvent & | event | ) | `[virtual]`

Handle mouse leaving the area

Parameters:

  | event | The event to handle

Reimplemented from Exponent::GUI::Controls::CControl.

virtual void Exponent::GUI::Controls::CRolloverButton::handleMouseMovement | ( | CMouseEvent & | event | ) | `[virtual]`

Handle mouse movement

Parameters:

  | event | The event to handle

Reimplemented from Exponent::GUI::Controls::CControl.

Reimplemented in Exponent::GUI::Controls::CRepeatingButton.

virtual void Exponent::GUI::Controls::CRolloverButton::setDownImage | ( | IImage * | theImage | ) | `[virtual]`

Set the down image

Parameters:

  | theImage | The image to display when the mouse is down

void Exponent::GUI::Controls::CRolloverButton::setLabelText | ( | const CString & | text | ) | `[inline]`

Set the label text

Parameters:

  | text | The text to display on the button if there is no image

Definition at line 138 of file CRolloverButton.hpp.

References m_labelText.

virtual void Exponent::GUI::Controls::CRolloverButton::setOverImage | ( | IImage * | theImage | ) | `[virtual]`

Set the over image

Parameters:

  | theImage | The image to display when the mouse is over

virtual void Exponent::GUI::Controls::CRolloverButton::useCursorChange | ( | const bool | use = `true` | ) | `[inline, virtual]`

Should we use cursor change?

Parameters:

  | use | If true then when mouse over occurs mouse is changed to hand cursor

Note:
  Not recommended on mac, cos it looks messy!

Definition at line 84 of file CRolloverButton.hpp.

References m_cursorChange.

## Member Data Documentation

bool Exponent::GUI::Controls::CRolloverButton::m_cursorChange`[protected]`

Should the cursor change

Definition at line 149 of file CRolloverButton.hpp.

Referenced by useCursorChange().

IImage* Exponent::GUI::Controls::CRolloverButton::m_downImage`[protected]`

The down image

Definition at line 146 of file CRolloverButton.hpp.

CString Exponent::GUI::Controls::CRolloverButton::m_labelText`[protected]`

Text drawn on the face of the button if no image is set

Definition at line 151 of file CRolloverButton.hpp.

Referenced by setLabelText().

bool Exponent::GUI::Controls::CRolloverButton::m_mouseIsDown`[protected]`

Is the mouse down?

Definition at line 150 of file CRolloverButton.hpp.

IImage* Exponent::GUI::Controls::CRolloverButton::m_overImage`[protected]`

The over image

Definition at line 147 of file CRolloverButton.hpp.

ERolloverState Exponent::GUI::Controls::CRolloverButton::m_state`[protected]`

The state

Definition at line 148 of file CRolloverButton.hpp.