Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: ui/views/examples/tree_view_example.cc

Issue 1894383002: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SetFocusBehavior
Patch Set: Rebased Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tree_view_example.h" 5 #include "ui/views/examples/tree_view_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/menu/menu_model_adapter.h" 9 #include "ui/views/controls/menu/menu_model_adapter.h"
10 #include "ui/views/controls/menu/menu_runner.h" 10 #include "ui/views/controls/menu/menu_runner.h"
(...skipping 29 matching lines...) Expand all
40 model_.GetRoot()->Add(sheep_node, 0); 40 model_.GetRoot()->Add(sheep_node, 0);
41 sheep_node->Add(new NodeType(ASCIIToUTF16("Sheep 1"), 1), 0); 41 sheep_node->Add(new NodeType(ASCIIToUTF16("Sheep 1"), 1), 0);
42 sheep_node->Add(new NodeType(ASCIIToUTF16("Sheep 2"), 1), 1); 42 sheep_node->Add(new NodeType(ASCIIToUTF16("Sheep 2"), 1), 1);
43 43
44 tree_view_ = new TreeView(); 44 tree_view_ = new TreeView();
45 tree_view_->set_context_menu_controller(this); 45 tree_view_->set_context_menu_controller(this);
46 tree_view_->SetRootShown(false); 46 tree_view_->SetRootShown(false);
47 tree_view_->SetModel(&model_); 47 tree_view_->SetModel(&model_);
48 tree_view_->SetController(this); 48 tree_view_->SetController(this);
49 add_ = new LabelButton(this, ASCIIToUTF16("Add")); 49 add_ = new LabelButton(this, ASCIIToUTF16("Add"));
50 add_->SetFocusBehavior(View::FocusBehavior::ALWAYS); 50 Button::ConfigureDefaultFocus(add_);
51 remove_ = new LabelButton(this, ASCIIToUTF16("Remove")); 51 remove_ = new LabelButton(this, ASCIIToUTF16("Remove"));
52 remove_->SetFocusBehavior(View::FocusBehavior::ALWAYS); 52 Button::ConfigureDefaultFocus(remove_);
53 change_title_ = new LabelButton(this, ASCIIToUTF16("Change Title")); 53 change_title_ = new LabelButton(this, ASCIIToUTF16("Change Title"));
54 change_title_->SetFocusBehavior(View::FocusBehavior::ALWAYS); 54 Button::ConfigureDefaultFocus(change_title_);
55 55
56 GridLayout* layout = new GridLayout(container); 56 GridLayout* layout = new GridLayout(container);
57 container->SetLayoutManager(layout); 57 container->SetLayoutManager(layout);
58 58
59 const int tree_view_column = 0; 59 const int tree_view_column = 0;
60 ColumnSet* column_set = layout->AddColumnSet(tree_view_column); 60 ColumnSet* column_set = layout->AddColumnSet(tree_view_column);
61 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 61 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL,
62 1.0f, GridLayout::USE_PREF, 0, 0); 62 1.0f, GridLayout::USE_PREF, 0, 0);
63 layout->StartRow(1 /* expand */, tree_view_column); 63 layout->StartRow(1 /* expand */, tree_view_column);
64 layout->AddView(tree_view_->CreateParentIfNecessary()); 64 layout->AddView(tree_view_->CreateParentIfNecessary());
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 case ID_ADD: 169 case ID_ADD:
170 AddNewNode(); 170 AddNewNode();
171 break; 171 break;
172 default: 172 default:
173 NOTREACHED(); 173 NOTREACHED();
174 } 174 }
175 } 175 }
176 176
177 } // namespace examples 177 } // namespace examples
178 } // namespace views 178 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698