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 22 matching lines...) Expand all Loading... |
33 BaseDateTimeView(); | 33 BaseDateTimeView(); |
34 | 34 |
35 private: | 35 private: |
36 // Starts |timer_| to schedule the next update. | 36 // Starts |timer_| to schedule the next update. |
37 void SetTimer(const base::Time& now); | 37 void SetTimer(const base::Time& now); |
38 | 38 |
39 // Updates labels to display the current time. | 39 // Updates labels to display the current time. |
40 virtual void UpdateTextInternal(const base::Time& now) = 0; | 40 virtual void UpdateTextInternal(const base::Time& now) = 0; |
41 | 41 |
42 // Overridden from views::View. | 42 // Overridden from views::View. |
43 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 43 virtual void ChildPreferredSizeChanged(views::View* child) override; |
44 virtual void OnLocaleChanged() OVERRIDE; | 44 virtual void OnLocaleChanged() override; |
45 | 45 |
46 // Invokes UpdateText() when the displayed time should change. | 46 // Invokes UpdateText() when the displayed time should change. |
47 base::OneShotTimer<BaseDateTimeView> timer_; | 47 base::OneShotTimer<BaseDateTimeView> timer_; |
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 the action the view should take. 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 executes the action. | 60 // or enter on the view executes the action. |
61 void SetAction(TrayDate::DateAction action); | 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 TrayDate::DateAction action_; | 84 TrayDate::DateAction action_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(DateView); | 86 DISALLOW_COPY_AND_ASSIGN(DateView); |
87 }; | 87 }; |
(...skipping 10 matching lines...) Expand all Loading... |
98 | 98 |
99 // Updates clock layout. | 99 // Updates clock layout. |
100 void UpdateClockLayout(TrayDate::ClockLayout clock_layout); | 100 void UpdateClockLayout(TrayDate::ClockLayout clock_layout); |
101 | 101 |
102 base::HourClockType GetHourTypeForTesting() const; | 102 base::HourClockType GetHourTypeForTesting() const; |
103 | 103 |
104 private: | 104 private: |
105 friend class TimeViewTest; | 105 friend class TimeViewTest; |
106 | 106 |
107 // Overridden from BaseDateTimeView. | 107 // Overridden from BaseDateTimeView. |
108 virtual void UpdateTextInternal(const base::Time& now) OVERRIDE; | 108 virtual void UpdateTextInternal(const base::Time& now) override; |
109 | 109 |
110 // Overridden from ActionableView. | 110 // Overridden from ActionableView. |
111 virtual bool PerformAction(const ui::Event& event) OVERRIDE; | 111 virtual bool PerformAction(const ui::Event& event) override; |
112 | 112 |
113 // Overridden from views::View. | 113 // Overridden from views::View. |
114 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 114 virtual bool OnMousePressed(const ui::MouseEvent& event) override; |
115 | 115 |
116 void SetBorderFromLayout(TrayDate::ClockLayout clock_layout); | 116 void SetBorderFromLayout(TrayDate::ClockLayout clock_layout); |
117 void SetupLabels(); | 117 void SetupLabels(); |
118 void SetupLabel(views::Label* label); | 118 void SetupLabel(views::Label* label); |
119 | 119 |
120 // Label text used for the normal horizontal shelf. | 120 // Label text used for the normal horizontal shelf. |
121 scoped_ptr<views::Label> horizontal_label_; | 121 scoped_ptr<views::Label> horizontal_label_; |
122 | 122 |
123 // The time label is split into two lines for the vertical shelf. | 123 // The time label is split into two lines for the vertical shelf. |
124 scoped_ptr<views::Label> vertical_label_hours_; | 124 scoped_ptr<views::Label> vertical_label_hours_; |
125 scoped_ptr<views::Label> vertical_label_minutes_; | 125 scoped_ptr<views::Label> vertical_label_minutes_; |
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 |