OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DATE_DATE_VIEW_H_ | 5 #ifndef ASH_SYSTEM_DATE_DATE_VIEW_H_ |
6 #define ASH_SYSTEM_DATE_DATE_VIEW_H_ | 6 #define ASH_SYSTEM_DATE_DATE_VIEW_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/system/date/tray_date.h" | 9 #include "ash/system/date/tray_date.h" |
10 #include "ash/system/tray/actionable_view.h" | 10 #include "ash/system/tray/actionable_view.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(BaseDateTimeView); | 49 DISALLOW_COPY_AND_ASSIGN(BaseDateTimeView); |
50 }; | 50 }; |
51 | 51 |
52 // Popup view used to display the date and day of week. | 52 // Popup view used to display the date and day of week. |
53 class ASH_EXPORT DateView : public BaseDateTimeView { | 53 class ASH_EXPORT DateView : public BaseDateTimeView { |
54 public: | 54 public: |
55 DateView(); | 55 DateView(); |
56 virtual ~DateView(); | 56 virtual ~DateView(); |
57 | 57 |
58 // Sets whether the view is actionable. An actionable date view gives visual | 58 // Sets the action the view should take. An actionable date view gives visual |
59 // feedback on hover, can be focused by keyboard, and clicking/pressing space | 59 // feedback on hover, can be focused by keyboard, and clicking/pressing space |
60 // or enter on the view shows date-related settings. | 60 // or enter on the view executes the action. |
61 void SetActionable(bool actionable); | 61 void SetAction(TrayDate::DateAction action); |
62 | 62 |
63 // Updates the format of the displayed time. | 63 // Updates the format of the displayed time. |
64 void UpdateTimeFormat(); | 64 void UpdateTimeFormat(); |
65 | 65 |
66 base::HourClockType GetHourTypeForTesting() const; | 66 base::HourClockType GetHourTypeForTesting() const; |
67 | 67 |
68 private: | 68 private: |
69 // Overridden from BaseDateTimeView. | 69 // Overridden from BaseDateTimeView. |
70 virtual void UpdateTextInternal(const base::Time& now) OVERRIDE; | 70 virtual void UpdateTextInternal(const base::Time& now) OVERRIDE; |
71 | 71 |
72 // Overridden from ActionableView. | 72 // Overridden from ActionableView. |
73 virtual bool PerformAction(const ui::Event& event) OVERRIDE; | 73 virtual bool PerformAction(const ui::Event& event) OVERRIDE; |
74 | 74 |
75 // Overridden from views::View. | 75 // Overridden from views::View. |
76 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 76 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
77 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 77 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
78 | 78 |
79 views::Label* date_label_; | 79 views::Label* date_label_; |
80 | 80 |
81 // Time format (12/24hr) used for accessibility string. | 81 // Time format (12/24hr) used for accessibility string. |
82 base::HourClockType hour_type_; | 82 base::HourClockType hour_type_; |
83 | 83 |
84 bool actionable_; | 84 TrayDate::DateAction action_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(DateView); | 86 DISALLOW_COPY_AND_ASSIGN(DateView); |
87 }; | 87 }; |
88 | 88 |
89 // Tray view used to display the current time. | 89 // Tray view used to display the current time. |
90 // Exported for tests. | 90 // Exported for tests. |
91 class ASH_EXPORT TimeView : public BaseDateTimeView { | 91 class ASH_EXPORT TimeView : public BaseDateTimeView { |
92 public: | 92 public: |
93 explicit TimeView(TrayDate::ClockLayout clock_layout); | 93 explicit TimeView(TrayDate::ClockLayout clock_layout); |
94 virtual ~TimeView(); | 94 virtual ~TimeView(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 base::HourClockType hour_type_; | 127 base::HourClockType hour_type_; |
128 | 128 |
129 DISALLOW_COPY_AND_ASSIGN(TimeView); | 129 DISALLOW_COPY_AND_ASSIGN(TimeView); |
130 }; | 130 }; |
131 | 131 |
132 } // namespace tray | 132 } // namespace tray |
133 } // namespace ash | 133 } // namespace ash |
134 | 134 |
135 #endif // ASH_SYSTEM_DATE_DATE_VIEW_H_ | 135 #endif // ASH_SYSTEM_DATE_DATE_VIEW_H_ |
OLD | NEW |