Vaca::ButtonBase Class Reference

#include <ButtonBase.h>

Inheritance diagram for Vaca::ButtonBase:

Vaca::Widget Vaca::Component Vaca::Referenceable Vaca::NonCopyable Vaca::Button Vaca::CheckBox Vaca::RadioButton Vaca::ToggleButton Vaca::CustomButton

List of all members.


Detailed Description

Base for every button.

Win32 Specific:
It's a wrapper for the BUTTON(W32) class.

Public Member Functions

 ButtonBase (Widget *parent, Style style)
virtual ~ButtonBase ()
bool isSelected ()
 Returns true if the button is selected or checked.
void setSelected (bool state)
 Selects or deselects (checks or unchecks) the button depending of state parameter.

Public Attributes

Signal1< void, Event & > Action

Protected Member Functions

virtual void onPreferredSize (Size &sz)
 Returns the preferred size for the button.
virtual void onAction (Event &ev)
 Event fired when you should take some responsability.
virtual bool onReflectedCommand (int id, int code, LRESULT &lResult)
 Catches BN_CLICKED to fire onAction event.

Constructor & Destructor Documentation

ButtonBase::ButtonBase ( Widget parent,
Style  style 
)

ButtonBase::~ButtonBase (  )  [virtual]


Member Function Documentation

bool ButtonBase::isSelected (  ) 

Returns true if the button is selected or checked.

It's useful to see if a CheckBox, RadioButton or ToggleButton is checked.

See also:
setSelected

void ButtonBase::setSelected ( bool  state  ) 

Selects or deselects (checks or unchecks) the button depending of state parameter.

The button is automatically redrawn, you don't need to call invalidate().

Parameters:
state true if you want to check the button, or false if you want to uncheck.
See also:
isSelected

void ButtonBase::onPreferredSize ( Size sz  )  [protected, virtual]

Returns the preferred size for the button.

Reimplemented from Vaca::Widget.

void ButtonBase::onAction ( Event ev  )  [protected, virtual]

Event fired when you should take some responsability.

For Button it's fired when the user push the button, for CheckBox and ToggleButton when the button-state is changed, and for RadioButton when one option is selected.

Reimplemented in Vaca::RadioButton.

bool ButtonBase::onReflectedCommand ( int  id,
int  code,
LRESULT &  lResult 
) [protected, virtual]

Catches BN_CLICKED to fire onAction event.

Reimplemented from Vaca::Widget.

Reimplemented in Vaca::RadioButton.


Member Data Documentation

See also:
onAction