Change to the linux kernel coding style
[wmaker-crm.git] / WINGs / Tests / wtest.c
Commit [+]AuthorDateLineData
9d2e6ef9 scottc1998-09-29 22:36:29 +00001/*
2 * WINGs test application
3 */
4
a20aebde dan2001-01-18 19:21:56 +00005#include <WINGs/WINGs.h>
9d2e6ef9 scottc1998-09-29 22:36:29 +00006
7#include <stdio.h>
c2ec1cfe dan2002-11-13 15:13:48 +00008#include <stdlib.h>
08e811aa dan2004-10-22 00:21:51 +00009#include <string.h>
9d2e6ef9 scottc1998-09-29 22:36:29 +000010
11/*
12 * You need to define this function to link any program to WINGs.
44f636e9 dan2003-08-02 21:36:45 +000013 * (this is no longer required as there is a default abort handler in WINGs)
9d2e6ef9 scottc1998-09-29 22:36:29 +000014 * This will be called when the application will be terminated because
44f636e9 dan2003-08-02 21:36:45 +000015 * of a fatal error (only for memory allocation failures ATM).
9d2e6ef9 scottc1998-09-29 22:36:29 +000016 */
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020017void wAbort()
9d2e6ef9 scottc1998-09-29 22:36:29 +000018{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020019 exit(1);
9d2e6ef9 scottc1998-09-29 22:36:29 +000020}
21
9d2e6ef9 scottc1998-09-29 22:36:29 +000022Display *dpy;
23
24int windowCount = 0;
25
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020026void closeAction(WMWidget * self, void *data)
9d2e6ef9 scottc1998-09-29 22:36:29 +000027{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020028 WMDestroyWidget(self);
29 windowCount--;
30 printf("window closed, window count = %d\n", windowCount);
31 if (windowCount < 1)
32 exit(0);
9d2e6ef9 scottc1998-09-29 22:36:29 +000033}
34
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020035void testOpenFilePanel(WMScreen * scr)
9d2e6ef9 scottc1998-09-29 22:36:29 +000036{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020037 WMOpenPanel *panel;
172da48a dan2000-10-15 00:11:41 +000038
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020039 /* windowCount++; */
172da48a dan2000-10-15 00:11:41 +000040
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020041 /* get the shared Open File panel */
42 panel = WMGetOpenPanel(scr);
172da48a dan2000-10-15 00:11:41 +000043
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020044 WMRunModalFilePanelForDirectory(panel, NULL, "/usr/local", NULL, NULL);
172da48a dan2000-10-15 00:11:41 +000045
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020046 /* free the panel to save some memory. Not needed otherwise. */
47 WMFreeFilePanel(WMGetOpenPanel(scr));
9d2e6ef9 scottc1998-09-29 22:36:29 +000048}
49
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020050void testFontPanel(WMScreen * scr)
9d2e6ef9 scottc1998-09-29 22:36:29 +000051{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020052 WMFontPanel *panel;
172da48a dan2000-10-15 00:11:41 +000053
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020054 /*windowCount++; */
172da48a dan2000-10-15 00:11:41 +000055
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020056 panel = WMGetFontPanel(scr);
172da48a dan2000-10-15 00:11:41 +000057
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020058 WMShowFontPanel(panel);
172da48a dan2000-10-15 00:11:41 +000059
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020060 /*WMFreeFontPanel(panel); */
9d2e6ef9 scottc1998-09-29 22:36:29 +000061}
62
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020063void testFrame(WMScreen * scr)
caa86529 kojima2000-04-07 22:47:04 +000064{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020065 WMWindow *win;
66 WMFrame *frame;
67 int i;
68 static char *titles[] = {
69 "AboveTop",
70 "AtTop",
71 "BelowTop",
72 "AboveBottom",
73 "AtBottom",
74 "BelowBottom"
75 };
76 static WMTitlePosition pos[] = {
77 WTPAboveTop,
78 WTPAtTop,
79 WTPBelowTop,
80 WTPAboveBottom,
81 WTPAtBottom,
82 WTPBelowBottom
83 };
84
85 windowCount++;
86
87 win = WMCreateWindow(scr, "testFrame");
88 WMSetWindowTitle(win, "Frame");
89 WMSetWindowCloseAction(win, closeAction, NULL);
90 WMResizeWidget(win, 400, 300);
91
92 for (i = 0; i < 6; i++) {
93 frame = WMCreateFrame(win);
94 WMMoveWidget(frame, 8 + (i % 3) * 130, 8 + (i / 3) * 130);
95 WMResizeWidget(frame, 120, 120);
96 WMSetFrameTitle(frame, titles[i]);
97 WMSetFrameTitlePosition(frame, pos[i]);
98 }
99
100 WMRealizeWidget(win);
101 WMMapSubwidgets(win);
102 WMMapWidget(win);
172da48a dan2000-10-15 00:11:41 +0000103
caa86529 kojima2000-04-07 22:47:04 +0000104}
105
9aca0d5f dan2004-10-12 01:34:32 +0000106/*static void
6830b057 dan2004-10-12 21:28:27 +0000107 resizedWindow(void *self, WMNotification *notif)
108 {
109 WMView *view = (WMView*)WMGetNotificationObject(notif);
110 WMSize size = WMGetViewSize(view);
52308a0a kojima2000-11-11 18:08:10 +0000111
6830b057 dan2004-10-12 21:28:27 +0000112 WMResizeWidget((WMWidget*)self, size.width, size.height);
113 }*/
52308a0a kojima2000-11-11 18:08:10 +0000114
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200115void testBox(WMScreen * scr)
19160e8d kojima2000-11-09 05:01:58 +0000116{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200117 WMWindow *win;
118 WMBox *box, *hbox;
119 WMButton *btn;
120 WMPopUpButton *pop;
121 int i;
122
123 windowCount++;
124
125 win = WMCreateWindow(scr, "testBox");
126 WMSetWindowTitle(win, "Box");
127 WMSetWindowCloseAction(win, closeAction, NULL);
128 WMResizeWidget(win, 400, 300);
129
130 box = WMCreateBox(win);
131 WMSetBoxBorderWidth(box, 5);
132 WMSetViewExpandsToParent(WMWidgetView(box), 0, 0, 0, 0);
133
134 /*WMSetBoxHorizontal(box, True); */
135 for (i = 0; i < 4; i++) {
136 btn = WMCreateCommandButton(box);
137 WMSetButtonText(btn, "bla");
138 WMMapWidget(btn);
139 WMAddBoxSubview(box, WMWidgetView(btn), i & 1, True, 20, 0, 5);
140 }
141
142 pop = WMCreatePopUpButton(box);
143 WMAddPopUpButtonItem(pop, "ewqeq");
144 WMAddPopUpButtonItem(pop, "ewqeqrewrw");
145 WMAddBoxSubview(box, WMWidgetView(pop), False, True, 20, 0, 5);
146 WMMapWidget(pop);
147
148 hbox = WMCreateBox(box);
149 WMSetBoxHorizontal(hbox, True);
150 WMAddBoxSubview(box, WMWidgetView(hbox), False, True, 24, 0, 0);
151 WMMapWidget(hbox);
152
153 for (i = 0; i < 4; i++) {
154 btn = WMCreateCommandButton(hbox);
155 WMSetButtonText(btn, "bla");
156 WMMapWidget(btn);
157 WMAddBoxSubview(hbox, WMWidgetView(btn), 1, True, 60, 0, i < 3 ? 5 : 0);
158 }
159
160 WMRealizeWidget(win);
161 WMMapSubwidgets(win);
162 WMMapWidget(win);
19160e8d kojima2000-11-09 05:01:58 +0000163
164}
165
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200166static void singleClick(WMWidget * self, void *data)
b2478b63 dan2000-10-01 23:26:03 +0000167{
168}
169
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200170static void doubleClick(WMWidget * self, void *data)
b2478b63 dan2000-10-01 23:26:03 +0000171{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200172 WMSelectAllListItems((WMList *) self);
b2478b63 dan2000-10-01 23:26:03 +0000173}
174
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200175static void listSelectionObserver(void *observer, WMNotification * notification)
b2478b63 dan2000-10-01 23:26:03 +0000176{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200177 WMLabel *label = (WMLabel *) observer;
178 WMList *lPtr = (WMList *) WMGetNotificationObject(notification);
179 char buf[255];
b2478b63 dan2000-10-01 23:26:03 +0000180
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200181 sprintf(buf, "Selected items: %d", WMGetArrayItemCount(WMGetListSelectedItems(lPtr)));
182 WMSetLabelText(label, buf);
b2478b63 dan2000-10-01 23:26:03 +0000183}
184
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200185void testList(WMScreen * scr)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000186{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200187 WMWindow *win;
188 WMList *list;
189 WMList *mlist;
190 WMLabel *label;
191 WMLabel *mlabel;
192 WMLabel *title;
193 WMLabel *mtitle;
194 char text[100];
195 int i;
196
197 windowCount++;
198
199 win = WMCreateWindow(scr, "testList");
200 WMResizeWidget(win, 370, 250);
201 WMSetWindowTitle(win, "List");
202 WMSetWindowCloseAction(win, closeAction, NULL);
203
204 title = WMCreateLabel(win);
205 WMResizeWidget(title, 150, 20);
206 WMMoveWidget(title, 10, 10);
207 WMSetLabelRelief(title, WRRidge);
208 WMSetLabelText(title, "Single selection list");
209
210 mtitle = WMCreateLabel(win);
211 WMResizeWidget(mtitle, 150, 20);
212 WMMoveWidget(mtitle, 210, 10);
213 WMSetLabelRelief(mtitle, WRRidge);
214 WMSetLabelText(mtitle, "Multiple selection list");
215
216 list = WMCreateList(win);
217 /*WMSetListAllowEmptySelection(list, True); */
218 WMMoveWidget(list, 10, 40);
219 for (i = 0; i < 105; i++) {
220 sprintf(text, "Item %i", i);
221 WMAddListItem(list, text);
222 }
223 mlist = WMCreateList(win);
224 WMSetListAllowMultipleSelection(mlist, True);
225 /*WMSetListAllowEmptySelection(mlist, True); */
226 WMMoveWidget(mlist, 210, 40);
227 for (i = 0; i < 135; i++) {
228 sprintf(text, "Item %i", i);
229 WMAddListItem(mlist, text);
230 }
231
232 label = WMCreateLabel(win);
233 WMResizeWidget(label, 150, 40);
234 WMMoveWidget(label, 10, 200);
235 WMSetLabelRelief(label, WRRidge);
236 WMSetLabelText(label, "Selected items: 0");
237
238 mlabel = WMCreateLabel(win);
239 WMResizeWidget(mlabel, 150, 40);
240 WMMoveWidget(mlabel, 210, 200);
241 WMSetLabelRelief(mlabel, WRRidge);
242 WMSetLabelText(mlabel, "Selected items: 0");
243
244 WMSetListAction(list, singleClick, label);
245 WMSetListDoubleAction(list, doubleClick, label);
246 WMSetListAction(mlist, singleClick, mlabel);
247 WMSetListDoubleAction(mlist, doubleClick, mlabel);
248
249 WMAddNotificationObserver(listSelectionObserver, label, WMListSelectionDidChangeNotification, list);
250 WMAddNotificationObserver(listSelectionObserver, mlabel, WMListSelectionDidChangeNotification, mlist);
251
252 WMRealizeWidget(win);
253 WMMapSubwidgets(win);
254 WMMapWidget(win);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000255}
256
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200257void testButton(WMScreen * scr)
e29fce43 kojima2000-07-10 22:37:39 +0000258{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200259 WMWindow *win;
260 int i;
261 char *types[] = {
262 "MomentaryPush",
263 "PushOnPushOff",
264 "Toggle",
265 "Switch",
266 "Radio",
267 "MomentaryChange",
268 "OnOff",
269 "MomentaryLigh"
270 };
271
272 windowCount++;
273
274 win = WMCreateWindow(scr, "testButton");
275 WMResizeWidget(win, 300, 300);
276 WMSetWindowTitle(win, "Buttons");
277
278 WMSetWindowCloseAction(win, closeAction, NULL);
279
280 for (i = 1; i < 9; i++) {
281 WMButton *b;
282 b = WMCreateButton(win, i);
283 WMResizeWidget(b, 150, 24);
284 WMMoveWidget(b, 20, i * 30);
285 WMSetButtonText(b, types[i - 1]);
286 }
287
288 WMRealizeWidget(win);
289 WMMapSubwidgets(win);
290 WMMapWidget(win);
e29fce43 kojima2000-07-10 22:37:39 +0000291}
292
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200293void testGradientButtons(WMScreen * scr)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000294{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200295 WMWindow *win;
296 WMButton *btn;
297 WMPixmap *pix1, *pix2;
298 RImage *back;
299 RColor light, dark;
300 WMColor *color, *altColor;
301
302 windowCount++;
303
304 /* creates the top-level window */
305 win = WMCreateWindow(scr, "testGradientButtons");
306 WMSetWindowTitle(win, "Gradiented Button Demo");
307 WMResizeWidget(win, 300, 200);
308
309 WMSetWindowCloseAction(win, closeAction, NULL);
310
311 light.red = 0x90;
312 light.green = 0x85;
313 light.blue = 0x90;
314 dark.red = 0x35;
315 dark.green = 0x30;
316 dark.blue = 0x35;
317
318 color = WMCreateRGBColor(scr, 0x5900, 0x5100, 0x5900, True);
319 WMSetWidgetBackgroundColor(win, color);
320 WMReleaseColor(color);
321
322 back = RRenderGradient(60, 24, &dark, &light, RGRD_DIAGONAL);
323 RBevelImage(back, RBEV_RAISED2);
324 pix1 = WMCreatePixmapFromRImage(scr, back, 0);
325 RReleaseImage(back);
326
327 back = RRenderGradient(60, 24, &dark, &light, RGRD_DIAGONAL);
328 RBevelImage(back, RBEV_SUNKEN);
329 pix2 = WMCreatePixmapFromRImage(scr, back, 0);
330 RReleaseImage(back);
331
332 color = WMWhiteColor(scr);
333 altColor = WMCreateNamedColor(scr, "red", True);
334
335 btn = WMCreateButton(win, WBTMomentaryChange);
336 WMResizeWidget(btn, 60, 24);
337 WMMoveWidget(btn, 20, 100);
338 WMSetButtonBordered(btn, False);
339 WMSetButtonImagePosition(btn, WIPOverlaps);
340 WMSetButtonImage(btn, pix1);
341 WMSetButtonAltImage(btn, pix2);
342 WMSetButtonText(btn, "Cool");
343 WMSetButtonTextColor(btn, color);
344 WMSetButtonAltTextColor(btn, altColor);
345
346 WMSetBalloonTextForView("This is a cool button", WMWidgetView(btn));
347
348 btn = WMCreateButton(win, WBTMomentaryChange);
349 WMResizeWidget(btn, 60, 24);
350 WMMoveWidget(btn, 90, 100);
351 WMSetButtonBordered(btn, False);
352 WMSetButtonImagePosition(btn, WIPOverlaps);
353 WMSetButtonImage(btn, pix1);
354 WMSetButtonAltImage(btn, pix2);
355 WMSetButtonText(btn, "Button");
356 WMSetButtonTextColor(btn, color);
357
358 WMSetBalloonTextForView("Este é outro balão.", WMWidgetView(btn));
359
360 WMReleaseColor(color);
361 color = WMCreateNamedColor(scr, "orange", True);
362
363 btn = WMCreateButton(win, WBTMomentaryChange);
364 WMResizeWidget(btn, 60, 24);
365 WMMoveWidget(btn, 160, 100);
366 WMSetButtonBordered(btn, False);
367 WMSetButtonImagePosition(btn, WIPOverlaps);
368 WMSetButtonImage(btn, pix1);
369 WMSetButtonAltImage(btn, pix2);
370 WMSetButtonText(btn, "Test");
371 WMSetButtonTextColor(btn, color);
372
373 WMSetBalloonTextForView("This is yet another button.\nBut the balloon has 3 lines.\nYay!",
374 WMWidgetView(btn));
375
376 WMReleaseColor(color);
377 WMReleaseColor(altColor);
378
379 WMRealizeWidget(win);
380 WMMapSubwidgets(win);
381 WMMapWidget(win);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000382}
383
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200384void testScrollView(WMScreen * scr)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000385{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200386 WMWindow *win;
387 WMScrollView *sview;
388 WMFrame *f;
389 WMLabel *l;
390 char buffer[128];
391 int i;
392
393 windowCount++;
394
395 /* creates the top-level window */
396 win = WMCreateWindow(scr, "testScroll");
397 WMSetWindowTitle(win, "Scrollable View");
398
399 WMSetWindowCloseAction(win, closeAction, NULL);
400
401 /* set the window size */
402 WMResizeWidget(win, 300, 300);
403
404 /* creates a scrollable view inside the top-level window */
405 sview = WMCreateScrollView(win);
406 WMResizeWidget(sview, 200, 200);
407 WMMoveWidget(sview, 30, 30);
408 WMSetScrollViewRelief(sview, WRSunken);
409 WMSetScrollViewHasVerticalScroller(sview, True);
410 WMSetScrollViewHasHorizontalScroller(sview, True);
411
412 /* create a frame with a bunch of labels */
413 f = WMCreateFrame(win);
414 WMResizeWidget(f, 400, 400);
415 WMSetFrameRelief(f, WRFlat);
416
417 for (i = 0; i < 20; i++) {
418 l = WMCreateLabel(f);
419 WMResizeWidget(l, 50, 18);
420 WMMoveWidget(l, 10, 20 * i);
421 sprintf(buffer, "Label %i", i);
422 WMSetLabelText(l, buffer);
423 WMSetLabelRelief(l, WRSimple);
424 }
425 WMMapSubwidgets(f);
426 WMMapWidget(f);
427
428 WMSetScrollViewContentView(sview, WMWidgetView(f));
429
430 /* make the windows of the widgets be actually created */
431 WMRealizeWidget(win);
432
433 /* Map all child widgets of the top-level be mapped.
434 * You must call this for each container widget (like frames),
435 * even if they are childs of the top-level window.
436 */
437 WMMapSubwidgets(win);
438
439 /* map the top-level window */
440 WMMapWidget(win);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000441}
442
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200443void testColorWell(WMScreen * scr)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000444{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200445 WMWindow *win;
446 WMColorWell *well1, *well2;
447
448 windowCount++;
449
450 win = WMCreateWindow(scr, "testColor");
451 WMResizeWidget(win, 300, 300);
452 WMSetWindowCloseAction(win, closeAction, NULL);
453
454 well1 = WMCreateColorWell(win);
455 WMResizeWidget(well1, 60, 40);
456 WMMoveWidget(well1, 100, 100);
457 WMSetColorWellColor(well1, WMCreateRGBColor(scr, 0x8888, 0, 0x1111, True));
458 well2 = WMCreateColorWell(win);
459 WMResizeWidget(well2, 60, 40);
460 WMMoveWidget(well2, 200, 100);
461 WMSetColorWellColor(well2, WMCreateRGBColor(scr, 0, 0, 0x8888, True));
462
463 WMRealizeWidget(win);
464 WMMapSubwidgets(win);
465 WMMapWidget(win);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000466}
467
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200468void testColorPanel(WMScreen * scr)
5c37df52 dan2001-04-16 00:37:34 +0000469{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200470 WMColorPanel *panel = WMGetColorPanel(scr);
5c37df52 dan2001-04-16 00:37:34 +0000471
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200472 /*if (colorname) {
473 startcolor = WMCreateNamedColor(scr, colorname, False);
474 WMSetColorPanelColor(panel, startcolor);
475 WMReleaseColor(startcolor);
476 } */
5c37df52 dan2001-04-16 00:37:34 +0000477
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200478 WMShowColorPanel(panel);
5c37df52 dan2001-04-16 00:37:34 +0000479}
480
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200481void sliderCallback(WMWidget * w, void *data)
bc0b869b kojima1999-04-19 00:27:47 +0000482{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200483 printf("SLIDER == %i\n", WMGetSliderValue(w));
bc0b869b kojima1999-04-19 00:27:47 +0000484}
485
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200486void testSlider(WMScreen * scr)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000487{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200488 WMWindow *win;
489 WMSlider *s;
9d2e6ef9 scottc1998-09-29 22:36:29 +0000490
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200491 windowCount++;
172da48a dan2000-10-15 00:11:41 +0000492
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200493 win = WMCreateWindow(scr, "testSlider");
494 WMResizeWidget(win, 300, 300);
495 WMSetWindowTitle(win, "Sliders");
9d2e6ef9 scottc1998-09-29 22:36:29 +0000496
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200497 WMSetWindowCloseAction(win, closeAction, NULL);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000498
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200499 s = WMCreateSlider(win);
500 WMResizeWidget(s, 16, 100);
501 WMMoveWidget(s, 100, 100);
502 WMSetSliderKnobThickness(s, 8);
503 WMSetSliderContinuous(s, False);
504 WMSetSliderAction(s, sliderCallback, s);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000505
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200506 s = WMCreateSlider(win);
507 WMResizeWidget(s, 100, 16);
508 WMMoveWidget(s, 100, 10);
509 WMSetSliderKnobThickness(s, 8);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000510
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200511 WMRealizeWidget(win);
512 WMMapSubwidgets(win);
513 WMMapWidget(win);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000514}
515
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200516void testTextField(WMScreen * scr)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000517{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200518 WMWindow *win;
519 WMTextField *field, *field2;
9d2e6ef9 scottc1998-09-29 22:36:29 +0000520
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200521 windowCount++;
172da48a dan2000-10-15 00:11:41 +0000522
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200523 win = WMCreateWindow(scr, "testTextField");
524 WMResizeWidget(win, 400, 300);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000525
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200526 WMSetWindowCloseAction(win, closeAction, NULL);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000527
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200528 field = WMCreateTextField(win);
529 WMResizeWidget(field, 200, 20);
530 WMMoveWidget(field, 20, 20);
531 WMSetTextFieldText(field, "the little \xc2\xa9 sign");
9d2e6ef9 scottc1998-09-29 22:36:29 +0000532
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200533 field2 = WMCreateTextField(win);
534 WMResizeWidget(field2, 200, 20);
535 WMMoveWidget(field2, 20, 50);
536 WMSetTextFieldAlignment(field2, WARight);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000537
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200538 WMRealizeWidget(win);
539 WMMapSubwidgets(win);
540 WMMapWidget(win);
172da48a dan2000-10-15 00:11:41 +0000541
9d2e6ef9 scottc1998-09-29 22:36:29 +0000542}
543
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200544void testText(WMScreen * scr)
770c3507 nwanua2000-09-29 04:50:32 +0000545{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200546 WMWindow *win;
547 WMText *text;
548 WMFont *font;
549 void *tb;
550 FILE *file = fopen("wm.html", "rb");
770c3507 nwanua2000-09-29 04:50:32 +0000551
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200552 windowCount++;
172da48a dan2000-10-15 00:11:41 +0000553
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200554 win = WMCreateWindow(scr, "testText");
555 WMResizeWidget(win, 500, 300);
770c3507 nwanua2000-09-29 04:50:32 +0000556
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200557 WMSetWindowCloseAction(win, closeAction, NULL);
770c3507 nwanua2000-09-29 04:50:32 +0000558
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200559 text = WMCreateText(win);
560 WMResizeWidget(text, 480, 280);
561 WMMoveWidget(text, 10, 10);
562 WMSetTextHasVerticalScroller(text, True);
563 WMSetTextEditable(text, False);
564 WMSetTextIgnoresNewline(text, False);
08e811aa dan2004-10-22 00:21:51 +0000565
566#define FNAME "Verdana,Luxi Sans:pixelsize=12"
567#define MSG \
568 "Window Maker is the GNU window manager for the " \
569 "X Window System. It was designed to emulate the " \
570 "look and feel of part of the NEXTSTEP(tm) GUI. It's " \
571 "supposed to be relatively fast and small, feature " \
572 "rich, easy to configure and easy to use, with a simple " \
573 "and elegant appearance borrowed from NEXTSTEP(tm)."
574
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200575 font = WMCreateFont(scr, FNAME ":autohint=false");
576 WMSetTextDefaultFont(text, font);
577 WMReleaseFont(font);
578
579 if (0 && file) {
580 char buf[1024];
581
582 WMFreezeText(text);
583 while (fgets(buf, 1023, file))
584 WMAppendTextStream(text, buf);
585
586 fclose(file);
587 WMThawText(text);
588 } else {
589 WMAppendTextStream(text, "First paragraph has autohinting turned off, "
590 "while the second has it turned on:");
591 WMAppendTextStream(text, "\n\n\n");
592 WMAppendTextStream(text, MSG);
593 WMAppendTextStream(text, "\n\n\n");
594 font = WMCreateFont(scr, FNAME ":autohint=true");
595 tb = WMCreateTextBlockWithText(text, MSG, font, WMBlackColor(scr), 0, strlen(MSG));
596 WMAppendTextBlock(text, tb);
597 WMReleaseFont(font);
598 }
599
600 WMRealizeWidget(win);
601 WMMapSubwidgets(win);
602 WMMapWidget(win);
770c3507 nwanua2000-09-29 04:50:32 +0000603}
604
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200605void testProgressIndicator(WMScreen * scr)
052ab01c kojima1999-09-16 02:55:56 +0000606{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200607 WMWindow *win;
608 WMProgressIndicator *pPtr;
052ab01c kojima1999-09-16 02:55:56 +0000609
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200610 windowCount++;
172da48a dan2000-10-15 00:11:41 +0000611
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200612 win = WMCreateWindow(scr, "testProgressIndicator");
613 WMResizeWidget(win, 292, 32);
052ab01c kojima1999-09-16 02:55:56 +0000614
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200615 WMSetWindowCloseAction(win, closeAction, NULL);
052ab01c kojima1999-09-16 02:55:56 +0000616
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200617 pPtr = WMCreateProgressIndicator(win);
618 WMMoveWidget(pPtr, 8, 8);
619 WMSetProgressIndicatorValue(pPtr, 75);
052ab01c kojima1999-09-16 02:55:56 +0000620
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200621 WMRealizeWidget(win);
622 WMMapSubwidgets(win);
623 WMMapWidget(win);
172da48a dan2000-10-15 00:11:41 +0000624
052ab01c kojima1999-09-16 02:55:56 +0000625}
626
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200627void testPullDown(WMScreen * scr)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000628{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200629 WMWindow *win;
630 WMPopUpButton *pop, *pop2;
631
632 windowCount++;
633
634 win = WMCreateWindow(scr, "pullDown");
635 WMResizeWidget(win, 400, 300);
636
637 WMSetWindowCloseAction(win, closeAction, NULL);
638
639 pop = WMCreatePopUpButton(win);
640 WMResizeWidget(pop, 100, 20);
641 WMMoveWidget(pop, 50, 60);
642 WMSetPopUpButtonPullsDown(pop, True);
643 WMSetPopUpButtonText(pop, "Commands");
644 WMAddPopUpButtonItem(pop, "Add");
645 WMAddPopUpButtonItem(pop, "Remove");
646 WMAddPopUpButtonItem(pop, "Check");
647 WMAddPopUpButtonItem(pop, "Eat");
648
649 pop2 = WMCreatePopUpButton(win);
650 WMResizeWidget(pop2, 100, 20);
651 WMMoveWidget(pop2, 200, 60);
652 WMSetPopUpButtonText(pop2, "Select");
653 WMAddPopUpButtonItem(pop2, "Apples");
654 WMAddPopUpButtonItem(pop2, "Bananas");
655 WMAddPopUpButtonItem(pop2, "Strawberries");
656 WMAddPopUpButtonItem(pop2, "Blueberries");
657
658 WMRealizeWidget(win);
659 WMMapSubwidgets(win);
660 WMMapWidget(win);
172da48a dan2000-10-15 00:11:41 +0000661
9d2e6ef9 scottc1998-09-29 22:36:29 +0000662}
663
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200664void testTabView(WMScreen * scr)
dd2d71fc kojima1999-05-15 17:38:05 +0000665{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200666 WMWindow *win;
667 WMTabView *tabv;
668 WMTabViewItem *tab;
669 WMFrame *frame;
670 WMLabel *label;
671
672 windowCount++;
673
674 win = WMCreateWindow(scr, "testTabs");
675 WMResizeWidget(win, 400, 300);
676
677 WMSetWindowCloseAction(win, closeAction, NULL);
678
679 tabv = WMCreateTabView(win);
680 WMMoveWidget(tabv, 50, 50);
681 WMResizeWidget(tabv, 300, 200);
682
683 frame = WMCreateFrame(win);
684 WMSetFrameRelief(frame, WRFlat);
685 label = WMCreateLabel(frame);
686 WMResizeWidget(label, 100, 100);
687 WMSetLabelText(label, "Label 1");
688 WMMapWidget(label);
689
690 tab = WMCreateTabViewItemWithIdentifier(0);
691 WMSetTabViewItemView(tab, WMWidgetView(frame));
692 WMAddItemInTabView(tabv, tab);
693 WMSetTabViewItemLabel(tab, "Instances");
694
695 frame = WMCreateFrame(win);
696 WMSetFrameRelief(frame, WRFlat);
697 label = WMCreateLabel(frame);
698 WMResizeWidget(label, 40, 50);
699 WMSetLabelText(label, "Label 2");
700 WMMapWidget(label);
701
702 tab = WMCreateTabViewItemWithIdentifier(0);
703 WMSetTabViewItemView(tab, WMWidgetView(frame));
704 WMAddItemInTabView(tabv, tab);
705 WMSetTabViewItemLabel(tab, "Classes");
706
707 frame = WMCreateFrame(win);
708 WMSetFrameRelief(frame, WRFlat);
709 label = WMCreateLabel(frame);
710 WMResizeWidget(label, 100, 100);
711 WMMoveWidget(label, 60, 40);
712 WMSetLabelText(label, "Label 3");
713 WMMapWidget(label);
714
715 tab = WMCreateTabViewItemWithIdentifier(0);
716 WMSetTabViewItemView(tab, WMWidgetView(frame));
717 WMAddItemInTabView(tabv, tab);
718 WMSetTabViewItemLabel(tab, "Something");
719
720 frame = WMCreateFrame(win);
721 WMSetFrameRelief(frame, WRFlat);
722 label = WMCreateLabel(frame);
723 WMResizeWidget(label, 100, 100);
724 WMMoveWidget(label, 160, 40);
725 WMSetLabelText(label, "Label 4");
726 WMMapWidget(label);
727
728 tab = WMCreateTabViewItemWithIdentifier(0);
729 WMSetTabViewItemView(tab, WMWidgetView(frame));
730 WMAddItemInTabView(tabv, tab);
731 WMSetTabViewItemLabel(tab, "Bla!");
732
733 frame = WMCreateFrame(win);
734 WMSetFrameRelief(frame, WRFlat);
735 label = WMCreateLabel(frame);
736 WMResizeWidget(label, 100, 100);
737 WMMoveWidget(label, 160, 40);
738 WMSetLabelText(label, "Label fjweqklrj qwl");
739 WMMapWidget(label);
740 tab = WMCreateTabViewItemWithIdentifier(0);
741 WMSetTabViewItemView(tab, WMWidgetView(frame));
742 WMAddItemInTabView(tabv, tab);
743 WMSetTabViewItemLabel(tab, "Weee!");
744
745 WMRealizeWidget(win);
746 WMMapSubwidgets(win);
747 WMMapWidget(win);
dd2d71fc kojima1999-05-15 17:38:05 +0000748}
749
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200750void splitViewConstrainProc(WMSplitView * sPtr, int indView, int *minSize, int *maxSize)
94f4483d kojima1999-10-27 22:32:12 +0000751{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200752 switch (indView) {
753 case 0:
754 *minSize = 20;
755 break;
756 case 1:
757 *minSize = 40;
758 *maxSize = 80;
759 break;
760 case 2:
761 *maxSize = 60;
762 break;
763 default:
764 break;
765 }
94f4483d kojima1999-10-27 22:32:12 +0000766}
767
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200768static void resizeSplitView(XEvent * event, void *data)
94f4483d kojima1999-10-27 22:32:12 +0000769{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200770 WMSplitView *sPtr = (WMSplitView *) data;
94f4483d kojima1999-10-27 22:32:12 +0000771
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200772 if (event->type == ConfigureNotify) {
773 int width = event->xconfigure.width - 10;
172da48a dan2000-10-15 00:11:41 +0000774
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200775 if (width < WMGetSplitViewDividerThickness(sPtr))
776 width = WMGetSplitViewDividerThickness(sPtr);
94f4483d kojima1999-10-27 22:32:12 +0000777
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200778 if (width != WMWidgetWidth(sPtr) || event->xconfigure.height != WMWidgetHeight(sPtr))
779 WMResizeWidget(sPtr, width, event->xconfigure.height - 55);
780 }
94f4483d kojima1999-10-27 22:32:12 +0000781}
782
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200783void appendSubviewButtonAction(WMWidget * self, void *data)
94f4483d kojima1999-10-27 22:32:12 +0000784{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200785 WMSplitView *sPtr = (WMSplitView *) data;
786 char buf[64];
787 WMLabel *label = WMCreateLabel(sPtr);
788
789 sprintf(buf, "Subview %d", WMGetSplitViewSubviewsCount(sPtr) + 1);
790 WMSetLabelText(label, buf);
791 WMSetLabelRelief(label, WRSunken);
792 WMAddSplitViewSubview(sPtr, WMWidgetView(label));
793 WMRealizeWidget(label);
794 WMMapWidget(label);
94f4483d kojima1999-10-27 22:32:12 +0000795}
796
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200797void removeSubviewButtonAction(WMWidget * self, void *data)
94f4483d kojima1999-10-27 22:32:12 +0000798{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200799 WMSplitView *sPtr = (WMSplitView *) data;
800 int count = WMGetSplitViewSubviewsCount(sPtr);
801
802 if (count > 2) {
803 WMView *view = WMGetSplitViewSubviewAt(sPtr, count - 1);
804 WMDestroyWidget(WMWidgetOfView(view));
805 WMRemoveSplitViewSubviewAt(sPtr, count - 1);
806 }
94f4483d kojima1999-10-27 22:32:12 +0000807}
808
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200809void orientationButtonAction(WMWidget * self, void *data)
94f4483d kojima1999-10-27 22:32:12 +0000810{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200811 WMSplitView *sPtr = (WMSplitView *) data;
812 WMSetSplitViewVertical(sPtr, !WMGetSplitViewVertical(sPtr));
94f4483d kojima1999-10-27 22:32:12 +0000813}
814
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200815void adjustSubviewsButtonAction(WMWidget * self, void *data)
94f4483d kojima1999-10-27 22:32:12 +0000816{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200817 WMAdjustSplitViewSubviews((WMSplitView *) data);
94f4483d kojima1999-10-27 22:32:12 +0000818}
819
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200820void testSplitView(WMScreen * scr)
94f4483d kojima1999-10-27 22:32:12 +0000821{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200822 WMWindow *win;
823 WMSplitView *splitv1, *splitv2;
824 WMFrame *frame;
825 WMLabel *label;
826 WMButton *button;
827
828 windowCount++;
829
830 win = WMCreateWindow(scr, "testTabs");
831 WMResizeWidget(win, 300, 400);
832 WMSetWindowCloseAction(win, closeAction, NULL);
833
834 frame = WMCreateFrame(win);
835 WMSetFrameRelief(frame, WRSunken);
836 WMMoveWidget(frame, 5, 5);
837 WMResizeWidget(frame, 290, 40);
838
839 splitv1 = WMCreateSplitView(win);
840 WMMoveWidget(splitv1, 5, 50);
841 WMResizeWidget(splitv1, 290, 345);
842 WMSetSplitViewConstrainProc(splitv1, splitViewConstrainProc);
843 WMCreateEventHandler(WMWidgetView(win), StructureNotifyMask, resizeSplitView, splitv1);
844
845 button = WMCreateCommandButton(frame);
846 WMSetButtonText(button, "+");
847 WMSetButtonAction(button, appendSubviewButtonAction, splitv1);
848 WMMoveWidget(button, 10, 8);
849 WMMapWidget(button);
850
851 button = WMCreateCommandButton(frame);
852 WMSetButtonText(button, "-");
853 WMSetButtonAction(button, removeSubviewButtonAction, splitv1);
854 WMMoveWidget(button, 80, 8);
855 WMMapWidget(button);
856
857 button = WMCreateCommandButton(frame);
858 WMSetButtonText(button, "=");
859 WMMoveWidget(button, 150, 8);
860 WMSetButtonAction(button, adjustSubviewsButtonAction, splitv1);
861 WMMapWidget(button);
862
863 button = WMCreateCommandButton(frame);
864 WMSetButtonText(button, "#");
865 WMMoveWidget(button, 220, 8);
866 WMSetButtonAction(button, orientationButtonAction, splitv1);
867 WMMapWidget(button);
868
869 label = WMCreateLabel(splitv1);
870 WMSetLabelText(label, "Subview 1");
871 WMSetLabelRelief(label, WRSunken);
872 WMMapWidget(label);
873 WMAddSplitViewSubview(splitv1, WMWidgetView(label));
874
875 splitv2 = WMCreateSplitView(splitv1);
876 WMResizeWidget(splitv2, 150, 150);
877 WMSetSplitViewVertical(splitv2, True);
878
879 label = WMCreateLabel(splitv2);
880 WMSetLabelText(label, "Subview 2.1");
881 WMSetLabelRelief(label, WRSunken);
882 WMMapWidget(label);
883 WMAddSplitViewSubview(splitv2, WMWidgetView(label));
884
885 label = WMCreateLabel(splitv2);
886 WMSetLabelText(label, "Subview 2.2");
887 WMSetLabelRelief(label, WRSunken);
888 WMMapWidget(label);
889 WMAddSplitViewSubview(splitv2, WMWidgetView(label));
890
891 label = WMCreateLabel(splitv2);
892 WMSetLabelText(label, "Subview 2.3");
893 WMSetLabelRelief(label, WRSunken);
894 WMMapWidget(label);
895 WMAddSplitViewSubview(splitv2, WMWidgetView(label));
896
897 WMMapWidget(splitv2);
898 WMAddSplitViewSubview(splitv1, WMWidgetView(splitv2));
899
900 WMRealizeWidget(win);
901 WMMapSubwidgets(win);
902 WMMapWidget(win);
94f4483d kojima1999-10-27 22:32:12 +0000903}
904
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200905void testUD()
71f73506 kojima2000-05-21 16:15:56 +0000906{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200907 WMUserDefaults *defs;
908 char str[32];
71f73506 kojima2000-05-21 16:15:56 +0000909
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200910 defs = WMGetStandardUserDefaults();
71f73506 kojima2000-05-21 16:15:56 +0000911
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200912 sprintf(str, "TEST DATA");
913 puts(str);
914 WMSetUDStringForKey(defs, str, "testKey");
915 puts(str);
71f73506 kojima2000-05-21 16:15:56 +0000916}
052ab01c kojima1999-09-16 02:55:56 +0000917
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200918int main(int argc, char **argv)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000919{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200920 WMScreen *scr;
921 WMPixmap *pixmap;
172da48a dan2000-10-15 00:11:41 +0000922
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200923 /* Initialize the application */
924 WMInitializeApplication("Test@eqweq_ewq$eqw", &argc, argv);
172da48a dan2000-10-15 00:11:41 +0000925
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200926 testUD();
172da48a dan2000-10-15 00:11:41 +0000927
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200928 /*
929 * Open connection to the X display.
930 */
931 dpy = XOpenDisplay("");
172da48a dan2000-10-15 00:11:41 +0000932
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200933 if (!dpy) {
934 puts("could not open display");
935 exit(1);
936 }
172da48a dan2000-10-15 00:11:41 +0000937
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200938 /* This is used to disable buffering of X protocol requests.
939 * Do NOT use it unless when debugging. It will cause a major
940 * slowdown in your application
941 */
1e922744 dan2002-10-16 04:05:45 +0000942#if 0
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200943 XSynchronize(dpy, True);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000944#endif
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200945 /*
946 * Create screen descriptor.
947 */
948 scr = WMCreateScreen(dpy, DefaultScreen(dpy));
9d2e6ef9 scottc1998-09-29 22:36:29 +0000949
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200950 /*
951 * Loads the logo of the application.
952 */
953 pixmap = WMCreatePixmapFromFile(scr, "logo.xpm");
172da48a dan2000-10-15 00:11:41 +0000954
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200955 /*
956 * Makes the logo be used in standard dialog panels.
957 */
958 if (pixmap) {
959 WMSetApplicationIconPixmap(scr, pixmap);
960 WMReleasePixmap(pixmap);
961 }
172da48a dan2000-10-15 00:11:41 +0000962
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200963 /*
964 * Do some test stuff.
965 *
966 * Put the testSomething() function you want to test here.
967 */
770c3507 nwanua2000-09-29 04:50:32 +0000968
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200969 testText(scr);
970 testFontPanel(scr);
c2ec1cfe dan2002-11-13 15:13:48 +0000971
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200972 testColorPanel(scr);
18b37532 dan2002-11-22 04:49:05 +0000973
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200974 testTextField(scr);
ca616755 dan2004-10-28 04:17:18 +0000975
affcc3ba kojima2001-02-20 23:38:36 +0000976#if 0
e7d0c5d9 dan2004-04-07 02:50:52 +0000977
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200978 testBox(scr);
979 testButton(scr);
980 testColorPanel(scr);
981 testColorWell(scr);
982 testDragAndDrop(scr);
983 testFrame(scr);
984 testGradientButtons(scr);
985 testList(scr);
986 testOpenFilePanel(scr);
987 testProgressIndicator(scr);
988 testPullDown(scr);
989 testScrollView(scr);
990 testSlider(scr);
991 testSplitView(scr);
992 testTabView(scr);
993 testTextField(scr);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000994#endif
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200995 /*
996 * The main event loop.
997 *
998 */
999 WMScreenMainLoop(scr);
9d2e6ef9 scottc1998-09-29 22:36:29 +00001000
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +02001001 return 0;
9d2e6ef9 scottc1998-09-29 22:36:29 +00001002}