[ecore] merged svn latest code (svn54830)
[profile/ivi/ecore.git] / src / lib / ecore_directfb / Ecore_DirectFB.h
1 #ifndef _ECORE_DIRECTFB_H
2 #define _ECORE_DIRECTFB_H
3
4 #include <directfb.h>
5
6 #include <Eina.h>
7
8 #ifdef EAPI
9 # undef EAPI
10 #endif /* ifdef EAPI */
11
12 #ifdef __GNUC__
13 # if __GNUC__ >= 4
14 #  define EAPI __attribute__ ((visibility("default")))
15 # else /* if __GNUC__ >= 4 */
16 #  define EAPI
17 # endif /* if __GNUC__ >= 4 */
18 #else /* ifdef __GNUC__ */
19 # define EAPI
20 #endif /* ifdef __GNUC__ */
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* ifdef __cplusplus */
25
26 EAPI extern int ECORE_DIRECTFB_EVENT_POSITION;
27 EAPI extern int ECORE_DIRECTFB_EVENT_SIZE;
28 EAPI extern int ECORE_DIRECTFB_EVENT_CLOSE;
29 EAPI extern int ECORE_DIRECTFB_EVENT_DESTROYED;
30 EAPI extern int ECORE_DIRECTFB_EVENT_GOT_FOCUS;
31 EAPI extern int ECORE_DIRECTFB_EVENT_LOST_FOCUS;
32 EAPI extern int ECORE_DIRECTFB_EVENT_KEY_DOWN;
33 EAPI extern int ECORE_DIRECTFB_EVENT_KEY_UP;
34 EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_DOWN;
35 EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_UP;
36 EAPI extern int ECORE_DIRECTFB_EVENT_MOTION;
37 EAPI extern int ECORE_DIRECTFB_EVENT_ENTER;
38 EAPI extern int ECORE_DIRECTFB_EVENT_LEAVE;
39 EAPI extern int ECORE_DIRECTFB_EVENT_WHEEL;
40
41 #ifndef _ECORE_DIRECTFB_WINDOW_PREDEF
42 typedef struct _Ecore_DirectFB_Window              Ecore_DirectFB_Window;
43 #endif /* ifndef _ECORE_DIRECTFB_WINDOW_PREDEF */
44 typedef struct _Ecore_DirectFB_Cursor              Ecore_DirectFB_Cursor;
45
46 typedef struct _Ecore_DirectFB_Event_Key_Down      Ecore_DirectFB_Event_Key_Down;
47 typedef struct _Ecore_DirectFB_Event_Key_Up        Ecore_DirectFB_Event_Key_Up;
48 typedef struct _Ecore_DirectFB_Event_Button_Down   Ecore_DirectFB_Event_Button_Down;
49 typedef struct _Ecore_DirectFB_Event_Button_Up     Ecore_DirectFB_Event_Button_Up;
50 typedef struct _Ecore_DirectFB_Event_Motion        Ecore_DirectFB_Event_Motion;
51 typedef struct _Ecore_DirectFB_Event_Enter         Ecore_DirectFB_Event_Enter;
52 typedef struct _Ecore_DirectFB_Event_Leave         Ecore_DirectFB_Event_Leave;
53 typedef struct _Ecore_DirectFB_Event_Wheel         Ecore_DirectFB_Event_Wheel;
54 typedef struct _Ecore_DirectFB_Event_Got_Focus     Ecore_DirectFB_Event_Got_Focus;
55 typedef struct _Ecore_DirectFB_Event_Lost_Focus    Ecore_DirectFB_Event_Lost_Focus;
56
57 /* this struct is to keep windows data (id, window itself and surface) in memory as every call
58  * to DirectFB for this values (e.g window->GetSurface(window,&surface)) will increment the
59  * reference count, then we will have to release N times the data, so better we just ask for
60    them once */
61 struct _Ecore_DirectFB_Window
62 {
63    DFBWindowID            id;
64    IDirectFBWindow       *window;
65    IDirectFBSurface      *surface;
66    Ecore_DirectFB_Cursor *cursor;
67 };
68
69 struct _Ecore_DirectFB_Cursor
70 {
71    IDirectFBSurface *surface;
72    int               hot_x;
73    int               hot_y;
74 };
75
76 struct _Ecore_DirectFB_Event_Key_Down /** DirectFB Key Down event */
77 {
78    char        *name; /**< The name of the key that was released */
79    char        *string; /**< The logical symbol of the key that was pressed */
80    char        *key_compose; /**< The UTF-8 string conversion if any */
81    unsigned int time;
82    DFBWindowID  win;
83 };
84
85 struct _Ecore_DirectFB_Event_Key_Up /** DirectFB Key Up event */
86 {
87    char        *name; /**< The name of the key that was released */
88    char        *string; /**< The logical symbol of the key that was pressed */
89    char        *key_compose; /**< The UTF-8 string conversion if any */
90    unsigned int time;
91    DFBWindowID  win;
92 };
93
94 struct _Ecore_DirectFB_Event_Button_Down
95 {
96    int          button;
97    int          modifiers;
98    int          x, y;
99    unsigned int time;
100    int          double_click : 1;
101    int          triple_click : 1;
102    DFBWindowID  win;
103 };
104 struct _Ecore_DirectFB_Event_Button_Up
105 {
106    int          button;
107    int          modifiers;
108    int          x, y;
109    unsigned int time;
110    DFBWindowID  win;
111    int          double_click : 1;
112    int          triple_click : 1;
113 };
114 struct _Ecore_DirectFB_Event_Motion
115 {
116    int          modifiers;
117    int          x, y;
118    unsigned int time;
119    DFBWindowID  win;
120 };
121
122 struct _Ecore_DirectFB_Event_Enter
123 {
124    int          modifiers;
125    int          x, y;
126    unsigned int time;
127    DFBWindowID  win;
128 };
129
130 struct _Ecore_DirectFB_Event_Leave
131 {
132    int          modifiers;
133    int          x, y;
134    unsigned int time;
135    DFBWindowID  win;
136 };
137
138 struct _Ecore_DirectFB_Event_Wheel
139 {
140    int          direction;
141    int          z;
142    int          modifiers;
143    unsigned int time;
144    DFBWindowID  win;
145 };
146
147 struct _Ecore_DirectFB_Event_Got_Focus
148 {
149    unsigned int time;
150    DFBWindowID  win;
151 };
152
153 struct _Ecore_DirectFB_Event_Lost_Focus
154 {
155    unsigned int time;
156    DFBWindowID  win;
157 };
158
159 /* main functions */
160 EAPI int                    ecore_directfb_init(const char *name);
161 EAPI int                    ecore_directfb_shutdown(void);
162 EAPI IDirectFB *            ecore_directfb_interface_get(void);
163
164 /* window operations */
165 EAPI Ecore_DirectFB_Window *ecore_directfb_window_new(int x, int y, int w, int h);
166 EAPI void                   ecore_directfb_window_free(Ecore_DirectFB_Window *window);
167 EAPI void                   ecore_directfb_window_move(Ecore_DirectFB_Window *window, int x, int y);
168 EAPI void                   ecore_directfb_window_resize(Ecore_DirectFB_Window *window, int w, int h);
169 EAPI void                   ecore_directfb_window_focus(Ecore_DirectFB_Window *window);
170 EAPI void                   ecore_directfb_window_show(Ecore_DirectFB_Window *window);
171 EAPI void                   ecore_directfb_window_hide(Ecore_DirectFB_Window *window);
172 EAPI void                   ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *window, Eina_Bool set);
173 EAPI void                   ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *window, Eina_Bool set);
174 EAPI void                   ecore_directfb_window_size_get(Ecore_DirectFB_Window *window, int *w, int *h);
175 EAPI void                   ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *window, Eina_Bool show);
176
177 #ifdef __cplusplus
178 }
179 #endif /* ifdef __cplusplus */
180
181 #endif /* ifndef _ECORE_DIRECTFB_H */