Vivoe Lite 0.5.0
Lightweight GVA like HMI for military displays.
Loading...
Searching...
No Matches
view_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_VIEW_GVA_H_
14#define HMICORE_VIEW_GVA_H_
15#include <functional>
16#include <memory>
17#include <string>
18#include <vector>
19
21#include "hmicore/gva.h"
22#include "hmicore/screen_gva.h"
23#include "hmicore/touch_gva.h"
24
25namespace gva {
26
28struct ToggleInfo {
30 bool visible;
34 std::string right_label;
38 std::string left_label;
39};
40
43 public:
49 void Bind(std::function<int(int parentId, GvaKeyEnum key)> fn) {
50 privateCallback = std::bind(fn, std::placeholders::_1, std::placeholders::_2);
51 }
55 std::function<int(int parentId, GvaKeyEnum key)> privateCallback; // Callback
56};
57
59class ViewGva {
60 public:
71 : function_(function), function_top_(top), common_bottom_(bottom), function_left_(left), function_right_(right) {}
72
79 bool Valid() const { return valid_; }
80
85 void Release() { valid_ = false; }
86
92 FunctionSelect *GetTop() { return function_top_; }
93
99 CommonTaskKeys *GetBottom() { return common_bottom_; }
100
106 FunctionKeys *GetLeft() { return &function_left_; }
107
113 FunctionKeys *GetRight() { return &function_right_; }
114
120 GvaFunctionEnum GetFunction() const { return function_; }
121
122 private:
124 bool valid_ = true;
126 GvaFunctionEnum function_;
127 // Screen top
128 FunctionSelect *function_top_;
129 // Screen bottom
130 CommonTaskKeys *common_bottom_;
131 // Screen left
132 FunctionKeys function_left_;
134 std::array<LabelAction, 6> function_left_action_;
135 // Screen right
136 FunctionKeys function_right_;
138 std::array<LabelAction, 6> function_right_action_;
139};
140
143 public:
149
159 void AddNewView(GvaFunctionEnum function, FunctionSelect *top, CommonTaskKeys *bottom, FunctionKeys left,
160 FunctionKeys right);
161
168 void SetScreen(Screen *screen, GvaFunctionEnum function) const;
169
177
178 private:
180 std::vector<ViewGva> views_;
182 int idLast_ = 0;
184 int id_ = 0;
185};
186
187} // namespace gva
188
189#endif // HMICORE_VIEW_GVA_H_
Class definition of the CommonTaskKeys.
Definition gva.h:465
These are the labels on the left and right of the screen.
Definition gva.h:324
Class defining the view.
Definition view_gva.h:42
std::function< int(int parentId, GvaKeyEnum key)> privateCallback
Callback.
Definition view_gva.h:55
ToggleInfo toggle_
Toggle info.
Definition view_gva.h:53
void Bind(std::function< int(int parentId, GvaKeyEnum key)> fn)
Bind a key to a callback.
Definition view_gva.h:49
Class defining the view manager.
Definition view_gva.h:142
ViewGva * GetView(GvaFunctionEnum function)
Get the View attribute.
Definition view_gva.cc:39
void SetScreen(Screen *screen, GvaFunctionEnum function) const
Set the Screen attribute.
Definition view_gva.cc:27
void AddNewView(GvaFunctionEnum function, FunctionSelect *top, CommonTaskKeys *bottom, FunctionKeys left, FunctionKeys right)
Get the View Gva Manager object.
Definition view_gva.cc:21
ViewGvaManager()
Construct a new View Gva Manager object.
Definition view_gva.cc:19
Class defining the view.
Definition view_gva.h:59
CommonTaskKeys * GetBottom()
Get the Bottom attribute.
Definition view_gva.h:99
FunctionKeys * GetRight()
Get the Right attribute.
Definition view_gva.h:113
FunctionKeys * GetLeft()
Get the Left attribute.
Definition view_gva.h:106
FunctionSelect * GetTop()
Get the Top attribute.
Definition view_gva.h:92
GvaFunctionEnum GetFunction() const
Get the Function attribute.
Definition view_gva.h:120
void Release()
Release the view.
Definition view_gva.h:85
bool Valid() const
Set the view as valid.
Definition view_gva.h:79
ViewGva(GvaFunctionEnum function, FunctionSelect *top, CommonTaskKeys *bottom, FunctionKeys left, FunctionKeys right)
Construct a new View Gva object.
Definition view_gva.h:70
GvaFunctionEnum
This is where you define all your screens, these are just the defaults.
Definition gva.h:218
GvaKeyEnum
These are physical GVA keys around the display.
Definition gva.h:67
These are at the top of the screen.
Definition gva.h:386
Struct definition of the Screen.
Definition screen_gva.h:85
Structure of the toggle data.
Definition view_gva.h:28
bool left_active
Left toggle active.
Definition view_gva.h:36
std::string right_label
Right toggle label.
Definition view_gva.h:34
std::string left_label
Left toggle label.
Definition view_gva.h:38
bool right_active
Right toggle active.
Definition view_gva.h:32
bool visible
Toggle visibility.
Definition view_gva.h:30
Manage the touch screen events.