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

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

# Exponent::GUI::Controls::CMomentaryButton Class Reference

Inheritance diagram for Exponent::GUI::Controls::CMomentaryButton:

List of all members.

## Detailed Description

A button that goes on when the user clicks the mouse and off when they release the mouse 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
  CMomentaryButton.hpp,v 1.7 2007/02/08 21:07:54 paul Exp

Definition at line 32 of file CMomentaryButton.hpp.

## Public Member Functions

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

## Protected Attributes

- bool m_cursorChange
- IImage * m_downImage
- CString m_labelText
- bool m_state

## Constructor & Destructor Documentation

Exponent::GUI::Controls::CMomentaryButton::CMomentaryButton | ( | 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::CMomentaryButton::~CMomentaryButton | ( |  | ) | `[virtual]`

Destruction

## Member Function Documentation

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

Draw the controls

Parameters:

  | graphics | The graphics context

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

virtual void Exponent::GUI::Controls::CMomentaryButton::handleDoubleClick | ( | CMouseEvent & | event | ) | `[virtual]`

Handle double click

Parameters:

  | event | The event to handle

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

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

Handle left button being clicked

Parameters:

  | event | The event to handle

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

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

Handle left button being released

Parameters:

  | event | The event to handle

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

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

Handle mouse movement

Parameters:

  | event | The event to handle

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

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

Set the off image

Parameters:

  | theImage | The image to use when the button is in down state

void Exponent::GUI::Controls::CMomentaryButton::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 119 of file CMomentaryButton.hpp.

References m_labelText.

virtual void Exponent::GUI::Controls::CMomentaryButton::setValue | ( | const double | value | ) | `[virtual]`

Set the value of the button

Parameters:

  | value | The value to display

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

virtual void Exponent::GUI::Controls::CMomentaryButton::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 65 of file CMomentaryButton.hpp.

References m_cursorChange.

## Member Data Documentation

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

Should the cursor change

Definition at line 129 of file CMomentaryButton.hpp.

Referenced by useCursorChange().

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

The off image

Definition at line 127 of file CMomentaryButton.hpp.

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

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

Definition at line 130 of file CMomentaryButton.hpp.

Referenced by setLabelText().

bool Exponent::GUI::Controls::CMomentaryButton::m_state`[protected]`

The current state (on or off)

Definition at line 128 of file CMomentaryButton.hpp.