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_SYSTEM_TRAY_HOVER_HIGHLIGHT_VIEW_H_ | 5 #ifndef ASH_SYSTEM_TRAY_HOVER_HIGHLIGHT_VIEW_H_ |
6 #define ASH_SYSTEM_TRAY_HOVER_HIGHLIGHT_VIEW_H_ | 6 #define ASH_SYSTEM_TRAY_HOVER_HIGHLIGHT_VIEW_H_ |
7 | 7 |
8 #include "ash/system/tray/actionable_view.h" | 8 #include "ash/system/tray/actionable_view.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "ui/gfx/font.h" | 11 #include "ui/gfx/font.h" |
| 12 #include "ui/gfx/text_constants.h" |
12 | 13 |
13 namespace views { | 14 namespace views { |
14 class Label; | 15 class Label; |
15 } | 16 } |
16 | 17 |
17 namespace ash { | 18 namespace ash { |
18 namespace internal { | 19 namespace internal { |
19 | 20 |
20 class ViewClickListener; | 21 class ViewClickListener; |
21 | 22 |
22 // A view that changes background color on hover, and triggers a callback in the | 23 // A view that changes background color on hover, and triggers a callback in the |
23 // associated ViewClickListener on click. The view can also be forced to | 24 // associated ViewClickListener on click. The view can also be forced to |
24 // maintain a fixed height. | 25 // maintain a fixed height. |
25 class HoverHighlightView : public ActionableView { | 26 class HoverHighlightView : public ActionableView { |
26 public: | 27 public: |
27 explicit HoverHighlightView(ViewClickListener* listener); | 28 explicit HoverHighlightView(ViewClickListener* listener); |
28 virtual ~HoverHighlightView(); | 29 virtual ~HoverHighlightView(); |
29 | 30 |
30 // Convenience function for adding an icon and a label. This also sets the | 31 // Convenience function for adding an icon and a label. This also sets the |
31 // accessible name. | 32 // accessible name. |
32 void AddIconAndLabel(const gfx::ImageSkia& image, | 33 void AddIconAndLabel(const gfx::ImageSkia& image, |
33 const base::string16& text, | 34 const base::string16& text, |
34 gfx::Font::FontStyle style); | 35 gfx::Font::FontStyle style); |
35 | 36 |
36 // Convenience function for adding a label with padding on the left for a | 37 // Convenience function for adding a label with padding on the left for a |
37 // blank icon. This also sets the accessible name. | 38 // blank icon. This also sets the accessible name. |
38 // Returns label after parenting it. | 39 // Returns label after parenting it. |
39 views::Label* AddLabel(const base::string16& text, | 40 views::Label* AddLabel(const base::string16& text, |
| 41 gfx::HorizontalAlignment alignment, |
40 gfx::Font::FontStyle style); | 42 gfx::Font::FontStyle style); |
41 | 43 |
42 // Convenience function for adding an optional check and a label. In the | 44 // Convenience function for adding an optional check and a label. In the |
43 // absence of a check, padding is added to align with checked items. | 45 // absence of a check, padding is added to align with checked items. |
44 // Returns label after parenting it. | 46 // Returns label after parenting it. |
45 views::Label* AddCheckableLabel(const base::string16& text, | 47 views::Label* AddCheckableLabel(const base::string16& text, |
46 gfx::Font::FontStyle style, | 48 gfx::Font::FontStyle style, |
47 bool checked); | 49 bool checked); |
48 | 50 |
49 // Allows view to expand its height. | 51 // Allows view to expand its height. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 bool checkable_; | 86 bool checkable_; |
85 bool checked_; | 87 bool checked_; |
86 | 88 |
87 DISALLOW_COPY_AND_ASSIGN(HoverHighlightView); | 89 DISALLOW_COPY_AND_ASSIGN(HoverHighlightView); |
88 }; | 90 }; |
89 | 91 |
90 } // namespace internal | 92 } // namespace internal |
91 } // namespace ash | 93 } // namespace ash |
92 | 94 |
93 #endif // ASH_SYSTEM_TRAY_HOVER_HIGHLIGHT_VIEW_H_ | 95 #endif // ASH_SYSTEM_TRAY_HOVER_HIGHLIGHT_VIEW_H_ |
OLD | NEW |