OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ui/views/examples/tabbed_pane_example.h" | 5 #include "ui/views/examples/tabbed_pane_example.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/views/controls/button/label_button.h" | 8 #include "ui/views/controls/button/label_button.h" |
9 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" | 9 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" |
10 #include "ui/views/layout/grid_layout.h" | 10 #include "ui/views/layout/grid_layout.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 namespace examples { | 13 namespace examples { |
14 | 14 |
15 TabbedPaneExample::TabbedPaneExample() : ExampleBase("Tabbed Pane") { | 15 TabbedPaneExample::TabbedPaneExample() : ExampleBase("Tabbed Pane") { |
16 } | 16 } |
17 | 17 |
18 TabbedPaneExample::~TabbedPaneExample() { | 18 TabbedPaneExample::~TabbedPaneExample() { |
19 } | 19 } |
20 | 20 |
21 void TabbedPaneExample::CreateExampleView(View* container) { | 21 void TabbedPaneExample::CreateExampleView(View* container) { |
22 tabbed_pane_ = new TabbedPane(false); | 22 tabbed_pane_ = new TabbedPane(); |
23 tabbed_pane_->set_listener(this); | 23 tabbed_pane_->set_listener(this); |
24 add_ = new LabelButton(this, ASCIIToUTF16("Add")); | 24 add_ = new LabelButton(this, ASCIIToUTF16("Add")); |
25 add_at_ = new LabelButton(this, ASCIIToUTF16("Add At 1")); | 25 add_at_ = new LabelButton(this, ASCIIToUTF16("Add At 1")); |
26 select_at_ = new LabelButton(this, ASCIIToUTF16("Select At 1")); | 26 select_at_ = new LabelButton(this, ASCIIToUTF16("Select At 1")); |
27 | 27 |
28 GridLayout* layout = new GridLayout(container); | 28 GridLayout* layout = new GridLayout(container); |
29 container->SetLayoutManager(layout); | 29 container->SetLayoutManager(layout); |
30 | 30 |
31 const int tabbed_pane_column = 0; | 31 const int tabbed_pane_column = 0; |
32 ColumnSet* column_set = layout->AddColumnSet(tabbed_pane_column); | 32 ColumnSet* column_set = layout->AddColumnSet(tabbed_pane_column); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 tabbed_pane_->selected_tab_index()); | 77 tabbed_pane_->selected_tab_index()); |
78 } | 78 } |
79 | 79 |
80 void TabbedPaneExample::AddButton(const std::string& label) { | 80 void TabbedPaneExample::AddButton(const std::string& label) { |
81 LabelButton* button = new LabelButton(NULL, ASCIIToUTF16(label)); | 81 LabelButton* button = new LabelButton(NULL, ASCIIToUTF16(label)); |
82 tabbed_pane_->AddTab(ASCIIToUTF16(label), button); | 82 tabbed_pane_->AddTab(ASCIIToUTF16(label), button); |
83 } | 83 } |
84 | 84 |
85 } // namespace examples | 85 } // namespace examples |
86 } // namespace views | 86 } // namespace views |
OLD | NEW |