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

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

Issue 6622002: Do all OOLing in the views code. linux_views now builds clean with the clang plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "views/controls/menu/menu_item_view.h" 5 #include "views/controls/menu/menu_item_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "grit/app_strings.h" 8 #include "grit/app_strings.h"
9 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/base/models/menu_model.h" 10 #include "ui/base/models/menu_model.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 submenu_->AddChildView(item); 311 submenu_->AddChildView(item);
312 return item; 312 return item;
313 } 313 }
314 314
315 SubmenuView* MenuItemView::CreateSubmenu() { 315 SubmenuView* MenuItemView::CreateSubmenu() {
316 if (!submenu_) 316 if (!submenu_)
317 submenu_ = new SubmenuView(this); 317 submenu_ = new SubmenuView(this);
318 return submenu_; 318 return submenu_;
319 } 319 }
320 320
321 bool MenuItemView::HasSubmenu() const {
322 return (submenu_ != NULL);
323 }
324
325 SubmenuView* MenuItemView::GetSubmenu() const {
326 return submenu_;
327 }
328
321 void MenuItemView::SetTitle(const std::wstring& title) { 329 void MenuItemView::SetTitle(const std::wstring& title) {
322 title_ = WideToUTF16Hack(title); 330 title_ = WideToUTF16Hack(title);
323 SetAccessibleName(GetAccessibleNameForMenuItem(title_, GetAcceleratorText())); 331 SetAccessibleName(GetAccessibleNameForMenuItem(title_, GetAcceleratorText()));
324 pref_size_.SetSize(0, 0); // Triggers preferred size recalculation. 332 pref_size_.SetSize(0, 0); // Triggers preferred size recalculation.
325 } 333 }
326 334
327 void MenuItemView::SetSelected(bool selected) { 335 void MenuItemView::SetSelected(bool selected) {
328 selected_ = selected; 336 selected_ = selected;
329 SchedulePaint(); 337 SchedulePaint();
330 } 338 }
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 } 685 }
678 686
679 string16 MenuItemView::GetAcceleratorText() { 687 string16 MenuItemView::GetAcceleratorText() {
680 Accelerator accelerator; 688 Accelerator accelerator;
681 return (GetDelegate() && 689 return (GetDelegate() &&
682 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? 690 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ?
683 accelerator.GetShortcutText() : string16(); 691 accelerator.GetShortcutText() : string16();
684 } 692 }
685 693
686 } // namespace views 694 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698