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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 // The transparent button which holds a button state but is not rendered. | 85 // The transparent button which holds a button state but is not rendered. |
86 class TransparentButton : public CustomButton { | 86 class TransparentButton : public CustomButton { |
87 public: | 87 public: |
88 TransparentButton(ButtonListener* listener) | 88 TransparentButton(ButtonListener* listener) |
89 : CustomButton(listener) { | 89 : CustomButton(listener) { |
90 SetAnimationDuration(LabelButton::kHoverAnimationDurationMs); | 90 SetAnimationDuration(LabelButton::kHoverAnimationDurationMs); |
91 } | 91 } |
92 virtual ~TransparentButton() {} | 92 virtual ~TransparentButton() {} |
93 | 93 |
| 94 virtual bool OnMousePressed(const ui::MouseEvent& mouse_event) OVERRIDE { |
| 95 parent()->RequestFocus(); |
| 96 return true; |
| 97 } |
| 98 |
94 double GetAnimationValue() const { | 99 double GetAnimationValue() const { |
95 return hover_animation_->GetCurrentValue(); | 100 return hover_animation_->GetCurrentValue(); |
96 } | 101 } |
97 | 102 |
98 private: | 103 private: |
99 DISALLOW_COPY_AND_ASSIGN(TransparentButton); | 104 DISALLOW_COPY_AND_ASSIGN(TransparentButton); |
100 }; | 105 }; |
101 | 106 |
102 // Returns the next or previous valid index (depending on |increment|'s value). | 107 // Returns the next or previous valid index (depending on |increment|'s value). |
103 // Skips separator or disabled indices. Returns -1 if there is no valid adjacent | 108 // Skips separator or disabled indices. Returns -1 if there is no valid adjacent |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 case STYLE_NORMAL: | 822 case STYLE_NORMAL: |
818 return kDisclosureArrowRightPadding; | 823 return kDisclosureArrowRightPadding; |
819 case STYLE_ACTION: | 824 case STYLE_ACTION: |
820 return kDisclosureArrowButtonRightPadding; | 825 return kDisclosureArrowButtonRightPadding; |
821 } | 826 } |
822 NOTREACHED(); | 827 NOTREACHED(); |
823 return 0; | 828 return 0; |
824 } | 829 } |
825 | 830 |
826 } // namespace views | 831 } // namespace views |
OLD | NEW |