2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FShellNotificationRequest.h
20 * @brief This is the header file for the %NotificationRequest class.
22 * This header file contains the declarations of the %NotificationRequest class.
25 #ifndef _FSHELL_NOTIFICATION_REQUEST_H_
26 #define _FSHELL_NOTIFICATION_REQUEST_H_
29 #include <FShellNotificationManager.h>
31 namespace Tizen { namespace Shell
35 * @class NotificationRequest
36 * @brief This class provides methods for handling a notification request.
40 * @final This class is not intended for extension.
42 * The %NotificationRequest class provides methods for handling a notification request. The request can contain following
44 * -# Constructing element of the notification area such as a notification title or alert text
45 * -# Information of the indicator area such as an alert text
46 * -# The path of the sound file to play when user selects the notification message of the notification area
47 * -# The badge number or badge offset for notification area or main menu
49 * %NotificationRequest are of 2 types: bound to an application or not bound to any application. If %NotificationRequest is bound to an application, then
50 * the associated application is launched by selecting the item in the notification area. Nothing happens when an unbounded %NotificationRequest is selected from a notification area.
52 * For more information about the class features, see <a href="../org.tizen.native.appprogramming/html/guide/shell/notifications.htm">Notifications</a>.
54 * @see Tizen::Shell::NotificationManager
56 class _OSP_EXPORT_ NotificationRequest
57 : public Tizen::Base::Object
62 * Initializes this instance of %NotificationRequest with the specified @c appBinding.
66 * @param[in] appBinding Set to @c true to bind %NotificationRequest to the destination application, @n
68 * @remarks Selecting the posted notification in the notification area leads to launch of the associated application
69 * if %NotificationRequest is bound to the destination application.
71 explicit NotificationRequest(bool appBinding = true);
74 * Copying of objects using this copy constructor is allowed.
78 * @param[in] rhs An instance of %NotificationRequest
80 NotificationRequest(const NotificationRequest& rhs);
83 * Copying of objects using this copy assignment operator is allowed.
87 * @param[in] rhs An instance of %NotificationRequest
89 NotificationRequest& operator =(const NotificationRequest& rhs);
92 * This destructor overrides Tizen::Base::Object::~Object().
96 virtual ~NotificationRequest(void);
99 * Checks whether the specified instance of %NotificationRequest equals the current instance.
103 * @return @c true if the specified instance equals the current instance, @n
105 * @param[in] rhs An instance of %NotificationRequest
106 * @remarks This method returns @c false if the specified object is not %NotificationRequest.
108 virtual bool Equals(const Object& rhs) const;
111 * Gets the hash value of the current instance.
115 * @return The hash value of the current instance
117 virtual int GetHashCode(void) const;
120 * Gets the badge number of a notification message.
124 * @return The badge number value
125 * @remarks If the badge number is not set, then this method returns @c -1.
127 int GetBadgeNumber(void) const;
130 * Sets the badge number of a notification message. @n
131 * %NotificationRequest has either badge number or badge number offset.
132 * If the badge number is set using %SetBadgeNumber(), then previous badge offset value is set to @c 0.
136 * @return An error code
137 * @param[in] value The badge number value
138 * @exception E_SUCCESS The method is successful.
139 * @exception E_INVALID_ARG The specified @c value is less than @c 0 or greater than Shell::MAX_NOTIFICATION_BADGE_NUMBER.
141 result SetBadgeNumber(int value);
144 * Gets the badge number offset of a notification message.
148 * @return The badge offset value
150 int GetBadgeOffset(void) const;
153 * Sets the badge number offset of the notification message. @n
154 * %NotificationRequest has either badge number or badge number offset.
155 * If the badge number offset is set using %SetBadgeOffset(), then previous badge number value is set to @c -1 and ignored. @n
157 * When posting the notification message, badge offset value is added to the current badge number,
158 * which can be acquired by NotificationManager::GetBadgeNumber(). Setting badge offset to @c 0
159 * means explicitly specifying not to change the current badge value with the notification message.
163 * @return An error code
164 * @param[in] value The badge number value
165 * @exception E_SUCCESS The method is successful.
166 * @exception E_INVALID_ARG The absolute value of the specified @c value is greater than Shell::MAX_NOTIFICATION_BADGE_NUMBER.
167 * @remarks Even though this method does not return @c E_INVALID_ARG, it does not guarantee the success of NotificationManager::Notify().
168 * @see SetBadgeNumber()
170 result SetBadgeOffset(int value);
173 * Gets the alert text of a notification message.
177 * @return The alert text
179 Tizen::Base::String GetAlertText(void) const;
182 * Sets an alert text of a notification message.
186 * @return An error code
187 * @param[in] text The alert text
188 * @exception E_SUCCESS The method is successful.
189 * @exception E_INVALID_ARG The specified @c text is empty or the length of @c text is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
190 * @remarks @c text is displayed according to notification layout, and the length of the text is depends on the font attributes or variable font width.
192 result SetAlertText(const Tizen::Base::String& text);
195 * Gets the application message of a notification message.
199 * @return The message for application
201 Tizen::Base::String GetAppMessage(void) const;
204 * Sets the application message of a notification message. @n
205 * @c appMessage is delivered as the value of the http://tizen.org/appcontrol/data/notification key
206 * for IAppControlProviderEventListener::OnAppControlRequestReceived().
210 * @return An error code
211 * @param[in] appMessage The message for the application
212 * @exception E_SUCCESS The method is successful.
213 * @exception E_INVALID_ARG The specified @c appMessage is empty or the length of @c appMessage is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
214 * @exception E_INVALID_OPERATION This instance is not bound to the application.
215 * @remarks This method returns @c E_INVALID_OPERATION if %NotificationRequest instance is not bound to the application.
217 result SetAppMessage(const Tizen::Base::String& appMessage);
220 * Gets the title text of a notification message.
224 * @return The title text
226 Tizen::Base::String GetTitleText(void) const;
229 * Sets the title text of a notification message.
233 * @return An error code
234 * @param[in] title The title text
235 * @exception E_SUCCESS The method is successful.
236 * @exception E_INVALID_ARG The specified @c title is empty or the length of @c title is greater than Shell::MAX_NOTIFICATION_TITLE_LENGTH.
238 result SetTitleText(const Tizen::Base::String& title);
241 * Gets the file path of the icon image for a notification message.
245 * @return The file path of an icon image
247 Tizen::Base::String GetIconFilePath(void) const;
250 * Sets the file path of the icon image for a notification message.
254 * @return An error code
255 * @param[in] iconPath The file path of the icon image
256 * @exception E_SUCCESS The method is successful.
257 * @exception E_INVALID_ARG The specified path is invalid.
259 result SetIconFilePath(const Tizen::Base::String& iconPath);
262 * Gets the file path of a sound file that is played for the notification message.
266 * @return The file path of the sound file to play
268 Tizen::Base::String GetSoundFilePath(void) const;
271 * Sets the file path of the sound file that is played for the notification message. @n
272 * The sound file should be in the WAVE file format.
276 * @return An error code
277 * @param[in] soundPath The file path of the sound file
278 * @exception E_SUCCESS The method is successful.
279 * @exception E_INVALID_ARG The specified path is invalid.
280 * @remarks If the format of the sound file is not valid, then the sound file is not played properly when the notification message is displayed.
282 result SetSoundFilePath(const Tizen::Base::String& soundPath);
285 * Gets the notification type for the ongoing activity notification.
289 * @return The ongoing activity notification type
290 * @remarks This information is only meaningful when the %NotificationRequest instance is delivered to the NotificationManager::NotifyOngoingActivity() method.
291 * @see SetOngoingActivityType()
293 OngoingActivityType GetOngoingActivityType(void) const;
296 * Sets the notification type for an ongoing activity.
300 * @return An error code
301 * @param[in] type The notification type for an ongoing activity
302 * @exception E_SUCCESS The method is successful.
303 * @exception E_INVALID_OPERATION The current progress value is not compatible to the specified @c type.
304 * @remarks This information is only meaningful when the %NotificationRequest instance is delivered to the NotificationManager::NotifyOngoingActivity() method.
305 * @see SetOngoingActivityProgress()
307 result SetOngoingActivityType(OngoingActivityType type = ONGOING_ACTIVITY_TYPE_TEXT);
310 * Gets the progress value for an ongoing activity notification.
314 * @return The progress value
316 int GetOngoingActivityProgress(void) const;
319 * Sets the progress value with the specified @c value.
323 * @return An error code
324 * @param[in] value The progress value
325 * @exception E_SUCCESS The method is successful.
326 * @exception E_INVALID_ARG The specified @c value is less than @c 0, or
327 * the specified @c value does not lie between @c 0 and @c 100 for Shell::ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE.
328 * @exception E_INVALID_OPERATION This instance is in an invalid state. @n
329 * OngoingActivityType must be either Shell::ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE or Shell::ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE.
331 result SetOngoingActivityProgress(int value);
334 * Gets the style of a notification message.
338 * @return The notification style
340 NotificationStyle GetNotificationStyle(void) const;
343 * Sets the style of a notification message.
347 * @return An error code
348 * @param[in] style The notification style
349 * @exception E_SUCCESS The method is successful.
350 * @exception E_INVALID_ARG The specified @c style is not valid.
352 result SetNotificationStyle(NotificationStyle style);
355 * Gets a list of message text for a notification message.
359 * @return A string list of detail information text
361 Tizen::Base::Collection::IList* GetMessageTextListN(void) const;
364 * Sets a string list of message text for a notification message.
368 * @return An error code
369 * @param[in] pTextList A list of detail information text
370 * @exception E_SUCCESS The method is successful.
371 * @exception E_INVALID_ARG The specified @c textList is empty or the length of individual text is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
372 * @remarks This information is only meaningful when the notification style is Shell::NOTIFICATION_STYLE_NORMAL. @n
373 * Use the tab(\\t) character to separate the columns.
376 result SetMessageTextList(const Tizen::Base::Collection::IList* pTextList);
379 * Gets a list of the message thumbnail image absolute file path for a notification message.
383 * @return A string list of thumbnail image file path
385 Tizen::Base::Collection::IList* GetMessageThumbnailFilePathListN(void) const;
388 * Sets a string list of the message thumbnail image absolute file path for a notification message.
392 * @return An error code
393 * @param[in] pThumbnailPathList A list of the thumbnail image file path
394 * @exception E_SUCCESS The method is successful.
395 * @exception E_INVALID_ARG The specified path is invalid.
396 * @remarks This information is only meaningful when then notification style is Shell::NOTIFICATION_STYLE_THUMBNAIL.
398 result SetMessageThumbnailFilePathList(const Tizen::Base::Collection::IList* pThumbnailPathList);
401 * Gets the notification count text of a notification message.
405 * @return The notification count text
407 Tizen::Base::String GetNotificationCountText(void) const;
410 * Sets the notification count text of a notification message.
414 * @return An error code
415 * @param[in] notificationCountText The event count text
416 * @exception E_SUCCESS The method is successful.
417 * @exception E_INVALID_ARG The specified @c eventCountText is empty or the length of @c eventCountText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH.
419 result SetNotificationCountText(const Tizen::Base::String& notificationCountText);
422 * Gets the absolute file path of the background image for a notification message.
426 * @return The file path of a background image file
428 Tizen::Base::String GetBackgroundImageFilePath(void) const;
431 * Sets the absolute file path of the background image for a notification message.
435 * @return An error code
436 * @param[in] imagePath The file path of the background image
437 * @exception E_SUCCESS The method is successful.
438 * @exception E_INVALID_ARG The specified path is invalid.
440 result SetBackgroundImageFilePath(const Tizen::Base::String& imagePath);
444 class _NotificationRequestImpl* __pNotificationRequestImpl;
446 friend class _NotificationRequestImpl;
447 }; // NotificationRequest
451 #endif // _FSHELL_NOTIFICATION_REQUEST_H_