summaryrefslogtreecommitdiff
path: root/new/test.c
blob: b2cb630d92c96bf02981327148f3d934f9655a61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// 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);
	uiWindowShow(w);

	button = uiNewButton("Click Me");
	uiButtonOnClicked(button, onClicked, NULL);
	uiWindowSetChild(w, button);

	uiMain();
	printf("after uiMain()\n");
	return 0;
}