OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_ | |
6 #define ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_ | |
7 #pragma once | |
8 | |
9 #include "ash/system/power/power_supply_status.h" | |
10 #include "ui/views/view.h" | |
11 | |
12 namespace views { | |
13 class ImageView; | |
14 class Label; | |
15 } | |
16 | |
17 namespace ash { | |
18 namespace internal { | |
19 | |
20 // This view is used only for the popup. | |
stevenjb (google-dont-use)
2012/06/08 17:11:16
This comment no longer applies. We should change i
jennyz
2012/06/08 17:29:51
Done.
| |
21 class PowerStatusView : public views::View { | |
22 public: | |
23 enum ViewType { | |
24 VIEW_DEFAULT, | |
25 VIEW_NOTIFICATION | |
26 }; | |
27 | |
28 explicit PowerStatusView(ViewType view_type); | |
29 virtual ~PowerStatusView() {} | |
30 | |
31 void UpdatePowerStatus(const PowerSupplyStatus& status); | |
32 | |
33 // Overridden from views::View. | |
34 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
35 | |
36 private: | |
37 void LayoutDefaultView(); | |
38 void LayoutNotificationView(); | |
39 void UpdateText(); | |
40 void UpdateIcon(); | |
41 void Update(); | |
42 void UpdateTextForDefaultView(); | |
43 void UpdateTextForNotificationView(); | |
44 | |
45 // Overridden from views::View. | |
46 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | |
47 | |
48 // labels used only for VIEW_NOTIFICATION. | |
49 views::Label* status_label_; | |
50 views::Label* time_label_; | |
51 | |
52 // labels used only for VIEW_DEFAULT. | |
53 views::Label* time_status_label_; | |
54 | |
55 views::ImageView* icon_; | |
56 ViewType view_type_; | |
57 | |
58 PowerSupplyStatus supply_status_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(PowerStatusView); | |
61 }; | |
62 | |
63 } // namespace internal | |
64 } // namespace ash | |
65 | |
66 #endif // ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_ | |
OLD | NEW |