Vivoe Lite 0.5.0
Lightweight GVA like HMI for military displays.
Loading...
Searching...
No Matches
renderer_gva.h
Go to the documentation of this file.
1//
2// Copyright (c) 2023, DefenceX PTY LTD
3//
4// This file is part of the VivoeX project developed by DefenceX.
5//
6// Licensed under the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
7// License. See the LICENSE file in the project root for full license details.
8//
12
13#ifndef HMICORE_RENDERER_GVA_H_
14#define HMICORE_RENDERER_GVA_H_
15
16#include <memory>
17#include <string>
18#include <vector>
19
21#include "hmicore/gva.h"
23#include "hmicore/touch_gva.h"
25
26namespace gva {
27
29class RendererGva : public RendererCairo {
30 public:
37 RendererGva(uint32_t width, uint32_t height);
38
43 ~RendererGva() override = default;
44
53 void DrawLabels(char *text, uint32_t fontSize, uint32_t x, uint32_t y);
54
61 void DrawFunctionLabels(uint32_t x, const std::array<FunctionKeys::Labels, 6> &labels);
62
69 void DrawTopLabels(uint32_t y, const std::array<FunctionSelect::Labels, 8> &labels);
70
77 void DrawControlLabels(const uint32_t y, const std::array<CommonTaskKeys::Labels, 8> &labels);
78
88 void DrawIcon(widget::IconType icon, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
89
99 void DrawButton(const std::string &keytext, uint32_t fontSize, uint32_t x, uint32_t y, uint32_t size);
100
112 void DrawButton(const std::string &key_text, uint32_t font_size, uint32_t x, uint32_t y, uint32_t height,
113 uint32_t width, widget::CellAlignType align);
114
120 TouchGva *GetTouch() { return &touch_; }
121
122 private:
123 TouchGva touch_;
124
131 void SetStateLabel(LabelStates state, ConfigData *config);
132
139 void SetStateText(LabelStates state, ConfigData *config);
140 ConfigData *config_ = nullptr;
141};
142
145 public:
151 explicit WidgetBase(RendererGva &renderer) : renderer_(renderer) {}
152
163 void Draw(uint32_t x, uint32_t y, uint32_t width, uint32_t height, std::string text, uint32_t text_colour);
164
170 uint32_t GetX() const { return x_; }
171
177 uint32_t GetY() const { return y_; }
178
182 uint32_t x_;
184 uint32_t y_;
185};
186
190
191 public:
198 void Toggle(const std::string &label1, const std::string &label2);
199};
200
201} // namespace gva
202
203#endif // HMICORE_RENDERER_GVA_H_
Class defining the config data.
Definition config_reader.h:256
Class definition of the Renderer Cairo.
Definition renderer_cairo.h:82
Class definition of the GVA renderer.
Definition renderer_gva.h:29
void DrawButton(const std::string &keytext, uint32_t fontSize, uint32_t x, uint32_t y, uint32_t size)
Draw keyboard buttons.
Definition renderer_gva.cc:223
~RendererGva() override=default
Destroy the Renderer Gva object.
void DrawTopLabels(uint32_t y, const std::array< FunctionSelect::Labels, 8 > &labels)
Draw the labels on the top of the screen.
void DrawIcon(widget::IconType icon, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
Draw an icon.
Definition renderer_gva.cc:24
TouchGva * GetTouch()
Get the Touch object.
Definition renderer_gva.h:120
void DrawControlLabels(const uint32_t y, const std::array< CommonTaskKeys::Labels, 8 > &labels)
Draw the control labels on the bottom of the screen.
void DrawFunctionLabels(uint32_t x, const std::array< FunctionKeys::Labels, 6 > &labels)
Draw all the labels on the screen.
void DrawLabels(char *text, uint32_t fontSize, uint32_t x, uint32_t y)
Draw all the labels on the screen.
Class defining the touch screen events.
Definition touch_gva.h:71
Class definition of the Widget Base.
Definition renderer_gva.h:144
uint32_t GetX() const
Get the X pixel attribute.
Definition renderer_gva.h:170
uint32_t x_
The X pixel position.
Definition renderer_gva.h:182
WidgetBase(RendererGva &renderer)
Construct a new Widget Base object.
Definition renderer_gva.h:151
RendererGva & renderer_
The GVA renderer.
Definition renderer_gva.h:180
uint32_t y_
The Y pixel position.
Definition renderer_gva.h:184
uint32_t GetY() const
Get the Y pixel attribute.
Definition renderer_gva.h:177
void Draw(uint32_t x, uint32_t y, uint32_t width, uint32_t height, std::string text, uint32_t text_colour)
Class definition of the Widget Function Select.
Definition renderer_gva.h:188
void Toggle(const std::string &label1, const std::string &label2)
Set the toggle states.
LabelStates
Enum for the label states.
Definition gva.h:41
Manage the touch screen events.
CellAlignType
Table (see WidgetTable) cell alignment.
Definition widget_types.h:27
IconType
All available types of icon.
Definition widget_types.h:83