| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 : model_(model), | 93 : model_(model), |
| 94 listener_(NULL), | 94 listener_(NULL), |
| 95 selected_index_(model_->GetDefaultIndex()), | 95 selected_index_(model_->GetDefaultIndex()), |
| 96 invalid_(false), | 96 invalid_(false), |
| 97 text_border_(new FocusableBorder()), | 97 text_border_(new FocusableBorder()), |
| 98 disclosure_arrow_(ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 98 disclosure_arrow_(ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 99 IDR_MENU_DROPARROW).ToImageSkia()), | 99 IDR_MENU_DROPARROW).ToImageSkia()), |
| 100 dropdown_open_(false) { | 100 dropdown_open_(false) { |
| 101 model_->AddObserver(this); | 101 model_->AddObserver(this); |
| 102 UpdateFromModel(); | 102 UpdateFromModel(); |
| 103 set_focusable(true); | 103 SetFocusable(true); |
| 104 set_border(text_border_); | 104 set_border(text_border_); |
| 105 } | 105 } |
| 106 | 106 |
| 107 Combobox::~Combobox() { | 107 Combobox::~Combobox() { |
| 108 model_->RemoveObserver(this); | 108 model_->RemoveObserver(this); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // static | 111 // static |
| 112 const gfx::Font& Combobox::GetFont() { | 112 const gfx::Font& Combobox::GetFont() { |
| 113 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 113 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 475 |
| 476 int Combobox::MenuCommandToIndex(int menu_command_id) const { | 476 int Combobox::MenuCommandToIndex(int menu_command_id) const { |
| 477 // (note that the id received is offset by kFirstMenuItemId) | 477 // (note that the id received is offset by kFirstMenuItemId) |
| 478 // Revert menu ID offset to map back to combobox model. | 478 // Revert menu ID offset to map back to combobox model. |
| 479 int index = menu_command_id - kFirstMenuItemId; | 479 int index = menu_command_id - kFirstMenuItemId; |
| 480 DCHECK_LT(index, model()->GetItemCount()); | 480 DCHECK_LT(index, model()->GetItemCount()); |
| 481 return index; | 481 return index; |
| 482 } | 482 } |
| 483 | 483 |
| 484 } // namespace views | 484 } // namespace views |
| OLD | NEW |