Button Class Reference

Inherits Widget.

Inherited by BButton, CheckButton, HighlightButton, RepeatButton, ReturnButton, and ToggleButton.

List of all members.

Public Types

enum  { HIDDEN }

Public Member Functions

bool value () const
bool value (bool v)
int handle (int)
int handle (int event, const Rectangle &)
 Button (int, int, int, int, const char *=0)
virtual void draw ()
void draw (int glyph_width) const

Static Public Attributes

NamedStyledefault_style


Detailed Description

Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for when():

Buttons can also generate callbacks in response to SHORTCUT events. The button can either have an explicit shortcut() value or a letter shortcut can be indicated in the label() with an '&' character before it. For the label shortcut it does not matter if Alt is held down, but if you have an input field in the same window, the user will have to hold down the Alt key so that the input field does not eat the event first as an KEY event.

buttons.gif


Member Function Documentation

void Button::draw int  glyph_width  )  const
 

This function provides a mess of back-compatabilty and Windows emulation to subclasses of Button to draw with. It will draw the button according to the current state of being pushed and it's value. If non-zero is passed for glyph_width then the glyph() is drawn in that space on the left (or on the right if negative), and it assummes the glyph indicates the value, so the box is only used to indicate the pushed state.

bool Button::value bool  v  )  [inline]
 

Change the value(). Redraws the button and returns true if the new value is different. This is the same function as Widget::state(). See also Widget::set(), Widget::clear(), and Widget::setonly().

If you turn it on, a normal button will draw pushed-in, until the user clicks it and releases it.

bool Button::value  )  const [inline]
 

The current value. True means it is pushed down, false means it is not pushed down. The ToggleButton subclass provides the ability for the user to change this value permanently, otherwise it is just temporary while the user is holding the button down.

This is the same as Widget::state().


The documentation for this class was generated from the following files:
Sun Jan 7 00:55:17 2007. FLTK ©2006 Bill Spitzak and others.
Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.