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

#include <zaf.hpp>

// ----- SystemMenuWindow ---------------------------------------------------

class SystemMenuWindow : public ZafWindow
{
public:
	SystemMenuWindow(int left, int top);
};

SystemMenuWindow::SystemMenuWindow(int left, int top) :
	ZafWindow(left, top, 40, 7)
{
	// Set the window information.
	SetStringID(ZAF_ITEXT("SystemMenuWindow"));
	if (left == 0 && top == 0)
		zafWindowManager->Center(this);

	// Create the window decorations.
	Add(new ZafBorder);
	Add(new ZafMaximizeButton);
	Add(new ZafMinimizeButton);

	ZafSystemButton *sysButton = new ZafSystemButton(ZAF_EMPTY_SYSTEM_BUTTON);
	sysButton->Add(new ZafPopUpItem(ZAF_ITEXT("Item 1")));
	sysButton->Add(new ZafPopUpItem(ZAF_ITEXT("Item 2")));
	sysButton->Add(new ZafPopUpItem(ZAF_ITEXT("Item 3")));
	sysButton->Add(new ZafPopUpItem(ZAF_ITEXT("Item 4")));
	sysButton->Add(new ZafPopUpItem(ZAF_ITEXT("Item 5")));
	sysButton->Add(new ZafPopUpItem(ZAF_NULLP(ZafIChar), ZAF_SEPARATOR));
	sysButton->Add(new ZafPopUpItem(ZAF_ITEXT(""), ZAF_EXIT_OPTION));
	Add(sysButton);

	Add(new ZafTitle(new ZafStringData("System Menu Window")));
}

// ----- Main() -------------------------------------------------------------

int ZafApplication::Main(void)
{
	// Ensure main() is linked properly.
	LinkMain();

	// Add the windows to the window manager.
	zafWindowManager->Add(new SystemMenuWindow(0, 0));

	// Get the user input.
	Control();

	// Return success.
	return (0);
}

