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 "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" |
11 | 11 |
12 namespace ash { | 12 namespace ash { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 class LauncherButtonHost; | 15 class LauncherButtonHost; |
16 | 16 |
17 // Button used for items on the launcher, except for the AppList. | 17 // Button used for items on the launcher, except for the AppList. |
18 class LauncherButton : public views::CustomButton { | 18 class LauncherButton : public views::CustomButton { |
19 public: | 19 public: |
20 // Used to indicate the current state of the button. | 20 // Used to indicate the current state of the button. |
21 enum State { | 21 enum State { |
22 STATE_NORMAL = 0, | 22 STATE_NORMAL = 0, |
23 STATE_HOVERED = 1 << 0, | 23 STATE_HOVERED = 1 << 0, |
24 STATE_RUNNING = 1 << 1, | 24 STATE_RUNNING = 1 << 1, |
25 STATE_ACTIVE = 1 << 2 | 25 STATE_ACTIVE = 1 << 2, |
| 26 STATE_ATTENTION = 1 << 3, |
26 }; | 27 }; |
27 | 28 |
28 virtual ~LauncherButton(); | 29 virtual ~LauncherButton(); |
29 | 30 |
30 // Called to create an instance of a LauncherButton. | 31 // Called to create an instance of a LauncherButton. |
31 static LauncherButton* Create(views::ButtonListener* listener, | 32 static LauncherButton* Create(views::ButtonListener* listener, |
32 LauncherButtonHost* host); | 33 LauncherButtonHost* host); |
33 | 34 |
34 // Sets the image to display for this entry. | 35 // Sets the image to display for this entry. |
35 void SetImage(const SkBitmap& image); | 36 void SetImage(const SkBitmap& image); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Sets the icon image with a shadow. | 80 // Sets the icon image with a shadow. |
80 void SetShadowedImage(const SkBitmap& bitmap); | 81 void SetShadowedImage(const SkBitmap& bitmap); |
81 // Override for custom initialization. | 82 // Override for custom initialization. |
82 virtual void Init(); | 83 virtual void Init(); |
83 // Override to subclass IconView. | 84 // Override to subclass IconView. |
84 virtual IconView* CreateIconView(); | 85 virtual IconView* CreateIconView(); |
85 IconView* icon_view() const { return icon_view_; } | 86 IconView* icon_view() const { return icon_view_; } |
86 LauncherButtonHost* host() const { return host_; } | 87 LauncherButtonHost* host() const { return host_; } |
87 | 88 |
88 private: | 89 private: |
| 90 class BarView; |
89 // Updates the parts of the button to reflect the current state_. This may | 91 // Updates the parts of the button to reflect the current state_. This may |
90 // add or remove views, layout and paint. | 92 // add or remove views, layout and paint. |
91 void UpdateState(); | 93 void UpdateState(); |
92 | 94 |
93 LauncherButtonHost* host_; | 95 LauncherButtonHost* host_; |
94 IconView* icon_view_; | 96 IconView* icon_view_; |
95 // Draws a bar underneath the image to represent the state of the application. | 97 // Draws a bar underneath the image to represent the state of the application. |
96 views::ImageView* bar_; | 98 BarView* bar_; |
97 // The current state of the application, multiple values of AppState are or'd | 99 // The current state of the application, multiple values of AppState are or'd |
98 // together. | 100 // together. |
99 int state_; | 101 int state_; |
100 | 102 |
101 DISALLOW_COPY_AND_ASSIGN(LauncherButton); | 103 DISALLOW_COPY_AND_ASSIGN(LauncherButton); |
102 }; | 104 }; |
103 | 105 |
104 } // namespace internal | 106 } // namespace internal |
105 } // namespace ash | 107 } // namespace ash |
106 | 108 |
107 #endif // ASH_LAUNCHER_APP_LAUNCHER_BUTTON_H_ | 109 #endif // ASH_LAUNCHER_APP_LAUNCHER_BUTTON_H_ |
OLD | NEW |