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 ASH_LAUNCHER_LAUNCHER_BUTTON_H_ | 5 #ifndef ASH_LAUNCHER_LAUNCHER_BUTTON_H_ |
6 #define ASH_LAUNCHER_LAUNCHER_BUTTON_H_ | 6 #define ASH_LAUNCHER_LAUNCHER_BUTTON_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/views/controls/button/custom_button.h" | 9 #include "ui/views/controls/button/custom_button.h" |
10 #include "ui/views/controls/image_view.h" | 10 #include "ui/views/controls/image_view.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 STATE_FOCUSED = 1 << 5, | 38 STATE_FOCUSED = 1 << 5, |
39 }; | 39 }; |
40 | 40 |
41 virtual ~LauncherButton(); | 41 virtual ~LauncherButton(); |
42 | 42 |
43 // Called to create an instance of a LauncherButton. | 43 // Called to create an instance of a LauncherButton. |
44 static LauncherButton* Create(views::ButtonListener* listener, | 44 static LauncherButton* Create(views::ButtonListener* listener, |
45 LauncherButtonHost* host); | 45 LauncherButtonHost* host); |
46 | 46 |
47 // Sets the image to display for this entry. | 47 // Sets the image to display for this entry. |
48 void SetImage(const SkBitmap& image); | 48 void SetImage(const gfx::ImageSkia& image); |
49 | 49 |
50 // |state| is or'd into the current state. | 50 // |state| is or'd into the current state. |
51 void AddState(State state); | 51 void AddState(State state); |
52 void ClearState(State state); | 52 void ClearState(State state); |
53 int state() const { return state_; } | 53 int state() const { return state_; } |
54 | 54 |
55 // Returns the bounds of the icon. | 55 // Returns the bounds of the icon. |
56 gfx::Rect GetIconBounds() const; | 56 gfx::Rect GetIconBounds() const; |
57 | 57 |
58 protected: | 58 protected: |
(...skipping 28 matching lines...) Expand all Loading... |
87 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; | 87 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; |
88 virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE; | 88 virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE; |
89 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 89 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
90 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; | 90 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |
91 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 91 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
92 virtual void Layout() OVERRIDE; | 92 virtual void Layout() OVERRIDE; |
93 virtual void OnFocus() OVERRIDE; | 93 virtual void OnFocus() OVERRIDE; |
94 virtual void OnBlur() OVERRIDE; | 94 virtual void OnBlur() OVERRIDE; |
95 | 95 |
96 // Sets the icon image with a shadow. | 96 // Sets the icon image with a shadow. |
97 void SetShadowedImage(const SkBitmap& bitmap); | 97 void SetShadowedImage(const gfx::ImageSkia& bitmap); |
98 // Override for custom initialization. | 98 // Override for custom initialization. |
99 virtual void Init(); | 99 virtual void Init(); |
100 // Override to subclass IconView. | 100 // Override to subclass IconView. |
101 virtual IconView* CreateIconView(); | 101 virtual IconView* CreateIconView(); |
102 IconView* icon_view() const { return icon_view_; } | 102 IconView* icon_view() const { return icon_view_; } |
103 LauncherButtonHost* host() const { return host_; } | 103 LauncherButtonHost* host() const { return host_; } |
104 | 104 |
105 private: | 105 private: |
106 class BarView; | 106 class BarView; |
107 class IconPulseAnimation; | 107 class IconPulseAnimation; |
(...skipping 18 matching lines...) Expand all Loading... |
126 // has a STATE_PENDING bit and destroyed when that bit is clear. | 126 // has a STATE_PENDING bit and destroyed when that bit is clear. |
127 scoped_ptr<IconPulseAnimation> icon_pulse_animation_; | 127 scoped_ptr<IconPulseAnimation> icon_pulse_animation_; |
128 | 128 |
129 DISALLOW_COPY_AND_ASSIGN(LauncherButton); | 129 DISALLOW_COPY_AND_ASSIGN(LauncherButton); |
130 }; | 130 }; |
131 | 131 |
132 } // namespace internal | 132 } // namespace internal |
133 } // namespace ash | 133 } // namespace ash |
134 | 134 |
135 #endif // ASH_LAUNCHER_LAUNCHER_BUTTON_H_ | 135 #endif // ASH_LAUNCHER_LAUNCHER_BUTTON_H_ |
OLD | NEW |