andlabs-ui/new/test.c

42 lines
707 B
C
Raw Normal View History

// 6 april 2015
#include "ui.h"
#include <stdio.h>
int onClosing(uiWindow *w, void *data)
{
printf("in closing!\n");
uiQuit();
return 1;
}
void onClicked(uiControl *b, void *data)
{
printf("button clicked!\n");
}
int main(void)
{
uiInitError *err;
uiWindow *w;
uiControl *button;
err = uiInit(NULL);
if (err != NULL) {
fprintf(stderr, "error initializing ui: %s\n", uiInitErrorMessage(err));
uiInitErrorFree(err);
return 1;
}
w = uiNewWindow("Hello", 320, 240);
uiWindowOnClosing(w, onClosing, NULL);
button = uiNewButton("Click Me");
uiButtonOnClicked(button, onClicked, NULL);
uiWindowSetChild(w, button);
uiWindowShow(w);
uiMain();
2015-04-06 19:01:14 -05:00
printf("after uiMain()\n");
return 0;
}