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

Side by Side Diff: ui/views/controls/menu/menu_item_view.cc

Issue 10533086: Action box menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Action box menu Created 8 years, 5 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 | 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/controls/menu/menu_item_view.h" 5 #include "ui/views/controls/menu/menu_item_view.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 else 225 else
226 item->SetTitle(label); 226 item->SetTitle(label);
227 if (!icon.empty()) 227 if (!icon.empty())
228 item->SetIcon(icon); 228 item->SetIcon(icon);
229 if (type == SUBMENU) 229 if (type == SUBMENU)
230 item->CreateSubmenu(); 230 item->CreateSubmenu();
231 submenu_->AddChildViewAt(item, index); 231 submenu_->AddChildViewAt(item, index);
232 return item; 232 return item;
233 } 233 }
234 234
235 void MenuItemView::AddMenuItemAt(int index, MenuItemView* item) {
236 DCHECK_LE(0, index);
237 submenu_->AddChildViewAt(item, index);
238 }
239
235 void MenuItemView::RemoveMenuItemAt(int index) { 240 void MenuItemView::RemoveMenuItemAt(int index) {
236 DCHECK(submenu_); 241 DCHECK(submenu_);
237 DCHECK_LE(0, index); 242 DCHECK_LE(0, index);
238 DCHECK_GT(submenu_->child_count(), index); 243 DCHECK_GT(submenu_->child_count(), index);
239 244
240 View* item = submenu_->child_at(index); 245 View* item = submenu_->child_at(index);
241 DCHECK(item); 246 DCHECK(item);
242 submenu_->RemoveChildView(item); 247 submenu_->RemoveChildView(item);
243 248
244 // RemoveChildView() does not delete the item, which is a good thing 249 // RemoveChildView() does not delete the item, which is a good thing
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 temp_width = menu_item->GetMaxIconViewWidth(); 850 temp_width = menu_item->GetMaxIconViewWidth();
846 } else if (menu_item->icon_view()) { 851 } else if (menu_item->icon_view()) {
847 temp_width = menu_item->icon_view()->GetPreferredSize().width(); 852 temp_width = menu_item->icon_view()->GetPreferredSize().width();
848 } 853 }
849 width = std::max(width, temp_width); 854 width = std::max(width, temp_width);
850 } 855 }
851 return width; 856 return width;
852 } 857 }
853 858
854 } // namespace views 859 } // namespace views
OLDNEW
« ui/views/controls/menu/menu_item_view.h ('K') | « ui/views/controls/menu/menu_item_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698