| Index: ui/views/examples/tabbed_pane_example.cc
|
| ===================================================================
|
| --- ui/views/examples/tabbed_pane_example.cc (revision 181830)
|
| +++ ui/views/examples/tabbed_pane_example.cc (working copy)
|
| @@ -22,6 +22,7 @@
|
| tabbed_pane_->set_listener(this);
|
| add_ = new TextButton(this, ASCIIToUTF16("Add"));
|
| add_at_ = new TextButton(this, ASCIIToUTF16("Add At 1"));
|
| + remove_at_ = new TextButton(this, ASCIIToUTF16("Remove At 1"));
|
| select_at_ = new TextButton(this, ASCIIToUTF16("Select At 1"));
|
|
|
| GridLayout* layout = new GridLayout(container);
|
| @@ -41,7 +42,7 @@
|
| // Add control buttons horizontally.
|
| const int button_column = 1;
|
| column_set = layout->AddColumnSet(button_column);
|
| - for (int i = 0; i < 3; i++) {
|
| + for (int i = 0; i < 4; i++) {
|
| column_set->AddColumn(GridLayout::FILL, GridLayout::FILL,
|
| 1.0f, GridLayout::USE_PREF, 0, 0);
|
| }
|
| @@ -49,6 +50,7 @@
|
| layout->StartRow(0 /* no expand */, button_column);
|
| layout->AddView(add_);
|
| layout->AddView(add_at_);
|
| + layout->AddView(remove_at_);
|
| layout->AddView(select_at_);
|
| }
|
|
|
| @@ -57,7 +59,10 @@
|
| AddButton("Added");
|
| } else if (sender == add_at_) {
|
| const string16 label = ASCIIToUTF16("Added at 1");
|
| - tabbed_pane_->AddTabAtIndex(1, label, new TextButton(NULL, label));
|
| + tabbed_pane_->AddTabAtIndex(1, label, new TextButton(NULL, label), true);
|
| + } else if (sender == remove_at_) {
|
| + if (tabbed_pane_->GetTabCount() > 1)
|
| + delete tabbed_pane_->RemoveTabAtIndex(1);
|
| } else if (sender == select_at_) {
|
| if (tabbed_pane_->GetTabCount() > 1)
|
| tabbed_pane_->SelectTabAt(1);
|
| @@ -73,7 +78,7 @@
|
| void TabbedPaneExample::PrintStatus() {
|
| ExampleBase::PrintStatus("Tab Count:%d, Selected Tab:%d",
|
| tabbed_pane_->GetTabCount(),
|
| - tabbed_pane_->selected_tab_index());
|
| + tabbed_pane_->GetSelectedTabIndex());
|
| }
|
|
|
| void TabbedPaneExample::AddButton(const std::string& label) {
|
|
|