[ACR][Add] Add appwidget feature, and add exception for optional feature.
[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          * @feature        %http://tizen.org/feature/shell.appwidget\r
60          *\r
61          * @return             A pointer to the %AppWidgetManager instance, @n
62          *                             else @c null if it fails
63          *
64          * @exception      E_SUCCESS       The method is successful.
65          * @exception      E_SYSTEM        The method cannot proceed due to a severe system error.
66          * @exception      E_UNSUPPORTED_OPERATION   The Emulator or target device does not support the required feature.\r
67          *                 For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.\r
68          *
69          * @remarks      - The specific error code can be accessed using the GetLastResult() method.
70          *               - Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
71          */
72         static AppWidgetManager* GetInstance(void);
73
74         /**
75          * Gets a list of installed AppWidgetProviderInfo.
76          *
77          * @since       2.1
78          *
79          * @return      A pointer to the array list that contains all AppWidgetProviderInfo of installed AppWidgetProvider, @n
80          *          else @c null if an error occurs
81          *
82          * @exception   E_SUCCESS                       The method is successful.
83          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
84          * @remarks     The specific error code can be accessed using the GetLastResult() method.
85          */
86         Tizen::Base::Collection::IList* GetAppWidgetProviderInfoListN(void) const;
87
88         /**
89          * Gets a AppWidgetProviderInfo of the specified AppWidget provider.
90          *
91          * @since       2.1
92          *
93          * @return      A pointer to the AppWidgetProviderInfo instance of the specified AppWidgetProvider, @n
94          *                      else @c null if an error occurs
95          * @param[in]   appId                   The ID of the application that provides AppWidget
96          * @param[in]   providerName    The name of the AppWidget provider
97          * @exception   E_SUCCESS                       The method is successful.
98          * @exception   E_APP_NOT_INSTALLED     The application is not installed.
99          * @exception   E_OBJ_NOT_FOUND         The specified AppWidget provider is not found.
100          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
101          * @remarks     The specific error code can be accessed using the GetLastResult() method.
102          */
103         AppWidgetProviderInfo* GetAppWidgetProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName) const;
104
105         /**
106          * Gets the AppWidgetProviderInfo of the default AppWidget provider in the package.
107          *
108          * @since       2.1
109          *
110          * @return      A pointer to the AppWidgetProviderInfo instance of the default AppWidgetProvider, @n
111          *                      else @c null if there is no default AppWidget provider or if an error occurs
112          * @param[in]   packageId                       The ID of the package that contains the AppWidget provider
113          * @exception   E_SUCCESS                       The method is successful.
114          * @exception   E_APP_NOT_INSTALLED     The application is not installed.
115          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
116          * @remarks     The specific error code can be accessed using the GetLastResult() method.
117          */
118         AppWidgetProviderInfo* GetDefaultAppWidgetProviderInfoN(const Tizen::App::PackageId& packageId) const;
119
120         /**
121          * Sets a AppWidget request listener. @n
122          * The listener gets notified when the request is received. @n
123          * To unset the listener, pass a @c null value to the @c pListener parameter.
124          *
125          * @since       2.1
126          *
127          * @return      An error code
128          * @param[in]   pListener               The pointer to the listener to receive request to add AppWidget
129          * @exception   E_SUCCESS               The method is successful.
130          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
131          * @remarks     Platform does not have the ownership of this pointer, so caller should manage the listener object properly.
132          * @see         IAppWidgetRequestListener
133          */
134         result SetAppWidgetRequestListener(IAppWidgetRequestListener* pListener);
135
136 private:
137         //
138         // This default constructor is intentionally declared as private to implement the %Singleton semantic.
139         //
140         // @since       2.1
141         //
142         AppWidgetManager(void);
143
144         //
145         // This destructor is intentionally declared as private to implement the %Singleton semantic.
146         //
147         // @since       2.1
148         //
149         virtual ~AppWidgetManager(void);
150
151         //
152         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
153         //
154         // @since       2.1
155         //
156         AppWidgetManager(const AppWidgetManager& rhs);
157
158         //
159         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
160         //
161         // @since       2.1
162         //
163         AppWidgetManager& operator =(const AppWidgetManager& rhs);
164
165         //
166         // Constructs the instance of this class.
167         //
168         // @since       2.1
169         //
170         // @return          An error code
171         // @exception   E_SUCCESS       The method is successful.
172         // @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
173         //
174         result Construct(void);
175
176         static void InitSingleton(void);
177         static void DestroySingleton(void);
178
179 private:
180         
181         static AppWidgetManager* __pTheInstance;
182         class _AppWidgetManagerImpl* __pAppWidgetManagerImpl;
183         friend struct std::default_delete< AppWidgetManager >;
184 };
185
186 }} // Tizen::Shell
187 #endif /* _FSHELL_APPWIDGET_MANAGER_H_ */