| 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_COMMON_SHELF_APP_LIST_BUTTON_H_ | |
| 6 #define ASH_COMMON_SHELF_APP_LIST_BUTTON_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "third_party/skia/include/core/SkColor.h" | |
| 11 #include "ui/views/controls/button/image_button.h" | |
| 12 | |
| 13 namespace ash { | |
| 14 class InkDropButtonListener; | |
| 15 class ShelfView; | |
| 16 class WmShelf; | |
| 17 | |
| 18 // Button used for the AppList icon on the shelf. | |
| 19 class ASH_EXPORT AppListButton : public views::ImageButton { | |
| 20 public: | |
| 21 AppListButton(InkDropButtonListener* listener, | |
| 22 ShelfView* shelf_view, | |
| 23 WmShelf* wm_shelf); | |
| 24 ~AppListButton() override; | |
| 25 | |
| 26 void OnAppListShown(); | |
| 27 void OnAppListDismissed(); | |
| 28 | |
| 29 bool is_showing_app_list() const { return is_showing_app_list_; } | |
| 30 | |
| 31 // Updates background and schedules a paint. | |
| 32 void UpdateShelfItemBackground(SkColor color); | |
| 33 | |
| 34 protected: | |
| 35 // views::ImageButton overrides: | |
| 36 bool OnMousePressed(const ui::MouseEvent& event) override; | |
| 37 void OnMouseReleased(const ui::MouseEvent& event) override; | |
| 38 void OnMouseCaptureLost() override; | |
| 39 bool OnMouseDragged(const ui::MouseEvent& event) override; | |
| 40 void OnPaint(gfx::Canvas* canvas) override; | |
| 41 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | |
| 42 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | |
| 43 void NotifyClick(const ui::Event& event) override; | |
| 44 bool ShouldEnterPushedState(const ui::Event& event) override; | |
| 45 std::unique_ptr<views::InkDrop> CreateInkDrop() override; | |
| 46 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; | |
| 47 | |
| 48 // ui::EventHandler overrides: | |
| 49 void OnGestureEvent(ui::GestureEvent* event) override; | |
| 50 | |
| 51 private: | |
| 52 // Get the center point of the app list button used to draw its background and | |
| 53 // ink drops. | |
| 54 gfx::Point GetCenterPoint() const; | |
| 55 | |
| 56 // True if the app list is currently showing for this display. | |
| 57 // This is useful because other IsApplistVisible functions aren't per-display. | |
| 58 bool is_showing_app_list_; | |
| 59 | |
| 60 // Color used to paint the background. | |
| 61 SkColor background_color_; | |
| 62 | |
| 63 InkDropButtonListener* listener_; | |
| 64 ShelfView* shelf_view_; | |
| 65 WmShelf* wm_shelf_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(AppListButton); | |
| 68 }; | |
| 69 | |
| 70 } // namespace ash | |
| 71 | |
| 72 #endif // ASH_COMMON_SHELF_APP_LIST_BUTTON_H_ | |
| OLD | NEW |