aboutsummaryrefslogtreecommitdiff
path: root/CruUI/main.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-09-15 23:28:06 +0800
committercrupest <crupest@outlook.com>2018-09-15 23:28:06 +0800
commit683419f2856d348436ca64cfd4b3abbfc73cda89 (patch)
treeeed6f7b324ca2a4a6b7cdf7879233eb2eacedf2c /CruUI/main.cpp
parent8248001b2506a866b6be0e22af36f8399a595da2 (diff)
downloadcru-683419f2856d348436ca64cfd4b3abbfc73cda89.tar.gz
cru-683419f2856d348436ca64cfd4b3abbfc73cda89.tar.bz2
cru-683419f2856d348436ca64cfd4b3abbfc73cda89.zip
...
Diffstat (limited to 'CruUI/main.cpp')
-rw-r--r--CruUI/main.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/CruUI/main.cpp b/CruUI/main.cpp
index 99f9ded6..0d1b4032 100644
--- a/CruUI/main.cpp
+++ b/CruUI/main.cpp
@@ -68,10 +68,25 @@ int APIENTRY wWinMain(
const auto layout = LinearLayout::Create();
- layout->AddChild(TextBlock::Create(L"Hello World!!!"));
+ layout->GetLayoutParams()->width.mode = cru::ui::MeasureMode::Stretch;
+
+ layout->mouse_click_event.AddHandler([layout](cru::ui::events::MouseButtonEventArgs& args)
+ {
+ layout->AddChild(TextBlock::Create(L"Layout is clicked!"));
+ });
+
+ const auto text_block = TextBlock::Create(L"Hello World!!!");
+
+ text_block->mouse_click_event.AddHandler([layout](cru::ui::events::MouseButtonEventArgs& args)
+ {
+ layout->AddChild(TextBlock::Create(L"Hello world is clicked!"));
+ });
+
+ layout->AddChild(text_block);
layout->AddChild(TextBlock::Create(L"This is a very very very very very long sentence!!!"));
layout->AddChild(TextBlock::Create(L"By crupest!!!"));
+
window.AddChild(layout);
window.Show();