| OLD | NEW |
| 1 // Copyright 2014 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/views/controls/button/image_button.h" | 9 #include "ui/views/controls/button/image_button.h" |
| 10 | 10 |
| 11 namespace ash { | 11 namespace ash { |
| 12 class ShelfButtonHost; | 12 class ShelfView; |
| 13 class ShelfWidget; | |
| 14 | 13 |
| 15 // Button used for the AppList icon on the shelf. | 14 // Button used for the AppList icon on the shelf. |
| 16 class AppListButton : public views::ImageButton { | 15 class AppListButton : public views::ImageButton { |
| 17 public: | 16 public: |
| 18 // Bounds size (inset) required for the app icon image (in pixels). | 17 explicit AppListButton(ShelfView* shelf_view); |
| 19 static const int kImageBoundsSize; | |
| 20 | |
| 21 AppListButton(views::ButtonListener* listener, | |
| 22 ShelfButtonHost* host, | |
| 23 ShelfWidget* shelf_widget); | |
| 24 ~AppListButton() override; | 18 ~AppListButton() override; |
| 25 | 19 |
| 26 bool draw_background_as_active() { | 20 bool draw_background_as_active() { return draw_background_as_active_; } |
| 27 return draw_background_as_active_; | |
| 28 } | |
| 29 | 21 |
| 30 protected: | 22 protected: |
| 31 // views::ImageButton overrides: | 23 // views::ImageButton overrides: |
| 32 bool OnMousePressed(const ui::MouseEvent& event) override; | 24 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 33 void OnMouseReleased(const ui::MouseEvent& event) override; | 25 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 34 void OnMouseCaptureLost() override; | 26 void OnMouseCaptureLost() override; |
| 35 bool OnMouseDragged(const ui::MouseEvent& event) override; | 27 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 36 void OnMouseMoved(const ui::MouseEvent& event) override; | |
| 37 void OnMouseEntered(const ui::MouseEvent& event) override; | |
| 38 void OnMouseExited(const ui::MouseEvent& event) override; | |
| 39 void OnPaint(gfx::Canvas* canvas) override; | 28 void OnPaint(gfx::Canvas* canvas) override; |
| 40 void GetAccessibleState(ui::AXViewState* state) override; | 29 void GetAccessibleState(ui::AXViewState* state) override; |
| 41 | 30 |
| 42 // ui::EventHandler overrides: | 31 // ui::EventHandler overrides: |
| 43 void OnGestureEvent(ui::GestureEvent* event) override; | 32 void OnGestureEvent(ui::GestureEvent* event) override; |
| 44 | 33 |
| 45 private: | 34 private: |
| 46 // Toggles the active state for painting the background and schedules a paint. | 35 // Toggles the active state for painting the background and schedules a paint. |
| 47 void SetDrawBackgroundAsActive(bool draw_background_as_active); | 36 void SetDrawBackgroundAsActive(bool draw_background_as_active); |
| 48 | 37 |
| 49 // True if the background should render as active, regardless of the state of | 38 // True if the background should render as active, regardless of the state of |
| 50 // the application list. | 39 // the application list. |
| 51 bool draw_background_as_active_; | 40 bool draw_background_as_active_; |
| 52 | 41 |
| 53 ShelfButtonHost* host_; | 42 ShelfView* shelf_view_; |
| 54 // Reference to the shelf widget containing this button, owned by the | |
| 55 // root window controller. | |
| 56 ShelfWidget* shelf_widget_; | |
| 57 | 43 |
| 58 DISALLOW_COPY_AND_ASSIGN(AppListButton); | 44 DISALLOW_COPY_AND_ASSIGN(AppListButton); |
| 59 }; | 45 }; |
| 60 | 46 |
| 61 } // namespace ash | 47 } // namespace ash |
| 62 | 48 |
| 63 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ | 49 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ |
| OLD | NEW |