ofxOui - UI Components for OpenFrameworks

Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ofxOui::Matrix Class Reference

Button Matrix (supports both button -single-button activation- and toggle -multi-button activation-) More...

#include <ofxOuiMatrix.hpp>

Inheritance diagram for ofxOui::Matrix:
[legend]
Collaboration diagram for ofxOui::Matrix:
[legend]

Classes

class  ClickEvent
 Event arguments for button clicks. More...
 

Public Member Functions

template<typename T , typename args , class ListenerClass >
void onClick (T *owner, void(ListenerClass::*listenerMethod)(args))
 Set callback function for click events. More...
 
 Matrix (int x_=0, int y_=0, int width_=0, int height_=0)
 Constructor. More...
 
virtual ~Matrix ()
 Destructor. More...
 
virtual void setup ()
 Setup the Matrix layout. More...
 
virtual void update ()
 OF-like update function. More...
 
virtual void draw ()
 OF-like draw function. More...
 
virtual bool inside (float x_, float y_) const
 checks if a point is inside the component (depending on the shape) More...
 
Type type () const
 get the type of the component More...
 

Public Attributes

int rows
 number of rows More...
 
int cols
 number of columns More...
 
float padding
 padding between matrix buttons More...
 
bool toggle
 specifies if the matrix works in toggle with several buttons that can be activated at the same time or if a single button can be activated at a time More...
 
bool draw_grid
 specifies if the grid between buttons should be drawn More...
 
Shape button_shape
 shape of individual buttons More...
 
vector< vector< Button > > buttons
 Matrix of button GUIs. More...
 
Shape shape = ofxOui::Shape::Rectangle
 shape of the component More...
 
Style style = ofxOui::Style::Default
 style of the component More...
 
TextBox font
 textbox for the main label of the component More...
 
Icon icon
 icon box of the component More...
 
float x
 x position (left) More...
 
float y
 y position(top) More...
 
float width
 component width More...
 
float height
 component height More...
 
string labelOn = ""
 Label of the component (active) More...
 
string labelOff = ""
 Label of the component (not active) More...
 
bool disabled = false
 specifies if the component should be in "disabled" mode (no interaction) More...
 
bool active = false
 specifies if the component is active More...
 

Protected Member Functions

void mouseDragged (ofMouseEventArgs &e)
 
void onButtonClick (Button::ClickEvent &e)
 
virtual void drawBackground ()
 
virtual void drawFrame ()
 
virtual void drawLabel ()
 
virtual void drawIcon ()
 

Protected Attributes

ofRectangle grid_rect_
 
float button_width_
 
float button_height_
 
Button const * selected_button_
 
std::function< void(Matrix::ClickEvent &)> click_event_callback_
 
Type type_ = ofxOui::Type::Label
 
bool hover_ = false
 
ofColor current_background_color_
 
ofColor current_frame_color_
 

Static Protected Attributes

static Componentblocking_component = nullptr
 

Detailed Description

Button Matrix (supports both button -single-button activation- and toggle -multi-button activation-)

Constructor & Destructor Documentation

§ Matrix()

ofxOui::Matrix::Matrix ( int  x_ = 0,
int  y_ = 0,
int  width_ = 0,
int  height_ = 0 
)

Constructor.

Parameters
x_x position (left)
y_y position (top)
width_component width
height_component height

§ ~Matrix()

ofxOui::Matrix::~Matrix ( )
virtual

Destructor.

Member Function Documentation

§ draw()

void ofxOui::Matrix::draw ( )
virtual

OF-like draw function.

Reimplemented from ofxOui::Component.

§ drawBackground()

void ofxOui::Component::drawBackground ( )
protectedvirtualinherited

§ drawFrame()

void ofxOui::Component::drawFrame ( )
protectedvirtualinherited

§ drawIcon()

void ofxOui::Component::drawIcon ( )
protectedvirtualinherited

Reimplemented in ofxOui::CheckBox.

§ drawLabel()

void ofxOui::Component::drawLabel ( )
protectedvirtualinherited

§ inside()

bool ofxOui::Component::inside ( float  x_,
float  y_ 
) const
virtualinherited

checks if a point is inside the component (depending on the shape)

Returns
true if the point of coordinates (x, y) is inside the component

§ mouseDragged()

void ofxOui::Matrix::mouseDragged ( ofMouseEventArgs &  e)
protected

§ onButtonClick()

void ofxOui::Matrix::onButtonClick ( Button::ClickEvent e)
protected

§ onClick()

template<typename T , typename args , class ListenerClass >
void ofxOui::Matrix::onClick ( T *  owner,
void(ListenerClass::*)(args)  listenerMethod 
)
inline

Set callback function for click events.

Parameters
ownerpointer to the owner object
listenerMethodmethod to be called on eaech event
Template Parameters
Ttype of the owner object
argsarguments of the callback function
ListenerClassclass to which the listener method belongs

§ setup()

void ofxOui::Matrix::setup ( )
virtual

Setup the Matrix layout.

§ type()

Type ofxOui::Component::type ( ) const
inlineinherited

get the type of the component

Returns
type of the component

§ update()

void ofxOui::Matrix::update ( )
virtual

OF-like update function.

Reimplemented from ofxOui::Component.

Member Data Documentation

§ active

bool ofxOui::Component::active = false
inherited

specifies if the component is active

§ blocking_component

ofxOui::Component * ofxOui::Component::blocking_component = nullptr
staticprotectedinherited

§ button_height_

float ofxOui::Matrix::button_height_
protected

§ button_shape

Shape ofxOui::Matrix::button_shape

shape of individual buttons

§ button_width_

float ofxOui::Matrix::button_width_
protected

§ buttons

vector<vector<Button> > ofxOui::Matrix::buttons

Matrix of button GUIs.

§ click_event_callback_

std::function<void(Matrix::ClickEvent&)> ofxOui::Matrix::click_event_callback_
protected

§ cols

int ofxOui::Matrix::cols

number of columns

§ current_background_color_

ofColor ofxOui::Component::current_background_color_
protectedinherited

§ current_frame_color_

ofColor ofxOui::Component::current_frame_color_
protectedinherited

§ disabled

bool ofxOui::Component::disabled = false
inherited

specifies if the component should be in "disabled" mode (no interaction)

§ draw_grid

bool ofxOui::Matrix::draw_grid

specifies if the grid between buttons should be drawn

§ font

TextBox ofxOui::Component::font
inherited

textbox for the main label of the component

§ grid_rect_

ofRectangle ofxOui::Matrix::grid_rect_
protected

§ height

float ofxOui::Component::height
inherited

component height

§ hover_

bool ofxOui::Component::hover_ = false
protectedinherited

§ icon

Icon ofxOui::Component::icon
inherited

icon box of the component

§ labelOff

string ofxOui::Component::labelOff = ""
inherited

Label of the component (not active)

§ labelOn

string ofxOui::Component::labelOn = ""
inherited

Label of the component (active)

§ padding

float ofxOui::Matrix::padding

padding between matrix buttons

§ rows

int ofxOui::Matrix::rows

number of rows

§ selected_button_

Button const* ofxOui::Matrix::selected_button_
protected

§ shape

Shape ofxOui::Component::shape = ofxOui::Shape::Rectangle
inherited

shape of the component

§ style

Style ofxOui::Component::style = ofxOui::Style::Default
inherited

style of the component

§ toggle

bool ofxOui::Matrix::toggle

specifies if the matrix works in toggle with several buttons that can be activated at the same time or if a single button can be activated at a time

§ type_

Type ofxOui::Component::type_ = ofxOui::Type::Label
protectedinherited

§ width

float ofxOui::Component::width
inherited

component width

§ x

float ofxOui::Component::x
inherited

x position (left)

§ y

float ofxOui::Component::y
inherited

y position(top)


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