Add progress item implementation
[platform/core/api/notification.git] / notification-ex / 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_ITEM_H_
18 #define NOTIFICATION_EX_ITEM_H_
19
20 #include <time.h>
21
22 #include <memory>
23 #include <string>
24 #include <list>
25
26 #include "notification-ex/abstract_item.h"
27 #include "notification-ex/ex_bundle.h"
28
29 #ifndef EXPORT_API
30 #define EXPORT_API __attribute__((visibility("default")))
31 #endif
32
33 namespace notification {
34 namespace item {
35
36 class EXPORT_API TextItem : public AbstractItem {
37  public:
38   TextItem(std::string text);
39   virtual ~TextItem();
40
41   Bundle Serialize() override;
42   void Deserialize(Bundle b) override;
43   AbstractItem& FindByID(std::string id) override;
44   void SetContents(std::string contents);
45   std::string GetContents() const;
46   std::string GetHyperLink() const;
47
48  private:
49   std::string text_ = nullptr;
50 };  // class TextItem
51
52 class EXPORT_API IconItem : public AbstractItem {
53  public:
54   IconItem(std::string iconpath);
55   virtual ~IconItem();
56
57   Bundle Serialize() override;
58   void Deserialize(Bundle b) override;
59   AbstractItem& FindByID(std::string id) override;
60
61  private:
62   std::string iconPath_ = nullptr;
63 };  // class IconItem
64
65 class EXPORT_API IconTextItem : public AbstractItem {
66  public:
67   IconTextItem(std::string iconpath, std::string text);
68   virtual ~IconTextItem();
69
70   Bundle Serialize() override;
71   void Deserialize(Bundle b) override;
72   AbstractItem& FindByID(std::string id) override;
73   IconItem GetIconItem() const;
74   TextItem GetTextItem() const;
75
76  private:
77   std::string iconPath_ = nullptr;
78   std::string text_ = nullptr;
79 };  // class IconTextItem
80
81 class EXPORT_API ImageItem : public AbstractItem {
82  public:
83   ImageItem(std::string imagePath);
84   virtual ~ImageItem();
85
86   Bundle Serialize() override;
87   void Deserialize(Bundle b) override;
88   AbstractItem& FindByID(std::string id) override;
89   std::string GetImagePath() const;
90
91  private:
92   std::string imagePath_ = nullptr;
93 };  // class ImageItem
94
95 class EXPORT_API CheckBoxItem : public AbstractItem {
96  public:
97   CheckBoxItem(bool checked);
98   virtual ~CheckBoxItem();
99
100   Bundle Serialize() override;
101   void Deserialize(Bundle b) override;
102   AbstractItem& FindByID(std::string id) override;
103   bool IsChecked() const;
104
105 private:
106   bool checked_ = false;
107 };  // class CheckBoxItem
108
109 class EXPORT_API ChatMessageItem : public AbstractItem {
110  public:
111   enum Type {
112     user,
113     sender,
114   };
115
116  public:
117   ChatMessageItem();
118   virtual ~ChatMessageItem();
119
120   Bundle Serialize() override;
121   void Deserialize(Bundle b) override;
122   AbstractItem& FindByID(std::string id) override;
123   TextItem GetTextItem() const;
124   TextItem GetDataItem() const;
125   time_t GetTimeItem() const;
126   Type GetType() const;
127 };  // class ChatMessageItem
128
129 class EXPORT_API EntryItem : public AbstractItem {
130  public:
131   EntryItem();
132   virtual ~EntryItem();
133
134   Bundle Serialize() override;
135   void Deserialize(Bundle b) override;
136   AbstractItem& FindByID(std::string id) override;
137   std::string GetText() const;
138   void SetText(std::string text);
139   void SetTextLimit(int size);
140   int GetTextLimit() const;
141
142  private:
143   std::string text_ = nullptr;
144   int limit_ = 160;
145 };  // class EntryItem
146
147 class EXPORT_API EffectItem : public AbstractItem {
148  public:
149   EffectItem();
150   virtual ~EffectItem();
151
152   Bundle Serialize() override;
153   void Deserialize(Bundle b) override;
154   AbstractItem& FindByID(std::string id) override;
155   std::string GetSoundPath() const;
156   std::string GetVibrationPath() const;
157
158  private:
159   std::string soundPath_ = nullptr;
160   std::string vibrationPath_ = nullptr;
161 };  // class EffectItem
162
163 class EXPORT_API CustomItem : public AbstractItem {
164  public:
165   CustomItem();
166   virtual ~CustomItem();
167
168   Bundle Serialize() override;
169   void Deserialize(Bundle b) override;
170   AbstractItem& FindByID(std::string id) override;
171 };  // class CustomItem
172
173 }  // namespace item
174 }  // nampace notification
175 #endif  // NOTIFICATION_EX_ITEM_H_