372950a82c967f2625dca4803e826078a31718eb
[profile/ivi/ico-uxf-homescreen.git] / src / onscreen / CicoOnScreen.h
1 /*
2  * Copyright (c) 2014, TOYOTA MOTOR CORPORATION.
3  *
4  * This program is licensed under the terms and conditions of the
5  * Apache License, version 2.0.  The full text of the Apache License is at
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  */
9 /**
10  * @brief   On Screen
11  *
12  * @date    Jan-07-2014
13  */
14 #ifndef __CICO_ON_SCREEN_H__
15 #define __CICO_ON_SCREEN_H__
16
17 #ifdef HAVE_CONFIG_H
18     #include "config.h"
19     #define __UNUSED__
20 #else
21     #define __UNUSED__
22 #endif
23
24 #include <stdio.h>
25 #include <unistd.h>
26 #include <string.h>
27
28 #include <app.h>
29 #include <aul.h>
30 #include <Ecore_Evas.h>
31 #include <Evas.h>
32 #include <Edje.h>
33
34 #include <stdbool.h>
35 #include <CicoNotification.h>
36 #include <CicoNotificationService.h>
37
38 #include "ico_syc_common.h"
39 #include "ico_syc_privilege.h"
40
41 #include "ico_log.h"
42
43 /*============================================================================*/
44 /* Define fixed parameters                                                    */
45 /*============================================================================*/
46 /* Window Size */
47 #define STATUS_BAR_HEIGHT    64
48 #define CTRL_BAR_HEIGHT      128
49 #define WIDTH                1080
50 #define HEIGHT               (1920 - STATUS_BAR_HEIGHT - CTRL_BAR_HEIGHT)
51
52 /* Popup Size */
53 #define POPUP_WIDTH         640
54 #define POPUP_HEIGHT        300
55
56 /* Popup Frame Size */
57 #define POPUP_FRAME_THICK   10
58 #define POPUP_FRAME_WIDTH   (POPUP_WIDTH+POPUP_FRAME_THICK)
59 #define POPUP_FRAME_HEIGHT  (POPUP_HEIGHT+POPUP_FRAME_THICK)
60
61 #if 0
62 #define POPUP_ST_X          ((WIDTH-POPUP_WIDTH)/2)
63 #define POPUP_ST_Y          ((HEIGHT-POPUP_HEIGHT)/2)
64
65 /* Popup Frame Size */
66 #define POPUP_FRAME_THICK   10
67 #define POPUP_FRAME_WIDTH   (POPUP_WIDTH+POPUP_FRAME_THICK)
68 #define POPUP_FRAME_HEIGHT  (POPUP_HEIGHT+POPUP_FRAME_THICK)
69 #define POPUP_FRAME_ST_X    (POPUP_ST_X-POPUP_FRAME_THICK/2)
70 #define POPUP_FRAME_ST_Y    (POPUP_ST_Y-POPUP_FRAME_THICK/2)
71
72 /* Popup Icon Size */
73 #define POPUP_ICON_WIDTH    50
74 #define POPUP_ICON_HEIGHT   50
75 #define POPUP_ICON_ST_X     POPUP_ST_X
76 #define POPUP_ICON_ST_Y     POPUP_ST_Y
77
78 /* Popup Title Size */
79 #define POPUP_TITLE_WIDTH   (POPUP_WIDTH-POPUP_ICON_WIDTH)
80 #define POPUP_TITLE_HEIGHT  POPUP_ICON_HEIGHT
81 #define POPUP_TITLE_ST_X    (POPUP_ST_X+POPUP_ICON_WIDTH)
82 #define POPUP_TITLE_ST_Y    POPUP_ST_Y
83
84 /* Popup Content BG Size */
85 #define POPUP_CONTENT_BG_WIDTH  POPUP_WIDTH
86 #define POPUP_CONTENT_BG_HEIGHT (POPUP_HEIGHT-POPUP_TITLE_HEIGHT)
87 #define POPUP_CONTENT_BG_ST_X   POPUP_ST_X
88 #define POPUP_CONTENT_BG_ST_Y   (POPUP_ST_Y+POPUP_TITLE_HEIGHT)
89
90 /* Popup Content Size */
91 #define POPUP_CONTENT_WIDTH  POPUP_WIDTH
92 #define POPUP_CONTENT_HEIGHT POPUP_TITLE_HEIGHT
93 #define POPUP_CONTENT_ST_X   POPUP_ST_X
94 #define POPUP_CONTENT_ST_Y   (POPUP_ST_Y+POPUP_TITLE_HEIGHT+(POPUP_HEIGHT-POPUP_CONTENT_HEIGHT)/2)
95
96 #define ICO_ORIENTATION_VERTICAL (1) 
97 #define ICO_ORIENTATION_HORIZONTAL (2)
98
99 #define LEMOLO_PKGNAME       "org.tizen.dialer"
100 #endif
101
102 #define FALSE                0
103 #define TRUE                 1
104
105 #if 0
106 #define ICON_PATH      (char *)"/usr/share/icons/default/small/org.tizen.dialer.png"
107 #endif
108
109 /*============================================================================*/
110 /* Define data types                                                          */
111 /*============================================================================*/
112 struct popup_data
113 {
114     Ecore_Evas  *window;
115     Evas_Object *icon;
116     Evas_Object *theme;
117     int         show_flag;
118     CicoNotification *noti;
119 };
120
121 /*============================================================================*/
122 /* Define class                                                               */
123 /*============================================================================*/
124 class CicoOnScreen
125 {
126 public:
127     CicoOnScreen(void);
128     ~CicoOnScreen(void);
129     bool StartOnScreen(void);
130     void Finalize(void);
131
132     void HidePopup(void);
133     static void NotificationCallback(void *data,
134                                      notification_type_e type,
135                                      notification_op *op_list,
136                                      int num_op);
137
138 private:
139     void ShowPopup(CicoNotification &noti);
140     void InitializePopup(void);
141     void InitializePopupData(void);
142
143     static void evasMouseUpCB(void *data,
144                               Evas *e,
145                               Evas_Object *obj,
146                               void *event_info);
147
148     static void EventCallBack(const ico_syc_ev_e event,
149                               const void *detail,
150                               void *user_data);
151
152     static CicoOnScreen *os_instance;
153     static struct popup_data ico_appdata;
154
155 protected:
156     CicoNotificationService notiservice_;
157 };
158 #endif  // __CICO_ON_SCREEN_H__
159 // vim:set expandtab ts=4 sw=4: