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 class PowerStatusView : public views::View { |
| 21 public: |
| 22 enum ViewType { |
| 23 VIEW_DEFAULT, |
| 24 VIEW_NOTIFICATION |
| 25 }; |
| 26 |
| 27 explicit PowerStatusView(ViewType view_type); |
| 28 virtual ~PowerStatusView() {} |
| 29 |
| 30 void UpdatePowerStatus(const PowerSupplyStatus& status); |
| 31 |
| 32 // Overridden from views::View. |
| 33 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 34 |
| 35 private: |
| 36 void LayoutDefaultView(); |
| 37 void LayoutNotificationView(); |
| 38 void UpdateText(); |
| 39 void UpdateIcon(); |
| 40 void Update(); |
| 41 void UpdateTextForDefaultView(); |
| 42 void UpdateTextForNotificationView(); |
| 43 |
| 44 // Overridden from views::View. |
| 45 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
| 46 |
| 47 // labels used only for VIEW_NOTIFICATION. |
| 48 views::Label* status_label_; |
| 49 views::Label* time_label_; |
| 50 |
| 51 // labels used only for VIEW_DEFAULT. |
| 52 views::Label* time_status_label_; |
| 53 |
| 54 views::ImageView* icon_; |
| 55 ViewType view_type_; |
| 56 |
| 57 PowerSupplyStatus supply_status_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(PowerStatusView); |
| 60 }; |
| 61 |
| 62 } // namespace internal |
| 63 } // namespace ash |
| 64 |
| 65 #endif // ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_ |
OLD | NEW |