2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef NOTIFICATION_EX_ABSTRACT_ITEM_H_
18 #define NOTIFICATION_EX_ABSTRACT_ITEM_H_
25 #include "notification-ex/abstract_action.h"
26 #include "notification-ex/bundle.h"
29 #define EXPORT_API __attribute__((visibility("default")))
32 namespace notification {
35 class EXPORT_API Color {
43 Color(unsigned char a, unsigned char r, unsigned char g, unsigned char b)
44 : a_(a), r_(r), g_(g), b_(b) {
48 unsigned char GetAVal() const {
51 unsigned char GetRVal() const {
54 unsigned char GetGVal() const {
57 unsigned char GetBVal() const {
68 class EXPORT_API Padding {
76 Padding(int left, int top, int right, int bottom)
77 : left_(left), top_(top), right_(right), bottom_(bottom) {
87 int GetRight() const {
90 int GetBottom() const {
101 class EXPORT_API Geometry {
109 Geometry(int x, int y, int w, int h) : x_(x), y_(y), w_(w), h_(h) {
119 int GetWidth() const {
122 int GetHeight() const {
133 class EXPORT_API Style {
135 Style(Color color, Padding padding, Geometry geometry);
138 Padding GetPadding() const;
139 Color GetColor() const;
140 Geometry GetGeometry() const;
148 class EXPORT_API LEDInfo {
153 explicit LEDInfo(Color color);
156 void SetOffPeriod(int ms);
157 void SetOnPeriod(int ms);
158 Color GetColor() const;
165 class EXPORT_API AbstractItem {
189 virtual ~AbstractItem();
191 virtual Bundle Serialize() = 0;
192 virtual void Deserialize(Bundle b) = 0;
193 virtual std::shared_ptr<AbstractItem> FindByID(std::string id) = 0;
194 std::string GetId() const;
195 void SetId(std::string id);
196 std::shared_ptr<AbstractAction> GetAction() const;
197 Style GetStyle() const;
198 Type GetType() const;
199 void SetVisible(bool visible);
200 void SetEnable(bool enable);
201 void AddReceiver(std::string receiver_group);
202 void RemoveReceiver(std::string receiver_group);
203 bool CanReceive(std::string id) const;
204 void SetPolicy(Policy policy);
205 int GetVersion() const;
206 void SetVersion(int ver);
207 int GetHideTime() const;
208 int GetDeleteTime() const;
212 }; // class AbstractItem
215 } // namespace notification
217 #endif // NOTIFICATION_EX_ABSTRACT_ITEM_H_