~aleteoryx/muditaos

muditaos/module-gui/gui/widgets/Style.hpp -rw-r--r-- 15.8 KiB
a405cad6Aleteoryx trim readme 6 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md

#pragma once

#include "screen.hpp"
#include <limits>
#include <gui/core/Color.hpp>
#include <gui/Common.hpp>
#include <Alignment.hpp>
#include <Margins.hpp>

namespace gui
{
    class Rect;
    class Label;
}; // namespace gui

/// one place to gather all common magical numbers from design
namespace style
{
    inline constexpr auto window_height = getScreenResolutionY();
    inline constexpr auto window_width  = getScreenResolutionX();

    namespace status_bar
    {
        inline constexpr auto default_horizontal_pos  = 20U;
        inline constexpr auto default_vertical_pos    = 0U;
        inline constexpr unsigned status_bar_margin_w = default_horizontal_pos * 2;
        inline constexpr auto width                   = window_width - status_bar_margin_w;
        inline constexpr auto height                  = 46U;
    } // namespace status_bar

    namespace header
    {
        inline constexpr auto default_horizontal_pos = 0U;
        inline constexpr auto default_vertical_pos   = status_bar::height;
        inline constexpr auto width                  = window_width;
        inline constexpr auto height                 = 59U;

        namespace font
        {
            inline constexpr auto title = "bigbold";
        } // namespace font
    }     // namespace header

    namespace window
    {
        inline constexpr auto default_vertical_pos = header::default_vertical_pos + header::height;
        inline constexpr auto default_left_margin  = 20U;
        inline constexpr auto default_right_margin = 20U;
        inline constexpr auto default_body_width =
            style::window_width - style::window::default_right_margin - style::window::default_left_margin;
        inline constexpr auto default_body_height          = 441U;
        inline constexpr auto default_border_focus_w       = 2U;
        inline constexpr auto default_border_rect_no_focus = 1U;
        inline constexpr auto default_border_no_focus_w    = 0U;
        inline constexpr auto default_rect_yaps            = 10U;
        namespace font
        {
            /// numeric
            /// 220 px (regular)
            inline constexpr auto gargantuan       = "gargantuan";
            /// numeric
            /// 200 px (light)
            inline constexpr auto colossal         = "colossal";
            /// numeric
            /// 170 px (regular)
            inline constexpr auto huge             = "huge";
            /// alpha-numeric (with special characters)
            /// 90 px (regular)
            inline constexpr auto supersizeme      = "supersizeme";
            /// alpha-numeric (with special characters)
            /// 90 px (light)
            inline constexpr auto supersizemelight = "supersizemelight";
            /// alpha-numeric (with special characters)
            /// 46 px (light)
            inline constexpr auto largelight       = "largelight";
            /// alpha-numeric (with special characters)
            /// 46 px (regular)
            inline constexpr auto large            = "large";
            /// alpha-numeric (without special characters)
            /// 40 px (light)
            inline constexpr auto veryverybiglight = "veryverybiglight";
            /// alpha-numeric (with special characters)
            /// 38 px (light)
            inline constexpr auto verybiglight     = "verybiglight";
            /// alpha-numeric (with special characters)
            /// 38 px (regular)
            inline constexpr auto verybig          = "verybig";
            /// alpha-numeric (with special characters)
            /// 38 px (bold)
            inline constexpr auto verybigbold      = "verybigbold";
            /// alpha-numeric (with special characters)
            /// 32 px (light)
            inline constexpr auto mediumbiglight = "mediumbiglight";
            /// alpha-numeric (with special characters)
            /// 32 px (regular)
            inline constexpr auto mediumbig = "mediumbig";
            /// alpha-numeric (with special characters)
            /// 32 px (bold)
            inline constexpr auto mediumbigbold    = "mediumbigbold";
            /// alpha-numeric (with special characters)
            /// 30 px (bold)
            inline constexpr auto bigbold          = "bigbold";
            /// alpha-numeric (with special characters)
            /// 30 px (regular)
            inline constexpr auto big              = "big";
            /// alpha-numeric (with special characters)
            /// 30 px (light)
            inline constexpr auto biglight         = "biglight";
            /// alpha-numeric (with special characters)
            /// 27 px (bold)
            inline constexpr auto mediumbold       = "mediumbold";
            /// alpha-numeric (with special characters)
            /// 27 px (regular)
            inline constexpr auto medium           = "medium";
            /// alpha-numeric (with special characters)
            /// 27 px (light)
            inline constexpr auto mediumlight      = "mediumlight";
            /// alpha-numeric (with special characters)
            /// 24 px (bold)
            inline constexpr auto smallbold        = "smallbold";
            /// alpha-numeric (with special characters)
            /// 24 px (regular)
            inline constexpr auto small            = "small";
            /// alpha-numeric (with special characters)
            /// 20 px (bold)
            inline constexpr auto verysmallbold    = "verysmallbold";
            /// alpha-numeric (with special characters)
            /// 20 px (regular)
            inline constexpr auto verysmall        = "verysmall";
        }; // namespace font

        inline constexpr auto list_offset_default = 12U;
        namespace label
        {
            inline constexpr auto small_h   = 33U;
            inline constexpr auto default_h = 50U;
            inline constexpr auto big_h     = 55U;
        }; // namespace label

        /// minimal label decoration - edges, focus & alignment
        void decorate(gui::Rect *el);
        void decorate(gui::Label *el);
        /// minimal label decoration for Option
        void decorateOption(gui::Label *el);

        namespace progressBar
        {
            inline constexpr auto x     = style::window::default_left_margin;
            inline constexpr auto y     = 400U;
            inline constexpr auto w     = style::window::default_body_width;
            inline constexpr auto h     = 50U;
            inline constexpr auto range = 10U;
        }; // namespace progressBar
    };     // namespace window

    namespace nav_bar
    {
        inline constexpr auto default_horizontal_pos = 0U;
        inline constexpr auto default_vertical_pos   = window::default_vertical_pos + window::default_body_width;
        inline constexpr auto width                  = window_width;
        inline constexpr auto height                 = 54U;

        inline constexpr auto bottom_padding = 16U;
        inline constexpr auto left_margin    = 30U;
        inline constexpr auto right_margin   = 30U;
    } // namespace nav_bar

    namespace settings
    {
        namespace date
        {
            inline constexpr auto date_time_item_height       = 107U;
            inline constexpr auto date_time_item_width        = 120U;
            inline constexpr auto date_time_item_title_height = 30U;
            inline constexpr auto date_time_spacer_width      = 20U;
            inline constexpr auto date_time_x_offset          = 30U;

            inline constexpr auto date_time_box_h = 107U;
            inline constexpr auto date_box_y_pos  = 123U;
            inline constexpr auto time_box_y_pos  = 285U;

        } // namespace date
        namespace ussd
        {
            inline constexpr auto commonXPos = 40U;
            inline constexpr auto commonYPos = 110U;

            inline constexpr auto commonW      = 420U;
            inline constexpr auto commonLabelH = 33U;
            inline constexpr auto commonTextH  = 99U;
        } // namespace ussd
    }     // namespace settings
    namespace color
    {
        inline constexpr auto lightgrey = gui::Color(3, 0);
    }; //  namespace color
    namespace text
    {
        inline constexpr auto defaultTextAlignment =
            gui::Alignment(gui::Alignment::Horizontal::Left, gui::Alignment::Vertical::Bottom);
        inline constexpr auto maxTextLines = 10;
    }; // namespace text

    namespace strings
    {
        namespace common
        {
            inline constexpr auto add            = "common_add";
            inline constexpr auto open           = "common_open";
            inline constexpr auto call           = "common_call";
            inline constexpr auto send           = "common_send";
            inline constexpr auto reply          = "common_reply";
            inline constexpr auto save           = "common_save";
            inline constexpr auto edit           = "common_edit";
            inline constexpr auto import         = "common_import";
            inline constexpr auto confirm        = "common_confirm";
            inline constexpr auto select         = "common_select";
            inline constexpr auto use            = "common_use";
            inline constexpr auto ok             = "common_ok";
            inline constexpr auto back           = "common_back";
            inline constexpr auto skip           = "common_skip";
            inline constexpr auto contacts       = "common_contacts";
            inline constexpr auto set            = "common_set";
            inline constexpr auto show           = "common_show";
            inline constexpr auto yes            = "common_yes";
            inline constexpr auto no             = "common_no";
            inline constexpr auto check          = "common_check";
            inline constexpr auto Switch         = "common_switch";
            inline constexpr auto options        = "common_options";
            inline constexpr auto information    = "common_information";
            inline constexpr auto search         = "common_search";
            inline constexpr auto search_results = "common_search_results";
            inline constexpr auto emoji          = "common_emoji";
            inline constexpr auto special_chars  = "common_special_characters";
            inline constexpr auto start          = "common_start";
            inline constexpr auto stop           = "common_stop";
            inline constexpr auto resume         = "common_resume";
            inline constexpr auto pause          = "common_pause";
            inline constexpr auto play           = "common_play";
            inline constexpr auto accept         = "common_accept";
            inline constexpr auto retry          = "common_retry";
            inline constexpr auto replace        = "common_replace";
            inline constexpr auto abort          = "common_abort";
            inline constexpr auto adjust         = "common_adjust";
            // days
            inline constexpr auto Monday    = "common_monday";
            inline constexpr auto Tuesday   = "common_tuesday";
            inline constexpr auto Wednesday = "common_wednesday";
            inline constexpr auto Thursday  = "common_thursday";
            inline constexpr auto Friday    = "common_friday";
            inline constexpr auto Saturday  = "common_saturday";
            inline constexpr auto Sunday    = "common_sunday";
            // months
            inline constexpr auto January   = "common_january";
            inline constexpr auto February  = "common_february";
            inline constexpr auto March     = "common_march";
            inline constexpr auto April     = "common_april";
            inline constexpr auto May       = "common_may";
            inline constexpr auto June      = "common_june";
            inline constexpr auto July      = "common_july";
            inline constexpr auto August    = "common_august";
            inline constexpr auto September = "common_september";
            inline constexpr auto October   = "common_october";
            inline constexpr auto November  = "common_november";
            inline constexpr auto December  = "common_december";
            inline constexpr auto Yesterday = "common_yesterday";
            inline constexpr auto Today     = "common_today";
        } // namespace common
    }     // namespace strings

    namespace listview
    {
        namespace scroll
        {
            inline constexpr auto x           = 0U;
            inline constexpr auto y           = 0U;
            inline constexpr auto w           = 5U;
            inline constexpr auto h           = 0U;
            inline constexpr auto radius      = 2U;
            inline constexpr auto color       = gui::Color{0, 0};
            inline constexpr auto margin      = 5U;
            inline constexpr auto min_space   = 10U;
            inline constexpr auto item_margin = 10U;
        } // namespace scroll

        inline constexpr auto item_width_with_scroll =
            style::window::default_body_width - style::listview::scroll::item_margin;
        inline constexpr auto item_width_with_without_scroll =
            style::window::default_body_width - 2 * style::listview::scroll::item_margin;
        inline constexpr auto body_width_with_scroll =
            style::window::default_body_width + style::listview::scroll::margin;

    } // namespace listview

    namespace sidelistview
    {
        namespace list_item
        {
            inline constexpr auto w = window_width;
            inline constexpr auto h = window_height;
        } // namespace list_item

        namespace progress_bar
        {
            inline constexpr auto margin_left   = 0U;
            inline constexpr auto margin_top    = 10U;
            inline constexpr auto margin_right  = 0U;
            inline constexpr auto margin_bottom = 10U;
            inline constexpr auto h             = 50U;
        } // namespace progress_bar

    } // namespace sidelistview

    namespace margins
    {
        inline constexpr auto very_small = 3U;
        inline constexpr auto small      = 6U;
        inline constexpr auto big        = 8U;
        inline constexpr auto very_big   = 12U;
        inline constexpr auto large      = 20U;
        inline constexpr auto huge       = 24U;
    } // namespace margins

    namespace padding
    {
        inline constexpr auto default_left_text_padding = 10U;
    } // namespace padding

    namespace widgets
    {
        inline constexpr auto h           = 55U;
        inline constexpr auto iconsSize   = h;
        inline constexpr auto leftMargin  = 10U;
        inline constexpr auto rightMargin = 10U;
    } // namespace widgets

    namespace notifications
    {
        inline constexpr auto spanSize     = 8;
        inline constexpr auto iconWidth    = 35;
        inline constexpr auto textMinWidth = 250;
        inline constexpr auto textMaxWidth = 350;
        inline constexpr auto itemHeight   = 55;

        namespace model
        {
            inline constexpr auto maxNotificationsPerPage = 4;
            inline constexpr auto x                       = 20;
            inline constexpr auto y                       = 284;
            inline constexpr auto w                       = style::window::default_body_width;
            inline constexpr auto h                       = itemHeight * maxNotificationsPerPage;
        } // namespace model
    }     // namespace notifications

    namespace wallpaper
    {
        namespace wallpaperBox
        {
            inline constexpr auto y = 110;
            inline constexpr auto h = 534;
        } // namespace wallpaperBox

        namespace notificationTiles
        {
            inline constexpr auto tileIconHeight  = 45;
            inline constexpr auto tileIconMarigin = 15;
        } // namespace notificationTiles
    }     // namespace wallpaper
} // namespace style