-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlainTextEditor.cpp
More file actions
42 lines (40 loc) · 1.19 KB
/
Copy pathPlainTextEditor.cpp
File metadata and controls
42 lines (40 loc) · 1.19 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
#include <ViewDesign/view/widget/DefaultWindow.h>
#include <ViewDesign/view/frame/ScrollFrame.h>
#include <ViewDesign/view/frame/ClipFrame.h>
#include <ViewDesign/view/frame/MaxFrame.h>
#include <ViewDesign/view/frame/PaddingFrame.h>
#include <ViewDesign/view/frame/ScaleFrame.h>
#include <ViewDesign/view/control/TextEditor.h>
#include <ViewDesign/view/wrapper/Background.h>
using namespace ViewDesign;
void App() {
ref_ptr<TextEditor> text_editor;
desktop.AddWindow(
new DefaultWindow(
DefaultWindow::Style(),
u"PlainTextEditor",
new DefaultBackground<ClipFrame<Fixed, Fixed, Top>>(
new ScrollFrame<Fixed, Bounded>(
new ClipFrame<Fixed, Auto, Left>(
new MaxFrame<Bounded, Auto>(
length_infinite,
// this padding is not scaled
new PaddingFrame(
Padding(10.0f),
new ScaleFrame(
// this padding is scaled
new PaddingFrame(
Padding(10.0f),
text_editor = new WithHistory<TextEditor>(TextEditor::Style(), u"Type something here...\n(hint: zoom with Ctrl + scroll)")
)
)
)
)
)
)
)
)
);
text_editor->Edit(22); // length of u"Type something here..."
desktop.EventLoop();
}