Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
applet_frame.hpp
Go to the documentation of this file.
1/*
2 Copyright 2019-2021 natinusala
3 Copyright 2021 XITRIX
4 Copyright 2019 p-sam
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17*/
18
19#pragma once
20
21#include <aurore/core/bind.hpp>
22#include <aurore/core/box.hpp>
23#include <aurore/core/event.hpp>
27
28namespace aurore
29{
30
31enum class HeaderStyle
32{
33 REGULAR,
34 POPUP
35};
36
37// A Horizon settings-like frame, with header and footer (no sidebar)
38class AppletFrame : public Box
39{
40 public:
43
45 {
46 aurore::Logger::debug("delete AppletFrame {}", this->describe());
47 }
48
49 void handleXMLElement(tinyxml2::XMLElement* element) override;
50
51 void pushContentView(View* view);
52 void popContentView(std::function<void(void)> cb = [] {});
53 void popToRootContentView(std::function<void(void)> cb = [] {});
54
55 void setTitle(std::string title);
56 void setIcon(std::string path);
57
60
63
65 {
66 return contentView;
67 }
68
70 {
71 return header;
72 }
73
75 {
76 return footer;
77 }
78
79 static View* create();
80
81 inline static bool HIDE_BOTTOM_BAR = false;
82
83 private:
84 AURORE_BIND(Box, header, "aurore/applet_frame/header");
85 AURORE_BIND(BottomBar, footer, "aurore/applet_frame/footer");
86 AURORE_BIND(Label, title, "aurore/applet_frame/title_label");
87 AURORE_BIND(Image, icon, "aurore/applet_frame/title_icon");
88 AURORE_BIND(Box, hintBox, "aurore/applet_frame/hint_box");
89
91
92 protected:
93 std::vector<View*> contentViewStack;
94 View* contentView = nullptr;
95
101 void setContentView(View* view);
102};
103
104} // namespace aurore
#define AURORE_BIND(type, name, id)
Definition bind.hpp:39
Definition applet_frame.hpp:39
void handleXMLElement(tinyxml2::XMLElement *element) override
void setHeaderVisibility(Visibility visibility)
void setTitle(std::string title)
void pushContentView(View *view)
void setContentView(View *view)
static View * create()
std::vector< View * > contentViewStack
Definition applet_frame.hpp:93
void popToRootContentView(std::function< void(void)> cb=[] {})
~AppletFrame()
Definition applet_frame.hpp:44
void setHeaderStyle(HeaderStyle style)
Box * getHeader()
Definition applet_frame.hpp:69
AppletFrame(View *contentView)
void updateAppletFrameItem()
View * getContentView()
Definition applet_frame.hpp:64
Box * getFooter()
Definition applet_frame.hpp:74
void setFooterVisibility(Visibility visibility)
void popContentView(std::function< void(void)> cb=[] {})
void setIcon(std::string path)
static bool HIDE_BOTTOM_BAR
Definition applet_frame.hpp:81
View * contentView
Definition applet_frame.hpp:94
Definition bottom_bar.hpp:29
Generic FlexBox layout.
Definition box.hpp:74
Definition image.hpp:67
Definition label.hpp:65
static void debug(fmt::format_string< Args... > format, Args &&... args)
Definition logger.hpp:170
Definition view.hpp:232
std::string describe() const
The class name and the id, for logs: Label (id="title").
Definition actions.hpp:25
Visibility
View visibility.
Definition view.hpp:128
HeaderStyle
Definition applet_frame.hpp:32