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

A Widget is the base class for all MUI interactive elements. More...

#include <Widget.h>

Inheritance diagram for ofx::MUI::Widget:
ofx::MUI::Button ofx::MUI::ButtonGroup ofx::MUI::Label ofx::MUI::Panel ofx::MUI::Scope< DataType > ofx::MUI::Slider< Type > ofx::MUI::SliderGroup ofx::MUI::RadioButton ofx::MUI::ToggleButton

Public Member Functions

 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.
 
virtual void onDraw () const override
 
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...
 

Protected Member Functions

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

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 Widget is the base class for all MUI interactive elements.

Member Function Documentation

std::shared_ptr< Styles > ofx::MUI::Widget::getStyles ( ) const

Get the Styles for this Widget.

Returns
the Widget's styles.
bool ofx::MUI::Widget::isDraggable ( ) const

Determine if draggability is enabled for this Widget.

Returns
true iff the draggability is enabled.
bool ofx::MUI::Widget::isDragging ( ) const

Determine if this Widget is being dragged.

Returns
true if this Widget is being dragged.
bool ofx::MUI::Widget::isDropTarget ( ) const

Determine if this Widget is a drop target.

Returns
true iff this Widget is a drop target.
bool ofx::MUI::Widget::isPointerDown ( ) const
Returns
true if the pointer is down on this Widget.
bool ofx::MUI::Widget::isPointerOver ( ) const
Returns
true if the pointer is over this Widget.
void ofx::MUI::Widget::setDraggable ( bool  draggable)

Set draggability for this Widget.

Parameters
draggableTrue iff draggability is enabled.
void ofx::MUI::Widget::setDropTarget ( bool  dropTarget)

Enable or disable the Widget as a drop target.

Parameters
dropTargetTrue iff this Widget is a drop target.
void ofx::MUI::Widget::setStyles ( std::shared_ptr< Styles styles)

Set the Styles for this Widget.

If the style is set to nullptr, it will automatically adopt the root document style.

Parameters
styleThe style to set.

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