/*
** Little tool to show the UserData custom class.
*/

#include "demo.h"
#include "UserData_mcc.h"


int main(int argc,char *argv[])
{
	Object *app,*win,*sasg;
	ULONG signals;
	BOOL running = TRUE;

	init();

	app = ApplicationObject,
		MUIA_Application_Title      , "ShowUserData",
		MUIA_Application_Version    , "$VER: ShowUserData 10.11 (23.12.94)",
		MUIA_Application_Copyright  , "©1994 by Stefan Stuntz",
		MUIA_Application_Author     , "Stefan Stuntz",
		MUIA_Application_Description, "Show the UserData custom class",
		MUIA_Application_Base       , "SHOWUSERDATA",

		SubWindow, win = WindowObject,
			MUIA_Window_Title, "Show the UserData public custom class",
			MUIA_Window_ID   , MAKE_ID('S','A','S','G'),

			WindowContents, VGroup,

				Child, sasg = MUI_NewObject(MUIC_UserData,
					MUIA_UserData_First  , "Jo",
					MUIA_UserData_Name   , "User",
					MUIA_UserData_Street , "Fakestreet 12",
					MUIA_UserData_City   , "Faketown, FT 1234",
					MUIA_UserData_Country, "Wonderland",
					MUIA_UserData_Phone  , "+1-234-567-8901",
					MUIA_UserData_EMail  , "jouser@fake.wonder.land",
					TAG_DONE),

				End,
			End,
		End;

	if (!app)
		fail(app,"Failed to create Application.");


/*
** Install notification events...
*/

	DoMethod(win,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
		app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);


/*
** Input loop...
*/

	set(win,MUIA_Window_Open,TRUE);

	while (running)
	{
		switch (DoMethod(app,MUIM_Application_Input,&signals))
		{
			case MUIV_Application_ReturnID_Quit:
				running = FALSE;
				break;
		}

		if (running && signals) Wait(signals);
	}

	set(win,MUIA_Window_Open,FALSE);


/*
** Shut down...
*/

	fail(app,NULL);
}
