OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 --i) { | 424 --i) { |
425 View* child = child_at(i); | 425 View* child = child_at(i); |
426 int width = child->GetPreferredSize().width(); | 426 int width = child->GetPreferredSize().width(); |
427 child->SetBounds(x - width, 0, width, height()); | 427 child->SetBounds(x - width, 0, width, height()); |
428 x -= width - kChildXPadding; | 428 x -= width - kChildXPadding; |
429 } | 429 } |
430 } | 430 } |
431 } | 431 } |
432 | 432 |
433 int MenuItemView::GetAcceleratorTextWidth() { | 433 int MenuItemView::GetAcceleratorTextWidth() { |
434 #if defined(TOUCH_UI) | |
sky
2011/09/02 00:43:04
How about adding to MenuConfig and option as to wh
| |
435 return 0; | |
436 #else | |
434 string16 text = GetAcceleratorText(); | 437 string16 text = GetAcceleratorText(); |
435 return text.empty() ? 0 : GetFont().GetStringWidth(text); | 438 return text.empty() ? 0 : GetFont().GetStringWidth(text); |
439 #endif | |
436 } | 440 } |
437 | 441 |
438 void MenuItemView::SetMargins(int top_margin, int bottom_margin) { | 442 void MenuItemView::SetMargins(int top_margin, int bottom_margin) { |
439 top_margin_ = top_margin; | 443 top_margin_ = top_margin; |
440 bottom_margin_ = bottom_margin; | 444 bottom_margin_ = bottom_margin; |
441 | 445 |
442 // invalidate GetPreferredSize() cache | 446 // invalidate GetPreferredSize() cache |
443 pref_size_.SetSize(0,0); | 447 pref_size_.SetSize(0,0); |
444 } | 448 } |
445 | 449 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
689 return string16(); | 693 return string16(); |
690 } | 694 } |
691 | 695 |
692 Accelerator accelerator; | 696 Accelerator accelerator; |
693 return (GetDelegate() && | 697 return (GetDelegate() && |
694 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? | 698 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? |
695 accelerator.GetShortcutText() : string16(); | 699 accelerator.GetShortcutText() : string16(); |
696 } | 700 } |
697 | 701 |
698 } // namespace views | 702 } // namespace views |
OLD | NEW |