| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 : model_(model), | 347 : model_(model), |
| 348 style_(STYLE_NORMAL), | 348 style_(STYLE_NORMAL), |
| 349 listener_(NULL), | 349 listener_(NULL), |
| 350 selected_index_(model_->GetDefaultIndex()), | 350 selected_index_(model_->GetDefaultIndex()), |
| 351 invalid_(false), | 351 invalid_(false), |
| 352 menu_model_adapter_(new ComboboxMenuModelAdapter(this, model)), | 352 menu_model_adapter_(new ComboboxMenuModelAdapter(this, model)), |
| 353 text_button_(new TransparentButton(this)), | 353 text_button_(new TransparentButton(this)), |
| 354 arrow_button_(new TransparentButton(this)), | 354 arrow_button_(new TransparentButton(this)), |
| 355 weak_ptr_factory_(this) { | 355 weak_ptr_factory_(this) { |
| 356 ModelChanged(); | 356 ModelChanged(); |
| 357 #if defined(OS_MACOSX) |
| 358 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); |
| 359 #else |
| 357 SetFocusBehavior(FocusBehavior::ALWAYS); | 360 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 361 #endif |
| 362 |
| 358 UpdateBorder(); | 363 UpdateBorder(); |
| 359 // set_background() takes ownership but takes a raw pointer. | 364 // set_background() takes ownership but takes a raw pointer. |
| 360 std::unique_ptr<Background> b = PlatformStyle::CreateComboboxBackground(); | 365 std::unique_ptr<Background> b = PlatformStyle::CreateComboboxBackground(); |
| 361 set_background(b.release()); | 366 set_background(b.release()); |
| 362 | 367 |
| 363 // Initialize the button images. | 368 // Initialize the button images. |
| 364 Button::ButtonState button_states[] = { | 369 Button::ButtonState button_states[] = { |
| 365 Button::STATE_DISABLED, | 370 Button::STATE_DISABLED, |
| 366 Button::STATE_NORMAL, | 371 Button::STATE_NORMAL, |
| 367 Button::STATE_HOVERED, | 372 Button::STATE_HOVERED, |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 return gfx::Size(width, font_list.GetHeight()); | 920 return gfx::Size(width, font_list.GetHeight()); |
| 916 } | 921 } |
| 917 | 922 |
| 918 PrefixSelector* Combobox::GetPrefixSelector() { | 923 PrefixSelector* Combobox::GetPrefixSelector() { |
| 919 if (!selector_) | 924 if (!selector_) |
| 920 selector_.reset(new PrefixSelector(this)); | 925 selector_.reset(new PrefixSelector(this)); |
| 921 return selector_.get(); | 926 return selector_.get(); |
| 922 } | 927 } |
| 923 | 928 |
| 924 } // namespace views | 929 } // namespace views |
| OLD | NEW |