Skip to content
Aleksandr edited this page May 22, 2019 · 2 revisions

Property based widget resource management

Every widget in PhWidgets library has its own or inherited 'properties'. Each 'property' is in fact a class member that basically has operator= and get/set class member functions to manipulate widget resources.

Under the hood each call to said property class member functions results in some way to the call to standard Photon microGUI functions like PtSetArg() or PtGetResources() that access the widget resources directly.

Example (switch widgets cursor types)

// You have somewhere:
PtWidget_t *ptwidget; // pointer to widget

// constructing wrapper for Photon microGUI widget pointer
PhWidgets::Widget widget(ptwidget);

// manipulating PhWidget::Widget::Cursor property
if(widget.Cursor == PhWidgets::Cursors::Inherit)
    widget.Cursor = PhWidgets::Cursors::Finger;
else if(Cursors::Finger == widget.Cursor)
    widget.Cursor = PhWidgets::Cursors::Inherit;