lecui 1.0.0-alpha.20
lecui C++ user interface library
pane.h
1//
2// pane.h - pane container 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 "../widgets/widget.h"
15#else
16#include <liblec/lecui/widgets/widget.h>
17#endif
18
19namespace liblec {
20 namespace lecui {
21 namespace containers {
23 class lecui_api pane_specs : public widgets::widget, public widgets::badge_widget {
24 float _border = .5f;
25 color _color_border;
26 float _corner_radius_x = 5.f;
27 float _corner_radius_y = 5.f;
28
29 public:
30 pane_specs() {}
31
36 bool operator==(const pane_specs& param);
37
42 bool operator!=(const pane_specs& param);
43
44 // generic widget
45
49 std::string& text() override;
50
55 pane_specs& text(const std::string& text);
56
60 std::string& tooltip() override;
61
66 pane_specs& tooltip(const std::string& tooltip);
67
71
76
80 lecui::rect& rect() override;
81
86
90
95
99 cursor_type& cursor() override;
100
106
110 std::string& font() override;
111
116 pane_specs& font(const std::string& font);
117
121 float& font_size() override;
122
127 pane_specs& font_size(const float& font_size);
128
132 color& color_text() override;
133
138 pane_specs& color_text(const color& color_text);
139
142 color& color_fill() override;
143
147 pane_specs& color_fill(const color& color_fill);
148
152 color& color_hot() override;
153
158 pane_specs& color_hot(const color& color_hot);
159
164
169 pane_specs& color_selected(const color& color_selected);
170
174
178 pane_specs& color_disabled(const color& color_disabled);
179
180 // widget specific widget
181
184 float& border();
185
189 pane_specs& border(const float& border);
190
194
198 pane_specs& color_border(const color& color_border);
199
203
207 pane_specs& corner_radius_x(const float& corner_radius_x);
208
212
216 pane_specs& corner_radius_y(const float& corner_radius_y);
217 };
218
223 class lecui_api pane :
224 public pane_specs, public containers::page {
225 public:
231 pane(form& fm, const std::string& alias);
232
240 [[nodiscard]] const lecui::size size() override;
241
249 [[nodiscard]]
250 static pane& add(containers::page& page, const std::string& alias = std::string(), const float& content_margin = 10.f);
251
258 [[nodiscard]]
259 static pane& get(form& fm, const std::string& path);
260 };
261 }
262 }
263}
264
265#if defined(lecui_helper)
267#define get_pane(path) liblec::lecui::containers::pane::get(*this, path)
268#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
Pane container specifications.
Definition: pane.h:23
float & corner_radius_x()
Get or set the horizontal radius of the corners.
color & color_text() override
Get or set the color of the widget's text.
pane_specs & corner_radius_x(const float &corner_radius_x)
Set the horizontal radius of the corners.
pane_specs & corner_radius_y(const float &corner_radius_y)
Set the vertical radius of the corners.
pane_specs & tooltip(const std::string &tooltip)
Set the tooltip text.
color & color_selected() override
Get or set the widget's color when selected.
std::string & text() override
Get or set the widget text.
color & color_fill() override
Get or set the fill color of the widget.
lecui::rect & rect() override
Get or set the position and dimensions of the widget.
pane_specs & on_resize(const resize_params &on_resize)
Set the behaviour of the widget when its container is resized.
std::string & font() override
Get or set the default widget font, e.g. "Georgia".
pane_specs & font(const std::string &font)
Set the default widget font.
pane_specs & color_disabled(const color &color_disabled)
Set the widget's color when it is disabled.
color & color_hot() override
Get or set the widget's color when the mouse is hovered over it.
std::string & tooltip() override
Get or set the widget's tooltip text.
float & border()
Get or set the thickness of the border.
pane_specs & color_selected(const color &color_selected)
Set the widget's color when selected.
float & corner_radius_y()
Get or set the vertical radius of the corners.
bool operator==(const pane_specs &param)
Check whether pane specs are equal. Only those properties that require the widget resources to be re-...
pane_specs & color_fill(const color &color_fill)
Set the fill color of the widget.
pane_specs & cursor(const cursor_type cursor)
Set the mouse cursor to use when over the widget.
pane_specs & badge(const widgets::badge_specs &badge)
Set the badge specs.
pane_specs & text(const std::string &text)
Set the widget's text.
widgets::badge_specs & badge() override
Get or set the badge specs.
pane_specs & color_text(const color &color_text)
Set the color of the widget's text.
color & color_border()
Get or set the color of the border.
pane_specs & rect(const lecui::rect &rect)
Set the position and dimensions of the widget.
color & color_disabled() override
Get or set the widget's color when it is disabled.
resize_params & on_resize() override
Get or set the behaviour of the widget when its container is resized.
cursor_type & cursor() override
Get or set the mouse cursor to use then over the widget.
float & font_size() override
Get or set the default widget font size in points, e.g. 9.0f.
pane_specs & color_border(const color &color_border)
Set the color of the border.
pane_specs & color_hot(const color &color_hot)
Set the widget's color when the mouse is hovered over it.
pane_specs & border(const float &border)
Set the thickness of the border.
bool operator!=(const pane_specs &param)
Check whether pane specs are NOT equal. Only those properties that require the widget resources to be...
pane_specs & font_size(const float &font_size)
Set the widget's font size.
Pane container. To create an instance use the add static method.
Definition: pane.h:224
static pane & get(form &fm, const std::string &path)
Get the specifications of a pane.
const lecui::size size() override
Get the size of the pane's page.
pane(form &fm, const std::string &alias)
Class constructor.
static pane & add(containers::page &page, const std::string &alias=std::string(), const float &content_margin=10.f)
Make a pane.
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
Size of a rectangular structure.
Definition: lecui.h:117
Badge specifications.
Definition: widget.h:177
Base class for all widgets with badges.
Definition: widget.h:292
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