Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
ds_gauge_battery.h
1/* Copyright (C) 2017 - 2024, Thornwave Labs Inc - All Rights Reserved.
2 * Unauthorized copying of this file, via any medium is strictly prohibited.
3 * Proprietary and confidential.
4 * Written by Razvan Turiac <razvan.turiac@thornwave.com>
5*/
6
7#ifndef _DS_GAUGE_BATTERY_H
8#define _DS_GAUGE_BATTERY_H
9
10
11#include <ds_view.h>
12#include <ds_gauge_base.h>
13#include <ds_value_base.h>
14
15
19class DsGaugeBattery: public DsView, public DsGaugeBase, public DsValueBase
20{
21public:
22
27 enum Style: uint32_t
28 {
30 STYLE_AUTOMOTIVE = (1 << 0),
31 };
32
40 DsGaugeBattery(DsView* parent, const DsPoint &pos, const DsSize &size, uint32_t style = STYLE_DEFAULT);
41
42
48
49
54 DsGaugeBattery& setFillMargin(uint8_t margin);
55
56
62
63
71
72
80
81
88 DsGaugeBattery& setSecondaryFormat(const char* format);
89
90
98
99
100private:
101 uint32_t mStyle;
102 uint16_t mCornerRadius;
103 uint8_t mFillMargin;
104 DsSize mTerminalSize;
105
106 DsColor mSecondaryTextColor;
107 const ds_bitmap_font_t* mSecondaryTextFont;
108 const char* mSecondaryFormat;
109 DsRect mSecondaryValueRegion;
110 float mSecondaryValue;
111
112 DsRect mPositiveRegion;
113 DsRect mNegativeRegion;
114 DsRect mBodyRegion;
115 DsRect mFillerRegion;
116
117 float onValueChange(float value) override final;
118 void onSizeChange(void) override final;
119 void onPaint(DsRenderer &renderer) override final;
120};
121
122
123#endif
DsColor is a class that represents a 4 channel color (Alpha, Red, Green, Blue).
Definition ds_color.h:53
DsGaugeBase is a base class for all gauge views.
Definition ds_gauge_base.h:22
DsGaugeBattery is a class that implements a battery style gauge.
Definition ds_gauge_battery.h:20
DsGaugeBattery(DsView *parent, const DsPoint &pos, const DsSize &size, uint32_t style=STYLE_DEFAULT)
Creates a DsGaugeBattery object.
DsGaugeBattery & setSecondaryFormat(const char *format)
Sets the printf() style format string used to print the secondary value.
DsGaugeBattery & setSecondaryTextFont(const ds_bitmap_font_t *font)
Sets the font used to render the secondary value.
DsGaugeBattery & setSecondaryValue(float value)
Sets the secondary value.
DsGaugeBattery & setSecondaryTextColor(DsColor color)
Sets the secondary value text color.
DsGaugeBattery & setCornerRadius(uint16_t radius)
Sets the corner radius.
DsGaugeBattery & setTerminalSize(const DsSize &size)
Sets the size of the battery terminal.
Style
Battery gauge style.
Definition ds_gauge_battery.h:28
@ STYLE_DEFAULT
Default battery gauge style.
Definition ds_gauge_battery.h:29
@ STYLE_AUTOMOTIVE
Automotive battery style.
Definition ds_gauge_battery.h:30
DsGaugeBattery & setFillMargin(uint8_t margin)
Sets the battery fill area margin.
DsPoint is a class that represents the X and Y 2D coordinates of a point as integer numbers.
Definition ds_geometry.h:24
DsRect is a class that represents a 2D rectangle (X, Y, W, H)
Definition ds_geometry.h:1507
DsRenderer is a class that implements all the drawing operations.
Definition ds_renderer.h:42
DsSize is class that represents the 2D size of a graphic object (width, height) as integer values.
Definition ds_geometry.h:780
DsValueBase is a base class that contains a float value.
Definition ds_value_base.h:19
DsView is a base class that represents any view on the screen.
Definition ds_view.h:40
Definition ds_font.h:45