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" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 int state() const { return state_; } | 56 int state() const { return state_; } |
57 const ShelfLayoutManager* shelf_layout_manager() const { | 57 const ShelfLayoutManager* shelf_layout_manager() const { |
58 return shelf_layout_manager_; | 58 return shelf_layout_manager_; |
59 } | 59 } |
60 | 60 |
61 // Returns the bounds of the icon. | 61 // Returns the bounds of the icon. |
62 gfx::Rect GetIconBounds() const; | 62 gfx::Rect GetIconBounds() const; |
63 | 63 |
64 // Overrides to views::CustomButton: | 64 // Overrides to views::CustomButton: |
65 virtual void ShowContextMenu(const gfx::Point& p, | 65 virtual void ShowContextMenu(const gfx::Point& p, |
66 ui::MenuSourceType source_type) OVERRIDE; | 66 ui::MenuSourceType source_type) override; |
67 | 67 |
68 // View override - needed by unit test. | 68 // View override - needed by unit test. |
69 virtual void OnMouseCaptureLost() OVERRIDE; | 69 virtual void OnMouseCaptureLost() override; |
70 | 70 |
71 protected: | 71 protected: |
72 ShelfButton(views::ButtonListener* listener, | 72 ShelfButton(views::ButtonListener* listener, |
73 ShelfButtonHost* host, | 73 ShelfButtonHost* host, |
74 ShelfLayoutManager* shelf_layout_manager); | 74 ShelfLayoutManager* shelf_layout_manager); |
75 | 75 |
76 // Class that draws the icon part of a button, so it can be animated | 76 // Class that draws the icon part of a button, so it can be animated |
77 // independently of the rest. This can be subclassed to provide a custom | 77 // independently of the rest. This can be subclassed to provide a custom |
78 // implementation, by overriding CreateIconView(). | 78 // implementation, by overriding CreateIconView(). |
79 class IconView : public views::ImageView { | 79 class IconView : public views::ImageView { |
80 public: | 80 public: |
81 IconView(); | 81 IconView(); |
82 virtual ~IconView(); | 82 virtual ~IconView(); |
83 | 83 |
84 void set_icon_size(int icon_size) { icon_size_ = icon_size; } | 84 void set_icon_size(int icon_size) { icon_size_ = icon_size; } |
85 int icon_size() const { return icon_size_; } | 85 int icon_size() const { return icon_size_; } |
86 | 86 |
87 private: | 87 private: |
88 // 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, |
89 // while maintaining original proportions. | 89 // while maintaining original proportions. |
90 int icon_size_; | 90 int icon_size_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(IconView); | 92 DISALLOW_COPY_AND_ASSIGN(IconView); |
93 }; | 93 }; |
94 | 94 |
95 // View overrides: | 95 // View overrides: |
96 virtual const char* GetClassName() const OVERRIDE; | 96 virtual const char* GetClassName() const override; |
97 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 97 virtual bool OnMousePressed(const ui::MouseEvent& event) override; |
98 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 98 virtual void OnMouseReleased(const ui::MouseEvent& event) override; |
99 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 99 virtual bool OnMouseDragged(const ui::MouseEvent& event) override; |
100 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; | 100 virtual void OnMouseMoved(const ui::MouseEvent& event) override; |
101 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 101 virtual void OnMouseEntered(const ui::MouseEvent& event) override; |
102 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 102 virtual void OnMouseExited(const ui::MouseEvent& event) override; |
103 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 103 virtual void GetAccessibleState(ui::AXViewState* state) override; |
104 virtual void Layout() OVERRIDE; | 104 virtual void Layout() override; |
105 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 105 virtual void ChildPreferredSizeChanged(views::View* child) override; |
106 virtual void OnFocus() OVERRIDE; | 106 virtual void OnFocus() override; |
107 virtual void OnBlur() OVERRIDE; | 107 virtual void OnBlur() override; |
108 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 108 virtual void OnPaint(gfx::Canvas* canvas) override; |
109 | 109 |
110 // ui::EventHandler overrides: | 110 // ui::EventHandler overrides: |
111 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 111 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
112 | 112 |
113 // Sets the icon image with a shadow. | 113 // Sets the icon image with a shadow. |
114 void SetShadowedImage(const gfx::ImageSkia& bitmap); | 114 void SetShadowedImage(const gfx::ImageSkia& bitmap); |
115 // Override for custom initialization. | 115 // Override for custom initialization. |
116 virtual void Init(); | 116 virtual void Init(); |
117 // Override to subclass IconView. | 117 // Override to subclass IconView. |
118 virtual IconView* CreateIconView(); | 118 virtual IconView* CreateIconView(); |
119 IconView* icon_view() const { return icon_view_; } | 119 IconView* icon_view() const { return icon_view_; } |
120 ShelfButtonHost* host() const { return host_; } | 120 ShelfButtonHost* host() const { return host_; } |
121 | 121 |
(...skipping 26 matching lines...) Expand all Loading... |
148 // 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 |
149 // 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. |
150 bool* destroyed_flag_; | 150 bool* destroyed_flag_; |
151 | 151 |
152 DISALLOW_COPY_AND_ASSIGN(ShelfButton); | 152 DISALLOW_COPY_AND_ASSIGN(ShelfButton); |
153 }; | 153 }; |
154 | 154 |
155 } // namespace ash | 155 } // namespace ash |
156 | 156 |
157 #endif // ASH_SHELF_SHELF_BUTTON_H_ | 157 #endif // ASH_SHELF_SHELF_BUTTON_H_ |
OLD | NEW |