Applied latest source code
[apps/native/preloaded/Clock.git] / inc / ClkSortByPopUp.h
1 //
2 // Tizen Native SDK
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.1 (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://floralicense.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 /**
19  * @file    ClkSortByPopUp.h
20  * @brief       This header file contains the declarations of the SortByPopUp
21  *
22  */
23
24 #ifndef _CLK_SORTBY_POPUP_H_
25 #define _CLK_SORTBY_POPUP_H_
26
27 #include <FApp.h>
28 #include <FBase.h>
29 #include <FUi.h>
30
31 enum SortBy
32 {
33         SORTBY_RECENT,
34         SORTBY_TIME
35 };
36
37 class ISortByEventListener
38 {
39 public:
40         ISortByEventListener();
41         virtual ~ISortByEventListener();
42
43         virtual void OnSortByPopUpItemSelected(SortBy sortby ) = 0;
44 };
45
46 class SortByPopUp
47   : public Tizen::Ui::Controls::Popup
48   , public Tizen::Ui::Controls::IListViewItemEventListener
49   , public Tizen::Ui::Controls::IListViewItemProvider
50   , public Tizen::Ui::IActionEventListener
51   , public Tizen::Ui::IPropagatedKeyEventListener
52   {
53   public:
54         /**
55          * @brief The Default Constructor
56          */
57          SortByPopUp(void);
58
59         /**
60          * @brief The Default Destructor
61          */
62         ~SortByPopUp(void);
63
64         /**
65          * @brief Initializes this SettingForm Form.
66          *
67          * @return              An error code
68          * @exception   true                            The method is succeIOrientationEventListenerssful.
69          * @exception   false                           An error Occured.
70          */
71         bool Initialize(void);
72
73         /**
74          * This function terminates all the controls
75          *
76          * @return      result type
77          * @param               No parameter
78          */
79         virtual result OnTerminating(void);
80
81   public:
82         //IListViewItemProvider
83         virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
84         virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
85         virtual int GetItemCount(void);
86
87         //IActionEventListener
88         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
89
90         // IListViewItemEventListener
91         virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state){};
92         virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
93         virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction){};
94         virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback){};
95
96         //ISortByEventListener
97         ISortByEventListener* GetEventListner(void);
98         void SetEventListner(ISortByEventListener*);
99
100         void SetDstIndex(int index);
101
102         virtual bool OnKeyPressed (Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo){return false;}
103         virtual bool OnKeyReleased (Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
104         virtual bool OnPreviewKeyPressed (Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo){return false;}
105         virtual bool OnPreviewKeyReleased (Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo){return false;}
106   private:
107         Tizen::Ui::Controls::ListView*  __pList;
108         ISortByEventListener *__pListener;
109         Tizen::Base::Collection::ArrayList* __pShareList;
110
111   };
112
113 #endif /* _CLK_SORTBY_POPUP_H_ */