/*
 * sample 2
 */
#include <stdio.h>
#include <stdlib.h>

#include "mgui.h"

void ExitCB(MOBJECT obj, void *a, void *b)
{
	if (MMessageDialog("Exit",
	  "Do you really\nwant to quit ?",
	  "Sure", "Cancel", NULL) != 0)
			return;
	obj = MObjectShell(obj); 
	MShellUnrealize(obj);
	MShellDestroy(obj);
	MGUITerm();
	exit(0);
}

void MGUIMain(int argc, char **argv)
{
	MOBJECT shell, pushbutton;

	shell = MCreateShell("Message", 0);
	MCreateLabel(shell, "Hello, world", HELV_L_FONT);
	pushbutton = MCreatePButton(shell, "Ok", TIMES_L_FONT);
	MPButtonSetCallback(pushbutton, ExitCB, NULL);
	MShellRealize (shell);

	MMainLoop();
}

