Fix group name for noti_ex
[platform/core/api/notification.git] / notification-ex / group_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_GROUP_ITEM_H_
18 #define NOTIFICATION_EX_GROUP_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 GroupItem type notification.
31  * @details The class to make the group of notifications.
32  * @since_tizen 5.5
33  */
34 class EXPORT_API GroupItem : public AbstractItem {
35  public:
36   /**
37    * @brief Constructor
38    * @since_tizen 5.5
39    * @param[in] action The action for GroupItem
40    */
41   GroupItem(std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}));
42
43   /**
44    * @brief Constructor
45    * @since_tizen 5.5
46    * @param[in] id The GroupItem id
47    * @param[in] action The action for GroupItem
48    */
49   GroupItem(std::string id,
50       std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}));
51
52   /**
53    * @brief Deserialize
54    * @since_tizen 5.5
55    */
56   virtual ~GroupItem();
57
58  public:
59   /**
60    * @brief Serialize the data of GroupItem.
61    * @since_tizen 5.5
62    * @return Bundle type data
63    */
64   tizen_base::Bundle Serialize() const override;
65
66   /**
67    * @brief Deserialize the serialized data.
68    * @since_tizen 5.5
69    * @param[in] b The serialized Bundle data
70    */
71   void Deserialize(tizen_base::Bundle b) override;
72
73   /**
74    * @brief Finds the AbstractItem using by notification item id.
75    * @since_tizen 5.5
76    * @param[in] id notification item id
77    * @return AbstractItem object
78    */
79   AbstractItem& FindByID(std::string id) override;
80
81   /**
82    * @brief Finds the AbstractItem using by main type.
83    * @since_tizen 5.5
84    * @param[in] type The main type
85    * @return AbstractItem object
86    */
87   AbstractItem& FindByMainType(MainType type) override;
88
89   /**
90    * @brief Checks the item type exist in this notification.
91    * @since_tizen 5.5
92    * @param[in] type notification item type
93    * @return true if the item type exists
94    */
95   bool IsItemTypeExist(int type) override;
96
97   /**
98    * @brief Gets the type of GroupItem.
99    * @since_tizen 5.5
100    * @return AbstractItem::Type::Group
101    */
102   int GetType() const override;
103
104   /**
105    * @brief Gets the path of shared file location.
106    * @since_tizen 5.5
107    * @return The list of shared path.
108    */
109   std::list<std::string> GetSharedPath() const override;
110
111   /**
112    * @brief Sets the vertical state.
113    * @details The vertical state is true, the children of GroupItem are associated vertically.
114    *          And if it is false, the children are associated horizontally.
115    * @since_tizen 5.5
116    * @param[in] The vertical state
117    */
118   void SetDirection(bool vertical);
119
120   /**
121    * @brief Gets whether the vertical state is true or not.
122    * @since_tizen 5.5
123    * @return true if vertical is true, or false
124    */
125   bool IsVertical();
126
127   /**
128    * @brief Gets app label data of GroupItem.
129    * @since_tizen 5.5
130    * @return The app label data
131    */
132   std::string GetAppLabel();
133
134   /**
135    * @brief Sets app label data of GroupItem.
136    * @since_tizen 5.5
137    * @return The app label data
138    */
139   void SetAppLabel(std::string label);
140
141   /**
142    * @brief Adds child notification item.
143    * @since_tizen 5.5
144    * @param[in] AbstractItem object
145    */
146   void AddChild(std::shared_ptr<AbstractItem> child);
147
148   /**
149    * @brief Removes child notification item.
150    * @since_tizen 5.5
151    * @param[in] The notification id
152    */
153   void RemoveChild(std::string itemId);
154
155   /**
156    * @brief Gets the list of children item of GroupItem.
157    * @since_tizen 5.5
158    * @return The list of AbstractItem
159    */
160   std::list<std::shared_ptr<AbstractItem>> GetChildren();
161
162  private:
163   class Impl;
164   std::unique_ptr<Impl> impl_;
165 };
166
167 }  // namespace item
168 }  // namespace notification
169
170 #endif  // NOTIFICATION_EX_GROUP_ITEM_H_