ecere: gfx/gui: support P/NaCl platform. add new Pepper interface driver for targetin...
[sdk] / ecere / src / gui / drivers / PepperInterface.ec
1 namespace gui::drivers;
2
3 #ifdef BUILDING_ECERE_COM
4 import "Window"
5 import "Interface"
6 #else
7 #ifdef ECERE_STATIC
8 public import static "ecere"
9 #else
10 public import "ecere"
11 #endif
12 #endif
13
14 /*#if !defined(ENABLE_PEPPER_DRIVER)
15 #define NO_PEPPER_DRIVER
16 #endif*/
17
18 #if (defined(__nacl__) || defined(__pnacl__)) // && !defined(NO_PEPPER_DRIVER)
19
20 #include <stdio.h>
21
22 //#include "ppapi_simple/ps_main.h"
23
24 #include "ppapi/c/pp_instance.h"
25 #include "ppapi/c/pp_module.h"
26 #include "ppapi/c/pp_var.h"
27
28
29 // source file line number printf (sflnprintf)
30 #define sflnprintf(format,...) printf("%s:% 5d: " format, __FILE__, __LINE__, ##__VA_ARGS__)
31
32 #include <stddef.h>
33
34 #include "ppapi/c/pp_errors.h"
35 #include "ppapi/c/pp_module.h"
36 #include "ppapi/c/ppb.h"
37 #include "ppapi/c/ppp.h"
38
39 class PepperInterface : Interface
40 {
41    class_property(name) = "Pepper";
42
43
44    // --- User Interface System ---
45
46    bool ::Initialize()
47    {
48       sflnprintf("class(PepperInterface) ::Initialize [STUB!]\n");
49       return false;
50    }
51
52    void ::Terminate()
53    {
54       sflnprintf("class(PepperInterface) ::Terminate [STUB!]\n");
55    }
56
57    bool ::ProcessInput(bool processAll)
58    {
59       sflnprintf("class(PepperInterface) ::ProcessInput [STUB!]\n");
60       return false;
61    }
62
63    void ::Wait()
64    {
65       sflnprintf("class(PepperInterface) ::Wait [STUB!]\n");
66    }
67
68    void ::Lock(Window window)
69    {
70       sflnprintf("class(PepperInterface) ::Lock [STUB!]\n");
71    }
72
73    void ::Unlock(Window window)
74    {
75       sflnprintf("class(PepperInterface) ::Unlock [STUB!]\n");
76    }
77
78    void ::SetTimerResolution(uint hertz)
79    {
80       sflnprintf("class(PepperInterface) ::SetTimerResolution [STUB!] Implement high resolution timer here\n");
81    }
82
83    const char ** ::GraphicsDrivers(int * numDrivers)
84    {
85       sflnprintf("class(PepperInterface) ::GraphicsDrivers [STUB!]\n");
86       return null;
87    }
88
89    void ::EnsureFullScreen(bool * fullScreen)
90    {
91       sflnprintf("class(PepperInterface) ::EnsureFullScreen [STUB!]\n");
92    }
93
94    void ::GetCurrentMode(bool * fullScreen, Resolution * resolution, PixelFormat * colorDepth, int * refreshRate)
95    {
96       sflnprintf("class(PepperInterface) ::GetCurrentMode [STUB!]\n");
97    }
98
99    bool ::ScreenMode(bool fullScreen, Resolution resolution, PixelFormat colorDepth, int refreshRate, bool * textMode)
100    {
101       sflnprintf("class(PepperInterface) ::ScreenMode [STUB!]\n");
102       return false;
103    }
104
105
106    // --- Window Creation ---
107
108    void * ::CreateRootWindow(Window window)
109    {
110       sflnprintf("class(PepperInterface) ::CreateRootWindow [STUB!]\n");
111       return null;
112    }
113
114    void ::DestroyRootWindow(Window window)
115    {
116       sflnprintf("class(PepperInterface) ::DestroyRootWindow [STUB!]\n");
117    }
118
119
120    // --- Window manipulation ---
121
122    void ::SetRootWindowCaption(Window window, const char * name)
123    {
124       sflnprintf("class(PepperInterface) ::SetRootWindowCaption [STUB!]\n");
125    }
126
127    void ::PositionRootWindow(Window window, int x, int y, int w, int h, bool move, bool resize)
128    {
129       sflnprintf("class(PepperInterface) ::PositionRootWindow [STUB!]\n");
130    }
131
132    void ::OffsetWindow(Window window, int * x, int * y)
133    {
134       sflnprintf("class(PepperInterface) ::OffsetWindow [STUB!]\n");
135    }
136
137    void ::UpdateRootWindow(Window window)
138    {
139       sflnprintf("class(PepperInterface) ::UpdateRootWindow [STUB!]\n");
140    }
141
142    void ::SetRootWindowState(Window window, WindowState state, bool visible)
143    {
144       sflnprintf("class(PepperInterface) ::SetRootWindowState [STUB!]\n");
145    }
146
147    void ::ActivateRootWindow(Window window)
148    {
149       sflnprintf("class(PepperInterface) ::ActivateRootWindow [STUB!]\n");
150    }
151
152    void ::OrderRootWindow(Window window, bool topMost)
153    {
154       sflnprintf("class(PepperInterface) ::OrderRootWindow [STUB!]\n");
155    }
156
157    void ::SetRootWindowColor(Window window)
158    {
159       sflnprintf("class(PepperInterface) ::SetRootWindowColor [STUB!]\n");
160    }
161
162    void ::FlashRootWindow(Window window)
163    {
164       sflnprintf("class(PepperInterface) ::FlashRootWindow [STUB!]\n");
165    }
166
167
168    // --- Mouse-based window movement ---
169
170    void ::StartMoving(Window window, int x, int y, bool fromKeyBoard)
171    {
172       sflnprintf("class(PepperInterface) ::StartMoving [STUB!]\n");
173    }
174
175    void ::StopMoving(Window window)
176    {
177       sflnprintf("class(PepperInterface) ::StopMoving [STUB!]\n");
178    }
179
180
181    // --- Mouse manipulation ---
182
183    void ::GetMousePosition(int *x, int *y)
184    {
185       sflnprintf("class(PepperInterface) ::GetMousePosition [STUB!]\n");
186    }
187
188    void ::SetMousePosition(int x, int y)
189    {
190       sflnprintf("class(PepperInterface) ::SetMousePosition [STUB!]\n");
191    }
192
193    void ::SetMouseRange(Window window, Box box)
194    {
195       sflnprintf("class(PepperInterface) ::SetMouseRange [STUB!]\n");
196    }
197
198    void ::SetMouseCapture(Window window)
199    {
200       sflnprintf("class(PepperInterface) ::SetMouseCapture [STUB!]\n");
201    }
202
203
204    // --- Mouse cursor ---
205
206    void ::SetMouseCursor(Window window, SystemCursor cursor)
207    {
208       sflnprintf("class(PepperInterface) ::SetMouseCursor [STUB!]\n");
209    }
210
211
212    // --- Caret manipulation ---
213
214    void ::SetCaret(int caretX, int caretY, int size)
215    {
216       sflnprintf("class(PepperInterface) ::SetCaret [STUB!]\n");
217    }
218
219
220    // --- Clipboard manipulation ---
221
222    void ::ClearClipboard()
223    {
224       sflnprintf("class(PepperInterface) ::ClearClipboard [STUB!]\n");
225    }
226
227    bool ::AllocateClipboard(ClipBoard clipBoard, uint size)
228    {
229       sflnprintf("class(PepperInterface) ::AllocateClipboard [STUB!]\n");
230       return false;
231    }
232
233    bool ::SaveClipboard(ClipBoard clipBoard)
234    {
235       sflnprintf("class(PepperInterface) ::SaveClipboard [STUB!]\n");
236       return false;
237    }
238
239    bool ::LoadClipboard(ClipBoard clipBoard)
240    {
241       sflnprintf("class(PepperInterface) ::LoadClipboard [STUB!]\n");
242       return false;
243    }
244
245    void ::UnloadClipboard(ClipBoard clipBoard)
246    {
247       sflnprintf("class(PepperInterface) ::UnloadClipboard [STUB!]\n");
248    }
249
250
251    // --- State based input ---
252
253    bool ::AcquireInput(Window window, bool state)
254    {
255       sflnprintf("class(PepperInterface) ::AcquireInput [STUB!]\n");
256       return false;
257    }
258
259    bool ::GetMouseState(MouseButtons * buttons, int * x, int * y)
260    {
261       sflnprintf("class(PepperInterface) ::GetMouseState [STUB!]\n");
262       return false;
263    }
264
265    bool ::GetJoystickState(int device, Joystick joystick)
266    {
267       sflnprintf("class(PepperInterface) ::GetJoystickState [STUB!]\n");
268       return false;
269    }
270
271    bool ::GetKeyState(Key key)
272    {
273       sflnprintf("class(PepperInterface) ::GetKeyState [STUB!]\n");
274       return false;
275    }
276
277    bool ::SetIcon(Window window, BitmapResource icon)
278    {
279       sflnprintf("class(PepperInterface) ::SetIcon [STUB!]\n");
280       return false;
281    }
282
283    void ::GetScreenArea(Window window, Box box)
284    {
285       sflnprintf("class(PepperInterface) ::GetScreenArea [STUB!]\n");
286    }
287 }
288
289 #endif // !defined(NO_PEPPER_DRIVER)