Tizen 2.1 base
[sdk/ide/native-sample.git] / samples / native / partner / cpp / Sample / Tizen C++ / SystemApp / SystemApp / project / inc / BatteryForm.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.tizenopensource.org/license
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #ifndef _BATTERY_FORM_H_
19 #define _BATTERY_FORM_H_
20
21 #include <FBase.h>
22 #include <FUi.h>
23 #include <FSystem.h>
24
25 class BatteryForm
26         : public Osp::Ui::Controls::Form
27         , public Osp::Ui::IActionEventListener
28         , public Osp::System::IChargingEventListener
29         , public Osp::System::IBatteryEventListener
30         , public Osp::Ui::Controls::IListViewItemEventListener
31         , public Osp::Ui::Controls::IListViewItemProvider
32 {
33 public:
34         BatteryForm(void);
35         virtual ~BatteryForm(void);
36         bool Initialize(void);
37
38         virtual result OnInitializing(void);
39         virtual result OnTerminating(void);
40         virtual void OnActionPerformed(const Osp::Ui::Control& source, int actionId);
41         virtual void OnChargingStateChanged(bool charging);
42         virtual void OnBatteryLevelChangedInPercentage(int percentage);
43
44         // IListViewItemEventListener
45         virtual void OnListViewContextItemStateChanged(Osp::Ui::Controls::ListView& listView,
46                 int index,
47                 int elementId,
48                 Osp::Ui::Controls::ListContextItemStatus state);
49         virtual void OnListViewItemStateChanged(Osp::Ui::Controls::ListView& listView,
50                 int index,
51                 int elementId,
52                 Osp::Ui::Controls::ListItemStatus status);
53         virtual void OnListViewItemSwept(Osp::Ui::Controls::ListView& listView,
54                 int index,
55                 Osp::Ui::Controls::SweepDirection direction);
56
57         //IListViewItemProvider
58         virtual Osp::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
59         virtual bool DeleteItem(int index, Osp::Ui::Controls::ListItemBase* pItem, int itemWidth);
60         virtual int GetItemCount(void);
61
62 private:
63         static const int ID_FORMAT_CUSTOM = 803;
64         Osp::Ui::Controls::Label* __pLabelCharging;
65         Osp::Ui::Controls::Label* __pLabelBatteryLevel;
66         Osp::Ui::Controls::Label* __pLabelBatteryState;
67         Osp::Ui::Controls::ListView* __pListView;
68         Osp::Base::Collection::ArrayList listElements;
69 };
70
71 #endif // _BATTERY_FORM_H_