| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| 6 #define VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 6 #define VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| 7 | 7 |
| 8 #include "app/animation.h" | 8 #include "app/animation.h" |
| 9 #include "views/controls/button/button.h" | 9 #include "views/controls/button/button.h" |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 virtual void OnMouseExited(const MouseEvent& e); | 69 virtual void OnMouseExited(const MouseEvent& e); |
| 70 virtual bool OnKeyPressed(const KeyEvent& e); | 70 virtual bool OnKeyPressed(const KeyEvent& e); |
| 71 virtual bool OnKeyReleased(const KeyEvent& e); | 71 virtual bool OnKeyReleased(const KeyEvent& e); |
| 72 virtual void OnDragDone(); | 72 virtual void OnDragDone(); |
| 73 virtual void ShowContextMenu(int x, int y, bool is_mouse_gesture); | 73 virtual void ShowContextMenu(int x, int y, bool is_mouse_gesture); |
| 74 virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); | 74 virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); |
| 75 | 75 |
| 76 // Overridden from AnimationDelegate: | 76 // Overridden from AnimationDelegate: |
| 77 virtual void AnimationProgressed(const Animation* animation); | 77 virtual void AnimationProgressed(const Animation* animation); |
| 78 | 78 |
| 79 // Returns true if the button should become pressed when the user |
| 80 // holds the mouse down over the button. For this implementation, |
| 81 // we simply return IsTriggerableEvent(e). |
| 82 virtual bool ShouldEnterPushedState(const MouseEvent& e); |
| 83 |
| 79 // The button state (defined in implementation) | 84 // The button state (defined in implementation) |
| 80 ButtonState state_; | 85 ButtonState state_; |
| 81 | 86 |
| 82 // Hover animation. | 87 // Hover animation. |
| 83 scoped_ptr<ThrobAnimation> hover_animation_; | 88 scoped_ptr<ThrobAnimation> hover_animation_; |
| 84 | 89 |
| 85 private: | 90 private: |
| 86 // Set / test whether the button is highlighted (in the hover state). | 91 // Set / test whether the button is highlighted (in the hover state). |
| 87 void SetHighlighted(bool highlighted); | 92 void SetHighlighted(bool highlighted); |
| 88 bool IsHighlighted() const; | 93 bool IsHighlighted() const; |
| 89 | 94 |
| 90 // Returns whether the button is pushed. | 95 // Returns whether the button is pushed. |
| 91 bool IsPushed() const; | 96 bool IsPushed() const; |
| 92 | 97 |
| 93 // Should we animate when the state changes? Defaults to true, but false while | 98 // Should we animate when the state changes? Defaults to true, but false while |
| 94 // throbbing. | 99 // throbbing. |
| 95 bool animate_on_state_change_; | 100 bool animate_on_state_change_; |
| 96 | 101 |
| 97 // Mouse event flags which can trigger button actions. | 102 // Mouse event flags which can trigger button actions. |
| 98 int triggerable_event_flags_; | 103 int triggerable_event_flags_; |
| 99 | 104 |
| 100 DISALLOW_COPY_AND_ASSIGN(CustomButton); | 105 DISALLOW_COPY_AND_ASSIGN(CustomButton); |
| 101 }; | 106 }; |
| 102 | 107 |
| 103 } // namespace views | 108 } // namespace views |
| 104 | 109 |
| 105 #endif // VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 110 #endif // VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| OLD | NEW |