Widget API Reference

class Label : public grvl::Component

Widget displaying static text.

XML parameters:

  • id - widget identifier

  • x - widget position on x axis in pixels

  • y - widget position on y axis in pixels

  • width - widget width in pixels

  • height - widget height in pixels

  • visible - indicates if the widget is visible (default: true)

  • text - text to display on the label (default: none)

  • font - text font (default: normal)

  • textColor - text color (default: black)

  • backgroundColor - widget background color (default: transparent)

  • frameColor - widget frame color (default: transparent)

  • alignment - horizontal alignment of the text (default: center)

Subclassed by grvl::Clock

Public Functions

const char *GetText()
Returns:

Label’s text.

class Button : public grvl::AbstractButton

Represents rectangle button.

XML parameters:

  • id - widget identifier

  • x - widget position on x axis in pixels

  • y - widget position on y axis in pixels

  • width - widget width in pixels

  • height - widget height in pixels

  • visible - indicates if the widget is visible

  • text - caption text to display on the widget (default: “”)

  • font - caption text font (default: “normal”)

  • textColor - caption text color (default: black)

  • activeTextColor - caption text color while pressed (default: textColor)

  • icoChar - single-character icon for the button (default: none)

  • icoFont - single-character icon font (default: “normal”)

  • icoColor - single-character icon color (default: textColor)

  • activeIcoColor - single-character icon color while pressed (default: textColor)

  • backgroundColor - button background color (default: transparent)

  • activeBackgroundColor - button background color while pressed (default: backgroundColor)

  • frameColor - button frame color (default: transparent)

  • text_top_offset - caption text top position offset

  • image - identifier of image content to display

  • image_x - image position on x axis in pixels (setting to -1 will center the image)

  • image_y - image position on y axis in pixels (setting to -1 will center the image)

XML events:

  • onClick - event invoked when touch is released, but only when it has not left widget boundaries since pressing and long press was not reported

  • onPress - event invoked when touch is detected within widget boundaries

  • onRelease - event invoked when touch is released within widget boundaries or when it leaves the boundaries

  • onLongPress - event invoked when the widget is pressed for longer than a second

  • onLongPressRepeat - event invoked periodically (every half a second) while the widget is being pressed

Subclassed by grvl::KeyboardKey, grvl::TextInput

class Clock : public grvl::Label

Widget displaying current time.

XML parameters:

  • id - widget identifier

  • x - widget position on x axis in pixels

  • y - widget position on y axis in pixels

  • width - widget width in pixels

  • height - widget height in pixels

  • visible - indicates if the widget is visible

  • foregroundColor - text color (default: black)

  • backgroundColor - background color (default: transparent)

  • font - text font (default: normal)

  • alignment - horizontal text alignment (default: centered)

XML events:

  • onClick - event invoked when touch is released, but only when it has not left widget boundaries since pressing

  • onPress - event invoked when touch is detected within widget boundaries

  • onRelease - event invoked when touch is released within widget boundaries or when it leaves the boundaries

class Image : public grvl::Component

Widget displaying an image.

XML parameters:

  • id - widget identifier

  • x - widget position on x axis in pixels

  • y - widget position on y axis in pixels

  • visible - indicates if the widget is visible

  • contentId - identifier of image content to display (default: none)

Remark

Width and height of a widget are deduced from image content.

class ProgressBar : public grvl::Component

Rectangle progress bar widget.

XML parameters:

  • id - widget identifier

  • x - widget position on x axis in pixels

  • y - widget position on y axis in pixels

  • width - widget width in pixels

  • height - widget height in pixels

  • visible - indicates if the widget is visible

  • progressBarColor - progress bar color (default: transparent)

  • backgroundColor - background color (default: transparent)

Subclassed by grvl::CircleProgressBar

class CircleProgressBar : public grvl::ProgressBar

Represents circular progress bar widget.

XML parameters:

  • id - widget identifier

  • x - widget position on x axis in pixels

  • y - widget position on y axis in pixels

  • width - widget width in pixels

  • height - widget height in pixels

  • visible - indicates if the widget is visible

  • startAngle - angle at which the ring starts in degrees (default: 0)

  • endAngle - angle at which the ring ends in degrees (default: 360)

  • radius - outer rim of the ring radius in pixels (default: 0)

  • thickness - ring thickness in pixels (default: 0)

  • staticGradient - indicates if static gradient method should be used instead of proportional one (default: true)

  • startColor - gradient color at the beginning of the ring in ARGB8888 format (default: transparent)

  • endColor - gradient color at the end of the ring in ARGB8888 format (default: transparent)

  • backgroundColor - ring background color

class GridView : public grvl::VerticalScrollView

Grid view widget.

This is a layout widget which organizes the screen by displaying inner widgets on a grid.

XML parameters:

  • id - widget identifier

  • x - widget position on x axis in pixels

  • y - widget position on y axis in pixels

  • width - widget width in pixels

  • height - widget height in pixels

  • visible - indicates if the widget is visible

  • scrollingEnabled - indicates if scrolling is enabled (default: false)

  • overscrollEnabled - indicates if scrolling beyond top/bottom is possible (default: false)

  • overscrollColor - overscrolled area color (default: light gray)

  • overscrollHeight - overscrolled area height in pixels (default: 50)

  • scrollIndicatorColor - scroll indicator color (default: transparent)

  • elementWidth - grid element width in pixels (default: 0)

  • elementHeight - grid element height in pixel (default: 0)

  • verticalOffset - vertical offset of grid elements (default: 0)

  • globalPanelVisible - indicates if global panel is visible (default: true)

  • backgroundColor - widget background color (default: transparent)

  • collection - collection of elements

XML events:

  • onSlideLeft - event invoked when widget is scrolled to the left

  • onSlideRight - event invoked when widget is scrolled to the right

Remark

XML node describing this widget can contain child nodes with components of type:

  • gridRow

  • panel (as a header)

Public Functions

virtual void SetBackgroundColor(uint32_t color)

Sets component’s background color.

Parameters:
uint32_t color

Desired color in ARGB8888 format.

class GridRow : public grvl::Container

Widget representing single row of a grid displayed by GridRow. The widget can contain buttons only.

class CustomView : public grvl::AbstractView

Represents a screen type supporting any element placement except for listItems and gridRows.

class ListView : public grvl::VerticalScrollView

Vertical list view widget.

XML parameters:

  • id - widget identifier

  • x - widget position on x axis in pixels

  • y - widget position on y axis in pixels

  • width - widget width in pixels

  • height - widget height in pixels

  • visible - indicates if the widget is visible

  • overscrollEnabled - indicates if scrolling beyond top/bottom is possible (default: false)

  • overscrollColor - overscrolled area color (default: light gray)

  • overscrollHeight - overscrolled area height in pixels (default: 50)

  • scrollIndicatorColor - scroll indicator color (default: transparent)

  • splitLineColor - color of the line drawn between list elements (default: transparent)

  • globalPanelVisible - indicates if global panel is visible (default: true)

  • backgroundColor - widget background color (default: transparent)

  • collection - collection of elements

XML events:

  • onSlideLeft - event invoked when widget is scrolled to the left

  • onSlideRight - event invoked when widget is scrolled to the right

Remark

XML node describing this widget can contain child nodes with components of type:

  • listItem

  • panel (as a header)

class ListItem : public grvl::AbstractButton

Widget representing an element of a list displayed by ListView.

XML events:

  • id - widget identifier

  • height - widget height in pixels

  • visible - indicates if the widget is visible

  • type - list item type; available values: StdListField, LeftArrowListField, RightArrowListField, EmptyField, Dots, DoubleImageField

  • text - caption text (default: none)

  • description - description text (default: none)

  • font - caption text font (default: “normal”)

  • descriptionFont - description text font (default: “small”)

  • textColor - caption text color (default: black)

  • activeTextColor - caption text color when pressed (default: textColor)

  • descriptionColor - description text color (default: black)

  • activeDescriptionColor - description text color when pressed (default: descriptionColor)

  • backgroundColor - background color (default: transparent)

  • activeBackgroundColor - background color when pressed (default: backgroundColor)

  • image - image content identifier

  • additionalImage - second image content identifier

Public Functions

void SetType(ItemType type)

Sets type of the list item.

Parameters:
ItemType type

New list item’s type.

Image *GetAdditionalImagePointer()
Returns:

Pointer to the second image set for this item or NULL.

class Panel : public grvl::Container

Represents panel widget.

Panel is a fixed top part of a screen that displays widgets that should be always visible.

XML parameters:

  • id - identifier of a widget

  • height - widget height in pixels (default: 30)

  • backgroundColor - background color (default: transparent)

Remark

XML node describing this widget can contain child nodes with components of type:

  • guiClock

  • image

  • textView

  • button

  • switch

  • scrollBar

  • listItem

  • progressBar

class SwitchButton : public grvl::AbstractButton

Represents switch (flip-flop) button.

XML parameters:

  • id - widget identifier

  • x - widget position on x axis in pixels

  • y - widget position on y axis in pixels

  • width - widget width in pixels

  • height - widget height in pixels

  • visible - indicates if the widget is visible

XML events:

  • onClick - event invoked when touch is released, but only when it has not left the boundaries of widget since pressing and long press was not reported

  • onPress - event invoked when touch is detected in the boundaries of the widget

  • onRelease - event invoked when touch is released in the boundaries of the widget

  • onLongPress - event invoked when the widget is pressed for longer than a second

  • onLongPressRepeat - event invoked periodically (every half a second) while the widget is being pressed

  • onSwitchON - event invoked when switch button is switched to ON mode

  • onSwitchOFF - event invoked when switch button is switched to OFF mode

Subclassed by grvl::Checkbox

class Slider : public grvl::Component

Horizontal scroll bar widget.

XML parameters:

  • id - widget identifier

  • x - widget position on x axis in pixels

  • y - widget position on y axis in pixels

  • width - widget width in pixels

  • height - widget height in pixels

  • visible - indicates if the widget is visible (default: true)

  • backgroundColor - background color (default: transparent)

  • activeBackgroundColor - background color when pressed (default: backgroundColor)

  • frameColor - frame color (default: transparent)

  • selectedFrameColor - frame color when pressed (default: frameColor)

  • barColor - scroll bar background color (default: white)

  • activeBarColor - scroll bar background color when pressed (default: barColor)

  • scrollColor - scrolling element color (default: blue)

  • activeScrollColor - scrolling element color when pressed (default: scrollColor)

  • minValue - minimal value (the one on the left) (default: 0)

  • maxValue - maximal value (the one on the right) (default: 100)

  • image - identifier of image content replacing standard scrolling element

XML events:

  • onClick - event invoked when touch is released, but only when it has not left the boundaries of widget since pressing

  • onPress - event invoked when touch is detected in the boundaries of the widget

  • onRelease - event invoked when touch is released

  • onValueChange - event invoked when the scrolling element is moved to another value

Public Functions

float GetValue() const
Returns:

Scroll bar’s current position.


Last update: 2026-01-26