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:

UBox UGroup 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 UStylegetStyle (UContext *) const
 returns the contextual UStyle of this object.

Static Public Member Functions

static const UStylemakeStyle ()
 creates the Style of this object.
static const UStylemakeMenuStyle ()
static const UStylemakeBarStyle ()
static const UStylemakeFlatStyle ()
static const UStylemakeLinkStyle ()

Static Public Attributes

static UStylestyle
 corresponding Ubit UStyle
static UStylemenuStyle
static UStylebarStyle
static UStyleflatStyle
static UStylelinkStyle
 contextual styles depending on the Button's parent

Friends

UButtonubutton (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 from UBox.

Reimplemented in UFlatbutton, ULinkbutton, and URadiobutton.

const UStyle & UButton::makeStyle  )  [static]
 

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.


The documentation for this class was generated from the following files:
Generated on Thu May 19 12:40:32 2005 for Ubit[Eric.Lecolinet@enst.fr] by  doxygen 1.4.2