ofxMUI
A Multi-touch GUI implementation built with ofxDOM for openFrameworks.
ofx::MUI::ToggleButton Class Reference

A two state button. More...

#include <Button.h>

Inheritance diagram for ofx::MUI::ToggleButton:
ofx::MUI::Button ofx::MUI::Widget

Public Member Functions

 ToggleButton (const std::string &id="", float x=0, float y=0, float width=DEFAULT_WIDTH, float height=DEFAULT_HEIGHT, bool autoExclusive=false, bool triggersOnRelease=false, bool requirePointerOverOnRelease=true)
 Create a ToggleButton with the given parameters. More...
 
virtual ~ToggleButton ()
 Destroy the ToggleButton.
 
virtual void onDraw () const override
 
- Public Member Functions inherited from ofx::MUI::Button
 Button (const std::string &id="", float x=0, float y=0, float width=DEFAULT_WIDTH, float height=DEFAULT_HEIGHT, bool autoExclusive=false, bool triggersOnRelease=false, bool requirePointerOverOnRelease=true, std::size_t stateCount=1)
 Create a Button with the given parameters. More...
 
virtual ~Button ()
 Destroy the Button.
 
bool triggersOnRelease () const
 
bool requirePointerOverOnRelease () const
 
bool autoExclusive () const
 
std::size_t stateCount () const
 Return the number of Button states.
 
void onPointerEvent (DOM::PointerUIEventArgs &e)
 Default callback for built-in events, including dragging. More...
 
void onPointerCaptureEvent (DOM::PointerCaptureUIEventArgs &e)
 Default callback for built-in events, including dragging. More...
 
template<class ListenerClass , typename ListenerMethod >
void addListener (ListenerClass *listener, ListenerMethod method, int priority=OF_EVENT_ORDER_AFTER_APP)
 Add listeners to this onValueChanged event. More...
 
template<class ListenerClass , typename ListenerMethod >
void removeListener (ListenerClass *listener, ListenerMethod method, int priority=OF_EVENT_ORDER_AFTER_APP)
 Remove listeners to this onValueChanged event. More...
 
int operator= (int v)
 The assignment operator. More...
 
 operator const int & ()
 Dereference operator.
 
- Public Member Functions inherited from ofx::MUI::Widget
 Widget (float x, float y, float width, float height)
 
 Widget (const std::string &id, float x, float y, float width, float height)
 
virtual ~Widget ()
 Destroy this Widget.
 
bool isPointerOver () const
 
bool isPointerDown () const
 
void setDropTarget (bool dropTarget)
 Enable or disable the Widget as a drop target. More...
 
bool isDropTarget () const
 Determine if this Widget is a drop target. More...
 
void setDraggable (bool draggable)
 Set draggability for this Widget. More...
 
bool isDraggable () const
 Determine if draggability is enabled for this Widget. More...
 
bool isDragging () const
 Determine if this Widget is being dragged. More...
 
std::shared_ptr< StylesgetStyles () const
 Get the Styles for this Widget. More...
 
void setStyles (std::shared_ptr< Styles > styles)
 Set the Styles for this Widget. More...
 

Additional Inherited Members

- Public Types inherited from ofx::MUI::Button
enum  { DEFAULT_WIDTH = 40, DEFAULT_HEIGHT = 40 }
 
- Public Attributes inherited from ofx::MUI::Button
DOM::DOMEvent< ButtonEventArgsonButtonPressed
 Event called when button is pressed and released. More...
 
DOM::DOMEvent< ButtonEventArgsonButtonDown
 The event called when the button goes from an up to down state.
 
DOM::DOMEvent< ButtonEventArgsonButtonUp
 The event called when the button goes from down to up state.
 
ofEvent< int > onValueChanged
 The event that is set when the value of a button changes.
 
- Protected Member Functions inherited from ofx::MUI::Button
void _onValueChanged (const void *sender, int &value)
 A callback for the ParameterWidget's value. More...
 
void _incrementState ()
 Increment the current button state.
 
- Protected Member Functions inherited from ofx::MUI::Widget
void _onPointerEvent (DOM::PointerUIEventArgs &e)
 Default callback for built-in events, including dragging.
 
void _onPointerCaptureEvent (DOM::PointerCaptureUIEventArgs &e)
 Default callback for built-in events, including dragging.
 
- Protected Attributes inherited from ofx::MUI::Button
bool _autoExclusive = true
 If true, will act as a radio button. More...
 
bool _triggersOnRelease = false
 Update the value immediately on press.
 
bool _requirePointerOverOnRelease = true
 Require that release is over the button.
 
std::size_t _stateCount = 1
 How many states can this button represent?
 
std::size_t _primaryPointerId = 0
 The "primary" pointer id. More...
 
ofParameter< int > _value
 The parameter to watch.
 
- Protected Attributes inherited from ofx::MUI::Widget
bool _isDropTarget = false
 True iff the Widget is a target for dragged Widgets.
 
bool _isDraggable = false
 True iff the Widget is configured to be dragged.
 
bool _isDragging = false
 True iff the widget is currently being dragged.
 
bool _isPointerOver = false
 True iff the pointer is over the widget.
 
bool _moveToFrontOnCapture = true
 True if the element should move to the fron upon pointer capture.
 

Detailed Description

A two state button.

Constructor & Destructor Documentation

ofx::MUI::ToggleButton::ToggleButton ( const std::string &  id = "",
float  x = 0,
float  y = 0,
float  width = DEFAULT_WIDTH,
float  height = DEFAULT_HEIGHT,
bool  autoExclusive = false,
bool  triggersOnRelease = false,
bool  requirePointerOverOnRelease = true 
)

Create a ToggleButton with the given parameters.

Parameters
idThe Widget's id string.
xx-position in parent coordinates.
yy-position in parent coordinates.
widthThe width (x-dimension) of Widget.
heightThe height (y-dimension) of Widget.
autoExclusiveIf true, behaves like an exclusive radio button.
triggersOnReleaseIf true, the button is toggled only on release.
requirePointerOverOnReleaseRequire a pointer to be over the button to trigger to change states.

The documentation for this class was generated from the following files: