
Button s are activated by clicking (i.e. pressing and releasing) a mouse button inside the widget's bounds. The clicks may be detected by registering an ActionListener with the button. Two methods are available for separation of actions from several buttons. The ActionEvent::getSource() function returns a pointer to the button that was clicked. In addition, the button's command id is reflected by the ActionEvent::getCommand() function. This id may be modified for each button by calling the Button::setCommand() function. The mouse button recognized as a click may be changed through the ACTIVATION_CLICK LaF property.
Public Types | |
| typedef ONE::util::ConstIterator< const Widget * > | ChildConstItr |
| typedef ONE::util::SmartPointer< ChildConstItr, ONE::util::DestructiveCopy > | ChildConstItrSP |
| typedef ONE::util::Iterator< Widget * > | ChildItr |
| typedef ONE::util::SmartPointer< ChildItr, ONE::util::DestructiveCopy > | ChildItrSP |
| typedef ActionListener * | LPtr |
Public Member Functions | |
| virtual void | add (Component *, const LayoutConstraint *) |
| void | addActionListener (const LPtr &l) |
| Button (const IconSP &sicn, const IconSP &dicn=0, const util::Command &cmd=DEFAULT_COMMAND) | |
| Button (const IconID &sicn, const IconID &dicn=UNKNOWN_ICON, const util::Command &cmd=DEFAULT_COMMAND) | |
| Button (const std::string &text="", const util::Command &cmd=DEFAULT_COMMAND) | |
| creates a new button | |
| virtual void | clear () |
| void | click () |
| emulates a click on the button | |
| void | draw (Renderer2D *r, const int &x, const int &y, const int &w, const int &h) |
| draws a portion of this object | |
| void | draw (Renderer2D *) |
| draws this object. | |
| EventDispatcher () | |
| void | fireEvent (ActionEvent &e) const |
| notifies all registered listeners | |
| Color | getBackground () const |
| accesses the color that should be used to render the object's background. | |
| const BrdSP & | getBorder () const |
| accesses the component's border | |
| const BrdDSP & | getBorderDelegate () const |
| const Bounds & | getBounds () const |
| accesses this object's bounds | |
| virtual int | getChildCount () const |
| virtual ChildConstItrSP | getChildren () const |
| virtual ChildItrSP | getChildren () |
| const util::Command & | getCommand () const |
| retrieves the currently set action commandthe command | |
| Bounds | getContentBounds () const |
| calculates the bounds around the label string and icon, if available | |
| const IMSP & | getDefaultInputMap () const |
| accesses this widget's default input map | |
| const UIDSP & | getDelegate () const |
| DelegateID | getDelegateID () const |
| Color | getDisabledBackground () const |
| accesses the color that should be used to render the object's background when the object is disabled | |
| Color | getDisabledForeground () const |
| accesses the color that should be used to render the object's foreground when the object is disabled. | |
| const IconSP & | getDisabledIcon () const |
| accesses the disabled icon | |
| Color | getFocus () const |
| accesses the color that should be used to render the component focus | |
| const FntSP & | getFont () const |
| accesses the font that should be used to render the label's text | |
| Color | getForeground () const |
| accesses the color that should be used to render the object's foreground. | |
| unsigned char | getHorizontalAlignment () const |
| const IconSP & | getIcon () const |
| accesses this label's standard icon | |
| const Point & | getIconOffset () const |
| const IMSP & | getInputMap () const |
| Fringe | getPadding () const |
| Widget * | getParent () const |
| const Point & | getPosition () const |
| accesses this object's position | |
| Size | getPreferredSize () const |
| determines this object's preferred size. | |
| const Size & | getSize () const |
| accesses this object's size | |
| const std::string & | getText () const |
| accesses the label's text | |
| const Point & | getTextOffset () const |
| accesses the text position offset | |
| unsigned char | getVerticalAlignment () const |
| virtual bool | hasChildren () const |
| bool | hasFocus () const |
| checks if this component has the input focus | |
| bool | isEnabled () const |
| checks if this widget is enabled | |
| bool | isMuted () const |
| reflects this dispatcher's muted state. | |
| bool | isOpaque () const |
| checks this object's opacity | |
| bool | isPressed () const |
| checks if the button is pressed | |
| virtual bool | isUnder (const Point &) const |
| virtual bool | isVisible () const |
| acesses the visibility property | |
| void | layout () |
| lays out this component's internal elements | |
| void | processKeyEvent (KeyEvent &) |
| does nothing | |
| void | processMouseMotion (MouseEvent &) |
| does nothing | |
| void | processMousePress (MouseEvent &) |
| does nothing | |
| void | processMouseRelease (MouseEvent &) |
| does nothing | |
| void | releaseFocus () const |
| drops the input focus | |
| virtual void | remove (Component *) |
| void | removeActionListener (const LPtr &l) |
| bool | requestFocus () |
| requests the input focus for this component. | |
| void | scheduleLayout () |
schedules a call to layout | |
| void | setBackground (const Color &c, bool laf=true) |
| changes this object's background color | |
| void | setBorder (const BrdSP &b, bool laf=true) |
| changes the component's border | |
| void | setBounds (const int &x, const int &y, const int &w, const int &h) |
| void | setBounds (const Bounds &b) |
| changes this object's bounds | |
| void | setCommand (const util::Command &cmd) |
| changes the click action command | |
| void | setDisabledBackground (const Color &c, bool laf=true) |
| changes this object's disabled background color | |
| void | setDisabledForeground (const Color &c, bool laf=true) |
| changes this object's disabled foreground color | |
| void | setDisabledIcon (const IconID &icon) |
| sets this label's disabled icon | |
| void | setDisabledIcon (const IconSP &icon) |
| sets this label's disabled icon | |
| void | setEnabled (bool) |
| enables or disables this component | |
| void | setFocus (const Color &c, bool laf=true) |
| changes the color that will be used to draw the component focus marker | |
| void | setFont (const FntSP &fnt, bool laf=true) |
| void | setForeground (const Color &c, bool laf=true) |
| changes this object's foreground color | |
| void | setHorizontalAlignment (const char &halign, bool laf=true) |
| void | setIcon (const IconID &icon) |
| changes this label's icon | |
| void | setIcon (const IconSP &icon) |
| changes this label's icon | |
| void | setInputMap (const IMSP &im, bool laf=true) |
| void | setMuted (bool mute) |
| mutes or un-mutes the dispatcher | |
| void | setOpaque (bool o, bool laf=true) |
| changes this object's opacity | |
| void | setParent (Widget *p) |
| changes this component's parent | |
| void | setPosition (const int &x, const int &y) |
| void | setPosition (const Point &p) |
| changes this object's position | |
| void | setPreferredSize (const Size &s) |
| sets the object's preferred size | |
| virtual void | setPressed (bool) |
| void | setSize (const int &w, const int &h) |
| void | setSize (const Size &s) |
| changes this object's size | |
| void | setText (const std::string &t) |
| changes the label's text | |
| void | setVerticalAlignment (const char &valign, bool laf=true) |
| virtual void | setVisible (bool vis) |
| void | updateUI () |
Static Public Attributes | |
| static const util::Command | DEFAULT_COMMAND |
| the default command that is used when no command id is set | |
Protected Types | |
| typedef unsigned int | bits |
Protected Member Functions | |
| void | add (const LPtr &l) |
| registers a listener | |
| void | buttonPressed () |
| void | buttonReleased (bool) |
| void | doDraw (Renderer2D *, const int &, const int &, const int &, const int &) |
| performs subclass-specific drawing | |
| bool | getBit (const bits &bit) const |
| void | layout (const Bounds &b) |
lays out the text using b as the usable area. | |
| void | remove (const LPtr &l) |
| de-registers a listener. | |
| void | setBit (const bits &bit, bool val) |
Protected Attributes | |
| Point | iconOffset |
| Size | prefSize |
| Point | textOffset |
Static Protected Attributes | |
| static const bits | ENABLED |
| static const bits | LSCHED |
| set when this object is scheduled to be laid out | |
| static const bits | OPQ |
| opacity bit | |
| static const bits | VIS |
| visibility bit | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
creates a new button
The button is labeled with the
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
registers a listener
|
|
||||||||||||
|
the default implementation of this function does nothing Implements ONE::gui::Widget. Reimplemented in ONE::gui::Panel. |
|
|
|
|
|
Implements ONE::gui::AbstractButton. |
|
|
Implements ONE::gui::AbstractButton. |
|
|
the default implementation of this function does nothing Implements ONE::gui::Widget. Reimplemented in ONE::gui::Panel. |
|
|
emulates a click on the button
This function notifies all registered |
|
||||||||||||||||||||||||
|
performs subclass-specific drawing
Implementations of this function may assume that this object is visible and that
Implements ONE::gui::Displayable. |
|
||||||||||||||||||||||||
|
draws a portion of this object
This function calls
|
|
|
draws this object.
This function calls |
|
|
|
|
|
notifies all registered listeners
The listeners are called in the order in which they were added.
|
|
|
accesses the color that should be used to render the object's background.
|
|
|
|
|
|
accesses the component's border
|
|
|
|
|
|
accesses this object's bounds
The
|
|
|
the default implementation of this function returns Implements ONE::gui::Widget. Reimplemented in ONE::gui::Console, ONE::gui::Panel, ONE::gui::ScrollBar, ONE::gui::TitleBar, and ONE::gui::Viewport. |
|
|
the default implementation of this function returns Implements ONE::gui::Widget. Reimplemented in ONE::gui::Console, ONE::gui::Panel, ONE::gui::ScrollBar, ONE::gui::TitleBar, and ONE::gui::Viewport. |
|
|
the default implementation of this function returns Implements ONE::gui::Widget. Reimplemented in ONE::gui::Console, ONE::gui::Panel, ONE::gui::ScrollBar, ONE::gui::TitleBar, and ONE::gui::Viewport. |
|
|
retrieves the currently set action commandthe command
If no action command was set, this function returns |
|
|
calculates the bounds around the label string and icon, if available
|
|
|
accesses this widget's default input map The default implementation returns an empty map. Subclasses may override this function in order to specify a different default map.
Reimplemented from ONE::gui::Widget. |
|
|
|
|
|
Reimplemented from ONE::gui::Label. |
|
|
accesses the color that should be used to render the object's background when the object is disabled
|
|
|
accesses the color that should be used to render the object's foreground when the object is disabled.
|
|
|
accesses the disabled icon
|
|
|
accesses the color that should be used to render the component focus
|
|
|
accesses the font that should be used to render the label's text
|
|
|
accesses the color that should be used to render the object's foreground.
|
|
|
|
|
|
accesses this label's standard icon
|
|
|
|
|
|
|
|
|
|
|
|
Implements ONE::gui::Widget. |
|
|
accesses this object's position
|
|
|
determines this object's preferred size.
If this object has a non-degenerate preferred size (i.e. Implements ONE::gui::Displayable. |
|
|
accesses this object's size
|
|
|
accesses the label's text
|
|
|
accesses the text position offset The offset specifies the position of the label string's top left corner relative to this component's position.
|
|
|
|
|
|
the default implementation of this function returns Implements ONE::gui::Widget. Reimplemented in ONE::gui::Console, ONE::gui::Panel, ONE::gui::ScrollBar, ONE::gui::TitleBar, and ONE::gui::Viewport. |
|
|
checks if this component has the input focus
This function queries the
Implements ONE::gui::Control. |
|
|
checks if this widget is enabled
Implements ONE::gui::Control. |
|
|
reflects this dispatcher's muted state.
|
|
|
checks this object's opacity objects that are set to not opaque (i.e. transparent) should not draw their background display.
|
|
|
checks if the button is pressed
|
|
|
This implementation checks if the given point is within the widget's bounds and then queries the delegate. Implements ONE::gui::Control. Reimplemented in ONE::gui::Picture. |
|
|
acesses the visibility property
The default value is
|
|
|
lays out this component's internal elements
This function may not change this object's bounds. Implementations should lay out their internal elements according to the currently set bounds. Implements ONE::gui::Displayable. |
|
|
lays out the text using
|
|
|
does nothing
Reimplemented from ONE::gui::Label. |
|
|
does nothing
Reimplemented from ONE::gui::Label. |
|
|
does nothing
Reimplemented from ONE::gui::Label. |
|
|
does nothing
Reimplemented from ONE::gui::Label. |
|
|
drops the input focus
Implements ONE::gui::Control. |
|
|
de-registers a listener.
This listener will no longer notify
|
|
|
the default implementation of this function does nothing Implements ONE::gui::Widget. Reimplemented in ONE::gui::Panel. |
|
|
|
|
|
requests the input focus for this component.
The
Implements ONE::gui::Control. |
|
|
schedules a call to
This function makes component layout more efficient as several calls to this function within one frame duration result in only one call to |
|
||||||||||||
|
changes this object's background color
The setting is active immediately. If
|
|
||||||||||||
|
|
|
||||||||||||
|
changes the component's border
If
|
|
||||||||||||||||||||
|
|
|
|
changes this object's bounds
See
|
|
|
changes the click action command
This command may be used to distinguish between
|
|
||||||||||||
|
changes this object's disabled background color
The setting is active immediately. If
|
|
||||||||||||
|
changes this object's disabled foreground color
The setting is active immediately. If
|
|
|
sets this label's disabled icon
See |
|
|
sets this label's disabled icon
This icon must have the same dimension as the standard icon. If no standard icon is set, it will be set to |
|
|
enables or disables this component Disabled components no longer react to user input. If this object has children, they are modified accordingly. Reimplemented from ONE::gui::Widget. |
|
||||||||||||
|
changes the color that will be used to draw the component focus marker
The setting is active immediately. If
|
|
||||||||||||
|
|
|
||||||||||||
|
changes this object's foreground color
The setting is active immediately. If
|
|
||||||||||||
|
|
|
|
changes this label's icon
This function removes the old icon (if present) but does not recalculate the component layout. The new icon will be displayed only after |
|
|
changes this label's icon Note that this icon must have the same dimension as the disabled icon. |
|
||||||||||||
|
|
|
|
mutes or un-mutes the dispatcher Muted dispatchers no longer notify their listeners. |
|
||||||||||||
|
changes this object's opacity
The setting is active immediately. If
|
|
|
changes this component's parent If a previous parent was set, this component will be removed from it.
|
|
||||||||||||
|
|
|
|
changes this object's position Note that this function does not request a re-layout.
|
|
|
sets the object's preferred size If the value is set to an empty size object, the component will calculate its preferred size.
|
|
|
Reimplemented in ONE::gui::RadioButton, and ONE::gui::ToggleButton. |
|
||||||||||||
|
|
|
|
changes this object's size Note that this function does not request a re-layout.
|
|
|
changes the label's text
This function calls
|
|
||||||||||||
|
|
|
|
This function releases the input focus if the widget is set to invisible. Reimplemented from ONE::gui::Displayable. |
|
|
Reimplemented from ONE::gui::Label. Reimplemented in ONE::gui::CheckBox, and ONE::gui::RadioButton. |
|
|
the default command that is used when no command id is set
|
|
|
|
|
|
|
|
|
set when this object is scheduled to be laid out
|
|
|
opacity bit
|
|
|
|
|
|
|
|
|
visibility bit
|
1.4.3