#include <ugadgets.hpp>
Inheritance diagram for UButton:
Public Member Functions | |
UButton (const UArgs &a=UArgs::none) | |
constructor; see also ~UGroup() and the creator shortcut ubutton() | |
virtual const UStyle & | getStyle (UContext *) const |
returns the contextual UStyle of this object. | |
Static Public Member Functions | |
static const UStyle & | makeStyle () |
creates the Style of this object. | |
static const UStyle & | makeMenuStyle () |
static const UStyle & | makeBarStyle () |
static const UStyle & | makeFlatStyle () |
static const UStyle & | makeLinkStyle () |
Static Public Attributes | |
static UStyle * | style |
corresponding Ubit UStyle | |
static UStyle * | menuStyle |
static UStyle * | barStyle |
static UStyle * | flatStyle |
static UStyle * | linkStyle |
contextual styles depending on the Button's parent | |
Friends | |
UButton & | ubutton (const UArgs &a=UArgs::none) |
creator shortcut that is equivalent to *new UButton(). |
Similar to the UItem gadget but has decorations. These decorations are determined in a dynamical way depending on the button's parents.
Geometry: same as ULabel
Default Properties:
Callbacks: as for other UBox subclasses generic callback conditions make it possible to specify callback methods and functions: see class UCond. For instance:
Exemple:
XXX* obj = ...; UButton& btn = ubutton( UPix::diskette + " Save..." + UOn::action / ucall(obj, "save", &XXX::foo) + UOn::arm / ucall(obj, "save", &XXX::foo) );
foo is a method of XXX (non member functions could also be specified: see class UCall). a method callback can have 0 to 2 arguments.
void XXX::foo(UEvent& e, const char* msg) { if (e.getSource()) { // returns the button if (e.getCond == &UOn::action) cout << "Action, arg= " << msg << endl; else if (e.getCond == &UOn::arm) cout << "Arm, arg= " << msg << endl; }
|
returns the contextual UStyle of this object. This virtual function calls one of the makeXxxStyle() functions that are defined for this specific class.
Reimplemented from UBox. Reimplemented in UFlatbutton, ULinkbutton, and URadiobutton. |
|
creates the Style of this object. This static function is redefined by each class that derives from UGroup. It is called by the virtual function UGroup::getStyle()
Reimplemented from UBox. |