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