diff options
Diffstat (limited to 'views/examples/scroll_view_example.h')
-rw-r--r-- | views/examples/scroll_view_example.h | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/views/examples/scroll_view_example.h b/views/examples/scroll_view_example.h index 2fd2d2f..035c06c 100644 --- a/views/examples/scroll_view_example.h +++ b/views/examples/scroll_view_example.h @@ -13,9 +13,18 @@ namespace examples { -class ScrollViewExample : protected ExampleBase, private views::ButtonListener { +class ScrollViewExample : public ExampleBase, + public views::ButtonListener { public: - explicit ScrollViewExample(ExamplesMain* main) : ExampleBase(main) { + explicit ScrollViewExample(ExamplesMain* main): ExampleBase(main) {} + + virtual ~ScrollViewExample() {} + + virtual std::wstring GetExampleTitle() { + return L"Scroll View"; + } + + virtual void CreateExampleView(views::View* container) { wide_ = new views::TextButton(this, L"Wide"); tall_ = new views::TextButton(this, L"Tall"); big_square_ = new views::TextButton(this, L"Big Square"); @@ -27,9 +36,8 @@ class ScrollViewExample : protected ExampleBase, private views::ButtonListener { scrollable_->SetBounds(0, 0, 1000, 100); scrollable_->SetColor(SK_ColorYELLOW, SK_ColorCYAN); - container_ = new views::View(); - views::GridLayout* layout = new views::GridLayout(container_); - container_->SetLayoutManager(layout); + views::GridLayout* layout = new views::GridLayout(container); + container->SetLayoutManager(layout); // Add scroll view. views::ColumnSet* column_set = layout->AddColumnSet(0); @@ -52,16 +60,6 @@ class ScrollViewExample : protected ExampleBase, private views::ButtonListener { layout->AddView(scroll_to_); } - virtual ~ScrollViewExample() {} - - virtual std::wstring GetExampleTitle() { - return L"Scroll View"; - } - - virtual views::View* GetExampleView() { - return container_; - } - private: // ScrollView's content, which draws gradient color on background. // TODO(oshima): add child views as well. @@ -108,9 +106,6 @@ class ScrollViewExample : protected ExampleBase, private views::ButtonListener { scroll_view_->Layout(); } - // The view containing this test's controls. - views::View* container_; - // Control buttons to change the size of scrollable and jump to // predefined position. views::TextButton* wide_, *tall_, *big_square_, *small_square_, *scroll_to_; |