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.
5 #ifndef ASH_SHELF_APP_LIST_BUTTON_H_
6 #define ASH_SHELF_APP_LIST_BUTTON_H_
8 #include "ui/views/controls/button/image_button.h"
11 class ShelfButtonHost;
14 // Button used for the AppList icon on the shelf.
15 class AppListButton : public views::ImageButton {
17 // Bounds size (inset) required for the app icon image (in pixels).
18 static const int kImageBoundsSize;
20 AppListButton(views::ButtonListener* listener,
21 ShelfButtonHost* host,
22 ShelfWidget* shelf_widget);
23 virtual ~AppListButton();
25 bool draw_background_as_active() {
26 return draw_background_as_active_;
30 // views::ImageButton overrides:
31 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
32 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
33 virtual void OnMouseCaptureLost() OVERRIDE;
34 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE;
35 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE;
36 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
37 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
38 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
39 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
41 // ui::EventHandler overrides:
42 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
45 // Toggles the active state for painting the background and schedules a paint.
46 void SetDrawBackgroundAsActive(bool draw_background_as_active);
48 // True if the background should render as active, regardless of the state of
49 // the application list.
50 bool draw_background_as_active_;
52 // True if touch view feedback command line flag has been enabled. When
53 // enabled touch gestures will toggle rendering the background as active.
54 bool touch_feedback_enabled_;
56 ShelfButtonHost* host_;
57 // Reference to the shelf widget containing this button, owned by the
58 // root window controller.
59 ShelfWidget* shelf_widget_;
61 DISALLOW_COPY_AND_ASSIGN(AppListButton);
66 #endif // ASH_SHELF_APP_LIST_BUTTON_H_