Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / ash / shelf / app_list_button.h
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 "ui/views/controls/button/image_button.h"
9
10 namespace ash {
11 class ShelfButtonHost;
12 class ShelfWidget;
13
14 // Button used for the AppList icon on the shelf.
15 class AppListButton : public views::ImageButton {
16  public:
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);
23   ~AppListButton() override;
24
25   bool draw_background_as_active() {
26     return draw_background_as_active_;
27   }
28
29  protected:
30   // views::ImageButton overrides:
31   bool OnMousePressed(const ui::MouseEvent& event) override;
32   void OnMouseReleased(const ui::MouseEvent& event) override;
33   void OnMouseCaptureLost() override;
34   bool OnMouseDragged(const ui::MouseEvent& event) override;
35   void OnMouseMoved(const ui::MouseEvent& event) override;
36   void OnMouseEntered(const ui::MouseEvent& event) override;
37   void OnMouseExited(const ui::MouseEvent& event) override;
38   void OnPaint(gfx::Canvas* canvas) override;
39   void GetAccessibleState(ui::AXViewState* state) 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   // True if the background should render as active, regardless of the state of
49   // the application list.
50   bool draw_background_as_active_;
51
52   ShelfButtonHost* host_;
53   // Reference to the shelf widget containing this button, owned by the
54   // root window controller.
55   ShelfWidget* shelf_widget_;
56
57   DISALLOW_COPY_AND_ASSIGN(AppListButton);
58 };
59
60 }  // namespace ash
61
62 #endif  // ASH_SHELF_APP_LIST_BUTTON_H_