aboutsummaryrefslogtreecommitdiff
path: root/demos/scroll_view
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-10 19:49:06 +0800
committercrupest <crupest@outlook.com>2022-02-10 19:49:06 +0800
commitc1dbad5fdf0560983e6c832eddded6f610eae94e (patch)
tree40f22f7e6aa7ef39c49b1c007beed37130fc0b5d /demos/scroll_view
parentb2622f654598f82a220a98daaa84fed9ce3b92b2 (diff)
downloadcru-c1dbad5fdf0560983e6c832eddded6f610eae94e.tar.gz
cru-c1dbad5fdf0560983e6c832eddded6f610eae94e.tar.bz2
cru-c1dbad5fdf0560983e6c832eddded6f610eae94e.zip
...
Diffstat (limited to 'demos/scroll_view')
-rw-r--r--demos/scroll_view/main.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/demos/scroll_view/main.cpp b/demos/scroll_view/main.cpp
index d859ce3a..b049a408 100644
--- a/demos/scroll_view/main.cpp
+++ b/demos/scroll_view/main.cpp
@@ -11,15 +11,14 @@ using cru::ui::controls::TextBlock;
using cru::ui::controls::Window;
int main() {
- IUiApplication* application = cru::platform::bootstrap::CreateUiApplication();
+ std::unique_ptr<IUiApplication> application(
+ cru::platform::bootstrap::CreateUiApplication());
- auto window = Window::Create();
+ Window window;
+ ScrollView scroll_view;
+ window.AddChild(&scroll_view);
- auto scroll_view = ScrollView::Create();
-
- window->AddChild(scroll_view);
-
- auto text_block = TextBlock::Create(
+ TextBlock text_block(
uR"([Verse 1]
The snow glows white on the mountain tonight
Not a footprint to be seen
@@ -76,13 +75,12 @@ Let it go, let it go
That perfect girl is gone
Here I stand in the light of day
Let the storm rage on!
-The cold never bothered me anyway)");
-
- text_block->SetSelectable(true);
+The cold never bothered me anyway)",
+ true);
- scroll_view->SetChild(text_block);
+ scroll_view.SetChild(&text_block);
- window->GetWindowHost()->GetNativeWindow()->SetVisibility(
+ window.GetWindowHost()->GetNativeWindow()->SetVisibility(
cru::platform::gui::WindowVisibilityType::Show);
return application->Run();