diff options
author | crupest <crupest@outlook.com> | 2018-11-25 22:57:07 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-11-25 22:57:07 +0800 |
commit | 22322daf6f51da53740ff95ef2eaceed9a6efcae (patch) | |
tree | 06b17b482e2e15cb0692d05b279c61cbd6923b4d /src/main.cpp | |
parent | 5391e781e4682731721c841462904809bc618870 (diff) | |
download | cru-22322daf6f51da53740ff95ef2eaceed9a6efcae.tar.gz cru-22322daf6f51da53740ff95ef2eaceed9a6efcae.tar.bz2 cru-22322daf6f51da53740ff95ef2eaceed9a6efcae.zip |
Develop basic functions of ScrollControl.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 376c03b8..5cc98a72 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,7 @@ #include "ui/controls/list_item.hpp" #include "ui/controls/popup_menu.hpp" #include "ui/controls/frame_layout.hpp" +#include "ui/controls/scroll_control.hpp" #include "graph/graph.hpp" using cru::String; @@ -27,6 +28,7 @@ using cru::ui::controls::Button; using cru::ui::controls::TextBox; using cru::ui::controls::ListItem; using cru::ui::controls::FrameLayout; +using cru::ui::controls::ScrollControl; int APIENTRY wWinMain( HINSTANCE hInstance, @@ -183,9 +185,16 @@ int APIENTRY wWinMain( } { - const auto text_block = CreateWithLayout<TextBlock>(LayoutSideParams::Stretch(), LayoutSideParams::Stretch(), L"This is a very very very very very long sentence!!!"); + const auto scroll_view = CreateWithLayout<ScrollControl>(LayoutSideParams::Stretch(), LayoutSideParams::Stretch()); + + scroll_view->SetVerticalScrollBarVisibility(ScrollControl::ScrollBarVisibility::Always); + + const auto text_block = TextBlock::Create( + L"Love myself I do. Not everything, but I love the good as well as the bad. I love my crazy lifestyle, and I love my hard discipline. I love my freedom of speech and the way my eyes get dark when I'm tired. I love that I have learned to trust people with my heart, even if it will get broken. I am proud of everything that I am and will become."); text_block->SetSelectable(true); - layout->AddChild(text_block); + + scroll_view->AddChild(text_block); + layout->AddChild(scroll_view); } layout->AddChild(CreateWithLayout<TextBlock>(LayoutSideParams::Content(Alignment::Start), LayoutSideParams::Content(), L"This is a little short sentence!!!")); |