| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VIEWS_EXAMPLES_TABBED_PANE_EXAMPLE_H_ | 5 #ifndef VIEWS_EXAMPLES_TABBED_PANE_EXAMPLE_H_ |
| 6 #define VIEWS_EXAMPLES_TABBED_PANE_EXAMPLE_H_ | 6 #define VIEWS_EXAMPLES_TABBED_PANE_EXAMPLE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" |
| 8 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 9 #include "views/controls/button/text_button.h" | 10 #include "views/controls/button/text_button.h" |
| 10 #include "views/controls/tabbed_pane/tabbed_pane.h" | 11 #include "views/controls/tabbed_pane/tabbed_pane.h" |
| 11 #include "views/examples/example_base.h" | 12 #include "views/examples/example_base.h" |
| 12 | 13 |
| 13 namespace examples { | 14 namespace examples { |
| 14 | 15 |
| 15 // A TabbedPane example tests adding/removing/selecting tabs. | 16 // A TabbedPane example tests adding/removing/selecting tabs. |
| 16 class TabbedPaneExample : protected ExampleBase, | 17 class TabbedPaneExample : protected ExampleBase, |
| 17 private views::ButtonListener, | 18 private views::ButtonListener, |
| 18 views::TabbedPane::Listener { | 19 views::TabbedPane::Listener { |
| 19 public: | 20 public: |
| 20 TabbedPaneExample(views::TabbedPane* parent, views::Label* message) | 21 TabbedPaneExample(views::TabbedPane* parent, views::Label* message) |
| 21 : ExampleBase(message), | 22 : ExampleBase(message), |
| 22 tabbed_pane_(new views::TabbedPane()), | 23 tabbed_pane_(new views::TabbedPane()), |
| 23 add_(new views::TextButton(this, L"Add")), | 24 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 24 add_at_(new views::TextButton(this, L"Add At 1")), | 25 add_(new views::TextButton(this, L"Add"))), |
| 25 remove_at_(new views::TextButton(this, L"Remove At 1")), | 26 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 26 select_at_(new views::TextButton(this, L"Select At 1")) { | 27 add_at_(new views::TextButton(this, L"Add At 1"))), |
| 28 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 29 remove_at_(new views::TextButton(this, L"Remove At 1"))), |
| 30 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 31 select_at_(new views::TextButton(this, L"Select At 1"))) { |
| 27 views::View* container = new views::View(); | 32 views::View* container = new views::View(); |
| 28 parent->AddTab(L"Tabbed Pane", container); | 33 parent->AddTab(L"Tabbed Pane", container); |
| 29 | 34 |
| 30 views::GridLayout* layout = new views::GridLayout(container); | 35 views::GridLayout* layout = new views::GridLayout(container); |
| 31 container->SetLayoutManager(layout); | 36 container->SetLayoutManager(layout); |
| 32 | 37 |
| 33 const int tabbed_pane_column = 0; | 38 const int tabbed_pane_column = 0; |
| 34 views::ColumnSet* column_set = layout->AddColumnSet(tabbed_pane_column); | 39 views::ColumnSet* column_set = layout->AddColumnSet(tabbed_pane_column); |
| 35 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, | 40 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, |
| 36 1.0f, views::GridLayout::USE_PREF, 0, 0); | 41 1.0f, views::GridLayout::USE_PREF, 0, 0); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Control buttons to add, remove or select tabs. | 101 // Control buttons to add, remove or select tabs. |
| 97 views::Button* add_, *add_at_, *remove_at_, *select_at_; | 102 views::Button* add_, *add_at_, *remove_at_, *select_at_; |
| 98 | 103 |
| 99 DISALLOW_COPY_AND_ASSIGN(TabbedPaneExample); | 104 DISALLOW_COPY_AND_ASSIGN(TabbedPaneExample); |
| 100 }; | 105 }; |
| 101 | 106 |
| 102 } // namespace examples | 107 } // namespace examples |
| 103 | 108 |
| 104 #endif // VIEWS_EXAMPLES_TABBED_PANE_EXAMPLE_H_ | 109 #endif // VIEWS_EXAMPLES_TABBED_PANE_EXAMPLE_H_ |
| 105 | 110 |
| OLD | NEW |