| 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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/events/event_constants.h" | 9 #include "ui/events/event_constants.h" |
| 10 #include "ui/gfx/animation/animation_delegate.h" | 10 #include "ui/gfx/animation/animation_delegate.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // holds the mouse down over the button. For this implementation, | 119 // holds the mouse down over the button. For this implementation, |
| 120 // we simply return IsTriggerableEvent(event). | 120 // we simply return IsTriggerableEvent(event). |
| 121 virtual bool ShouldEnterPushedState(const ui::Event& event); | 121 virtual bool ShouldEnterPushedState(const ui::Event& event); |
| 122 | 122 |
| 123 // Returns true if the button should enter hovered state; that is, if the | 123 // Returns true if the button should enter hovered state; that is, if the |
| 124 // mouse is over the button, and no other window has capture (which would | 124 // mouse is over the button, and no other window has capture (which would |
| 125 // prevent the button from receiving MouseExited events and updating its | 125 // prevent the button from receiving MouseExited events and updating its |
| 126 // state). This does not take into account enabled state. | 126 // state). This does not take into account enabled state. |
| 127 bool ShouldEnterHoveredState(); | 127 bool ShouldEnterHoveredState(); |
| 128 | 128 |
| 129 void SetInkDropDelegate(scoped_ptr<InkDropDelegate> ink_drop_delegate); | 129 InkDropDelegate* ink_drop_delegate() const { return ink_drop_delegate_; } |
| 130 InkDropDelegate* ink_drop_delegate() const { | 130 void set_ink_drop_delegate(InkDropDelegate* ink_drop_delegate) { |
| 131 return ink_drop_delegate_.get(); | 131 ink_drop_delegate_ = ink_drop_delegate; |
| 132 } | 132 } |
| 133 | 133 |
| 134 // Overridden from View: | 134 // Overridden from View: |
| 135 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 135 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| 136 void ViewHierarchyChanged( | 136 void ViewHierarchyChanged( |
| 137 const ViewHierarchyChangedDetails& details) override; | 137 const ViewHierarchyChangedDetails& details) override; |
| 138 void OnBlur() override; | 138 void OnBlur() override; |
| 139 | 139 |
| 140 // The button state (defined in implementation) | 140 // The button state (defined in implementation) |
| 141 ButtonState state_; | 141 ButtonState state_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 154 | 154 |
| 155 // Is the hover animation running because StartThrob was invoked? | 155 // Is the hover animation running because StartThrob was invoked? |
| 156 bool is_throbbing_; | 156 bool is_throbbing_; |
| 157 | 157 |
| 158 // Mouse event flags which can trigger button actions. | 158 // Mouse event flags which can trigger button actions. |
| 159 int triggerable_event_flags_; | 159 int triggerable_event_flags_; |
| 160 | 160 |
| 161 // See description above setter. | 161 // See description above setter. |
| 162 bool request_focus_on_press_; | 162 bool request_focus_on_press_; |
| 163 | 163 |
| 164 // Animation delegate for the ink drop ripple effect. | 164 // Animation delegate for the ink drop ripple effect. It is owned by a |
| 165 scoped_ptr<InkDropDelegate> ink_drop_delegate_; | 165 // descendant class and needs to be reset before an instance of the concrete |
| 166 // CustomButton is destroyed. |
| 167 InkDropDelegate* ink_drop_delegate_; |
| 166 | 168 |
| 167 // The event on which the button should notify its listener. | 169 // The event on which the button should notify its listener. |
| 168 NotifyAction notify_action_; | 170 NotifyAction notify_action_; |
| 169 | 171 |
| 170 DISALLOW_COPY_AND_ASSIGN(CustomButton); | 172 DISALLOW_COPY_AND_ASSIGN(CustomButton); |
| 171 }; | 173 }; |
| 172 | 174 |
| 173 } // namespace views | 175 } // namespace views |
| 174 | 176 |
| 175 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 177 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| OLD | NEW |