C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
widget_bargraph.h
Go to the documentation of this file.
1
11
12#pragma once
13
15#include "sw/ui_core/ui_core.h"
16#include "sw//widget/widget.h"
17
22class ModelBargraph : public Model
23{
24private:
25protected:
27 std::vector<int> values;
28
29public:
32 std::vector<int> get_values();
33
36 void update_values(std::vector<int> values);
53};
54
60{
61private:
63 uint8_t bar_spacing;
65 uint8_t bar_height;
67 uint8_t bar_width;
68
70 uint8_t px_max;
72 uint8_t px_min;
80 uint8_t convert_level_value_to_px(int level);
83 void draw_bar(uint8_t bin_index);
84
85protected:
87 std::vector<int> values;
90
91public:
93 void draw();
94
95 virtual void get_value_of_interest();
96
107 GraphicDisplayDevice *graphic_display_screen,
109 CanvasFormat format,
110 uint8_t bar_spacing = 1);
116};
117
123{
124private:
126 uint8_t py_max;
128 uint8_t py_min;
136 uint8_t convert_level_value_to_py(int level);
139 void draw_bar(uint8_t bin_index);
140
141protected:
143 std::vector<int> values;
146
147public:
149 uint8_t bar_spacing;
151 uint8_t bar_height;
153 uint8_t bar_width;
155 void draw();
156
157 virtual void get_value_of_interest();
158
166 GraphicDisplayDevice *graphic_display_screen,
168 CanvasFormat format,
169 uint8_t bar_spacing = 1);
171};
CanvasFormat
the format of the canvas
Definition canvas.h:61
This is the abstract class to handle all generic behavior of physical graphic display devices (e....
Definition display_device.h:58
GraphicWidget(GraphicDisplayDevice *graphic_display_screen, struct_ConfigGraphicWidget graph_cfg, CanvasFormat canvas_format, Model *displayed_object=nullptr)
Construct a new Graphic Widget object.
Definition widget.cpp:52
the Model used by Bargraph GraphicWidget
Definition widget_bargraph.h:23
void update_values(std::vector< int > values)
update internal values of the bargraph and set_change_flag
Definition widget_bargraph.cpp:89
size_t number_of_bar
the number of bar in the bargraph (and the number of values)
Definition widget_bargraph.h:38
~ModelBargraph()
Destroy the Model Bargraph object.
Definition widget_bargraph.cpp:105
ModelBargraph(size_t number_of_bar, int min_value, int max_value)
conctructor of ModelBargraph
Definition widget_bargraph.cpp:95
std::vector< int > values
the vector of values displayed by the bargraph
Definition widget_bargraph.h:27
std::vector< int > get_values()
get internal values of the bargraph model
Definition widget_bargraph.cpp:84
int min_value
the min value of the range of values
Definition widget_bargraph.h:40
int max_value
the max value of the range of values
Definition widget_bargraph.h:42
Model()
Construct the Model object.
Definition ui_core.cpp:3
uint8_t px_min
the computed equivalent of min level value of the bar in x-coordinate
Definition widget_bargraph.h:72
uint8_t px_max
the computed equivalent of max level value of the bar in x-coordinate
Definition widget_bargraph.h:70
uint8_t number_of_bar
number of values in the bargraph
Definition widget_bargraph.h:89
float level_coef
the computed proportional coeficient of the value to pixel converter
Definition widget_bargraph.h:74
uint8_t bar_height
the computed height of each bar, according to the widget height, the number of bar and the space betw...
Definition widget_bargraph.h:65
uint8_t convert_level_value_to_px(int level)
the value to pixel x-coordinate converter
Definition widget_bargraph.cpp:5
std::vector< int > values
the set of values for the bargraph
Definition widget_bargraph.h:87
WidgetHorizontalBargraph(ModelBargraph *bargraph_model, GraphicDisplayDevice *graphic_display_screen, struct_ConfigGraphicWidget graph_cfg, CanvasFormat format, uint8_t bar_spacing=1)
Construct a new Widget Horizontal Bargraph object.
Definition widget_bargraph.cpp:56
uint8_t bar_width
the computed bar width. Usually the widget width.
Definition widget_bargraph.h:67
int level_offset
the computed offset of the value to pixel converter
Definition widget_bargraph.h:76
virtual void get_value_of_interest()
A pure virtual method that results in the transfer of the displayed values of the displayed model to ...
Definition widget_bargraph.cpp:26
void draw()
the function that draw the widget
Definition widget_bargraph.cpp:12
void draw_bar(uint8_t bin_index)
the function that draw a bar in the widget
Definition widget_bargraph.cpp:31
uint8_t bar_spacing
the number of pixel that separates each bar (usually 1 pixel)
Definition widget_bargraph.h:63
~WidgetHorizontalBargraph()
Destroy the GraphicWidget Horizontal Bargraph object.
Definition widget_bargraph.cpp:80
uint8_t bar_width
the computed width of each bar, according to the widget width, the number of bar and the space betwee...
Definition widget_bargraph.h:153
uint8_t py_max
the computed equivalent of max level value of the bar in y-coordinate
Definition widget_bargraph.h:126
std::vector< int > values
the set of values for the bargraph
Definition widget_bargraph.h:143
int level_offset
the computed offset of the value to pixel converter
Definition widget_bargraph.h:132
uint8_t py_min
the computed equivalent of min level value of the bar in y-coordinate
Definition widget_bargraph.h:128
void draw_bar(uint8_t bin_index)
the function that draw a bar in the widget
Definition widget_bargraph.cpp:135
float level_coef
the computed proportional coeficient of the value to pixel converter
Definition widget_bargraph.h:130
uint8_t bar_height
the computed bar height. Usually the widget height.
Definition widget_bargraph.h:151
WidgetVerticalBargraph(ModelBargraph *bargraph_model, GraphicDisplayDevice *graphic_display_screen, struct_ConfigGraphicWidget graph_cfg, CanvasFormat format, uint8_t bar_spacing=1)
Construct a new GraphicWidget Vertical Bargraph object.
Definition widget_bargraph.cpp:161
uint8_t bar_spacing
the number of pixel that separates each bar (usually 1 pixel)
Definition widget_bargraph.h:149
void draw()
the function that draw the widget
Definition widget_bargraph.cpp:116
uint8_t convert_level_value_to_py(int level)
the value to pixel y-coordinate converter
Definition widget_bargraph.cpp:109
virtual void get_value_of_interest()
A pure virtual method that results in the transfer of the displayed values of the displayed model to ...
Definition widget_bargraph.cpp:130
uint8_t number_of_bar
number of values in the bargraph
Definition widget_bargraph.h:145
data structure used to configure graphic framebuffer
Definition canvas.h:81