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

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

Issue 108063004: Give up focus if the focused view becomes unfocusable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years 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 | Annotate | Revision Log
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 27 matching lines...) Expand all
38 model_.GetRoot()->Add(sheep_node, 0); 38 model_.GetRoot()->Add(sheep_node, 0);
39 sheep_node->Add(new NodeType(ASCIIToUTF16("Sheep 1"), 1), 0); 39 sheep_node->Add(new NodeType(ASCIIToUTF16("Sheep 1"), 1), 0);
40 sheep_node->Add(new NodeType(ASCIIToUTF16("Sheep 2"), 1), 1); 40 sheep_node->Add(new NodeType(ASCIIToUTF16("Sheep 2"), 1), 1);
41 41
42 tree_view_ = new TreeView(); 42 tree_view_ = new TreeView();
43 tree_view_->set_context_menu_controller(this); 43 tree_view_->set_context_menu_controller(this);
44 tree_view_->SetRootShown(false); 44 tree_view_->SetRootShown(false);
45 tree_view_->SetModel(&model_); 45 tree_view_->SetModel(&model_);
46 tree_view_->SetController(this); 46 tree_view_->SetController(this);
47 add_ = new LabelButton(this, ASCIIToUTF16("Add")); 47 add_ = new LabelButton(this, ASCIIToUTF16("Add"));
48 add_->set_focusable(true); 48 add_->SetFocusable(true);
49 remove_ = new LabelButton(this, ASCIIToUTF16("Remove")); 49 remove_ = new LabelButton(this, ASCIIToUTF16("Remove"));
50 remove_->set_focusable(true); 50 remove_->SetFocusable(true);
51 change_title_ = new LabelButton(this, ASCIIToUTF16("Change Title")); 51 change_title_ = new LabelButton(this, ASCIIToUTF16("Change Title"));
52 change_title_->set_focusable(true); 52 change_title_->SetFocusable(true);
53 53
54 GridLayout* layout = new GridLayout(container); 54 GridLayout* layout = new GridLayout(container);
55 container->SetLayoutManager(layout); 55 container->SetLayoutManager(layout);
56 56
57 const int tree_view_column = 0; 57 const int tree_view_column = 0;
58 ColumnSet* column_set = layout->AddColumnSet(tree_view_column); 58 ColumnSet* column_set = layout->AddColumnSet(tree_view_column);
59 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 59 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL,
60 1.0f, GridLayout::USE_PREF, 0, 0); 60 1.0f, GridLayout::USE_PREF, 0, 0);
61 layout->StartRow(1 /* expand */, tree_view_column); 61 layout->StartRow(1 /* expand */, tree_view_column);
62 layout->AddView(tree_view_->CreateParentIfNecessary()); 62 layout->AddView(tree_view_->CreateParentIfNecessary());
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 case ID_ADD: 163 case ID_ADD:
164 AddNewNode(); 164 AddNewNode();
165 break; 165 break;
166 default: 166 default:
167 NOTREACHED(); 167 NOTREACHED();
168 } 168 }
169 } 169 }
170 170
171 } // namespace examples 171 } // namespace examples
172 } // namespace views 172 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698