Tizen 2.1 base
[apps/osp/MyFiles.git] / inc / MfBaseItemProvider.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file: MfBaseItemProvider.h
19  * @brief: This file contains declaration of BaseItemProvider class, which acts as a common item provider for all
20  * ListViews
21  */
22
23 #ifndef _MF_BASE_ITEM_PROVIDER_H_
24 #define _MF_BASE_ITEM_PROVIDER_H_
25
26 #include <FApp.h>
27 #include <FBase.h>
28 #include <FLocales.h>
29 #include <FSystem.h>
30 #include <FUi.h>
31
32 #include "MfContentListItem.h"
33 #include "MfFolderEntryDetailPresentationModel.h"
34 #include "MfFolderEntryPresentationModel.h"
35 #include "MfFolderNavigationPresentationModel.h"
36 #include "MfMediaMetaData.h"
37 #include "MfThumbnailManager.h"
38 #include "MfTypes.h"
39 #include "MfUtility.h"
40
41 class BaseItemProvider
42         : public Tizen::Ui::Controls::IListViewItemProvider
43 {
44 public:
45         //! Constructor of the class.
46         /*!@fn BaseItemProvider(void)
47          * @brief A public member taking no arguments, initializes member variables.
48          * @param Takes no parameters
49          * @return No value returned */
50         BaseItemProvider(void);
51
52         //! Destructor of the class.
53         /*!@fn ~BaseItemProvider(void)
54          * @brief A public virtual member taking no arguments, frees the memory allocated to the member variables.
55          * @param Takes no parameters
56          * @return No value returned
57          * */
58         virtual ~BaseItemProvider(void);
59
60         //! Initializes the sub items of the listview control.
61         /*!@fn Construct(void)
62          * @brief A public member taking no arguments which initializes the sub items of the listview control.
63          * @param Takes no parameters
64          * @return No value returned */
65         void Construct(void);
66
67         //! Sets the event listener for the current instance of the FolderEntryPresentationModel.
68         /*!@fn SetFolderEntryProvider(IFolderEntryProviderListener* pProvider)
69          * @brief A public member function to get the current instance of the FolderEntryPresentationModel and set it to the member variable of the provider class.
70          * @param [IFolderEntryProviderListener*] pProvider, an Enumerator indicating the current source form.
71          * @return No Values Returned.
72          * */
73         void SetFolderEntryProvider(IFolderEntryProviderListener* pProvider);
74
75         //! Notifies the Current Form OnListViewItemStateChanged
76         /*!@fn SetFooterItemStateChangeListener(IListViewStateChangeListener*   listener)
77          * @brief A public function which notifies any member implementing the IListViewStateChangeListener interface on ListViewItemStateChanged
78          * so that the footer of the form can be updated accordingly.
79          * @param [IListViewStateChangeListener] Pointer to a class inherited from the IListViewStateChangeListener interface.
80          * @return An ErrorCode.
81          * */
82         result SetFooterItemStateChangeListener(IListViewStateChangeListener* listener);
83
84         //! Sets the source form for the base item provider.
85         /*!@fn SetSourceForm(CreateItemSource sourceInfo)
86          * @brief A public member function to set the current source form for the item provider.
87          * @param [CreateItemSource] sourceInfo, an Enumerator indicating the current source form.
88          * @return No Values Returned.
89          * */
90         void SetSourceForm(CreateItemSource sourceInfo);
91
92         //Callback Methods.
93         virtual int GetItemCount(void);
94         virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
95         virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
96
97 private:
98         // Copy Constructor of the class.
99         /*@fn BaseItemProvider(const BaseItemProvider&)
100          * @brief Copy Constructor
101          * @param Takes Reference of the class
102          * @return No value returned
103          * */
104         BaseItemProvider(const BaseItemProvider&);
105
106         /*
107          * A private member function taking 2 integers as arguments and returning a customItem that gets
108          * added to the listview control.
109          * @fn CreateDetailedListViewItem
110          * @brief Called during CreateItem of ListView to create item for a detailed view.
111          * @param[int, int] The listview itemIndex and width of each item.
112          * @return ContentListItem, a CustomItem element which is returned to ListView Control
113          */
114         ContentListItem* CreateDetailedListViewItem(int listItemIndex, int listItemWidth);
115
116         /*
117          * A private member function taking 2 integers as arguments and returning a customItem that gets
118          * added to the listview control.
119          * @fn CreateNormalListViewItem.
120          * @brief Called during CreateItem of ListView to create item for a normal view.
121          * @param[int, int] The listview itemIndex and width of each item.
122          * @return CustomItem, a CustomItem element which is returned to ListView Control.
123          */
124         ContentListItem* CreateNormalListViewItem(int listItemIndex, int listItemWidth);
125
126         // Assignment operator of the class.
127         /*@fn BaseItemProvider& operator = (const BaseItemProvider& baseItemProvider)
128          * @brief Assignment operator of the class.
129          * @param Takes Reference of the class
130          * @return No value returned
131          * */
132         BaseItemProvider& operator =(const BaseItemProvider& baseItemProvider);
133
134 private:
135         int __flagViewAsStatus;
136         CreateItemSource __sourceInfo;
137
138         //ListView ContextItems
139         static const int IDA_CONTEXT_DETAIL = 105;
140         static const int IDA_CONTEXT_RENAME = 106;
141         static const int IDA_CONTEXT_DELETE = 107;
142
143         FolderEntryPresentationModel* __pFolderEntryPM;
144         FolderEntryDetailPresentationModel __MediaUtility;
145         MediaMetaData* __pMediaMetaData;
146         ThumbnailManager* __pThumbnailManager;
147
148         IFolderEntryProviderListener* __pProviderPM;
149         IListViewStateChangeListener* __pListViewItemStateChangeListener;
150
151         Tizen::Base::Collection::ArrayList* __pFileNames;
152         Tizen::Base::String __extensionKeyName;
153         Tizen::Base::String __hideExtension;
154         Tizen::Base::String __selectAll;
155         Tizen::Base::String __showExtension;
156
157         Tizen::Graphics::Bitmap* __pDummyImage;
158         Tizen::Graphics::Bitmap* __pFolderBitmap;
159         Tizen::Graphics::Bitmap* __pRenameBitmap;
160         Tizen::Graphics::Bitmap* __pRenamePressed;
161
162         Tizen::Ui::Controls::ListContextItem* __pItemContext;
163 };
164 #endif