Chromium Code Reviews| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 return bounds; | 103 return bounds; |
| 104 } | 104 } |
| 105 | 105 |
| 106 // The transparent button which holds a button state but is not rendered. | 106 // The transparent button which holds a button state but is not rendered. |
| 107 class TransparentButton : public CustomButton { | 107 class TransparentButton : public CustomButton { |
| 108 public: | 108 public: |
| 109 TransparentButton(ButtonListener* listener) | 109 TransparentButton(ButtonListener* listener) |
| 110 : CustomButton(listener) { | 110 : CustomButton(listener) { |
| 111 SetAnimationDuration(LabelButton::kHoverAnimationDurationMs); | 111 SetAnimationDuration(LabelButton::kHoverAnimationDurationMs); |
| 112 SetFocusBehavior(FocusBehavior::NEVER); | 112 SetFocusBehavior(FocusBehavior::NEVER); |
| 113 set_notify_action(NOTIFY_ON_PRESS); | |
|
tapted
2016/06/16 00:05:13
We need to restrict this just to Mac - I think the
spqchan
2016/06/22 02:16:38
Done.
| |
| 113 } | 114 } |
| 114 ~TransparentButton() override {} | 115 ~TransparentButton() override {} |
| 115 | 116 |
| 116 bool OnMousePressed(const ui::MouseEvent& mouse_event) override { | 117 bool OnMousePressed(const ui::MouseEvent& mouse_event) override { |
| 117 parent()->RequestFocus(); | 118 parent()->RequestFocus(); |
|
tapted
2016/06/16 00:05:13
This actually isn't needed, CustomButton has a set
spqchan
2016/06/22 02:16:38
Done.
| |
| 119 CustomButton::OnMousePressed(mouse_event); | |
| 118 return true; | 120 return true; |
| 119 } | 121 } |
| 120 | 122 |
| 121 double GetAnimationValue() const { | 123 double GetAnimationValue() const { |
| 122 return hover_animation().GetCurrentValue(); | 124 return hover_animation().GetCurrentValue(); |
| 123 } | 125 } |
| 124 | 126 |
| 125 private: | 127 private: |
| 126 DISALLOW_COPY_AND_ASSIGN(TransparentButton); | 128 DISALLOW_COPY_AND_ASSIGN(TransparentButton); |
| 127 }; | 129 }; |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 897 | 899 |
| 898 int Combobox::GetArrowContainerWidth() const { | 900 int Combobox::GetArrowContainerWidth() const { |
| 899 const int kNormalPadding = 7; | 901 const int kNormalPadding = 7; |
| 900 int padding = style_ == STYLE_NORMAL | 902 int padding = style_ == STYLE_NORMAL |
| 901 ? kNormalPadding * 2 | 903 ? kNormalPadding * 2 |
| 902 : kActionLeftPadding + kActionRightPadding; | 904 : kActionLeftPadding + kActionRightPadding; |
| 903 return ArrowSize().width() + padding; | 905 return ArrowSize().width() + padding; |
| 904 } | 906 } |
| 905 | 907 |
| 906 } // namespace views | 908 } // namespace views |
| OLD | NEW |