Change to the linux kernel coding style
[wmaker-crm.git] / WINGs / Tests / testmywidget.c
Commit [+]AuthorDateLineData
9d2e6ef9 scottc1998-09-29 22:36:29 +00001
a20aebde dan2001-01-18 19:21:56 +00002#include <WINGs/WINGs.h>
c2ec1cfe dan2002-11-13 15:13:48 +00003#include <stdlib.h>
9d2e6ef9 scottc1998-09-29 22:36:29 +00004
5#include "mywidget.h"
6
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +02007void wAbort()
9d2e6ef9 scottc1998-09-29 22:36:29 +00008{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +02009 exit(1);
9d2e6ef9 scottc1998-09-29 22:36:29 +000010}
11
9d2e6ef9 scottc1998-09-29 22:36:29 +000012int main(int argc, char **argv)
13{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020014 Display *dpy = XOpenDisplay("");
15 WMScreen *scr;
16 WMWindow *win;
17 MyWidget *thing;
9d2e6ef9 scottc1998-09-29 22:36:29 +000018
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020019 WMInitializeApplication("Test", &argc, argv);
9d2e6ef9 scottc1998-09-29 22:36:29 +000020
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020021 if (!dpy) {
22 wfatal("could not open display");
23 exit(1);
24 }
6830b057 dan2004-10-12 21:28:27 +000025
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020026 scr = WMCreateSimpleApplicationScreen(dpy);
6830b057 dan2004-10-12 21:28:27 +000027
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020028 /* init our widget */
29 InitMyWidget(scr);
9d2e6ef9 scottc1998-09-29 22:36:29 +000030
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020031 win = WMCreateWindow(scr, "test");
32 WMResizeWidget(win, 150, 50);
6830b057 dan2004-10-12 21:28:27 +000033
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020034 thing = CreateMyWidget(win);
35 SetMyWidgetText(thing, "The Test");
36 WMResizeWidget(thing, 100, 20);
37 WMMoveWidget(thing, 10, 10);
6830b057 dan2004-10-12 21:28:27 +000038
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020039 WMRealizeWidget(win);
40 WMMapSubwidgets(win);
41 WMMapWidget(win);
6830b057 dan2004-10-12 21:28:27 +000042
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020043 WMScreenMainLoop(scr);
6830b057 dan2004-10-12 21:28:27 +000044
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020045 return 0;
9d2e6ef9 scottc1998-09-29 22:36:29 +000046}