lecui 1.0.0-alpha.20
lecui C++ user interface library
page.h
1//
2// page.h - page 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 "../form.h"
15#else
16#include <liblec/lecui/form.h>
17#endif
18
19namespace liblec {
20 namespace lecui {
22 namespace containers {
32 class lecui_api page {
33 public:
39 page(form& fm, const std::string& alias);
40 virtual ~page();
41
49 [[nodiscard]] virtual const size size();
50
53 const bool rendered();
54
63 [[nodiscard]] virtual const lecui::size change_in_size();
64
70 void scroll_vertically(const float& amount);
71
77 void scroll_horizontally(const float& amount);
78
79 protected:
80 class impl;
81 impl& _d_page;
82
83 // Default constructor and copying an object of this class are not allowed
84 page() = delete;
85 page(const page&) = delete;
86 page& operator=(const page&) = delete;
87
88#if defined(LECUI_EXPORTS)
89 friend class form;
90 friend class page_manager;
91 friend class containers::status_pane_builder;
92 friend class containers::tab_pane_builder;
93 friend class containers::tab_builder;
94 friend class containers::pane_builder;
95 friend class containers::group_builder;
96 friend class widgets::rectangle_builder;
97 friend class widgets::label_builder;
98 friend class widgets::button_builder;
99 friend class widgets::toggle_builder;
100 friend class widgets::table_view_builder;
101 friend class widgets::custom_builder;
102 friend class widgets::image_view_builder;
103 friend class widgets::progress_indicator_builder;
104 friend class widgets::progress_bar_builder;
105 friend class widgets::checkbox_builder;
106 friend class widgets::text_field_builder;
107 friend class widgets::tree_view_builder;
108 friend class widgets::slider_builder;
109 friend class widgets::html_editor_builder;
110 friend class widgets::combobox_builder;
111 friend class widgets::line_builder;
112 friend class widgets::time_builder;
113 friend class widgets::date_builder;
114 friend class widgets::icon_builder;
115 friend class widgets::strength_bar_builder;
116
117 friend class widgets::widget_impl;
118 friend class widgets::html_editor_impl;
119 friend class widgets::image_view_impl;
120 friend class widgets::table_view_impl;
121 friend class widgets::tree_view_impl;
122 friend class widgets::time_impl;
123 friend class widgets::date_impl;
124 friend class widgets::icon_impl;
125 friend class widgets::pane_impl;
126 friend class widgets::tab_pane_impl;
127#endif
128 };
129 }
130
132 class lecui_api page_manager {
133 public:
137
140
144 [[nodiscard]] bool exists(const std::string& alias);
145
151 [[nodiscard]] containers::page&
152 add(const std::string& alias);
153
161 [[nodiscard]] static containers::page&
162 get(form& fm, const std::string& alias);
163
169 void show(const std::string& alias);
170
173 void close(const std::string& path);
174
178 [[nodiscard]]
179 std::string current();
180
184 [[nodiscard]]
185 std::string previous();
186
187 private:
188 class impl;
189 impl& _d;
190
191 // Default constructor and copying an object of this class are not allowed
192 page_manager() = delete;
193 page_manager(const page_manager&) = delete;
194 page_manager& operator=(const page_manager&) = delete;
195 };
196 }
197}
198
199#if defined(lecui_helper)
201#define get_page(path) liblec::lecui::page_manager::get(*this, path)
202#endif
Page container.
Definition: page.h:32
virtual const lecui::size change_in_size()
Get the page's change in size.
void scroll_horizontally(const float &amount)
Programmatically scroll the page horizontally.
page(form &fm, const std::string &alias)
Page constructor.
impl & _d_page
Reference to page implementation.
Definition: page.h:80
void scroll_vertically(const float &amount)
Programmatically scroll the page vertically.
virtual const size size()
Get the size of the page.
const bool rendered()
Check whether the page has been rendered.
Form base class. The user must inherit from this class and call one of the two constructors from its ...
Definition: form.h:122
Page manager class.
Definition: page.h:132
void show(const std::string &alias)
Show a page.
~page_manager()
Class destructor.
std::string current()
Get the name of the currently displayed page.
containers::page & add(const std::string &alias)
Add a page to the form.
std::string previous()
Get the name of the page that was displayed before the current page.
static containers::page & get(form &fm, const std::string &alias)
Get the page container of an existing page.
page_manager(form &fm)
Page manager constructor.
void close(const std::string &path)
Close a container.
bool exists(const std::string &alias)
Check if a page exists.
Size of a rectangular structure.
Definition: lecui.h:117
Top level namespace for the liblec libraries.
Definition: appearance.h:19