lecui 1.0.0-alpha.20
lecui C++ user interface library
time.h
1//
2// time.h - time widget interface
3//
4// lecui user interface library, part of the liblec library
5// Copyright (c) 2019 Alec Musasa (alecmus at live dot com)
6//
7// Released under the MIT license. For full details see the
8// file LICENSE.txt
9//
10
11#pragma once
12
13#if defined(LECUI_EXPORTS)
14#include "widget.h"
15#else
16#include <liblec/lecui/widgets/widget.h>
17#endif
18
19namespace liblec {
20 namespace lecui {
21 namespace widgets {
24 class lecui_api time : public widget {
25 float _border = .5f;
26 color _color_border;
27 float _corner_radius_x = 2.f;
28 float _corner_radius_y = 2.f;
29 lecui::time _time_value{};
30 void* _p_special_pane_specs = nullptr;
31
32 public:
34 time() {
35 _rect.size({ 70.f, 20.f });
36 };
37
42 std::function<void(lecui::time)> change = nullptr;
43 };
44
48 return _time_events;
49 }
50
55 bool operator==(const time& param);
56
61 bool operator!=(const time& param);
62
63 // generic widget
64
67 std::string& text() override;
68
72 time& text(const std::string& text);
73
76 std::string& tooltip() override;
77
81 time& tooltip(const std::string& tooltip);
82
86 lecui::rect& rect() override;
87
92
96
100 time& on_resize(const resize_params& on_resize);
101
104 cursor_type& cursor() override;
105
109 time& cursor(const cursor_type cursor);
110
113 std::string& font() override;
114
118 time& font(const std::string& font);
119
122 float& font_size() override;
123
127 time& font_size(const float& font_size);
128
131 color& color_text() override;
132
136 time& color_text(const color& color_text);
137
140 color& color_fill() override;
141
145 time& color_fill(const color& color_fill);
146
149 color& color_hot() override;
150
154 time& color_hot(const color& color_hot);
155
159
163 time& color_selected(const color& color_selected);
164
168
172 time& color_disabled(const color& color_disabled);
173
174 // widget specific widget
175
178 float& border();
179
183 time& border(const float& border);
184
188
192 time& color_border(const color& color_border);
193
197
201 time& corner_radius_x(const float& corner_radius_x);
202
206
210 time& corner_radius_y(const float& corner_radius_y);
211
215
219 time& time_value(const lecui::time& time_value);
220
221 public:
228 [[nodiscard]]
229 static time& add(containers::page& page, const std::string& alias = std::string());
230
237 [[nodiscard]]
238 static time& get(form& fm, const std::string& path);
239
240 private:
242 time_events _time_events;
243
244#if defined(LECUI_EXPORTS)
245 friend class form;
246#endif
247 };
248 }
249 }
250}
251
252#if defined(lecui_helper)
254#define get_time(path) liblec::lecui::widgets::time::get(*this, path)
255#endif
RGBA color on a standard 0 to 255 scale. For the alpha channel 0 is transparent and 255 is opaque.
Definition: lecui.h:583
Page container.
Definition: page.h:32
Form base class. The user must inherit from this class and call one of the two constructors from its ...
Definition: form.h:122
Rectangle class.
Definition: lecui.h:158
Resize parameters.
Definition: lecui.h:363
Time class.
Definition: lecui.h:878
Time widget. To instantiate and add to a container use the add static method.
Definition: time.h:24
time & cursor(const cursor_type cursor)
Set the mouse cursor to use when over the widget.
std::string & tooltip() override
Get or set the widget's tooltip text.
static time & add(containers::page &page, const std::string &alias=std::string())
Add a time widget to a container.
color & color_hot() override
Get or set the widget's color when the mouse is hovered over it.
time & border(const float &border)
Set the thickness of the border.
time & tooltip(const std::string &tooltip)
Set the tooltip text.
time & rect(const lecui::rect &rect)
Set the position and dimensions of the widget.
time()
Constructor.
Definition: time.h:34
time & on_resize(const resize_params &on_resize)
Set the behaviour of the widget when its container is resized.
float & border()
Get or set the thickness of the border.
time & corner_radius_x(const float &corner_radius_x)
Set the horizontal radius of the corners.
time & color_text(const color &color_text)
Set the color of the widget's text.
float & font_size() override
Get or set the default widget font size in points, e.g. 9.0f.
cursor_type & cursor() override
Get or set the mouse cursor to use then over the widget.
time_events & events()
Get or set time widget events.
Definition: time.h:47
color & color_text() override
Get or set the color of the widget's text.
time & text(const std::string &text)
Set the widget's text.
resize_params & on_resize() override
Get or set the behaviour of the widget when its container is resized.
float & corner_radius_x()
Get or set the horizontal radius of the corners.
static time & get(form &fm, const std::string &path)
Get the specifications of a time widget.
bool operator==(const time &param)
Check whether widget specs are equal. Only those properties that require the widget resources to be r...
time & font_size(const float &font_size)
Set the widget's font size.
time & corner_radius_y(const float &corner_radius_y)
Set the vertical radius of the corners.
lecui::rect & rect() override
Get or set the position and dimensions of the widget.
time & color_border(const color &color_border)
Set the color of the border.
float & corner_radius_y()
Get or set the vertical radius of the corners.
bool operator!=(const time &param)
Check whether widget specs are NOT equal. Only those properties that require the widget resources to ...
time & color_fill(const color &color_fill)
Set the fill color of the widget.
lecui::time & time_value()
Get or set the time.
std::string & text() override
Get or set the widget text.
std::string & font() override
Get or set the default widget font, e.g. "Georgia".
color & color_fill() override
Get or set the fill color of the widget.
time & color_disabled(const color &color_disabled)
Set the widget's color when it is disabled.
time & color_hot(const color &color_hot)
Set the widget's color when the mouse is hovered over it.
color & color_disabled() override
Get or set the widget's color when it is disabled.
color & color_border()
Get or set the color of the border.
time & time_value(const lecui::time &time_value)
Set the time.
color & color_selected() override
Get or set the widget's color when selected.
time & font(const std::string &font)
Set the default widget font.
time & color_selected(const color &color_selected)
Set the widget's color when selected.
Base class for all widgets.
Definition: widget.h:24
cursor_type
Mouse cursor type.
Definition: widget.h:27
Top level namespace for the liblec libraries.
Definition: appearance.h:19
Events specific to this widget.
Definition: time.h:39
Events common to all widgets.
Definition: widget.h:72