Euphoria
gui.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "io/json.h"
4 
5 
6 namespace eu::files::gui
7 {
8  enum class InterpolationType {
9  linear,
10 
11  // also called ease in
12  // start slow, end quick
14 
15  // also called ease out
16  // start fast, end slow
18 
19  // also called ease in and out
20  // start slow, end slow
22  };
23 
24 
25  struct Button;
26  struct Lrtb;
27  struct Widget;
28  struct TableLayout;
29  struct SingleRowLayout;
30  struct Layout;
31  struct LayoutContainer;
32  struct Panel;
33  struct Rgb;
34  struct ButtonState;
35  struct Skin;
36  struct File;
37 
38 
39  struct Button
40  {
41  std::string skin = "default";
42  std::string text;
43  std::string command;
44  };
45 
46  struct Lrtb
47  {
48  float left;
49  float right;
50  float top;
51  float bottom;
52  };
53 
54  struct Widget
55  {
56  // common data
57  std::string name;
58 
59  int column;
60  int row;
65 
66 
67  // implementations, only one is valid
68  std::optional<Button> button;
69  std::unique_ptr<Panel> panel;
70  };
71 
72  struct TableLayout
73  {
74  std::vector<bool> expanded_cols;
75  std::vector<bool> expanded_rows;
76  float padding;
77  };
78 
80  {
81  float padding;
82  };
83 
84  struct Layout
85  {
86  std::optional<TableLayout> table;
87  std::optional<SingleRowLayout> single_row;
88  };
89 
91  {
93  std::vector<Widget> widgets;
94  };
95 
96  struct Panel
97  {
99  };
100 
101  struct Rgb
102  {
103  float r = 1.0f;
104  float g = 1.0f;
105  float b = 1.0f;
106  };
107 
108  struct ButtonState
109  {
110  // string image;
111  float scale = 1.0f;
114  float dx;
115  float dy;
116 
119 
122 
124  float interpolate_size_time = 0.1f;
125  };
126 
127  struct Skin
128  {
129  std::string name = "default";
130  std::string font;
131  float text_size = 12.0f;
132  std::string button_image;
133 
137  };
138 
139  struct File
140  {
141  // common data
142  std::string cursor_image;
143  std::string hover_image;
144 
145  std::vector<Skin> skins;
147  };
148 
150 }
InterpolationType
Definition: gui.h:8
JSON_PARSE_FUNC(Button)
Definition: gui.cc:35
Definition: rgb.h:62
InterpolationType interpolate_color
Definition: gui.h:120
float interpolate_position_time
Definition: gui.h:118
float interpolate_color_time
Definition: gui.h:121
InterpolationType interpolate_size
Definition: gui.h:123
InterpolationType interpolate_position
Definition: gui.h:117
std::string command
Definition: gui.h:43
std::string skin
Definition: gui.h:41
std::string text
Definition: gui.h:42
std::string cursor_image
Definition: gui.h:142
std::string hover_image
Definition: gui.h:143
std::vector< Skin > skins
Definition: gui.h:145
LayoutContainer root
Definition: gui.h:146
std::vector< Widget > widgets
Definition: gui.h:93
std::optional< SingleRowLayout > single_row
Definition: gui.h:87
std::optional< TableLayout > table
Definition: gui.h:86
float bottom
Definition: gui.h:51
LayoutContainer container
Definition: gui.h:98
float text_size
Definition: gui.h:131
std::string button_image
Definition: gui.h:132
ButtonState button_idle
Definition: gui.h:134
std::string font
Definition: gui.h:130
ButtonState button_active_hot
Definition: gui.h:136
std::string name
Definition: gui.h:129
ButtonState button_hot
Definition: gui.h:135
std::vector< bool > expanded_cols
Definition: gui.h:74
std::vector< bool > expanded_rows
Definition: gui.h:75
float preferred_width
Definition: gui.h:61
std::string name
Definition: gui.h:57
std::optional< Button > button
Definition: gui.h:68
std::unique_ptr< Panel > panel
Definition: gui.h:69
float preferred_height
Definition: gui.h:62