Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

UButton Class Reference

Button gadget. More...

#include <ugadgets.hpp>

Inheritance diagram for UButton:

UFlatbutton ULinkbutton URadiobutton List of all members.

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 ()
static const UStyle & makeMenuStyle ()
static const UStyle & makeBarStyle ()
static const UStyle & makeFlatStyle ()
static const UStyle & makeLinkStyle ()

Static Public Attributes

static UStyle * style
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().

Detailed Description

Button gadget.

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;
     }
 


Member Function Documentation

const UStyle & UButton::getStyle (  UContext *   )  const [virtual]
 

returns the contextual UStyle of this object

This virtual function calls one of the makeXxxStyle() functions that are defined for this specific class.

  • see also: UStyle and makeXxxStyle() functions

Reimplemented in UFlatbutton, ULinkbutton, and URadiobutton.


The documentation for this class was generated from the following files:
Generated on Thu Mar 3 06:36:50 2005 for Ubit[Eric.Lecolinet@enst.fr] by  doxygen 1.4.1