| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_SHELF_APP_LIST_BUTTON_H_ | |
| 6 #define ASH_SHELF_APP_LIST_BUTTON_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "ui/views/controls/button/image_button.h" | |
| 11 | |
| 12 namespace ash { | |
| 13 class InkDropButtonListener; | |
| 14 class ShelfView; | |
| 15 | |
| 16 // Button used for the AppList icon on the shelf. | |
| 17 class ASH_EXPORT AppListButton : public views::ImageButton { | |
| 18 public: | |
| 19 explicit AppListButton(InkDropButtonListener* listener, | |
| 20 ShelfView* shelf_view); | |
| 21 ~AppListButton() override; | |
| 22 | |
| 23 void OnAppListShown(); | |
| 24 void OnAppListDismissed(); | |
| 25 | |
| 26 bool draw_background_as_active() { return draw_background_as_active_; } | |
| 27 | |
| 28 protected: | |
| 29 // views::ImageButton overrides: | |
| 30 bool OnMousePressed(const ui::MouseEvent& event) override; | |
| 31 void OnMouseReleased(const ui::MouseEvent& event) override; | |
| 32 void OnMouseCaptureLost() override; | |
| 33 bool OnMouseDragged(const ui::MouseEvent& event) override; | |
| 34 void OnPaint(gfx::Canvas* canvas) override; | |
| 35 void GetAccessibleState(ui::AXViewState* state) override; | |
| 36 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | |
| 37 void NotifyClick(const ui::Event& event) override; | |
| 38 bool ShouldEnterPushedState(const ui::Event& event) override; | |
| 39 bool ShouldShowInkDropHighlight() const override; | |
| 40 | |
| 41 // ui::EventHandler overrides: | |
| 42 void OnGestureEvent(ui::GestureEvent* event) override; | |
| 43 | |
| 44 private: | |
| 45 // Toggles the active state for painting the background and schedules a paint. | |
| 46 void SetDrawBackgroundAsActive(bool draw_background_as_active); | |
| 47 | |
| 48 // Helper functions to paint the background and foreground of the AppList | |
| 49 // button in Chrome OS MD. | |
| 50 void PaintBackgroundMD(gfx::Canvas* canvas); | |
| 51 void PaintForegroundMD(gfx::Canvas* canvas, | |
| 52 const gfx::ImageSkia& foreground_image); | |
| 53 | |
| 54 // Helper function to paint the AppList button in Chrome OS non-MD. | |
| 55 void PaintAppListButton(gfx::Canvas* canvas, | |
| 56 const gfx::ImageSkia& foreground_image); | |
| 57 | |
| 58 // True if the background should render as active, regardless of the state of | |
| 59 // the application list. | |
| 60 bool draw_background_as_active_; | |
| 61 | |
| 62 InkDropButtonListener* listener_; | |
| 63 ShelfView* shelf_view_; | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(AppListButton); | |
| 66 }; | |
| 67 | |
| 68 } // namespace ash | |
| 69 | |
| 70 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ | |
| OLD | NEW |