bindings: Picture, Anchor
[sdk] / bindings / c / ecere.c
1 #include "ecere.h"
2
3 Class * class_Surface;
4
5 Method * method_Surface_writeTextf;
6
7 void (* Surface_writeTextf)(Surface s, int x, int y, const char * format, ...);
8
9 Class * class_BitmapResource;
10
11 Property * property_BitmapResource_fileName;
12
13 void (* BitmapResource_set_fileName)(BitmapResource f, constString v);
14 constString (* BitmapResource_get_fileName)(BitmapResource f);
15
16 Class * class_FontResource;
17
18 Property * property_FontResource_faceName;
19 Property * property_FontResource_size;
20 Property * property_FontResource_bold;
21 Property * property_FontResource_italic;
22 Property * property_FontResource_outlineSize;
23 Property * property_FontResource_outlineFade;
24
25 void (* FontResource_set_faceName)(FontResource f, constString v);
26 constString (* FontResource_get_faceName)(FontResource f);
27
28 void (* FontResource_set_size)(FontResource f, float v);
29 float (* FontResource_get_size)(FontResource f);
30
31 void (* FontResource_set_outlineSize)(FontResource f, float v);
32 float (* FontResource_get_outlineSize)(FontResource f);
33
34 void (* FontResource_set_outlineFade)(FontResource f, float v);
35 float (* FontResource_get_outlineFade)(FontResource f);
36
37 void (* FontResource_set_bold)(FontResource f, bool v);
38 bool (* FontResource_get_bold)(FontResource f);
39
40 void (* FontResource_set_italic)(FontResource f, bool v);
41 bool (* FontResource_get_italic)(FontResource f);
42
43 Class * class_Window;
44
45 int Window_onCreate_vTblID;
46 int Window_onRedraw_vTblID;
47
48 Property * property_Window_caption;
49 Property * property_Window_size;
50 Property * property_Window_clientSize;
51 Property * property_Window_hasClose;
52 Property * property_Window_hasMinimize;
53 Property * property_Window_hasMaximize;
54 Property * property_Window_borderStyle;
55 Property * property_Window_background;
56 Property * property_Window_foreground;
57 Property * property_Window_parent;
58 Property * property_Window_position;
59 Property * property_Window_anchor;
60 Property * property_Window_font;
61 Property * property_Window_displayDriver;
62
63 Method * method_Window_modal;
64 Method * method_Window_create;
65
66 Method * method_Window_onCreate;
67 Method * method_Window_onRedraw;
68
69 void (* Window_set_borderStyle)(Window w, BorderStyle v);
70 BorderStyle (* Window_get_borderStyle)(Window w);
71
72 void (* Window_set_size)(Window w, const Size * v);
73 void (* Window_get_size)(Window w, Size * v);
74
75 void (* Window_set_clientSize)(Window w, const Size * v);
76 void (* Window_get_clientSize)(Window w, Size * v);
77
78 void (* Window_set_hasClose)(Window w, bool v);
79 bool (* Window_get_hasClose)(Window w);
80
81 void (* Window_set_hasMaximize)(Window w, bool v);
82 bool (* Window_get_hasMaximize)(Window w);
83
84 void (* Window_set_hasMinimize)(Window w, bool v);
85 bool (* Window_get_hasMinimize)(Window w);
86
87 void (* Window_set_parent)(Window w, Window v);
88 Window (* Window_get_parent)(Window w);
89
90 void (* Window_set_background)(Window w, Color v);
91 Color (* Window_get_background)(Window w);
92
93 void (* Window_set_foreground)(Window w, Color v);
94 Color (* Window_get_foreground)(Window w);
95
96 void (* Window_set_position)(Window w, const Point * v);
97 void (* Window_get_position)(Window w, Point * v);
98
99 void (* Window_set_anchor)(Window w, const Anchor * v);
100 void (* Window_get_anchor)(Window w, Anchor * v);
101
102 void (* Window_set_font)(Window w, Instance v);
103 FontResource (* Window_get_font)(Window w);
104
105 void (* Window_set_caption)(Window w, constString v);
106 constString (* Window_get_caption)(Window w);
107
108 void (* Window_set_displayDriver)(Window w, constString v);
109 constString (* Window_get_displayDriver)(Window w);
110
111 DialogResult (* Window_modal)(Window);
112
113 bool (* Window_create)(Window);
114
115 Class * class_Button;
116
117 Method * method_Button_notifyClicked;
118
119 int Button_notifyClicked_vTblID;
120
121 Class * class_ToolButton;
122
123 Class * class_Label;
124
125 Class * class_Picture;
126
127 Property * property_Picture_image;
128
129 void (* Picture_set_image)(Picture p, BitmapResource v);
130 constString (* Picture_get_image)(Picture p);
131
132 Class * class_GuiApplication;
133
134 Class * class_MessageBox;
135
136 Property * property_MessageBox_contents;
137
138 void (* MessageBox_set_contents)(MessageBox m, constString v);
139 constString (* MessageBox_get_contents)(MessageBox m);
140
141 Module ecere_init(Module fromModule)
142 {
143    Module module = Module_load(fromModule, "ecere", publicAccess);
144    if(module)
145    {
146       // Set up all the class_*, property, method, function pointers ...
147       class_Surface = eC_findClass(module, "Surface");
148       if(class_Surface)
149       {
150          method_Surface_writeTextf = Class_findMethod(class_Surface, "WriteTextf", module);
151          if(method_Surface_writeTextf)
152             Surface_writeTextf = (void *)method_Surface_writeTextf->function;
153       }
154
155       class_FontResource = eC_findClass(module, "FontResource");
156       if(class_FontResource)
157       {
158          property_FontResource_faceName = Class_findProperty(class_FontResource, "faceName", module);
159          if(property_FontResource_faceName)
160          {
161             FontResource_set_faceName = (void *)property_FontResource_faceName->Set;
162             FontResource_get_faceName = (void *)property_FontResource_faceName->Get;
163          }
164
165          property_FontResource_size = Class_findProperty(class_FontResource, "size", module);
166          if(property_FontResource_size)
167          {
168             FontResource_set_size = (void *)property_FontResource_size->Set;
169             FontResource_get_size = (void *)property_FontResource_size->Get;
170          }
171
172          property_FontResource_bold = Class_findProperty(class_FontResource, "bold", module);
173          if(property_FontResource_bold)
174          {
175             FontResource_set_bold = (void *)property_FontResource_bold->Set;
176             FontResource_get_bold = (void *)property_FontResource_bold->Get;
177          }
178
179          property_FontResource_italic = Class_findProperty(class_FontResource, "italic", module);
180          if(property_FontResource_italic)
181          {
182             FontResource_set_italic = (void *)property_FontResource_italic->Set;
183             FontResource_get_italic = (void *)property_FontResource_italic->Get;
184          }
185
186          property_FontResource_outlineSize = Class_findProperty(class_FontResource, "outlineSize", module);
187          if(property_FontResource_outlineSize)
188          {
189             FontResource_set_outlineSize = (void *)property_FontResource_outlineSize->Set;
190             FontResource_get_outlineSize = (void *)property_FontResource_outlineSize->Get;
191          }
192
193          property_FontResource_outlineFade = Class_findProperty(class_FontResource, "outlineFade", module);
194          if(property_FontResource_outlineFade)
195          {
196             FontResource_set_outlineFade = (void *)property_FontResource_outlineFade->Set;
197             FontResource_get_outlineFade = (void *)property_FontResource_outlineFade->Get;
198          }
199       }
200
201       class_BitmapResource = eC_findClass(module, "BitmapResource");
202       if(class_BitmapResource)
203       {
204          property_BitmapResource_fileName = Class_findProperty(class_BitmapResource, "fileName", module);
205          if(property_BitmapResource_fileName)
206          {
207             BitmapResource_set_fileName = (void *)property_BitmapResource_fileName->Set;
208             BitmapResource_get_fileName = (void *)property_BitmapResource_fileName->Get;
209          }
210       }
211
212       class_Window = eC_findClass(module, "Window");
213       if(class_Window)
214       {
215          method_Window_modal = Class_findMethod(class_Window, "Modal", module);
216          if(method_Window_modal)
217             Window_modal = (void *)method_Window_modal->function;
218
219          method_Window_create = Class_findMethod(class_Window, "Create", module);
220          if(method_Window_create)
221             Window_create = (void *)method_Window_create->function;
222
223          method_Window_onCreate = Class_findMethod(class_Window, "OnCreate", module);
224          if(method_Window_onCreate)
225             Window_onCreate_vTblID = method_Window_onCreate->vid;
226          method_Window_onRedraw = Class_findMethod(class_Window, "OnRedraw", module);
227          if(method_Window_onRedraw)
228             Window_onRedraw_vTblID = method_Window_onRedraw->vid;
229
230          property_Window_displayDriver = Class_findProperty(class_Window, "displayDriver", module);
231          if(property_Window_displayDriver)
232          {
233             Window_set_displayDriver = (void *)property_Window_displayDriver->Set;
234             Window_get_displayDriver = (void *)property_Window_displayDriver->Get;
235          }
236
237          property_Window_caption = Class_findProperty(class_Window, "caption", module);
238          if(property_Window_caption)
239          {
240             Window_set_caption = (void *)property_Window_caption->Set;
241             Window_get_caption = (void *)property_Window_caption->Get;
242          }
243
244          property_Window_size = Class_findProperty(class_Window, "size", module);
245          if(property_Window_size)
246          {
247             Window_set_size = (void *)property_Window_size->Set;
248             Window_get_size = (void *)property_Window_size->Get;
249          }
250
251          property_Window_clientSize = Class_findProperty(class_Window, "clientSize", module);
252          if(property_Window_clientSize)
253          {
254             Window_set_clientSize = (void *)property_Window_clientSize->Set;
255             Window_get_clientSize = (void *)property_Window_clientSize->Get;
256          }
257
258          property_Window_borderStyle = Class_findProperty(class_Window, "borderStyle", module);
259          if(property_Window_borderStyle)
260          {
261             Window_set_borderStyle = (void *)property_Window_borderStyle->Set;
262             Window_get_borderStyle = (void *)property_Window_borderStyle->Get;
263          }
264
265          property_Window_background = Class_findProperty(class_Window, "background", module);
266          if(property_Window_background)
267          {
268             Window_set_background = (void *)property_Window_background->Set;
269             Window_get_background = (void *)property_Window_background->Get;
270          }
271
272          property_Window_foreground = Class_findProperty(class_Window, "foreground", module);
273          if(property_Window_foreground)
274          {
275             Window_set_foreground = (void *)property_Window_foreground->Set;
276             Window_get_foreground = (void *)property_Window_foreground->Get;
277          }
278
279          property_Window_hasClose = Class_findProperty(class_Window, "hasClose", module);
280          if(property_Window_hasClose)
281          {
282             Window_set_hasClose = (void *)property_Window_hasClose->Set;
283             Window_get_hasClose = (void *)property_Window_hasClose->Get;
284          }
285
286          property_Window_hasMinimize = Class_findProperty(class_Window, "hasMinimize", module);
287          if(property_Window_hasMinimize)
288          {
289             Window_set_hasMinimize = (void *)property_Window_hasMinimize->Set;
290             Window_get_hasMinimize = (void *)property_Window_hasMinimize->Get;
291          }
292
293          property_Window_hasMaximize = Class_findProperty(class_Window, "hasMaximize", module);
294          if(property_Window_hasMaximize)
295          {
296             Window_set_hasMaximize = (void *)property_Window_hasMaximize->Set;
297             Window_get_hasMaximize = (void *)property_Window_hasMaximize->Get;
298          }
299
300          property_Window_parent = Class_findProperty(class_Window, "parent", module);
301          if(property_Window_parent)
302          {
303             Window_set_parent = (void *)property_Window_parent->Set;
304             Window_get_parent = (void *)property_Window_parent->Get;
305          }
306
307          property_Window_position = Class_findProperty(class_Window, "position", module);
308          if(property_Window_position)
309          {
310             Window_set_position = (void *)property_Window_position->Set;
311             Window_get_position = (void *)property_Window_position->Get;
312          }
313
314          property_Window_anchor = Class_findProperty(class_Window, "anchor", module);
315          if(property_Window_anchor)
316          {
317             Window_set_anchor = (void *)property_Window_anchor->Set;
318             Window_get_anchor = (void *)property_Window_anchor->Get;
319          }
320
321          property_Window_font = Class_findProperty(class_Window, "font", module);
322          if(property_Window_font)
323          {
324             Window_set_font = (void *)property_Window_font->Set;
325             Window_get_font = (void *)property_Window_font->Get;
326          }
327       }
328
329       class_Label = eC_findClass(module, "Label");
330
331       class_Button = eC_findClass(module, "Button");
332       if(class_Button)
333       {
334          method_Button_notifyClicked = Class_findMethod(class_Button, "NotifyClicked", module);
335          if(method_Button_notifyClicked)
336             Button_notifyClicked_vTblID = method_Button_notifyClicked->vid;
337       }
338
339       class_Picture = eC_findClass(module, "Picture");
340       if(class_Picture)
341       {
342          property_Picture_image = Class_findProperty(class_Picture, "image", module);
343          if(property_Picture_image)
344          {
345             Picture_set_image = (void *)property_Picture_image->Set;
346             Picture_get_image = (void *)property_Picture_image->Get;
347          }
348       }
349
350       class_MessageBox = eC_findClass(module, "MessageBox");
351       if(class_MessageBox)
352       {
353          property_MessageBox_contents = Class_findProperty(class_MessageBox, "contents", module);
354          if(property_MessageBox_contents)
355          {
356             MessageBox_set_contents = (void *)property_MessageBox_contents->Set;
357             MessageBox_get_contents = (void *)property_MessageBox_contents->Get;
358          }
359       }
360
361       class_GuiApplication = eC_findClass(module, "GuiApplication");
362    }
363    return module;
364 }