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

Represents a compact gauge view for the BindCanvas framework. More...

#include <BindGaugeCompact.hpp>

Inheritance diagram for BindGaugeCompact:
BindView

Public Member Functions

 BindGaugeCompact (const char *cstr)
 Constructs a BindGaugeCompact object with a custom label.
 
 BindGaugeCompact ()
 Constructs a BindGaugeCompact object with a default label.
 
void setlabel (const char *cstr)
 Sets the label to be displayed on the gauge.
 
uint16_t getBytes (uint8_t *out) override
 Gets the bytes representing the BindGaugeCompact object for data synchronization.
 

Public Attributes

int16_t x
 The x-coordinate position of the gauge on the canvas.
 
int16_t y
 The y-coordinate position of the gauge on the canvas.
 
uint8_t cmdId = 0
 The command ID associated with the gauge. See the notes for possible cmdId values.
 
int16_t dimSize = 100
 The dimensions (size) of the gauge.
 
float value = 0
 The current value of the gauge.
 
float maxValue = 100.0f
 The maximum value that the gauge can represent.
 
uint8_t drawArc = 0
 Indicates whether to draw an arc for the gauge. 0=False, 1=True.
 
float arcGreenMaxVal = 0
 The maximum value for the green arc section.
 
float arcYellowMaxVal = 0
 The maximum value for the yellow arc section.
 
float arcRedMaxVal = 0
 The maximum value for the red arc section.
 
- Public Attributes inherited from BindView
int16_t tag
 

Detailed Description

Represents a compact gauge view for the BindCanvas framework.

BindGaugeCompact

The BindGaugeCompact class is used to create compact gauge views that can be displayed on the BindCanvas screen. These gauges provide visual feedback for values within a specified range. Users can customize the gauge appearance, label, and value range.

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.

This class inherits from BindViewAutoTag, allowing it to be managed by the BindCanvas framework. It includes functionality for setting properties such as position, dimensions, current value, maximum value, and color options. The getBytes function is used for data synchronization with BindCanvas.

Example usage:

// Create a BindGaugeCompact object with a label
BindGaugeCompact gauge("My Gauge");// Global
....
gauge.x = 50;
gauge.y = 50;
gauge.value = 75.0f;
gauge.maxValue = 100.0f;
// Bind the gauge to the canvas and display it
bind.sync(gauge);
Represents a compact gauge view for the BindCanvas framework.
Definition BindGaugeCompact.hpp:43

Constructor & Destructor Documentation

◆ BindGaugeCompact()

BindGaugeCompact::BindGaugeCompact ( const char *  cstr)

Constructs a BindGaugeCompact object with a custom label.

Parameters
cstrThe label to display on the gauge.

Member Function Documentation

◆ getBytes()

uint16_t BindGaugeCompact::getBytes ( uint8_t *  out)
inlineoverridevirtual

Gets the bytes representing the BindGaugeCompact object for data synchronization.

This function generates a byte representation of the BindGaugeCompact object, including its properties, and stores it in the provided buffer for data transmission and synchronization with the BindCanvas screen.

Parameters
outA pointer to the buffer where the byte data will be stored.
Returns
The number of bytes written to the buffer.

Reimplemented from BindView.

◆ setlabel()

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

Sets the label to be displayed on the gauge.

Parameters
cstrThe label text.

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