#include "split1.hpp"

// Create a basic window class to add the splitters.
SplitterWindow::SplitterWindow(int left, int top, int width, int height) : 
	ZafWindow(left, top, width, height)
{
	// Add the normal support objects.
	AddGenericObjects(new ZafStringData("Splitter Window"));

	// Create a new ZafSplitter object and add it to the window.
	// The first splitter must have ZAF_AVAILABLE_REGION set while
	// any subsequent splitters must NOT have this set.
	ZafSplitter *splitter = new ZafSplitter(ZAF_HORIZONTAL_SPLITTER);
	splitter->SetRegionType(ZAF_AVAILABLE_REGION);
	Add(splitter);

	// Add a text object to one side of the splitter by using
	// the SetPreviousPaneObject or SetNextPaneObject.  By definition
	// the top and left side of each splitter are the previous pane areas
	// while the bottom and right sides of a splitter are the next pane areas.
	ZafText *text = new ZafText(0, 0, 0, 0, new ZafStringData("This is a text object."));
	text->Add(new ZafScrollBar(ZAF_VERTICAL_SCROLL));
	splitter->SetPreviousPaneObject(text);
	Add(text);

	// Create and add a text object to the other side of the splitter.
	text = new ZafText(0, 0, 0, 0, new ZafStringData("This is a text object."));
	text->Add(new ZafScrollBar(ZAF_VERTICAL_SCROLL));
	splitter->SetNextPaneObject(text);
	Add(text);

	// Center the application window.
	zafWindowManager->Center(this);
}

int ZafApplication::Main()
{
	LinkMain();

	SplitterWindow *split = new SplitterWindow(0, 0, 60, 10);

	zafWindowManager->Add(split);

	Control();

	return (0);
}
