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

#include "mgui.h"

void ExitCB(MOBJECT obj, void *a, void *b)
{
	obj = MObjectShell(obj);
	MShellUnrealize(obj);
	MShellDestroy(obj);
	MGUITerm();
	exit(0);
}

void MGUIMain(int argc, char **argv)
{
	MOBJECT shell, sform, rform, cform, pb, lbl;

	shell = MCreateShell("Sample 5", 0);

	sform = MCreateScrolledForm(shell, 150, 100);
 
	rform = MCreateRowForm(sform);
	lbl = MCreateLabel(rform, "This Label forces the width", DEFAULT_FONT);
	MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0); 
	lbl = MCreateLabel(rform, "Small Label", DEFAULT_FONT);
	MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0); 
	lbl = MCreateLabel(rform, "Not scaleable Label", DEFAULT_FONT); 
	MObjectSetOffset(lbl, 15, -1, -1, -1);
	MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0); 
	MObjectSetResize(lbl, False, False); 

	cform = MCreateColForm(sform); 
	pb = MCreatePButton(cform, "Dummy", TIMES_L_FONT);
	pb = MCreatePButton(cform, "Quit", TIMES_L_FONT);
	MObjectSetAttachment(pb, True, True, False, True);
	MPButtonSetCallback(pb, ExitCB, NULL);

	MShellRealize(shell);

	MMainLoop();
}
