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 #include "ash/system/date/date_view.h" | 5 #include "ash/system/date/date_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray_delegate.h" | 8 #include "ash/system/tray/system_tray_delegate.h" |
9 #include "ash/system/tray/tray_constants.h" | 9 #include "ash/system/tray/tray_constants.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 bool DateView::PerformAction(const ui::Event& event) { | 137 bool DateView::PerformAction(const ui::Event& event) { |
138 if (!actionable_) | 138 if (!actionable_) |
139 return false; | 139 return false; |
140 | 140 |
141 ash::Shell::GetInstance()->tray_delegate()->ShowDateSettings(); | 141 ash::Shell::GetInstance()->tray_delegate()->ShowDateSettings(); |
142 return true; | 142 return true; |
143 } | 143 } |
144 | 144 |
145 void DateView::OnMouseEntered(const views::MouseEvent& event) { | 145 void DateView::OnMouseEntered(const ui::MouseEvent& event) { |
146 if (!actionable_) | 146 if (!actionable_) |
147 return; | 147 return; |
148 date_label_->SetEnabledColor(kHeaderTextColorHover); | 148 date_label_->SetEnabledColor(kHeaderTextColorHover); |
149 day_of_week_label_->SetEnabledColor(kHeaderTextColorHover); | 149 day_of_week_label_->SetEnabledColor(kHeaderTextColorHover); |
150 SchedulePaint(); | 150 SchedulePaint(); |
151 } | 151 } |
152 | 152 |
153 void DateView::OnMouseExited(const views::MouseEvent& event) { | 153 void DateView::OnMouseExited(const ui::MouseEvent& event) { |
154 if (!actionable_) | 154 if (!actionable_) |
155 return; | 155 return; |
156 date_label_->SetEnabledColor(kHeaderTextColorNormal); | 156 date_label_->SetEnabledColor(kHeaderTextColorNormal); |
157 day_of_week_label_->SetEnabledColor(kHeaderTextColorNormal); | 157 day_of_week_label_->SetEnabledColor(kHeaderTextColorNormal); |
158 SchedulePaint(); | 158 SchedulePaint(); |
159 } | 159 } |
160 | 160 |
161 TimeView::TimeView(TrayDate::ClockLayout clock_layout) | 161 TimeView::TimeView(TrayDate::ClockLayout clock_layout) |
162 : hour_type_( | 162 : hour_type_( |
163 ash::Shell::GetInstance()->tray_delegate()->GetHourClockType()) { | 163 ash::Shell::GetInstance()->tray_delegate()->GetHourClockType()) { |
(...skipping 27 matching lines...) Expand all Loading... |
191 label_minute_left_->SetText(minute.substr(0, 1)); | 191 label_minute_left_->SetText(minute.substr(0, 1)); |
192 label_minute_right_->SetText(minute.substr(1, 1)); | 192 label_minute_right_->SetText(minute.substr(1, 1)); |
193 | 193 |
194 Layout(); | 194 Layout(); |
195 } | 195 } |
196 | 196 |
197 bool TimeView::PerformAction(const ui::Event& event) { | 197 bool TimeView::PerformAction(const ui::Event& event) { |
198 return false; | 198 return false; |
199 } | 199 } |
200 | 200 |
201 bool TimeView::OnMousePressed(const views::MouseEvent& event) { | 201 bool TimeView::OnMousePressed(const ui::MouseEvent& event) { |
202 // Let the event fall through. | 202 // Let the event fall through. |
203 return false; | 203 return false; |
204 } | 204 } |
205 | 205 |
206 void TimeView::UpdateClockLayout(TrayDate::ClockLayout clock_layout){ | 206 void TimeView::UpdateClockLayout(TrayDate::ClockLayout clock_layout){ |
207 SetBorder(clock_layout); | 207 SetBorder(clock_layout); |
208 if (clock_layout == TrayDate::HORIZONTAL_CLOCK) { | 208 if (clock_layout == TrayDate::HORIZONTAL_CLOCK) { |
209 RemoveChildView(label_hour_left_.get()); | 209 RemoveChildView(label_hour_left_.get()); |
210 RemoveChildView(label_hour_right_.get()); | 210 RemoveChildView(label_hour_right_.get()); |
211 RemoveChildView(label_minute_left_.get()); | 211 RemoveChildView(label_minute_left_.get()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 void TimeView::SetupLabel(views::Label* label) { | 262 void TimeView::SetupLabel(views::Label* label) { |
263 label->set_owned_by_client(); | 263 label->set_owned_by_client(); |
264 SetupLabelForTray(label); | 264 SetupLabelForTray(label); |
265 gfx::Font font = label->font(); | 265 gfx::Font font = label->font(); |
266 label->SetFont(font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD)); | 266 label->SetFont(font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD)); |
267 } | 267 } |
268 | 268 |
269 } // namespace tray | 269 } // namespace tray |
270 } // namespace internal | 270 } // namespace internal |
271 } // namespace ash | 271 } // namespace ash |
OLD | NEW |