Base class for views having a regular grid of elements. More...
#include <glv_widget.h>
Public Member Functions | |
Widget (const Rect &r, space_t pad=3, bool momentary=false, bool mutExc=false, bool drawGrid=true) | |
template<class T > | |
T | getValue () const |
Get selected element value type-casted to template parameter. | |
template<class T > | |
T | getValue (int i) const |
Get element value at 1D index type-casted to template parameter. | |
template<class T > | |
T | getValue (int i1, int i2) const |
Get element value at 2D index type-casted to template parameter. | |
bool | isSelected (int x, int y) const |
Returns whether this element coordinate is selected. | |
const double & | max () const |
Get maximum of value interval. | |
const double & | min () const |
Get minimum of value interval. | |
double | mid () const |
Get middle point of value interval. | |
space_t | padding () const |
Get element padding amount. | |
int | selected () const |
Get selected element index. | |
int | selectedX () const |
Get selected element x coordinate. | |
int | selectedY () const |
Get selected element y coordinate. | |
int | size () const |
Get total number of elements. | |
int | sizeX () const |
Get number of elements along x. | |
int | sizeY () const |
Get number of elements along y. | |
template<class V > | |
void | attachVariable (V &val, int i=0) |
Attach a single variable at a specified index. | |
Widget & | interval (const double &max, const double &min=0) |
Set interval for numerical values. | |
Widget & | padding (space_t v) |
Set element padding amount. | |
Widget & | select (int i) |
Select element at 1D index. | |
Widget & | select (int ix, int iy) |
Select element at 2D index. | |
template<class T > | |
Widget & | setValue (const T &v, int i) |
Set value at specified 1D index. | |
template<class T > | |
Widget & | setValue (const T &v, int ix, int iy) |
Set value at specified 2D index. | |
Widget & | setValueMax () |
Set all values to maximum. | |
Widget & | setValueMid () |
Set all values to middle value. | |
virtual void | onDataModelSync () |
Update internal values if different from attached model variables. | |
virtual const char * | className () const |
Get class name. | |
Protected Member Functions | |
virtual void | onDraw (GLV &g) |
Drawing callback. | |
virtual bool | onEvent (Event::t e, GLV &g) |
Event callback to be called after those in callback list. |
Base class for views having a regular grid of elements.
glv::Widget::Widget | ( | const Rect & | r, | |
space_t | pad = 3 , |
|||
bool | momentary = false , |
|||
bool | mutExc = false , |
|||
bool | drawGrid = true | |||
) |
[in] | r | geometry |
[in] | pad | padding from border |
[in] | toggles | whether the value elements toggle |
[in] | mutExc | whether value elements operate mutually exclusively |
[in] | drawGrid | whether to draw grid separater for multiple elements |