/* Libraries */
#include <libraries/mui.h>

/* protos */
#include <clib/muimaster_protos.h>
#include <clib/alib_protos.h>
#include <clib/dos_protos.h>
#include <clib/exec_protos.h>

/*  Pragmas  */
#include <pragmas/muimaster_pragmas.h>
#include <pragmas/exec_pragmas.h>

/*  Ansi  */
#include <stdlib.h>
#include <stdio.h>

/* MUIBuilder */
#include "MUIB-DemoGui.h"

struct Library * MUIMasterBase;

/* Init function */
static void init( void )
{
	if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
	{
		printf("Can't Open MUIMaster Library");
		exit(20);
	}
}

/* main function */
main()
{
	struct ObjApp * App = NULL;	/* Application object */
	BOOL	running = TRUE;
	ULONG	signal;

	/* Program initialisation ( you need to write it yourself) */
	init();

	/* Create Application : generated by MUIBuilder */
	App = CreateApp();

	while (running)
        {
                switch (DoMethod(App->App,MUIM_Application_Input,&signal))
                {
                case MUIV_Application_ReturnID_Quit:
                        running = FALSE;
                        break;
                }
	if (running && signal) Wait(signal);
        }
	DisposeApp(App);
	CloseLibrary(MUIMasterBase);
	exit(0);
}
