|
FabGL2 2.0.0
Graphics, audio, GUI and retro-computing library for the ESP32 (ESP-IDF)
|
A grid of cells for step sequencers: one row for each instrument (or note), one column for each step. More...
#include <fabui.h>

Public Member Functions | |
| uiStepGrid (uiWindow *parent, const Point &pos, const Size &size, int rows, int columns, bool visible=true, uint32_t styleClassID=0) | |
| Creates an instance of the object. | |
| int | activeColumns () |
| Gets the number of active columns. | |
| 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. | |
| int | cell (int row, int column) |
| Gets the value of a cell. | |
| Rect | cellRect (int row, int column) |
| Gets the area of a cell, in client coordinates. | |
| 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. | |
| int | columns () |
| Gets the number of columns. | |
| 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. | |
| uiWindow * | lastChild () |
| Gets last child. | |
| uiWindow * | next () |
| Gets next sibling. | |
| uiObjectType & | objectType () |
| Determines the object type. | |
| uiWindow * | parent () |
| Determines the parent window. | |
| RGB888 | parentBackgroundColor () |
| Determines the background color behind this window. | |
| uiWindow * | parentFrame () |
| Determines the parent frame. | |
| int | playhead () |
| Gets the playing column, -1 = none. | |
| Point | pos () |
| Determines the window position relative to parent window. | |
| 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. | |
| bool | rowMuted (int row) |
| Determines whether a row is muted. | |
| int | rows () |
| Gets the number of rows. | |
| int | selectedRow () |
| Gets the selected row, -1 = none. | |
| void | selectRow (int row) |
| Selects a row (its label is highlighted). | |
| void | setActiveColumns (int value) |
| Sets the number of active columns: the following cells are painted as disabled and can't be changed. | |
| void | setCell (int row, int column, int value, bool repaint=true) |
| Sets the value of a cell. This method does not call onCellChange. | |
| void | setFocusIndex (int value) |
| Sets the focus index (aka tab-index). | |
| void | setParentProcessKbdEvents (bool value) |
| Enables a child window to send keyboard events to its parent. | |
| void | setPlayhead (int column) |
| Sets the playing column (highlighted). Only the old and the new columns are repainted. | |
| void | setRowActive (int row, bool value) |
| Shows the activity of a row (a mark in its label). | |
| void | setRowLabel (int row, char const *text) |
| Sets the label of a row. | |
| void | setRowMuted (int row, bool value) |
| Mutes a row (its label is painted with uiStepGridStyle.mutedLabelColor and a mark). | |
| void | setStyleClassID (uint16_t value) |
| Sets style class for this UI element. | |
| Size | size () |
| Determines the window size. | |
| uiWindowState | state () |
| Determines the window state. | |
| uiStepGridProps & | stepGridProps () |
| Sets or gets step grid properties. | |
| uiStepGridStyle & | stepGridStyle () |
| Sets or gets step grid style. | |
| uint16_t | styleClassID () |
| Determines current style class for this UI element. | |
| 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< int, int > | onCellChange |
| Cell changed event delegate. | |
| Delegate< int, int > | onLabelClick |
| Label click event delegate. | |
A grid of cells for step sequencers: one row for each instrument (or note), one column for each step.
Every cell has a value from 0 (empty) to uiStepGridProps.levels - 1 (for example the velocity), shown with uiStepGridStyle.cellColors. The grid can show the playing column (setPlayhead()), the selected row, the muted rows, the row activity (setRowActive()) and the active columns (setActiveColumns(): for example the pattern length).
Mouse: a click on an empty cell sets uiStepGridProps.clickValue, a click on a full cell empties it, and dragging applies the same change to the other cells. The right button and the wheel change the value of a full cell (1..levels-1). Clicking a row label calls onLabelClick (left button = select, right button = mute, for example). Keyboard (when focused): arrows move the cursor, SPACE toggles the cell, +/- change the value.
Example:
auto grid = new uiStepGrid(frame, Point(10, 10), Size(600, 200), 8, 16);
grid->setRowLabel(0, "KICK");
grid->onCellChange = [&](int row, int column) { pattern.set(column, row, grid->cell(row, column)); };