diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 16:45:34 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 16:45:34 +0000 |
commit | 4a672db19685df00f748681c57a00ee253a2047e (patch) | |
tree | 6c64d27e9cdb0ced677f20c0afa4cf084d25e3ee /views/examples/radio_button_example.h | |
parent | bab6cac3c2ad3f335a4694f3ea0b33477a98508b (diff) | |
download | chromium_src-4a672db19685df00f748681c57a00ee253a2047e.zip chromium_src-4a672db19685df00f748681c57a00ee253a2047e.tar.gz chromium_src-4a672db19685df00f748681c57a00ee253a2047e.tar.bz2 |
Fixed view example. It was failing because some of view classes requires WidgetGTK in
view hierarchy to call methods on it.
* added ContainerExamlpeBase that defers the creation of such views after WidgetGTK available.
minor fixes
* replaced unnecessary includes with forward decls.
* make sure we don't try to set negative hight to viewport.
BUG=None
TEST=build & run view_examples
Review URL: http://codereview.chromium.org/347010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30586 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/examples/radio_button_example.h')
-rw-r--r-- | views/examples/radio_button_example.h | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/views/examples/radio_button_example.h b/views/examples/radio_button_example.h index abe5a4c..5610700 100644 --- a/views/examples/radio_button_example.h +++ b/views/examples/radio_button_example.h @@ -13,10 +13,18 @@ namespace examples { -class RadioButtonExample : protected ExampleBase, - private views::ButtonListener { +class RadioButtonExample : public ExampleBase, + public views::ButtonListener { public: - explicit RadioButtonExample(ExamplesMain* main) : ExampleBase(main) { + explicit RadioButtonExample(ExamplesMain* main): ExampleBase(main) {} + + virtual ~RadioButtonExample() {} + + virtual std::wstring GetExampleTitle() { + return L"Radio Button"; + } + + virtual void CreateExampleView(views::View* container) { select_ = new views::TextButton(this, L"Select"); status_ = new views::TextButton(this, L"Show Status"); @@ -31,9 +39,8 @@ class RadioButtonExample : protected ExampleBase, group); } - container_ = new views::View(); - views::GridLayout* layout = new views::GridLayout(container_); - container_->SetLayoutManager(layout); + views::GridLayout* layout = new views::GridLayout(container); + container->SetLayoutManager(layout); views::ColumnSet* column_set = layout->AddColumnSet(0); column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, @@ -48,16 +55,6 @@ class RadioButtonExample : protected ExampleBase, layout->AddView(status_); } - virtual ~RadioButtonExample() {} - - virtual std::wstring GetExampleTitle() { - return L"Radio Button"; - } - - virtual views::View* GetExampleView() { - return container_; - } - private: // Override from ButtonListener virtual void ButtonPressed(views::Button* sender, const views::Event& event) { @@ -76,9 +73,6 @@ class RadioButtonExample : protected ExampleBase, } } - // The view containing this test's controls. - views::View* container_; - // 6 radio buttons, 0-2 consists 1st group, and 3-5 consists // 2nd group. views::RadioButton* radio_buttons_[6]; |