Lockscreen refactor
[apps/core/preloaded/lockscreen.git] / inc / events.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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 * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #ifndef _LOCKSCREEN_EVENTS_H_
17 #define _LOCKSCREEN_EVENTS_H_
18
19 #include <Elementary.h>
20 #include <time.h>
21
22 typedef enum {
23         LOCKSCREEN_EVENT_TYPE_NOTIFICATION = (1 << 0),
24         LOCKSCREEN_EVENT_TYPE_MINICONTROLLER = (1 << 1)
25 } lockscreen_event_type_e;
26
27 /**
28  * @brief Event fired when lockscreen's events change.
29  */
30 extern int LOCKSCREEN_EVENT_EVENTS_CHANGED;
31
32 /**
33  * @brief lockscreen event handle
34  */
35 typedef struct lockscreen_event lockscreen_event_t;
36
37 /**
38  * @brief Initialize event support
39  *
40  * @return: 0 on success, other value on failure.
41  */
42 int lockscreen_events_init(void);
43
44 /**
45  * @brief Denitialize event support.
46  */
47 void lockscreen_events_shutdown(void);
48
49 /**
50  * @brief Gets main event icon
51  */
52 const char *lockscreen_event_icon_get(const lockscreen_event_t *event);
53
54 /**
55  * @brief Get secondary event icon
56  */
57 const char *lockscreen_event_sub_icon_get(const lockscreen_event_t *event);
58
59 /**
60  * @brief Get event title
61  */
62 const char *lockscreen_event_title_get(const lockscreen_event_t *event);
63
64 /**
65  * @brief Get event textual content.
66  */
67 const char *lockscreen_event_content_get(const lockscreen_event_t *event);
68
69 /**
70  * @brief Gets time when event was posted.
71  */
72 time_t lockscreen_event_time_get(const lockscreen_event_t *event);
73
74 /**
75  * @brief Result of launch true if launch has successed, false otherwise
76  */
77 typedef void (*Launch_Result_Cb)(bool result);
78
79 /**
80  * @brief Launch application which posted the event
81  */
82 bool lockscreen_event_launch(lockscreen_event_t *event, Launch_Result_Cb cb);
83
84 /**
85  * @brief Get event type.
86  */
87 lockscreen_event_type_e lockscreen_event_type_get(const lockscreen_event_t *event);
88
89 /**
90  * @brief Gets list of all displayed events.
91  *
92  * @note list elements are only until LOCKSCREEN_EVENT_NOTIFICATIONS_CHANGED is fired.
93  * @note should be free with eina_list_free
94  */
95 Eina_List *lockscreen_events_get(void);
96
97 /**
98  * @brief Inticates if any events for lockscreen are currently posted.
99  */
100 bool lockscreen_events_exists(void);
101
102 /**
103  * @brief Creates minicontroller for given event.
104  */
105 Evas_Object *lockscreen_event_minicontroller_create(lockscreen_event_t *event, Evas_Object *parent);
106
107 /**
108  * @brief Clears event
109  */
110 void lockscreen_event_remove(lockscreen_event_t *event);
111
112 /**
113  * @brief Clears all events
114  */
115 void lockscreen_events_remove_all(void);
116
117 #endif