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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" | 8 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" |
9 #include "ui/views/layout/grid_layout.h" | 9 #include "ui/views/layout/grid_layout.h" |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 1.0f, GridLayout::USE_PREF, 0, 0); | 47 1.0f, GridLayout::USE_PREF, 0, 0); |
48 } | 48 } |
49 | 49 |
50 layout->StartRow(0 /* no expand */, button_column); | 50 layout->StartRow(0 /* no expand */, button_column); |
51 layout->AddView(add_); | 51 layout->AddView(add_); |
52 layout->AddView(add_at_); | 52 layout->AddView(add_at_); |
53 layout->AddView(remove_at_); | 53 layout->AddView(remove_at_); |
54 layout->AddView(select_at_); | 54 layout->AddView(select_at_); |
55 } | 55 } |
56 | 56 |
57 void TabbedPaneExample::ButtonPressed(Button* sender, const Event& event) { | 57 void TabbedPaneExample::ButtonPressed(Button* sender, const ui::Event& event) { |
58 if (sender == add_) { | 58 if (sender == add_) { |
59 AddButton("Added"); | 59 AddButton("Added"); |
60 } else if (sender == add_at_) { | 60 } else if (sender == add_at_) { |
61 const string16 label = ASCIIToUTF16("Added at 1"); | 61 const string16 label = ASCIIToUTF16("Added at 1"); |
62 tabbed_pane_->AddTabAtIndex(1, label, new TextButton(NULL, label), true); | 62 tabbed_pane_->AddTabAtIndex(1, label, new TextButton(NULL, label), true); |
63 } else if (sender == remove_at_) { | 63 } else if (sender == remove_at_) { |
64 if (tabbed_pane_->GetTabCount() > 1) | 64 if (tabbed_pane_->GetTabCount() > 1) |
65 delete tabbed_pane_->RemoveTabAtIndex(1); | 65 delete tabbed_pane_->RemoveTabAtIndex(1); |
66 } else if (sender == select_at_) { | 66 } else if (sender == select_at_) { |
67 if (tabbed_pane_->GetTabCount() > 1) | 67 if (tabbed_pane_->GetTabCount() > 1) |
(...skipping 13 matching lines...) Expand all Loading... |
81 tabbed_pane_->GetSelectedTabIndex()); | 81 tabbed_pane_->GetSelectedTabIndex()); |
82 } | 82 } |
83 | 83 |
84 void TabbedPaneExample::AddButton(const std::string& label) { | 84 void TabbedPaneExample::AddButton(const std::string& label) { |
85 TextButton* button = new TextButton(NULL, ASCIIToUTF16(label)); | 85 TextButton* button = new TextButton(NULL, ASCIIToUTF16(label)); |
86 tabbed_pane_->AddTab(ASCIIToUTF16(label), button); | 86 tabbed_pane_->AddTab(ASCIIToUTF16(label), button); |
87 } | 87 } |
88 | 88 |
89 } // namespace examples | 89 } // namespace examples |
90 } // namespace views | 90 } // namespace views |
OLD | NEW |