diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-20 17:22:48 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-20 17:22:48 +0000 |
commit | e557d64b1d89a5acbe4b185e63c029c428bd217b (patch) | |
tree | adc254b279329bfae6f1a53cc19a03a3cade7a41 /views/examples/scroll_view_example.h | |
parent | dd92c8dc5191650d37501f74bf017e4ad4f664a4 (diff) | |
download | chromium_src-e557d64b1d89a5acbe4b185e63c029c428bd217b.zip chromium_src-e557d64b1d89a5acbe4b185e63c029c428bd217b.tar.gz chromium_src-e557d64b1d89a5acbe4b185e63c029c428bd217b.tar.bz2 |
Porting the view examples to Windows.
Some refactoring done to the tests also.
See original review at:
http://codereview.chromium.org/295013/show
BUG=None
TEST=Make sure the view examples build and run on Windows
and Linux.
Review URL: http://codereview.chromium.org/294026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/examples/scroll_view_example.h')
-rw-r--r-- | views/examples/scroll_view_example.h | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/views/examples/scroll_view_example.h b/views/examples/scroll_view_example.h index b032224..2fd2d2f 100644 --- a/views/examples/scroll_view_example.h +++ b/views/examples/scroll_view_example.h @@ -5,6 +5,7 @@ #ifndef VIEWS_EXAMPLES_SCROLL_BAR_EXAMPLE_H_ #define VIEWS_EXAMPLES_SCROLL_BAR_EXAMPLE_H_ +#include "base/compiler_specific.h" #include "base/string_util.h" #include "views/controls/button/text_button.h" #include "views/controls/scroll_view.h" @@ -14,24 +15,21 @@ namespace examples { class ScrollViewExample : protected ExampleBase, private views::ButtonListener { public: - ScrollViewExample(views::TabbedPane* tabbed_pane, views::Label* message) - : ExampleBase(message), - wide_(new views::TextButton(this, L"Wide")), - tall_(new views::TextButton(this, L"Tall")), - big_square_(new views::TextButton(this, L"Big Square")), - small_square_(new views::TextButton(this, L"Small Square")), - scroll_to_(new views::TextButton(this, L"Scroll to")), - scrollable_(new ScrollableView()), - scroll_view_(new views::ScrollView()) { + explicit ScrollViewExample(ExamplesMain* main) : ExampleBase(main) { + wide_ = new views::TextButton(this, L"Wide"); + tall_ = new views::TextButton(this, L"Tall"); + big_square_ = new views::TextButton(this, L"Big Square"); + small_square_ = new views::TextButton(this, L"Small Square"); + scroll_to_ = new views::TextButton(this, L"Scroll to"); + scrollable_ = new ScrollableView(); + scroll_view_ = new views::ScrollView(); scroll_view_->SetContents(scrollable_); scrollable_->SetBounds(0, 0, 1000, 100); scrollable_->SetColor(SK_ColorYELLOW, SK_ColorCYAN); - views::View* container = new views::View(); - tabbed_pane->AddTab(L"Scroll View", container); - - views::GridLayout* layout = new views::GridLayout(container); - container->SetLayoutManager(layout); + container_ = new views::View(); + views::GridLayout* layout = new views::GridLayout(container_); + container_->SetLayoutManager(layout); // Add scroll view. views::ColumnSet* column_set = layout->AddColumnSet(0); @@ -56,6 +54,14 @@ class ScrollViewExample : protected ExampleBase, private views::ButtonListener { 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. @@ -102,6 +108,9 @@ 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_; |