- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ufo::UButton Class Reference

The base class for all clickable widgets. More...

#include <ubutton.hpp>

Inheritance diagram for ufo::UButton:

ufo::UCompound ufo::UWidget ufo::UObject ufo::UCollectable ufo::UCheckBox ufo::UMenuItem ufo::URadioButton ufo::UCheckBoxMenuItem ufo::UMenu List of all members.

Public Member Functions

 UButton (UIcon *icon)
 UButton (const std::string &text, UIcon *icon=NULL)
virtual void doClick ()
virtual void doClick (int millis)
virtual bool isSelected () const
virtual void setSelected (bool b)
bool isPressed () const
void setPressed (bool b)
bool isRolloverEnabled () const
void setRolloverEnabled (bool b)
bool isRollover () const
bool isToggable () const
void setToggable (bool b)
virtual std::string getActionCommand () const
virtual void setActionCommand (const std::string &actionCommand)
void setPressedIcon (UIcon *icon)
UIcongetPressedIcon () const
void setRolloverIcon (UIcon *icon)
UIcongetRolloverIcon () const
void setAccelerator (const UKeyStroke &stroke)
UKeyStroke getAccelerator () const
int getAcceleratorIndex () const
void setButtonGroup (UButtonGroup *buttonGroup)
UButtonGroupgetButtonGroup () const
virtual void activate ()
virtual bool isActive () const
virtual UIcongetIcon () const
virtual void setText (const std::string &text)
USignal1< UActionEvent * > & sigActivated ()
USignal1< UActionEvent * > & sigHighlighted ()

Protected Member Functions

void fireActionEvent ()
void buttonUp ()
virtual UDimension getContentsSize (const UDimension &maxSize) const
virtual void processKeyEvent (UKeyEvent *e)
virtual void processMouseEvent (UMouseEvent *e)
virtual void processShortcutEvent (UShortcutEvent *e)

Detailed Description

The base class for all clickable widgets.

In its basic version, it is a standard push button.

Author:
Johannes Schmidt


Member Function Documentation

virtual void ufo::UButton::activate  )  [virtual]
 

Activates the button and fires an action event.

Reimplemented in ufo::UMenuItem.

void ufo::UButton::buttonUp  )  [protected]
 

A slot for the doClick method.

virtual void ufo::UButton::doClick int  millis  )  [virtual]
 

Emulates a mouse click on that button, i.e. shows a pressed button, releases it and calls activate.

Parameters:
millis How long should that button be pressed
See also:
doClick

virtual void ufo::UButton::doClick  )  [virtual]
 

Emulates a mouse click on that button, i.e. shows a pressed button, releases it and calls activate.

int ufo::UButton::getAcceleratorIndex  )  const
 

If the accelerator is Alt+character and the text caption contains that letter, the index of this character within the caption is returned.

virtual std::string ufo::UButton::getActionCommand  )  const [virtual]
 

Gets the action command

See also:
setActionCommand
Returns:
The string which describes the performed action.

virtual UIcon* ufo::UButton::getIcon  )  const [virtual]
 

returns the icon that is currently used to paint this button.

Returns:
The icon which would be used to paint this icon at the moment

Reimplemented from ufo::UCompound.

UIcon * ufo::UButton::getPressedIcon  )  const [inline]
 

Returns:
The icon used if this button is down. May be NULL.

UIcon * ufo::UButton::getRolloverIcon  )  const [inline]
 

Returns:
The icon used if this button has mouse focus. May be NULL.

virtual bool ufo::UButton::isActive  )  const [virtual]
 

Returns whether this widget is active. Mostly this means that the current widget has mouse focus. But this may differ from widget to widget (e.g. text widget are active if they have keyboard focus). This is not really an isolated widget state but the combination of other states. It is used as style hint for the UI object.

Reimplemented from ufo::UWidget.

bool ufo::UButton::isPressed  )  const
 

Checks whether the button is pressed or not. This is mainly for visible effects.

Returns:
true if the button is down

bool ufo::UButton::isRollover  )  const
 

checks whether rollover effects are taking places, i.e. mouse is over button

Returns:
True of rollover is enabled and the mouse is over this widget

bool ufo::UButton::isRolloverEnabled  )  const
 

checks whether rollover effects are enabled

Returns:
the rollover flag

virtual bool ufo::UButton::isSelected  )  const [virtual]
 

Checks whether the button is selected or not. Only toggable buttons like check boxes and radio buttons can be selected.

See also:
UCheckBox

URadioButton

UCheckBoxMenuItem

Returns:
true if the button is selected

bool ufo::UButton::isToggable  )  const
 

if a button is toggable, you change the state by a mouse click

Returns:
if true, the button is toggable

virtual void ufo::UButton::processKeyEvent UKeyEvent e  )  [protected, virtual]
 

Processes key events. Primarily, it is used to notify listeners.

Reimplemented from ufo::UWidget.

Reimplemented in ufo::UMenuItem.

virtual void ufo::UButton::processMouseEvent UMouseEvent e  )  [protected, virtual]
 

Processes focus events. Primarily, it is used to notify listeners.

Reimplemented from ufo::UWidget.

Reimplemented in ufo::UMenuItem.

void ufo::UButton::setAccelerator const UKeyStroke stroke  ) 
 

Sets the accelerator. If the given key combination is pressed and the focused widget does not process it, the button will be activated.

virtual void ufo::UButton::setActionCommand const std::string &  actionCommand  )  [virtual]
 

Sets the action command. This string is delivered as action command to created action events. If no action command is specified, the current text caption is used as actino command.

Parameters:
actionCommand The action command used for action events

void ufo::UButton::setButtonGroup UButtonGroup buttonGroup  ) 
 

Sets the button group. Only one button within a button group can be selected.

void ufo::UButton::setPressed bool  b  ) 
 

Sets whether the button is pressed or not. A button is pressed normally by mouse or keyboard.

Parameters:
b If true, the button is pressed

void ufo::UButton::setPressedIcon UIcon icon  ) 
 

void ufo::UButton::setRolloverEnabled bool  b  ) 
 

sets whether rollover effects should be enabled

Parameters:
b If true, rollover effects are painted

void ufo::UButton::setRolloverIcon UIcon icon  ) 
 

virtual void ufo::UButton::setSelected bool  b  )  [virtual]
 

Sets whether the button is selected or not.

Parameters:
b The new selection state

virtual void ufo::UButton::setText const std::string &  text  )  [virtual]
 

sets the visible text

See also:
getText
Parameters:
text the static which should be visible on screen

Reimplemented from ufo::UCompound.

void ufo::UButton::setToggable bool  b  ) 
 

if a button is toggable, you change the state by a mouse click

Parameters:
b if true, the button is now toggable

USignal1<UActionEvent*>& ufo::UButton::sigActivated  )  [inline]
 

This signal is fired when the button has been clicked, toggled etc.

USignal1<UActionEvent*>& ufo::UButton::sigHighlighted  )  [inline]
 

This signal is fired when the button gets some type of highlight. This can mean that the button got mouse or keyboard focus.


The documentation for this class was generated from the following file:
The libUFO Project - written by Johannes Schmidt