// COPYRIGHT (C) 1990-1999.  All Rights Reserved. - HELLO1.CPP
// Zinc Software Incorporated.  Pleasant Grove, Utah  USA
// May be freely copied, used and distributed.

#include <zaf.hpp>

int ZafApplication::Main(void)
{
	// This line is only needed for linkers that don't automatically look
	// for unresolved references to main() or WinMain() inside of libraries.
	// (Either main() or WinMain() is found in a ZAF library.)
	LinkMain();

	// Create the hello window and attach generic objects (border, maximize
	// button, minimize button, system button, and title) to it.
	ZafWindow *helloWindow = new ZafWindow(0, 0, 30, 3);
	helloWindow->AddGenericObjects(new ZafStringData("Hello Window"));

	// Attach a prompt with the "hello world" text.
	// (The optional ZAF_ITEXT macro guarantees Unicode compatibility.)
	helloWindow->Add(new ZafPrompt(2, 1, 0, ZAF_ITEXT("Hello World!")));

	// Center the window on the main monitor.
	zafWindowManager->Center(helloWindow);

	// Attach the hello window to the window manager, or in other words,
	// make it appear on the screen.
	zafWindowManager->Add(helloWindow);

	// Process events.
	// (This function passes events from the event manager to the
	// window manager until an S_EXIT is received or until there are no
	// more windows attached to the window manager.)
	Control();

	// Return an exit code.
	// (This is the exit code returned to the OS by the application.)
	return (0);
}
