Merge branch 'tizen' into tizen_5.5
[platform/core/api/notification.git] / notification-ex / button_item.h
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 #ifndef NOTIFICATION_EX_BUTTON_ITEM_H_
18 #define NOTIFICATION_EX_BUTTON_ITEM_H_
19
20 #include <string>
21 #include <memory>
22 #include <list>
23
24 #include "notification-ex/abstract_item.h"
25
26 namespace notification {
27 namespace item {
28
29 /**
30  * @brief The class for ButtonItem type notification.
31  * @details The class to make the notification with button.
32  * @since_tizen 5.5
33  */
34 class EXPORT_API ButtonItem : public AbstractItem {
35  public:
36   /**
37    * @brief Constructor
38    * @since_tizen 5.5
39    * @param[in] id The ButtonItem id
40    * @param[in] title The title of ButtonItem
41    * @param[in] action The action for ButtonItem
42    */
43
44   ButtonItem(std::string id, std::string title,
45       std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}));
46
47   /**
48    * @brief Constructor
49    * @since_tizen 5.5
50    * @param[in] title The title of ButtonItem
51    * @param[in] action The action for ButtonItem
52    */
53
54   ButtonItem(std::string title,
55       std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}));
56
57   /**
58    * @brief Destructor
59    * @since_tizen 5.5
60    */
61   virtual ~ButtonItem();
62
63   /**
64    * @brief Serialize the data of ButtonItem.
65    * @since_tizen 5.5
66    * @return Bundle type data
67    */
68   tizen_base::Bundle Serialize() const override;
69
70   /**
71    * @brief Deserialize the serialized data.
72    * @since_tizen 5.5
73    * @param[in] b The serialized Bundle data
74    */
75   void Deserialize(tizen_base::Bundle b) override;
76
77   /**
78    * @brief Checks the item type exist in this notification.
79    * @since_tizen 5.5
80    * @param[in] type notification item type
81    * @return true if the item type exists
82    */
83   bool IsItemTypeExist(int type) override;
84
85   /**
86    * @brief Gets the type of ButtonItem.
87    * @since_tizen 5.5
88    * @return AbstractItem::Type::Button
89    */
90   int GetType() const override;
91
92   /**
93    * @brief Gets the title of ButtonItem.
94    * @since_tizen 5.5
95    * @return The title of ButtonItem
96    */
97   std::string GetTitle() const;
98
99   /**
100    * @brief Gets the image path of ButtonItem.
101    * @since_tizen 5.5
102    * @return The path of image
103    */
104   std::string GetImgPath() const;
105
106   /**
107    * @brief Sets the image path of ButtonItem.
108    * @since_tizen 5.5
109    * @param[in] path Image path
110    */
111   void SetImgPath(std::string path);
112
113  private:
114   class Impl;
115   std::unique_ptr<Impl> impl_;
116 };  // class ButtonItem
117
118 }  // namespace item
119 }  // namespace notification
120
121 #endif  // NOTIFICATION_EX_BUTTON_ITEM_H_