ofxMUI
A Multi-touch GUI implementation built with ofxDOM for openFrameworks.
|
#include <Slider.h>
Public Types | |
enum | { DEFAULT_WIDTH = 15, DEFAULT_HEIGHT = 300 } |
Public Member Functions | |
Slider (const std::string &id, DOM::Orientation orientation, DragMode mode=DragMode::ABSOLUTE) | |
Create a Slider with the given parameters. More... | |
Slider (const std::string &id="", float x=0, float y=0, float width=DEFAULT_WIDTH, float height=DEFAULT_HEIGHT, DOM::Orientation orientation=DOM::Orientation::DEFAULT, DragMode mode=DragMode::ABSOLUTE) | |
Create a Slider with the given parameters. More... | |
virtual | ~Slider () |
Destroy the Slider. | |
virtual void | onDraw () const override |
DragMode | getDragMode () const |
void | setDragMode (DragMode mode) |
Set the current DragMode. More... | |
DOM::Orientation | getOrientation () const |
void | setOrientation (DOM::Orientation orientation) |
Set the Orientation of the slider. More... | |
bool | isInverted () const |
Determine if the slider direction inverted. More... | |
void | setInverted (bool inverted) |
Invert the Slider direction. More... | |
void | onPointerEvent (DOM::PointerUIEventArgs &e) |
Pointer event callback. More... | |
void | onPointerCaptureEvent (DOM::PointerCaptureUIEventArgs &e) |
Pointer event callback. More... | |
template<class ListenerClass , typename ListenerMethod > | |
void | addListener (ListenerClass *listener, ListenerMethod method, int priority=OF_EVENT_ORDER_AFTER_APP) |
Bind this adapter to an existing parameter. 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... | |
void | setValueWithoutEventNotifications (const Type &value) |
void | setValue (const Type &value) |
Type | getValue () const |
void | setMin (const Type &min) |
Type | getMin () const |
void | setMax (const Type &max) |
Type | getMax () const |
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< Styles > | getStyles () const |
Get the Styles for this Widget. More... | |
void | setStyles (std::shared_ptr< Styles > styles) |
Set the Styles for this Widget. More... | |
Static Public Member Functions | |
static float | defaultWidthForOrientation (DOM::Orientation orientation) |
static float | defaultHeightForOrientation (DOM::Orientation orientation) |
Public Attributes | |
ofEvent< Type > | onValueChanged |
A callback for the parameter change. | |
Static Public Attributes | |
static const DOM::Orientation | DEFAULT_ORIENTATION = DOM::Orientation::HORIZONTAL |
Protected Member Functions | |
DOM::Orientation | _getEffectiveOrientation () const |
Get the effective orientation. More... | |
std::size_t | _getActiveAxisIndex () const |
Get the active axis index. More... | |
void | _onResize (DOM::ResizeEventArgs &) |
A callback for any resize events. More... | |
void | _onValueChanged (const void *sender, Type &value) |
A callback for the ParameterWidget's value. More... | |
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 | |
DOM::Orientation | _orientation = DOM::Orientation::HORIZONTAL |
The Slider orientation. | |
DragMode | _dragMode = DragMode::RELATIVE |
The drag mode. | |
std::size_t | _primaryPointerId = 0 |
The "primary" pointer id. More... | |
Type | _valueOffset = 0 |
The start value of the value itself. More... | |
bool | _isInverted = false |
Is the Slider direction inverted. | |
ofParameter< Type > | _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. | |
Type | the data type represented by the Slider. |
ofx::MUI::Slider< Type >::Slider | ( | const std::string & | id, |
DOM::Orientation | orientation, | ||
DragMode | mode = DragMode::ABSOLUTE |
||
) |
ofx::MUI::Slider< Type >::Slider | ( | const std::string & | id = "" , |
float | x = 0 , |
||
float | y = 0 , |
||
float | width = DEFAULT_WIDTH , |
||
float | height = DEFAULT_HEIGHT , |
||
DOM::Orientation | orientation = DOM::Orientation::DEFAULT , |
||
DragMode | mode = DragMode::ABSOLUTE |
||
) |
Create a Slider with the given parameters.
|
protected |
Get the active axis index.
|
protected |
Get the effective orientation.
|
protected |
A callback for any resize events.
value | The DOM::ResizeEvent arguments. |
|
protected |
A callback for the ParameterWidget's value.
value | The the updated value. |
|
inline |
Bind this adapter to an existing parameter.
parameter | The parameter to bind to. void makeReferenceTo(ofParameter<Type>& parameter); Add listeners to this onValueChanged event. |
ListenerClass | The class type of the listener. |
ListenerMethod | The name of the listener method. |
listener | A pointer to the listener instance. |
method | A pointer to the listener method. |
prioirty | The order priority of this listener. |
DragMode ofx::MUI::Slider< Type >::getDragMode | ( | ) | const |
DOM::Orientation ofx::MUI::Slider< Type >::getOrientation | ( | ) | const |
bool ofx::MUI::Slider< Type >::isInverted | ( | ) | const |
void ofx::MUI::Slider< Type >::onPointerCaptureEvent | ( | DOM::PointerCaptureUIEventArgs & | e | ) |
Pointer event callback.
evt | The event data. |
void ofx::MUI::Slider< Type >::onPointerEvent | ( | DOM::PointerUIEventArgs & | e | ) |
Pointer event callback.
evt | The event data. |
|
inline |
Remove listeners to this onValueChanged event.
ListenerClass | The class type of the listener. |
ListenerMethod | The name of the listener method. |
listener | A pointer to the listener instance. |
method | A pointer to the listener method. |
prioirty | The order priority of this listener. |
void ofx::MUI::Slider< Type >::setDragMode | ( | DragMode | mode | ) |
Set the current DragMode.
DragMode affects how a slider interprets drags.
mode | The DragMode to set. |
void ofx::MUI::Slider< Type >::setInverted | ( | bool | inverted | ) |
Invert the Slider direction.
By default the Slider direction is mapped from 0 (left) to 1 (right) in Orientation::LANDSCAPE mode and from 0 (bottom) to 1 (top) in Orientation::PORTRAIT mode. Inverted Sliders map in the opposite way.
inverted | true if the Slider direction should be inverted. |
void ofx::MUI::Slider< Type >::setOrientation | ( | DOM::Orientation | orientation | ) |
Set the Orientation of the slider.
the | Desired Orientation. |
|
protected |
The "primary" pointer id.
This is the first pointer that was captured when dragging.
|
protected |
The start value of the value itself.
Used when computing offsets in Mode::RELATIVE.