-
Notifications
You must be signed in to change notification settings - Fork 6
Buttons
Buttons are one of the most basic features of a user interface. Woopsi provides several variations.
**TODO: Pictures and example usage for all buttons **
The most basic Woopsi button class is called, obviously enough, “Button”. It shows a user-defined string inside a rectangular box. Its edge is bevelled outwards until it is clicked and held down, at which point the box is bevelled inwards. Clicking the button fires an ACTION event.
The second variety of button that Woopsi provides is the “BitmapButton”. Instead of containing a string, BitmapButtons display images instead. They show one image when clicked and another image when not. Like the Button, they fire an ACTION event they are clicked.
AnimButtons are similar to BitmapButtons, but instead of showing a static image they show an animation. They show one animation when clicked and another when not. They fire an ACTION event when clicked.
The CycleButton is, perhaps, more of a list gadget that has been miscategorised than a button. A button’s purpose is to raise an event when it is clicked, and that is true of the CycleButton, but it has a second purpose. The CycleButton contains a list of options that can be added to and removed from. The text it displays is pulled from the currently-selected option.
Clicking the button selects the next option in the list or, if no more options are available, the first option. The value of the currently selected option can be retrieved using the gadget’s getValue() method.
When clicked, the CycleButton raises both an ACTION event and, assuming that the value changes (this won't be the case if the button has less than two options), a VALUE CHANGED event.
// Create a cycle button
CycleButton* button = new CycleButton(10, 10, 100, 30);
// Add options
button->addOption("Option 1", 1);
button->addOption("Option 2", 2);The DecorationGlyphButton is used by the AmigaScreen and AmigaWindow gadgets as a way of adding buttons to their borders. It is not typically useful outside of this context.