|
FabGL2 2.0.0
Graphics, audio, GUI and retro-computing library for the ESP32 (ESP-IDF)
|
A momentary button that reacts when pressed, like the pads and the buttons of the drum machines. More...
#include <fabui.h>

Public Member Functions | |
| uiPad (uiWindow *parent, char const *text, const Point &pos, const Size &size, bool visible=true, uint32_t styleClassID=0) | |
| Creates an instance of the object. | |
| uiAnchors & | anchors () |
| Allows to switch on or off anchors. | |
| uiApp * | app () |
| Determines the app that owns this object. | |
| void | bringAfter (uiWindow *insertionPoint) |
| Brings this window after another one. | |
| void | bringOnTop () |
| Brings this window on top. | |
| Point | clientPos () |
| Determines position of the client area. | |
| virtual Rect | clientRect (uiOrigin origin) |
| Determines the client area bounding box. | |
| Size | clientSize () |
| Determines the client area size. | |
| void | exitModal (int modalResult) |
| Exits from a modal window. | |
| uiWindow * | firstChild () |
| Gets first child. | |
| int | focusIndex () |
| Determines the focus index (aka tab-index). | |
| bool | hasChildren () |
| Determines whether this window has children. | |
| bool | hasFocus () |
| Determines whether this window or control has focus. | |
| bool | isActiveWindow () |
| Determines whether this window is the active one. | |
| bool | isMouseOver () |
| Determines whether the mouse is over this window. | |
| char const * | keyLabel () |
| Gets the key label. | |
| uiWindow * | lastChild () |
| Gets last child. | |
| bool | led () |
| Gets the led state. | |
| bool | lit () |
| Determines whether the pad is lit. | |
| uiWindow * | next () |
| Gets next sibling. | |
| uiObjectType & | objectType () |
| Determines the object type. | |
| uiPadProps & | padProps () |
| Sets or gets pad properties. | |
| uiPadStyle & | padStyle () |
| Sets or gets pad style. | |
| uiWindow * | parent () |
| Determines the parent window. | |
| RGB888 | parentBackgroundColor () |
| Determines the background color behind this window. | |
| uiWindow * | parentFrame () |
| Determines the parent frame. | |
| Point | pos () |
| Determines the window position relative to parent window. | |
| bool | pressed () |
| Determines whether the pad is pressed. | |
| uiWindow * | prev () |
| Gets previous sibling. | |
| Rect | rect (uiOrigin origin) |
| Determines the window bounding box. | |
| void | repaint () |
| Repaints this window. | |
| void | repaint (Rect const &rect) |
| Repaints a rectangle of this window. | |
| void | setFocusIndex (int value) |
| Sets the focus index (aka tab-index). | |
| void | setKeyLabel (char const *value) |
| Sets the key label: a small text that shows the keyboard shortcut of the pad (for example "F1"). | |
| void | setLed (bool value) |
| Switches the led on or off. The pad is repainted only when the state changes. | |
| void | setLit (bool value) |
| Lights the pad (uiPadStyle.litPadColor). The pad is repainted only when the state changes. | |
| void | setParentProcessKbdEvents (bool value) |
| Enables a child window to send keyboard events to its parent. | |
| void | setStyleClassID (uint16_t value) |
| Sets style class for this UI element. | |
| void | setText (char const *value) |
| Sets the text. | |
| Size | size () |
| Determines the window size. | |
| uiWindowState | state () |
| Determines the window state. | |
| uint16_t | styleClassID () |
| Determines current style class for this UI element. | |
| char const * | text () |
| Gets the text. | |
| Rect | transformRect (Rect const &rect, uiWindow *baseWindow) |
| Transforms rectangle origins from current window to another one. | |
| uiWindowProps & | windowProps () |
| Sets or gets window properties. | |
| uiWindowStyle & | windowStyle () |
| Sets or gets window style. | |
Public Attributes | |
| Delegate | onPress |
| Press event delegate. | |
| Delegate | onRelease |
| Release event delegate. | |
A momentary button that reacts when pressed, like the pads and the buttons of the drum machines.
Unlike uiButton (that fires onClick on release), onPress is called on the mouse button down (or SPACE/ENTER when focused), onRelease when released. The pad can be lit by the application (for example to show the activity of an instrument) and can have a led. The text can have more lines, separated by "\n". A small key label (setKeyLabel()) shows the keyboard shortcut of the pad.
Example:
auto pad = new uiPad(frame, "SNARE", Point(10, 30), Size(48, 32));
pad->onPress = [&]() { drums.trigger(1); };