ofxOui - UI Components for OpenFrameworks

Public Member Functions | Public Attributes | Protected Attributes | List of all members
ofxOui::Group Class Reference

Group of UI components. More...

#include <ofxOuiGroup.hpp>

Public Member Functions

 Group (int x_=0, int y_=0, int width_=100, int height_=100)
 Constructor. More...
 
 ~Group ()
 Destructor. More...
 
virtual void setup ()
 
virtual void update ()
 OF-like update function. More...
 
virtual void draw ()
 OF-like draw function. More...
 
virtual bool inside (int x_, int y_)
 checks if the point (x, y) is inside the UI group More...
 
int rows () const
 get the number of rows in the group More...
 
int cols () const
 get the number of columns in the group More...
 
bool addComponent (shared_ptr< Component > component, int row, int col, int rowSpan=1, int colSpan=1)
 add a component to the group More...
 
shared_ptr< ComponentgetComponent (int row, int col)
 get the pointer to a component by grid position More...
 
shared_ptr< ComponentgetComponentByLabel (string label)
 get the pointer to a component by label (inactive label) More...
 
vector< shared_ptr< Component > > getComponents ()
 get a vector of pointers to the components of the group More...
 
bool removeComponent (shared_ptr< Component > component)
 remove a given component from the group by pointer More...
 
bool removeComponent (int row, int col)
 remove a given component from the group by position More...
 
void clear ()
 clear the UI group (deletes all components) More...
 
void disable ()
 disable all components More...
 
void enable ()
 disable all components More...
 

Public Attributes

float x
 x position (left) More...
 
float y
 y position(top) More...
 
float width
 group width More...
 
float height
 group height More...
 
int max_component_width
 maximum width of each component More...
 
int max_component_height
 maximum height of each component More...
 
int padding
 padding between the components More...
 
ofColor backgroundColor
 background color of the group More...
 
ofColor frameColor
 frame color of the group More...
 
int frame_width
 width of the group frame More...
 
ofxOui::Anchor alignment = ofxOui::Anchor::TopLeft
 width of the group frame More...
 

Protected Attributes

map< vector< int >, shared_ptr< Component > > components
 

Detailed Description

Group of UI components.

Constructor & Destructor Documentation

§ Group()

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

Constructor.

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

§ ~Group()

ofxOui::Group::~Group ( )

Destructor.

Member Function Documentation

§ addComponent()

bool ofxOui::Group::addComponent ( shared_ptr< Component component,
int  row,
int  col,
int  rowSpan = 1,
int  colSpan = 1 
)

add a component to the group

Parameters
componentshared pointer to the component to add
rowindex of the row in the group grid
colindex of the column in the group grid
rowSpannumber of rows the component is spanning in the group grid
colSpannumber of columns the component is spanning in the group grid
Returns
true if the component was successully added to the group

§ clear()

void ofxOui::Group::clear ( )

clear the UI group (deletes all components)

§ cols()

int ofxOui::Group::cols ( ) const

get the number of columns in the group

Returns
total number of columns (including multi-column spans)

§ disable()

void ofxOui::Group::disable ( )

disable all components

§ draw()

void ofxOui::Group::draw ( )
virtual

OF-like draw function.

§ enable()

void ofxOui::Group::enable ( )

disable all components

§ getComponent()

shared_ptr< ofxOui::Component > ofxOui::Group::getComponent ( int  row,
int  col 
)

get the pointer to a component by grid position

Parameters
rowindex of the row in the group grid
colindex of the column in the group grid
Returns
shared pointer to the component if it exists (else nullptr)

§ getComponentByLabel()

shared_ptr< ofxOui::Component > ofxOui::Group::getComponentByLabel ( string  label)

get the pointer to a component by label (inactive label)

Parameters
labellabel of the component (inactive mode)
Warning
returns the first component with the given label

§ getComponents()

vector< shared_ptr< ofxOui::Component > > ofxOui::Group::getComponents ( )

get a vector of pointers to the components of the group

Returns
vector of pointers to the components of the group

§ inside()

bool ofxOui::Group::inside ( int  x_,
int  y_ 
)
virtual

checks if the point (x, y) is inside the UI group

§ removeComponent() [1/2]

bool ofxOui::Group::removeComponent ( shared_ptr< Component component)

remove a given component from the group by pointer

Parameters
componentshared pointer to the component
Returns
true if the component was successfully removed from the group

§ removeComponent() [2/2]

bool ofxOui::Group::removeComponent ( int  row,
int  col 
)

remove a given component from the group by position

Parameters
rowindex of the row in the group grid
colindex of the column in the group grid
Returns
true if the component was successfully removed from the group

§ rows()

int ofxOui::Group::rows ( ) const

get the number of rows in the group

Returns
total number of rows (including multi-row spans)

§ setup()

void ofxOui::Group::setup ( )
virtual

§ update()

void ofxOui::Group::update ( )
virtual

OF-like update function.

Member Data Documentation

§ alignment

ofxOui::Anchor ofxOui::Group::alignment = ofxOui::Anchor::TopLeft

width of the group frame

§ backgroundColor

ofColor ofxOui::Group::backgroundColor

background color of the group

§ components

map<vector<int>, shared_ptr<Component> > ofxOui::Group::components
protected

§ frame_width

int ofxOui::Group::frame_width

width of the group frame

§ frameColor

ofColor ofxOui::Group::frameColor

frame color of the group

§ height

float ofxOui::Group::height

group height

§ max_component_height

int ofxOui::Group::max_component_height

maximum height of each component

§ max_component_width

int ofxOui::Group::max_component_width

maximum width of each component

§ padding

int ofxOui::Group::padding

padding between the components

§ width

float ofxOui::Group::width

group width

§ x

float ofxOui::Group::x

x position (left)

§ y

float ofxOui::Group::y

y position(top)


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