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

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

Issue 2790773002: Cleanup MenuRunner API (Closed)
Patch Set: Rebase Created 3 years, 8 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
« no previous file with comments | « ui/views/examples/menu_example.cc ('k') | ui/views/test/combobox_test_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "ui/views/controls/button/label_button.h" 9 #include "ui/views/controls/button/label_button.h"
10 #include "ui/views/controls/menu/menu_model_adapter.h" 10 #include "ui/views/controls/menu/menu_model_adapter.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return true; 126 return true;
127 } 127 }
128 128
129 void TreeViewExample::ShowContextMenuForView(View* source, 129 void TreeViewExample::ShowContextMenuForView(View* source,
130 const gfx::Point& point, 130 const gfx::Point& point,
131 ui::MenuSourceType source_type) { 131 ui::MenuSourceType source_type) {
132 context_menu_model_.reset(new ui::SimpleMenuModel(this)); 132 context_menu_model_.reset(new ui::SimpleMenuModel(this));
133 context_menu_model_->AddItem(ID_EDIT, ASCIIToUTF16("Edit")); 133 context_menu_model_->AddItem(ID_EDIT, ASCIIToUTF16("Edit"));
134 context_menu_model_->AddItem(ID_REMOVE, ASCIIToUTF16("Remove")); 134 context_menu_model_->AddItem(ID_REMOVE, ASCIIToUTF16("Remove"));
135 context_menu_model_->AddItem(ID_ADD, ASCIIToUTF16("Add")); 135 context_menu_model_->AddItem(ID_ADD, ASCIIToUTF16("Add"));
136 context_menu_runner_.reset( 136 context_menu_runner_.reset(new MenuRunner(context_menu_model_.get(), 0));
137 new MenuRunner(context_menu_model_.get(), MenuRunner::ASYNC));
138 context_menu_runner_->RunMenuAt(source->GetWidget(), nullptr, 137 context_menu_runner_->RunMenuAt(source->GetWidget(), nullptr,
139 gfx::Rect(point, gfx::Size()), 138 gfx::Rect(point, gfx::Size()),
140 MENU_ANCHOR_TOPLEFT, source_type); 139 MENU_ANCHOR_TOPLEFT, source_type);
141 } 140 }
142 141
143 bool TreeViewExample::IsCommandIdChecked(int command_id) const { 142 bool TreeViewExample::IsCommandIdChecked(int command_id) const {
144 return false; 143 return false;
145 } 144 }
146 145
147 bool TreeViewExample::IsCommandIdEnabled(int command_id) const { 146 bool TreeViewExample::IsCommandIdEnabled(int command_id) const {
(...skipping 13 matching lines...) Expand all
161 case ID_ADD: 160 case ID_ADD:
162 AddNewNode(); 161 AddNewNode();
163 break; 162 break;
164 default: 163 default:
165 NOTREACHED(); 164 NOTREACHED();
166 } 165 }
167 } 166 }
168 167
169 } // namespace examples 168 } // namespace examples
170 } // namespace views 169 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/menu_example.cc ('k') | ui/views/test/combobox_test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698