| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 } else { | 540 } else { |
| 541 // Child views are laid out right aligned and given the full height. To | 541 // Child views are laid out right aligned and given the full height. To |
| 542 // right align start with the last view and progress to the first. | 542 // right align start with the last view and progress to the first. |
| 543 int x = width() - (use_right_margin_ ? item_right_margin_ : 0); | 543 int x = width() - (use_right_margin_ ? item_right_margin_ : 0); |
| 544 for (int i = child_count() - 1; i >= 0; --i) { | 544 for (int i = child_count() - 1; i >= 0; --i) { |
| 545 View* child = child_at(i); | 545 View* child = child_at(i); |
| 546 if (icon_view_ && (icon_view_ == child)) | 546 if (icon_view_ && (icon_view_ == child)) |
| 547 continue; | 547 continue; |
| 548 int width = child->GetPreferredSize().width(); | 548 int width = child->GetPreferredSize().width(); |
| 549 child->SetBounds(x - width, 0, width, height()); | 549 child->SetBounds(x - width, 0, width, height()); |
| 550 x -= width - kChildXPadding; | 550 x -= width + kChildXPadding; |
| 551 } | 551 } |
| 552 // Position |icon_view|. | 552 // Position |icon_view|. |
| 553 const MenuConfig& config = MenuConfig::instance(); | 553 const MenuConfig& config = MenuConfig::instance(); |
| 554 if (icon_view_) { | 554 if (icon_view_) { |
| 555 icon_view_->SizeToPreferredSize(); | 555 icon_view_->SizeToPreferredSize(); |
| 556 gfx::Size size = icon_view_->GetPreferredSize(); | 556 gfx::Size size = icon_view_->GetPreferredSize(); |
| 557 int x = config.item_left_margin + left_icon_margin_ + | 557 int x = config.item_left_margin + left_icon_margin_ + |
| 558 (icon_area_width_ - size.width()) / 2; | 558 (icon_area_width_ - size.width()) / 2; |
| 559 if (config.icons_in_label || type_ == CHECKBOX || type_ == RADIO) | 559 if (config.icons_in_label || type_ == CHECKBOX || type_ == RADIO) |
| 560 x = label_start_; | 560 x = label_start_; |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 } else { | 1081 } else { |
| 1082 const Type& type = menu_item->GetType(); | 1082 const Type& type = menu_item->GetType(); |
| 1083 if (type == CHECKBOX || type == RADIO) | 1083 if (type == CHECKBOX || type == RADIO) |
| 1084 return true; | 1084 return true; |
| 1085 } | 1085 } |
| 1086 } | 1086 } |
| 1087 return false; | 1087 return false; |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 } // namespace views | 1090 } // namespace views |
| OLD | NEW |