Tizen 2.1 base
[framework/osp/app-controls.git] / src / certmgr-app-control / CertificateListForm.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 /**
19  * @file                CertificateListForm.h
20  * @brief               This file contains the declaration of CertificateListForm class.
21  */
22
23 #ifndef _CERTIFICATELISTFORM_H_
24 #define _CERTIFICATELISTFORM_H_
25
26 #include <unique_ptr.h>
27 #include <FBaseDataType.h>
28 #include <FUiCtrlForm.h>
29 #include <FUiCtrlIFormBackEventListener.h>
30 #include <FUiCtrlIListViewItemEventListener.h>
31 #include <FUiCtrlIListViewItemProvider.h>
32 #include <FUiCtrlListViewTypes.h>
33 #include <FUiCtrlListItemBase.h>
34
35
36 namespace Tizen { namespace Ui { namespace Controls
37 {
38 class ListView;
39 } } } // Tizen::Ui::Controls
40
41 namespace Tizen { namespace Security { namespace Cert
42 {
43 struct _CertFieldInfos;
44 } } } // Tizen::Security::Cert
45
46 class CertificateListForm
47         : public Tizen::Ui::Controls::Form
48         , virtual public Tizen::Ui::Controls::IListViewItemProvider
49         , virtual public Tizen::Ui::Controls::IListViewItemEventListener
50         , virtual public Tizen::Ui::Controls::IFormBackEventListener
51 {
52
53 // Construction
54 public:
55         CertificateListForm(void);
56         virtual ~CertificateListForm(void);
57         result Initialize(void);
58
59 private:
60         // prevent copy and assignment
61         CertificateListForm(const CertificateListForm& rhs);
62         CertificateListForm& operator =(const CertificateListForm& rhs);
63
64         // Form
65         virtual result OnInitializing(void);
66         virtual result OnTerminating(void);
67
68         // IFormBackEventListener
69         virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
70
71         // IListViewItemProvider
72         virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
73         virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
74         virtual int GetItemCount(void);
75
76         // IListViewItemEventListener
77         virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
78         virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
79         virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);
80
81 private:
82         std::unique_ptr<Tizen::Security::Cert::_CertFieldInfos[]> __pCertList;
83         std::unique_ptr<int[]> __pCertIndex;
84         int __certCount;
85         int __itemLeftMargin;
86         int __itemHeight;
87 };
88
89 #endif  //_CERTIFICATELISTFORM_H_