| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SHELF_BUTTON_H_ | 5 #ifndef ASH_SHELF_SHELF_BUTTON_H_ |
| 6 #define ASH_SHELF_SHELF_BUTTON_H_ | 6 #define ASH_SHELF_SHELF_BUTTON_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ui/gfx/shadow_value.h" | 9 #include "ui/gfx/shadow_value.h" |
| 10 #include "ui/views/controls/button/custom_button.h" | 10 #include "ui/views/controls/button/custom_button.h" |
| 11 #include "ui/views/controls/image_view.h" | 11 #include "ui/views/controls/image_view.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 class ShelfButtonHost; | 14 class ShelfButtonHost; |
| 15 class ShelfLayoutManager; | 15 class ShelfLayoutManager; |
| 16 | 16 |
| 17 // Button used for items on the launcher, except for the AppList. | 17 // Button used for items on the launcher, except for the AppList. |
| 18 class ASH_EXPORT ShelfButton : public views::CustomButton { | 18 class ASH_EXPORT ShelfButton : public views::CustomButton { |
| 19 public: | 19 public: |
| 20 static const char kViewClassName[]; |
| 21 |
| 20 // Used to indicate the current state of the button. | 22 // Used to indicate the current state of the button. |
| 21 enum State { | 23 enum State { |
| 22 // Nothing special. Usually represents an app shortcut item with no running | 24 // Nothing special. Usually represents an app shortcut item with no running |
| 23 // instance. | 25 // instance. |
| 24 STATE_NORMAL = 0, | 26 STATE_NORMAL = 0, |
| 25 // Button has mouse hovering on it. | 27 // Button has mouse hovering on it. |
| 26 STATE_HOVERED = 1 << 0, | 28 STATE_HOVERED = 1 << 0, |
| 27 // Underlying ShelfItem has a running instance. | 29 // Underlying ShelfItem has a running instance. |
| 28 STATE_RUNNING = 1 << 1, | 30 STATE_RUNNING = 1 << 1, |
| 29 // Underlying ShelfItem is active (i.e. has focus). | 31 // Underlying ShelfItem is active (i.e. has focus). |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 86 |
| 85 private: | 87 private: |
| 86 // Set to non-zero to force icons to be resized to fit within a square, | 88 // Set to non-zero to force icons to be resized to fit within a square, |
| 87 // while maintaining original proportions. | 89 // while maintaining original proportions. |
| 88 int icon_size_; | 90 int icon_size_; |
| 89 | 91 |
| 90 DISALLOW_COPY_AND_ASSIGN(IconView); | 92 DISALLOW_COPY_AND_ASSIGN(IconView); |
| 91 }; | 93 }; |
| 92 | 94 |
| 93 // View overrides: | 95 // View overrides: |
| 96 virtual const char* GetClassName() const OVERRIDE; |
| 94 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 97 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 95 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 98 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 96 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 99 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
| 97 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; | 100 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; |
| 98 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 101 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
| 99 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 102 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| 100 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 103 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
| 101 virtual void Layout() OVERRIDE; | 104 virtual void Layout() OVERRIDE; |
| 102 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 105 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
| 103 virtual void OnFocus() OVERRIDE; | 106 virtual void OnFocus() OVERRIDE; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // If non-null the destuctor sets this to true. This is set while the menu is | 148 // If non-null the destuctor sets this to true. This is set while the menu is |
| 146 // showing and used to detect if the menu was deleted while running. | 149 // showing and used to detect if the menu was deleted while running. |
| 147 bool* destroyed_flag_; | 150 bool* destroyed_flag_; |
| 148 | 151 |
| 149 DISALLOW_COPY_AND_ASSIGN(ShelfButton); | 152 DISALLOW_COPY_AND_ASSIGN(ShelfButton); |
| 150 }; | 153 }; |
| 151 | 154 |
| 152 } // namespace ash | 155 } // namespace ash |
| 153 | 156 |
| 154 #endif // ASH_SHELF_SHELF_BUTTON_H_ | 157 #endif // ASH_SHELF_SHELF_BUTTON_H_ |
| OLD | NEW |