Merge branch 'tizen' into tizen_5.5
[platform/core/api/notification.git] / notification-ex / icon_text_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_ICON_TEXT_ITEM_H_
18 #define NOTIFICATION_EX_ICON_TEXT_ITEM_H_
19
20 #include <string>
21 #include <memory>
22 #include <list>
23
24 #include "notification-ex/abstract_item.h"
25 #include "notification-ex/icon_item.h"
26 #include "notification-ex/text_item.h"
27
28 namespace notification {
29 namespace item {
30
31 /**
32  * @brief The class for IconTextItem type notification.
33  * @details The class to make the notification with icon and text.
34  * @since_tizen 5.5
35  */
36 class EXPORT_API IconTextItem : public AbstractItem {
37  public:
38   /**
39    * @brief Constructor
40    * @since_tizen 5.5
41    * @param[in] id The IconTextItem id
42    * @param[in] icon The icon of IconTextItem
43    * @param[in] text The text of IconTextItem
44    * @param[in] action The action for IconTextItem
45    */
46   IconTextItem(std::string id, std::shared_ptr<IconItem> icon,
47     std::shared_ptr<TextItem> text,
48     std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}));
49
50   /**
51    * @brief Destructor
52    * @since_tizen 5.5
53    */
54   virtual ~IconTextItem();
55
56   /**
57    * @brief Serialize the data of IconTextItem.
58    * @since_tizen 5.5
59    * @return Bundle type data
60    */
61   tizen_base::Bundle Serialize() const override;
62
63   /**
64    * @brief Deserialize the serialized data.
65    * @since_tizen 5.5
66    * @param[in] b The serialized Bundle data
67    */
68   void Deserialize(tizen_base::Bundle b) override;
69
70   /**
71    * @brief Finds the AbstractItem using by notification item id.
72    * @since_tizen 5.5
73    * @param[in] id notification item id
74    * @return AbstractItem object
75    */
76   AbstractItem& FindByID(std::string id) override;
77
78   /**
79    * @brief Finds the AbstractItem using by main type.
80    * @since_tizen 5.5
81    * @param[in] type The main type
82    * @return AbstractItem object
83    */
84   AbstractItem& FindByMainType(MainType type) override;
85
86   /**
87    * @brief Checks the item type exist in this notification.
88    * @since_tizen 5.5
89    * @param[in] type notification item type
90    * @return true if the item type exists
91    */
92   bool IsItemTypeExist(int type) override;
93
94   /**
95    * @brief Gets the type of IconTextItem.
96    * @since_tizen 5.5
97    * @return AbstractItem::Type::IconText
98    */
99   int GetType() const override;
100
101   /**
102    * @brief Gets the IconItem of IconTextItem.
103    * @since_tizen 5.5
104    * @return The IconItem object
105    */
106   IconItem& GetIconItem() const;
107
108   /**
109    * @brief Gets the TextItem of IconTextItem.
110    * @since_tizen 5.5
111    * @return The TextItem object
112    */
113   TextItem& GetTextItem() const;
114
115  private:
116   class Impl;
117   std::unique_ptr<Impl> impl_;
118 };  // class IconTextItem
119
120 }  // namespace item
121 }  // namespace notification
122 #endif  // NOTIFICATION_EX_ICON_TEXT_ITEM_H_