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