Inherits fltk::Menu.
Public Member Functions | |
int | handle (int) |
Static Public Attributes | |
static NamedStyle * | default_style = &::style |
Protected Member Functions | |
void | draw () |
This widget lets the user select one of a set of choices by clicking on it. Each click cycles to the next choice. Holding down any shift key or using the middle or right mouse button cycles backwards.
Notice that the number of items can be 2. In this case this widget serves the common purpose of a "toggle" button that shows the current on/off state by changing it's label.
This is a subclass of Menu. The possible states are defined by using Menu::add() or other methods that define the menu items. You can also put a different callback on each item. Or you can replace this widget's callback with your own and use value() to get the index of the current setting. Items that are not visible() or are not active() are skipped by the cycling.
If you set buttonbox() to NO_BOX then you must define your items to draw identical-sized and fully opaque images, so that drawing one completely obscures any other one. This was done to avoid blinking when drawing "artistic" user interfaces where all the entire button is an image.
void CycleButton::draw | ( | void | ) | [protected, virtual] |
Fltk calls this virtual function to draw the widget, after setting up the graphics (current window, xy translation, etc) so that any drawing functions will go into this widget.
User code should not call this! You probably want to call redraw().
The default version calls draw_box() and draw_label(), thus drawing the box() to fill the widget and putting the label() and image() inside it to fill it, unless the align() flags are set to put it outside.
Information on how to write your own version is here.
Reimplemented from fltk::Group.
int CycleButton::handle | ( | int | event | ) | [virtual] |
Calls send() on some or all of the children widgets.
Reimplemented from fltk::Group.
NamedStyle * CycleButton::default_style = &::style [static] |
This style is assigned to Menu subclasses.
Because of the need to be compatable with Windows, which has a somewhat inconsistent appearance, the default is different than Widget::default_style, and the usage of the fields is somewhat unusual:
The Browser subclass sets the style back to Widget::default_style, so that they appear more like a text editor (ie they put the color and leading back to normal).
Reimplemented from fltk::Menu.