-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPadding.cpp
More file actions
53 lines (49 loc) · 1.53 KB
/
Copy pathPadding.cpp
File metadata and controls
53 lines (49 loc) · 1.53 KB
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
#include <ViewDesign/view/widget/DefaultWindow.h>
#include <ViewDesign/view/frame/CenterFrame.h>
#include <ViewDesign/view/frame/BackgroundFrame.h>
#include <ViewDesign/view/frame/PaddingFrame.h>
#include <ViewDesign/view/control/TextView.h>
#include <ViewDesign/view/wrapper/Background.h>
using namespace ViewDesign;
struct TextViewStyle : TextView::Style {
TextViewStyle() {
font.size(75.0f).color(ColorCode::Black);
}
};
void App() {
//desktop.AddWindow(
// create<DefaultBackground<DefaultWindow>>>(
// DefaultWindow::Style(),
// u"HelloWorld",
// create<CenterFrame<Fixed, Fixed>>(
// create<BackgroundFrame<Bounded, Bounded>>(
// ColorCode::LightPink,
// create<PaddingFrame<Bounded, Bounded>>(
// Padding(50.0f),
// create<TextView>(TextViewStyle(), u"Hello World!")
// )
// )
// )
// )
//);
// `operator new` can be safely used here to replace `create<...>`
// which doesn't require the template arguments for `BackgroundFrame` and `PaddingFrame` to be fully given
// `CenterFrame<Fixed, Fixed>` still needs to be explicitly written because it can't be deduced from its child view argument
// and there is no template argument deduction based on the return value type
desktop.AddWindow(
new DefaultBackground<DefaultWindow>(
DefaultWindow::Style(),
u"HelloWorld",
new CenterFrame<Fixed, Fixed>(
new BackgroundFrame(
ColorCode::LightPink,
new PaddingFrame(
Padding(50.0f),
new TextView(TextViewStyle(), u"Hello World!")
)
)
)
)
);
desktop.EventLoop();
}