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/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
26 | 26 |
27 namespace views { | 27 namespace views { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 // Menu border widths | 31 // Menu border widths |
32 const int kMenuBorderWidthLeft = 1; | 32 const int kMenuBorderWidthLeft = 1; |
33 const int kMenuBorderWidthTop = 1; | 33 const int kMenuBorderWidthTop = 1; |
34 const int kMenuBorderWidthRight = 1; | 34 const int kMenuBorderWidthRight = 1; |
35 const int kMenuBorderWidthBottom = 2; | |
36 | 35 |
37 // Limit how small a combobox can be. | 36 // Limit how small a combobox can be. |
38 const int kMinComboboxWidth = 25; | 37 const int kMinComboboxWidth = 25; |
39 | 38 |
40 // Size of the combobox arrow margins | 39 // Size of the combobox arrow margins |
41 const int kDisclosureArrowLeftPadding = 7; | 40 const int kDisclosureArrowLeftPadding = 7; |
42 const int kDisclosureArrowRightPadding = 7; | 41 const int kDisclosureArrowRightPadding = 7; |
43 | 42 |
44 // Define the id of the first item in the menu (since it needs to be > 0) | 43 // Define the id of the first item in the menu (since it needs to be > 0) |
45 const int kFirstMenuItemId = 1000; | 44 const int kFirstMenuItemId = 1000; |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 458 |
460 int Combobox::MenuCommandToIndex(int menu_command_id) const { | 459 int Combobox::MenuCommandToIndex(int menu_command_id) const { |
461 // (note that the id received is offset by kFirstMenuItemId) | 460 // (note that the id received is offset by kFirstMenuItemId) |
462 // Revert menu ID offset to map back to combobox model. | 461 // Revert menu ID offset to map back to combobox model. |
463 int index = menu_command_id - kFirstMenuItemId; | 462 int index = menu_command_id - kFirstMenuItemId; |
464 DCHECK_LT(index, model()->GetItemCount()); | 463 DCHECK_LT(index, model()->GetItemCount()); |
465 return index; | 464 return index; |
466 } | 465 } |
467 | 466 |
468 } // namespace views | 467 } // namespace views |
OLD | NEW |