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