| 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 #ifndef UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| 6 #define UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "build/build_config.h" |
| 11 #include "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" |
| 12 #include "ui/gfx/animation/animation_delegate.h" | 13 #include "ui/gfx/animation/animation_delegate.h" |
| 13 #include "ui/gfx/animation/throb_animation.h" | 14 #include "ui/gfx/animation/throb_animation.h" |
| 14 #include "ui/views/animation/ink_drop_state.h" | 15 #include "ui/views/animation/ink_drop_state.h" |
| 15 #include "ui/views/controls/button/button.h" | 16 #include "ui/views/controls/button/button.h" |
| 16 | 17 |
| 17 namespace views { | 18 namespace views { |
| 18 | 19 |
| 19 class InkDropDelegate; | 20 class InkDropDelegate; |
| 20 | 21 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 void SetAnimationDuration(int duration); | 56 void SetAnimationDuration(int duration); |
| 56 | 57 |
| 57 void set_triggerable_event_flags(int triggerable_event_flags) { | 58 void set_triggerable_event_flags(int triggerable_event_flags) { |
| 58 triggerable_event_flags_ = triggerable_event_flags; | 59 triggerable_event_flags_ = triggerable_event_flags; |
| 59 } | 60 } |
| 60 int triggerable_event_flags() const { return triggerable_event_flags_; } | 61 int triggerable_event_flags() const { return triggerable_event_flags_; } |
| 61 | 62 |
| 62 // Sets whether |RequestFocus| should be invoked on a mouse press. The default | 63 // Sets whether |RequestFocus| should be invoked on a mouse press. The default |
| 63 // is false. | 64 // is false. |
| 64 void set_request_focus_on_press(bool value) { | 65 void set_request_focus_on_press(bool value) { |
| 66 // On Mac, buttons should not request focus on a mouse press. Hence keep the |
| 67 // default value i.e. false. |
| 68 #if !defined(OS_MACOSX) |
| 65 request_focus_on_press_ = value; | 69 request_focus_on_press_ = value; |
| 70 #endif |
| 66 } | 71 } |
| 72 |
| 67 bool request_focus_on_press() const { return request_focus_on_press_; } | 73 bool request_focus_on_press() const { return request_focus_on_press_; } |
| 68 | 74 |
| 69 // See description above field. | 75 // See description above field. |
| 70 void set_animate_on_state_change(bool value) { | 76 void set_animate_on_state_change(bool value) { |
| 71 animate_on_state_change_ = value; | 77 animate_on_state_change_ = value; |
| 72 } | 78 } |
| 73 | 79 |
| 74 // Sets the event on which the button should notify its listener. | 80 // Sets the event on which the button should notify its listener. |
| 75 void set_notify_action(NotifyAction notify_action) { | 81 void set_notify_action(NotifyAction notify_action) { |
| 76 notify_action_ = notify_action; | 82 notify_action_ = notify_action; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // because it needs to paint to a layer so it can extend beyond the bounds of | 220 // because it needs to paint to a layer so it can extend beyond the bounds of |
| 215 // |this|. | 221 // |this|. |
| 216 views::View* md_focus_ring_; | 222 views::View* md_focus_ring_; |
| 217 | 223 |
| 218 DISALLOW_COPY_AND_ASSIGN(CustomButton); | 224 DISALLOW_COPY_AND_ASSIGN(CustomButton); |
| 219 }; | 225 }; |
| 220 | 226 |
| 221 } // namespace views | 227 } // namespace views |
| 222 | 228 |
| 223 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 229 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| OLD | NEW |