Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
ds_gauge_linear.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_LINEAR_H
8#define _DS_GAUGE_LINEAR_H
9
10
11#include <ds_view.h>
12#include <ds_gauge_base.h>
13#include <ds_value_base.h>
14
15
16
20class DsGaugeLinear: public DsView, public DsGaugeBase, public DsValueBase
21{
22public:
23
27 enum Style
28 {
29 STYLE_DEFAULT = 0,
30 };
31
32
34 {
35 float value;
36
37 DsColor track_color;
38 DsColor active_color;
39 };
40
41 typedef ValueInterval ValueIntervalList[8];
42
51 DsGaugeLinear(DsView* parent, const DsPoint &pos, const DsSize &size, uint32_t style = STYLE_DEFAULT);
52
60 void addValueInterval(float value, DsColor track_color, DsColor active_color);
61
62private:
63 uint32_t mStyle;
64
65 ValueIntervalList mValueIntervals;
66 size_t mValueIntervalCount;
67
68 DsRect mTrackRegion;
69
70 int32_t mCursorWidth;
71 int32_t mCursorOverhang;
72
73 DsFPoint mCursorPoints[6];
74 size_t mCursorPointCount;
75 DsColor mCursorColor;
76
77 float onValueChange(float value) override final;
78 void onSizeChange(void) override final;
79 void onPaint(DsRenderer &renderer) override final;
80};
81
82
83#endif
DsColor is a class that represents a 4 channel color (Alpha, Red, Green, Blue).
Definition ds_color.h:53
DsFPoint is a class that represents the X and Y 2D coordinates of a point as floating point numbers.
Definition ds_geometry.h:397
DsGaugeBase is a base class for all gauge views.
Definition ds_gauge_base.h:22
DsGaugeLinear is a class that implements a linear style gauge.
Definition ds_gauge_linear.h:21
Style
Linear gauge style.
Definition ds_gauge_linear.h:28
DsGaugeLinear(DsView *parent, const DsPoint &pos, const DsSize &size, uint32_t style=STYLE_DEFAULT)
Creates a DsGaugeLinear object.
void addValueInterval(float value, DsColor track_color, DsColor active_color)
Adds a color coded value interval.
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_gauge_linear.h:34