Bind
C++ UI toolkit for Arduino
 
Loading...
Searching...
No Matches
BindGauge Class Reference

The BindGauge class represents a gauge UI element for use with BindCanvas. More...

#include <BindGauge.hpp>

Inheritance diagram for BindGauge:
BindView

Public Member Functions

 BindGauge (const char *cstr)
 Constructs a BindGauge with a custom label.
 
 BindGauge ()
 Constructs a BindGauge with a default label.
 
void setlabel (const char *cstr)
 Sets the label text for the gauge.
 
uint16_t getBytes (uint8_t *out) override
 Serializes gauge properties into a byte array for synchronization.
 

Public Attributes

int16_t x
 X-coordinate position of the gauge.
 
int16_t y
 Y-coordinate position of the gauge.
 
uint8_t cmdId = 0
 Command ID for the gauge. See the notes for possible cmdId values.
 
int16_t dimSize = 100
 Size of the gauge (Width = height)
 
float value = 0
 Current value of the gauge.
 
float maxValue = 100.0f
 Maximum value of the gauge.
 
uint8_t drawArc = 0
 Indicates whether to draw the gauge arc.
 
float arcGreenMaxVal = 0
 Maximum value for the green arc section.
 
float arcYellowMaxVal = 0
 Maximum value for the yellow arc section.
 
float arcRedMaxVal = 0
 Maximum value for the red arc section.
 
- Public Attributes inherited from BindView
int16_t tag
 

Detailed Description

The BindGauge class represents a gauge UI element for use with BindCanvas.

BindGauge

BindGauge is a class that defines a gauge UI element that can be used within BindCanvas-based applications. It inherits from the BindView class and provides functionality to create and customize gauges, including setting positions, dimensions, value ranges, and appearance.

Note
Possible cmdId values for a BindView and corresponding effects:
  • BIND_ADD_OR_REFRESH_CMD: Adds the object to the canvas (screen) or refreshes the existing one.
  • BIND_DATA_ONLY_CMD: Refreshes the existing object without moving or resizing; updates data, such as text.
  • BIND_REMOVE_CMD: Removes the object from the canvas (screen).
  • BIND_DISABLE_CMD: Disables the object.
  • BIND_ENABLE_CMD: Enables the object.
  • BIND_HIDE_CMD: Hides the object.
  • BIND_VISIBLE_CMD: Restores the object's visibility.

Gauges created with BindGauge can be synchronized with BindCanvas through the Bind framework, allowing real-time updates of gauge values and visual styles in various applications.

Note
To use BindGauge effectively, you can set various properties such as position, dimensions, value range, appearance, and label.

Constructor & Destructor Documentation

◆ BindGauge() [1/2]

BindGauge::BindGauge ( const char *  cstr)

Constructs a BindGauge with a custom label.

This constructor creates a BindGauge with a custom label provided as 'cstr.' The label can be used to define the text content of the gauge.

Parameters
cstrA pointer to the character array representing the custom label for the gauge.

◆ BindGauge() [2/2]

BindGauge::BindGauge ( )
inline

Constructs a BindGauge with a default label.

This constructor creates a BindGauge with a default label of "Gauge." You can customize the label later using the 'setLabel' function.

Member Function Documentation

◆ getBytes()

uint16_t BindGauge::getBytes ( uint8_t *  out)
inlineoverridevirtual

Serializes gauge properties into a byte array for synchronization.

The 'getBytes' function serializes the properties of the BindGauge object into a byte array, which is used internally by the Bind framework for synchronization with BindCanvas. This function should not be called directly by users.

Parameters
outA pointer to the byte array where serialized data is stored.
Returns
The offset within the byte array where serialization ends.

Reimplemented from BindView.

◆ setlabel()

void BindGauge::setlabel ( const char *  cstr)
inline

Sets the label text for the gauge.

This function allows you to set the label text for the gauge UI element, providing additional context or description for the gauge.

Parameters
cstrA pointer to the character array representing the label text.

The documentation for this class was generated from the following files: