c99241d11deb5fbccced43cf6b81dae43cdd326f
[platform/framework/native/shell.git] / inc / FShellAppWidgetManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 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://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     FShellAppWidgetManager.h
20  * @brief    This is the header file for the %AppWidgetManager class.
21  *
22  * This header file contains the declarations of the %AppWidgetManager class.
23  */
24
25 #ifndef _FSHELL_APPWIDGET_MANAGER_H_
26 #define _FSHELL_APPWIDGET_MANAGER_H_
27
28 #include <unique_ptr.h>
29 #include <FBaseString.h>
30 #include <FAppTypes.h>
31
32 namespace Tizen { namespace Base { namespace Collection { class IList; } } }
33 namespace Tizen { namespace Shell
34 {
35
36 class AppWidgetProviderInfo;
37 class IAppWidgetRequestListener;
38
39 /**
40  * @class               AppWidgetManager
41  * @brief               This class manages static information of all the AppWidgets and provides APIs for AppWidget viewer (such as the Home screen).
42  *
43  * @since       2.1
44  *
45  * @final               This class is not intended for extension.
46  *
47  * The %AppWidgetManager class manages static information of all the AppWidgets and deliveries request to add AppWidget.
48  */
49 class _OSP_EXPORT_ AppWidgetManager
50         : public Tizen::Base::Object
51 {
52 public:
53
54         /**
55          * Gets the AppWidget manager instance.
56          *
57          * @since       2.1
58          *
59          * @return      A pointer to the %AppWidgetManager instance, @n
60          *                      else @c null if it fails
61          */
62         static AppWidgetManager* GetInstance(void);
63
64         /**
65          * Gets a list of installed AppWidgetProviderInfo.
66          *
67          * @since       2.1
68          *
69          * @return      A pointer to the array list that contains all AppWidgetProviderInfo of installed AppWidgetProvider, @n
70          *          else @c null if an error occurs
71          *
72          * @exception   E_SUCCESS                       The method is successful.
73          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
74          * @remarks     The specific error code can be accessed using the GetLastResult() method.
75          */
76         Tizen::Base::Collection::IList* GetAppWidgetProviderInfoListN(void) const;
77
78         /**
79          * Gets a AppWidgetProviderInfo of the specified AppWidget provider.
80          *
81          * @since       2.1
82          *
83          * @return      A pointer to the AppWidgetProviderInfo instance of the specified AppWidgetProvider, @n
84          *                      else @c null if an error occurs
85          * @param[in]   appId                   The ID of the application that provides AppWidget
86          * @param[in]   providerName    The name of the AppWidget provider
87          * @exception   E_SUCCESS                       The method is successful.
88          * @exception   E_APP_NOT_INSTALLED     The application is not installed.
89          * @exception   E_OBJ_NOT_FOUND         The specified AppWidget provider is not found.
90          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
91          * @remarks     The specific error code can be accessed using the GetLastResult() method.
92          */
93         AppWidgetProviderInfo* GetAppWidgetProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName) const;
94
95         /**
96          * Gets the AppWidgetProviderInfo of the default AppWidget provider in the package.
97          *
98          * @since       2.1
99          *
100          * @return      A pointer to the AppWidgetProviderInfo instance of the default AppWidgetProvider, @n
101          *                      else @c null if there is no default AppWidget provider or if an error occurs
102          * @param[in]   packageId                       The ID of the package that contains the AppWidget provider
103          * @exception   E_SUCCESS                       The method is successful.
104          * @exception   E_APP_NOT_INSTALLED     The application is not installed.
105          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
106          * @remarks     The specific error code can be accessed using the GetLastResult() method.
107          */
108         AppWidgetProviderInfo* GetDefaultAppWidgetProviderInfoN(const Tizen::App::PackageId& packageId) const;
109
110         /**
111          * Sets a AppWidget request listener. @n
112          * The listener gets notified when the request is received. @n
113          * To unset the listener, pass a @c null value to the @c pListener parameter.
114          *
115          * @since       2.1
116          *
117          * @return      An error code
118          * @param[in]   pListener               The pointer to the listener to receive request to add AppWidget
119          * @exception   E_SUCCESS               The method is successful.
120          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
121          * @remarks     Platform does not have the ownership of this pointer, so caller should manage the listener object properly.
122          * @see         IAppWidgetRequestListener
123          */
124         result SetAppWidgetRequestListener(IAppWidgetRequestListener* pListener);
125
126 private:
127         //
128         // This default constructor is intentionally declared as private to implement the %Singleton semantic.
129         //
130         // @since       2.1
131         //
132         AppWidgetManager(void);
133
134         //
135         // This destructor is intentionally declared as private to implement the %Singleton semantic.
136         //
137         // @since       2.1
138         //
139         virtual ~AppWidgetManager(void);
140
141         //
142         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
143         //
144         // @since       2.1
145         //
146         AppWidgetManager(const AppWidgetManager& rhs);
147
148         //
149         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
150         //
151         // @since       2.1
152         //
153         AppWidgetManager& operator =(const AppWidgetManager& rhs);
154
155         //
156         // Constructs the instance of this class.
157         //
158         // @since       2.1
159         //
160         // @return          An error code
161         // @exception   E_SUCCESS       The method is successful.
162         // @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
163         //
164         result Construct(void);
165
166         static void InitSingleton(void);
167         static void DestroySingleton(void);
168
169 private:
170         
171         static AppWidgetManager* __pTheInstance;
172         class _AppWidgetManagerImpl* __pAppWidgetManagerImpl;
173         friend struct std::default_delete< AppWidgetManager >;
174 };
175
176 }} // Tizen::Shell
177 #endif /* _FSHELL_APPWIDGET_MANAGER_H_ */