OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SHELF_APP_LIST_BUTTON_H_ | 5 #ifndef ASH_SHELF_APP_LIST_BUTTON_H_ |
6 #define ASH_SHELF_APP_LIST_BUTTON_H_ | 6 #define ASH_SHELF_APP_LIST_BUTTON_H_ |
7 | 7 |
8 #include "ui/views/controls/button/image_button.h" | 8 #include "ui/views/controls/button/image_button.h" |
9 | 9 |
10 namespace ash { | 10 namespace ash { |
11 class ShelfButtonHost; | 11 class ShelfButtonHost; |
| 12 class ShelfWidget; |
12 | 13 |
13 // Button used for the AppList icon on the shelf. | 14 // Button used for the AppList icon on the shelf. |
14 class AppListButton : public views::ImageButton { | 15 class AppListButton : public views::ImageButton { |
15 public: | 16 public: |
16 AppListButton(views::ButtonListener* listener, ShelfButtonHost* host); | 17 // Bounds size (inset) required for the app icon image (in pixels). |
| 18 static const int kImageBoundsSize; |
| 19 |
| 20 AppListButton(views::ButtonListener* listener, |
| 21 ShelfButtonHost* host, |
| 22 ShelfWidget* shelf_widget); |
17 virtual ~AppListButton(); | 23 virtual ~AppListButton(); |
18 | 24 |
19 void StartLoadingAnimation(); | |
20 void StopLoadingAnimation(); | |
21 | |
22 protected: | 25 protected: |
23 // views::ImageButton: | 26 // views::ImageButton overrides: |
24 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 27 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
25 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 28 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
26 virtual void OnMouseCaptureLost() OVERRIDE; | 29 virtual void OnMouseCaptureLost() OVERRIDE; |
27 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 30 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
28 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; | 31 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; |
29 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 32 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
30 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 33 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| 34 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
31 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 35 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
32 | 36 |
| 37 // ui::EventHandler overrides: |
| 38 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 39 |
33 private: | 40 private: |
34 ShelfButtonHost* host_; | 41 ShelfButtonHost* host_; |
| 42 // Reference to the shelf widget containing this button, owned by the |
| 43 // root window controller. |
| 44 ShelfWidget* shelf_widget_; |
35 | 45 |
36 DISALLOW_COPY_AND_ASSIGN(AppListButton); | 46 DISALLOW_COPY_AND_ASSIGN(AppListButton); |
37 }; | 47 }; |
38 | 48 |
39 } // namespace ash | 49 } // namespace ash |
40 | 50 |
41 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ | 51 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ |
OLD | NEW |