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