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 "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/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 &left_icon_margin_, | 1025 &left_icon_margin_, |
1026 &right_icon_margin_); | 1026 &right_icon_margin_); |
1027 } else { | 1027 } else { |
1028 left_icon_margin_ = 0; | 1028 left_icon_margin_ = 0; |
1029 right_icon_margin_ = 0; | 1029 right_icon_margin_ = 0; |
1030 } | 1030 } |
1031 int label_start = GetLabelStartForThisItem(); | 1031 int label_start = GetLabelStartForThisItem(); |
1032 | 1032 |
1033 int string_width = font.GetStringWidth(title_); | 1033 int string_width = font.GetStringWidth(title_); |
1034 if (!subtitle_.empty()) | 1034 if (!subtitle_.empty()) |
1035 string_width = std::max(string_width, font.GetStringWidth(subtitle_)); | 1035 string_width = std::max<int>(string_width, font.GetStringWidth(subtitle_)); |
1036 | 1036 |
1037 dimensions.standard_width = string_width + label_start + | 1037 dimensions.standard_width = string_width + label_start + |
1038 item_right_margin_; | 1038 item_right_margin_; |
1039 // Determine the length of the right-side text. | 1039 // Determine the length of the right-side text. |
1040 string16 minor_text = GetMinorText(); | 1040 string16 minor_text = GetMinorText(); |
1041 dimensions.minor_text_width = | 1041 dimensions.minor_text_width = |
1042 minor_text.empty() ? 0 : GetFont().GetStringWidth(minor_text); | 1042 minor_text.empty() ? 0 : GetFont().GetStringWidth(minor_text); |
1043 | 1043 |
1044 // Determine the height to use. | 1044 // Determine the height to use. |
1045 dimensions.height = std::max(dimensions.height, | 1045 dimensions.height = std::max(dimensions.height, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 } else { | 1110 } else { |
1111 const Type& type = menu_item->GetType(); | 1111 const Type& type = menu_item->GetType(); |
1112 if (type == CHECKBOX || type == RADIO) | 1112 if (type == CHECKBOX || type == RADIO) |
1113 return true; | 1113 return true; |
1114 } | 1114 } |
1115 } | 1115 } |
1116 return false; | 1116 return false; |
1117 } | 1117 } |
1118 | 1118 |
1119 } // namespace views | 1119 } // namespace views |
OLD | NEW |