Sample code for all Widgets

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Revision as of 07:42, 1 May 2006 by Rackle (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This code goes through every widget and demonstrates how to retrieve and set their data as well as some of their particularities.

Widgets

General

A widget can be enabled/disabled via setEnabled(). Disabling a widget prevents the user from activating it and manipulating its contents. A widget can be hidden/shown via setVisible().


Tooltip

A Tooltip widget displays text when the mouse has been hovering over a widget for a certain amount of time. This widget requires that time be injected within CEGUI via injectTimePulse().

The graphical aspect (the scheme) of the tooltip can be specified via setTooltip(). The amount of hovering time required to activate the tooltip can be specified via setHoverTime(). The amount of time the tooltip is displayed can be specified via setDisplayTime(). And the fade transition time can be specified via setFadeTime(); this affects both the fade in and the fade out times. The tooltip text of a widget can be specified via setTooltipText(). Please note that some complex widgets are composed of several widgets. In order to have a tooltip text displayed while hovering over any region of the complex widget then every component widget needs to have a tooltip text specified. For example a Spinner widget is composed of an Editbox widget and two Button widgets.


StaticText

A StaticText widget displays text; it does not receive inputs from a user.

The currently displayed text can be specified via setText(). The color of this text can be specified via setTextColours(). The horizontal and vertical alignement can be specified via setFormatting().


StaticImage

A StaticImage widget displays an image; it does not receive inputs from a user.

The currently displayed image can be specified via setImage().


ProgressBar

A ProgressBar widget displays a progression; it does not receive inputs from a user.

The current progress can be specified via setProgress(). Progress can be advanced through steps. The step size can be specified via setStepSize() and a step performed via step(). Progress can be adjusted by a delta value via adjustProgress(). The current progress value can be obtained via getProgress().


Button

A Button widget displays a text and receives an activation instruction from the user.

The text can be specified via setText().


ScrollablePane

A ScrollablePane widget displays contents that can be scrolled. Contents can be added via addChildWindow(). When that content exceeds the dimensions of the ScrollablePane then scrollbars appear to allow the use to view and interact with that hidden content.


Checkbox

A Checkbox widget controls a boolean value; true when checked and false when unchecked. This value can be obtained via isSelected() and specified via setSelected(true) to check or setSelected(true) to uncheck.


Spinner

A Spinner widget controls a numerical values (float) through an editbox or the use of the increment or decrement buttons.

This value is bounded within a minimum and a maximum by calling setMinimumValue() and setMaximumValue(). The arrow buttons increment or decrement the value by the amount specified with setStepSize(). The numerical value can be displayed in four formats: FloatingPoint, Integer, Hexadecimal, Octal.

The current value is obtained via getCurrentValue() and specified via setCurrentValue().


Editbox

An Editbox widget controls printable character values; letters, numbers, punctuations, and symbols.

The maximal number of characters that can be specified is bound by setMaxTextLength(). The value can be set to readable only (modifications by users are not allowed) via setReadOnly(true). The value can be masked via setTextMasked() and the default value of * can be modified via setMaskCodePoint().

The current value can be obtained via getText() and specified via setText().


Slider

A Slider widget controls a numerical value (float) through the position of a "thumb".

This value is bounded within a maximum by setMaxValue(); the minimum value is set to 0.0f. The thumb can be dragged to the desired position or moved by clicking on either side of the thumb. The increment or decrement value is set by setClickStep().

The current value can be obtained via getCurrentValue() and specified via setCurrentValue().


Scrollbar

A Scrollbar widget controls a numerical value (float) through the position of a "thumb".

This value is bounded within a maximum by setDocumentSize(); the minimum value is set to 0.0f. The thumb can be dragged to the desired position or moved by clicking on either side of the thumb. The increment or decrement value is set by setPageSize(). The arrow buttons increment or decrement the value by the amount specified with setStepSize().

The current value can be obtained via getScrollPosition() and specified via setScrollPosition(). Note that the actual maximum value that the scrollbar will return is set by the following formula: document_size - page_size. Thus, a document of size 100 and a page size of 10 will have a value from 0 to 90.


MultiLineEditbox

A MultiLineEditbox widget controls printable character values; letters, numbers, punctuations, and symbols.

Unlike the Editbox widget there is no maximal number of characters that can be specified. The value can be set to readable only (modifications by users are not allowed) via setReadOnly(true). Text can be automatically wrapped via a call to setWordWrapping(true).

The current value can be obtained via getText() and specified via setText().


RadioButton

A RadioButton widget controls a single selection among many choices.

The choices are grouped by calling setGroupID(). Only one RadioButton per group ID can be selected; this widget does not support multiple selection. However it is possible for a choice to possess no decision; initially every RadioButton of a group is unselected.

The currently selected RadioButton can be obtained via getSelectedButtonInGroup(). This RadioButton pointer can then be used to query the ID via getID(), the text (visible label of the RadioButton) via getText(), or user data via getUserData(). A RadioButton can be selected via setSelected(true). Passing false will deselect the RadioButton, potentially making every RadioButton of the group unselected.


Listbox

A Listbox widget controls either a single selection or multiple selections among many choices. Multiple selections are enabled via setMultiselectEnabled().

The choices are listbox text items (ListboxTextItem) added to the listbox via addItem(). These do not possess a selection indicator by default; one must be specified via setSelectionBrushImage().

The selected ListboxItem can be obtained via getFirstSelectedItem() and subsequent selections through getNextSelected(). A selection can be specified via setItemSelectState().


Combobox

A Combobox widget controls a single selection among many choices.

The choices are listbox text items (ListboxTextItem) added to the combobox via addItem(). These do not possess a selection indicator by default; one must be specified via setSelectionBrushImage().

The value of the text within the Editbox can be obtained via getText() and the last selected ListboxItem can be obtained via getSelectedItem(). However there is no guarantee that both are synchronized; typing text within the Editbox will not automatically select the corresponding ListboxItem. Fortunately the reverse is not true; selecting a ListboxItem will place that text within the Editbox. Placing the Editbox in read-only mode with setReadOnly(true) can avoid problems. The current value can be specified via listboxTextItem->setSelected(true) and a setText(itemCombobox->getText()).


MultiColumnList

A MultiColumnList widget controls controls either a single selection or multiple selections among many choices. Multiple selections are enabled via setSelectionMode(MultiColumnList::RowMultiple).

A MultiColumnList widget may contain a single column or multiple columns. Columns are added via addColumn(), specifying a label, a column ID, and a column width.

Three steps are required to add a row. The first step is to add a new row with addRow(). The second step is to create a ListboxTextItem for each cell of the row and specify the selection indicator via setSelectionBrushImage(). The third step is to add the newly created ListboxTextItem to the MultiColumnList via setItem(), specifying the ListboxTextItem, the column ID, and the row ID.

The selected row can be obtained via getFirstSelectedItem() and subsequent selections through getNextSelected(). This will iterate through every selected cell, returning each selected ListboxTextItem . A selection can be specified via setItemSelectState(); by setting the selection mode to rows (either RowSingle or RowMultiple) you actually only need to select the ListboxTextItem of the first column.


TabControl

A TabControl widget allows multiple windows to be displayed one at a time, via tab buttons.

Two objects must be created within the Layout Editor to generate a functional tab control. The first is a window of type "TabControl". This will be the parent window of the tab buttons as well as the pages. The second is a window of type "TabPane". This window will be placed within the TabControl (via addTab(), not through the Layout Editor) and will specify the contents of a page. Widgets are to be placed within these TabPane via the Layout Editor. The "TabButton" windows are not to be specified via the Layout Editor since they will be automatically created when a TabPane is added to the TabControl.

In this demo the TabControl widget was placed within a FrameWindow. This is not a requirement. It could have just easily been placed alongside the widgets of the other window.

Files

WidgetGalore.h

#ifndef _WidgetGalore_h_
#define _WidgetGalore_h_

#include "CEGuiSample.h"
#include "CEGUI.h"
#include "WindowSystem.h"

class WindowWidgets : public WindowSystem
{
public:
	bool onValueChanged(const CEGUI::EventArgs& e)
	{
		using namespace CEGUI;
		WindowManager& winMgr = WindowManager::getSingleton();
		Scrollbar* widget = static_cast<Scrollbar*>(winMgr.getWindow("HorizontalScrollbar"));
		Editbox* editbox = static_cast<Editbox*>(winMgr.getWindow("Editbox"));
		std::ostringstream stringStream;
		stringStream << widget->getScrollPosition();
		editbox->setText(stringStream.str());
		return true;
	}

	void initWindow()
	{
		// Initialise the window
		using namespace CEGUI;

		// Initialise the windowing system
		WindowSystem::initialise("winWidgets",	// The handle of this window
									true);		// Initially visible
		subscribeToEvents();
		WindowManager& winMgr = WindowManager::getSingleton();

		/* Tooltip */
		System::getSingleton().setTooltip("TaharezLook/Tooltip"); // Set the name of the default tooltip
		Tooltip* tooltip = System::getSingleton().getDefaultTooltip();
		tooltip->setHoverTime(0.5f); // Display the tooltip after the mouse has been hovering over the widget for half a second
		tooltip->setDisplayTime(10.0f); // Display for 15 seconds then disappear
		tooltip->setFadeTime(1.0f); // Duration of the transition between fully visible and fully invisible

		/* StaticText */
		StaticText* staticText = static_cast<StaticText*>(winMgr.getWindow((utf8*) "StaticText"));
		staticText->setText("Red StaticText");
		staticText->setTextColours( colour(1.0f, 0.0f, 0.0f, 1.0f) ); // Red text
		staticText->setFormatting(StaticText::HorzCentred, StaticText::VertCentred); // Center the text
		staticText->setTooltipText("This is a StaticText widget");

		/* StaticImage */
		ImagesetManager::getSingleton().createImagesetFromImageFile("ImageForStaticImage", "../datafiles/imagesets/GPN-2000-001437.tga");
		StaticImage* staticImage = static_cast<StaticImage*>(winMgr.getWindow((utf8*) "StaticImage"));
		staticImage->setImage("ImageForStaticImage", "full_image"); // "full_image" is a default name from CEGUIImageset::Imageset()

		/* ProgressBar */
		ProgressBar* progressBar = static_cast<ProgressBar*>(winMgr.getWindow((utf8*) "ProgressBar"));
		progressBar->setProgress(0.25f); // Initial progress of 25%
		progressBar->setStepSize(0.10f); // Calling step() will increase the progress by 10%
		progressBar->step(); // Advance the progress by the size specified in setStepSize()
		progressBar->adjustProgress(-0.05f); // Adjust the progress by a delta value rather than setting a new value through setProgress
		float valueProgressBar = progressBar->getProgress(); // initial 0.25f + step 0.10f - adjustment 0.05f = 0.30f

		/* Button */
		PushButton* btnClose = static_cast<PushButton*>(winMgr.getWindow((utf8*) "btnClose"));
		btnClose->setText("Exit");

		/* ScrollablePane */
		ScrollablePane* scrollablePane = static_cast<ScrollablePane*>(winMgr.getWindow((utf8*) "ScrollablePane"));
		ImagesetManager::getSingleton().createImagesetFromImageFile("ImageForScrollablePane", "../datafiles/imagesets/GPN-2000-001437.tga");
		StaticImage* staticImageInScrollablePane = static_cast<StaticImage*>(winMgr.createWindow("TaharezLook/StaticImage", "StaticImageInScrollablePane"));
		staticImageInScrollablePane->setImage("ImageForScrollablePane", "full_image"); // "full_image" is a default name from CEGUIImageset::Imageset()
		staticImageInScrollablePane->setPosition( Point(0.0f, 0.0f) ); // Start in the upper left corner
		staticImageInScrollablePane->setWidth(2.0f); // Twice the width of the parent, the ScrollablePane
		staticImageInScrollablePane->setHeight(2.0f); // Twice the height of the parent, the ScrollablePane
		scrollablePane->addChildWindow(staticImageInScrollablePane); // Add the image to the // Twice the width of the parent, the ScrollablePane
		Editbox* editboxInScrollablePane = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "EditboxInScrollablePane"));
		editboxInScrollablePane->setPosition( Point(0.0f, 2.1f) ); // Start below the image
		editboxInScrollablePane->setWidth(2.0f); 
		editboxInScrollablePane->setHeight(0.3f);
		scrollablePane->addChildWindow(editboxInScrollablePane);

		/* Check box */
		Checkbox* checkbox = static_cast<Checkbox*>(winMgr.getWindow("Checkbox"));
		checkbox->setSelected( true );
		bool valueCheckbox = checkbox->isSelected();

		/* Spinner */
		Spinner* spinner = static_cast<Spinner*>(winMgr.getWindow("Spinner"));
		spinner->setTextInputMode(Spinner::FloatingPoint); // FloatingPoint, Integer, Hexadecimal, Octal
		spinner->setMinimumValue(-10.0f);
		spinner->setMaximumValue(10.0f);
		spinner->setStepSize(0.2f);
		spinner->setCurrentValue(5.2f);
		float valueSpinner = spinner->getCurrentValue();

		/* Editbox */
		Editbox* editbox = static_cast<Editbox*>(winMgr.getWindow("Editbox"));
		editbox->setText("Editbox values");
		editbox->setMaxTextLength(13); // The trailing 's' will not be displayed
		editbox->setReadOnly(false);
		editbox->setTextMasked(false);
		editbox->setMaskCodePoint(0x002A); // *
		String valueEditbox = editbox->getText();

		/* Slider */
		Slider* slider = static_cast<Slider*>(winMgr.getWindow("Slider"));
		slider->setMaxValue(100.0f);
		slider->setClickStep(10.0f);
		slider->setCurrentValue(20.0f);
		float valueSlider = slider->getCurrentValue();

		/* Scrollbar (Horizontal) */
		Scrollbar* scrollbarHorizontal = static_cast<Scrollbar*>(winMgr.getWindow("HorizontalScrollbar"));
		scrollbarHorizontal->setDocumentSize(100.0f);
		scrollbarHorizontal->setPageSize(10.0f);
		scrollbarHorizontal->setStepSize(1.0f);
		scrollbarHorizontal->setScrollPosition(75.0f);
		float valueScrollbarHorizontal = scrollbarHorizontal->getScrollPosition();

		/* Scrollbar (Vertical) */
		Scrollbar* scrollbarVertical = static_cast<Scrollbar*>(winMgr.getWindow("VerticalScrollbar"));
		scrollbarVertical->setDocumentSize(100.0f);
		scrollbarVertical->setPageSize(10.0f);
		scrollbarVertical->setStepSize(1.0f);
		scrollbarVertical->setScrollPosition(25.0f);
		float valueScrollbarVertical = scrollbarVertical->getScrollPosition();

		/* MultiLineEditbox */
		MultiLineEditbox* multiLineEditbox = static_cast<MultiLineEditbox*>(winMgr.getWindow("MultiLineEditbox"));
		multiLineEditbox->setText("MultiLineEditbox value");
		multiLineEditbox->setReadOnly(false);
		multiLineEditbox->setWordWrapping(true);
		String valueMultiLineEditbox = multiLineEditbox->getText();

		/* RadioButton */
		RadioButton* radioButton = static_cast<RadioButton*>(winMgr.getWindow("RadioButton_A"));
			radioButton->setGroupID(1);
			radioButton->setID(101);
			radioButton->setSelected(true);
		radioButton = static_cast<RadioButton*>(winMgr.getWindow("RadioButton_B"));
			radioButton->setGroupID(1);
			radioButton->setID(102);
		radioButton = static_cast<RadioButton*>(winMgr.getWindow("RadioButton_C"));
			radioButton->setGroupID(1);
			radioButton->setID(103);
		radioButton = static_cast<RadioButton*>(winMgr.getWindow("RadioButton_1"));
			radioButton->setGroupID(2);
			radioButton->setID(201);
			radioButton->setSelected(true);
		radioButton = static_cast<RadioButton*>(winMgr.getWindow("RadioButton_2"));
			radioButton->setGroupID(2);
			radioButton->setID(202);
		radioButton = static_cast<RadioButton*>(winMgr.getWindow("RadioButton_3"));
			radioButton->setGroupID(2);
			radioButton->setID(203);
		radioButton = static_cast<RadioButton*>(winMgr.getWindow("RadioButton_A"));
		uint valueRadioButtonLetters = radioButton->getSelectedButtonInGroup()->getID();
		radioButton = static_cast<RadioButton*>(winMgr.getWindow("RadioButton_3"));
		uint valueRadioButtonNumbers = radioButton->getSelectedButtonInGroup()->getID();
		radioButton->setSelected(true);

		/* Listbox */
		Listbox* listbox = static_cast<Listbox*>(winMgr.getWindow("Listbox"));
		listbox->setMultiselectEnabled(false);
		ListboxTextItem* itemListbox = new ListboxTextItem("Value A", 1);
			itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			listbox->addItem(itemListbox);
		itemListbox = new ListboxTextItem("Value B", 2);
			itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			listbox->addItem(itemListbox);
		itemListbox = new ListboxTextItem("Value C", 3);
			itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			listbox->addItem(itemListbox);
		itemListbox = new ListboxTextItem("Value D", 4);
			itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			listbox->addItem(itemListbox);
		listbox->setItemSelectState(itemListbox, true);
		uint valueListbox = listbox->getFirstSelectedItem()->getID();

		/* Combobox */
		Combobox* combobox = static_cast<Combobox*>(winMgr.getWindow("Combobox"));
		combobox->setReadOnly(true);
		ListboxTextItem* itemCombobox = new ListboxTextItem("Value 1", 1);
			itemCombobox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			combobox->addItem(itemCombobox);
		itemCombobox = new ListboxTextItem("Value 2", 2);
			itemCombobox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			combobox->addItem(itemCombobox);
			itemCombobox->setSelected(true); // Select this item
			combobox->setText(itemCombobox->getText()); // Copy the item's text into the Editbox
		itemCombobox = new ListboxTextItem("Value 3", 3);
			itemCombobox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			combobox->addItem(itemCombobox);
		itemCombobox = new ListboxTextItem("Value 4", 4);
			itemCombobox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			combobox->addItem(itemCombobox);
		String valueCombobox = combobox->getText();

		/* MultiColumnList */
		MultiColumnList* multiColumnList = static_cast<MultiColumnList*>(winMgr.getWindow("MultiColumnList"));
		multiColumnList->addColumn("Col A", 0, 0.32f);
		multiColumnList->addColumn("Col B", 1, 0.32f);
		multiColumnList->addColumn("Col C", 2, 0.32f);
		multiColumnList->setSelectionMode(MultiColumnList::RowSingle); // MultiColumnList::RowMultiple
		ListboxTextItem* itemMultiColumnList;
		multiColumnList->addRow();
		itemMultiColumnList = new ListboxTextItem("A1", 101);
			itemMultiColumnList->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			multiColumnList->setItem(itemMultiColumnList, 0, 0); // ColumnID, RowID
		itemMultiColumnList = new ListboxTextItem("B1", 102);
			//itemMultiColumnList->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush"); // This cell does not specify a selection indicator
			multiColumnList->setItem(itemMultiColumnList, 1, 0); // ColumnID, RowID
		itemMultiColumnList = new ListboxTextItem("C1", 103);
			itemMultiColumnList->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			multiColumnList->setItem(itemMultiColumnList, 2, 0); // ColumnID, RowID
		multiColumnList->addRow();
		itemMultiColumnList = new ListboxTextItem("A2", 201);
			itemMultiColumnList->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			multiColumnList->setItem(itemMultiColumnList, 0, 1); // ColumnID, RowID
		itemMultiColumnList = new ListboxTextItem("B2", 202);
			itemMultiColumnList->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			multiColumnList->setItem(itemMultiColumnList, 1, 1); // ColumnID, RowID
		itemMultiColumnList = new ListboxTextItem("C2", 203);
			itemMultiColumnList->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
			multiColumnList->setItem(itemMultiColumnList, 2, 1); // ColumnID, RowID
		MCLGridRef grid_ref(1, 0); // Select according to a grid reference; second row
		multiColumnList->setItemSelectState(grid_ref, true);
		ListboxItem* listboxItem = multiColumnList->getFirstSelectedItem();
		uint valueColumnA = listboxItem->getID();
		listboxItem = multiColumnList->getNextSelected(listboxItem);
		uint valueColumnB = listboxItem->getID();
		listboxItem = multiColumnList->getNextSelected(listboxItem);
		uint valueColumnC = listboxItem->getID();
	}

private:
	void subscribeToEvents()
	{
		// Subscribe to events
		using namespace CEGUI;

		// WindowSystem events
		WindowSystem::bindEvent("Toolbar_btnWidgets",	PushButton::EventClicked,		WindowSystem::open); // Open this window
		WindowSystem::bindEvent("btnClose",				PushButton::EventClicked,		WindowSystem::ok); // Close this window
		WindowSystem::bindEvent("winWidgets",			FrameWindow::EventCloseClicked,	WindowSystem::cancel); // The 'X' button was clicked
	}
};

//////////////////////////////////////////////

class WindowTabControl : public WindowSystem
{
public:
	void initWindow()
	{
		// Initialise the dialog
		using namespace CEGUI;
		WindowManager& winMgr = WindowManager::getSingleton();

		// Initialise the windowing system
		WindowSystem::initialise("winTabControl",	// The handle of this window
									false);			// Initially invisible

		TabControl* winTabControl = static_cast<TabControl*>(winMgr.getWindow((utf8*) "TabControl"));
		winTabControl->setTabHeight(0.15f); // Make the tab buttons a little bigger

		Window* tabPage = winMgr.getWindow((utf8*) "TabPane1");
		tabPage->setText("Page 1");
		tabPage->setSize(CEGUI::Size(1.0f, 1.0f)); // Size to 100 of its parent, the TabControl
		tabPage->setPosition(CEGUI::Point(0.00f, 0.0f)); // Move to the upper left corner of its parent
		winTabControl->addTab(tabPage);

		tabPage = winMgr.getWindow((utf8*) "TabPane2");
		tabPage->setText("Page 2");
		tabPage->setSize(CEGUI::Size(1.0f, 1.0f)); 
		tabPage->setPosition(CEGUI::Point(0.00f, 0.0f)); 
		winTabControl->addTab(tabPage);

		subscribeToEvents();
	}
private:
	void subscribeToEvents()
	{
		// Subscribe to events
		using namespace CEGUI;

		// WindowSystem events
		WindowSystem::bindEvent("Toolbar_btnTabControl",	PushButton::EventClicked,		WindowSystem::open); // Open this window
		WindowSystem::bindEvent("btnOk",					PushButton::EventClicked,		WindowSystem::ok);
		WindowSystem::bindEvent("btnCancel",				PushButton::EventClicked,		WindowSystem::cancel);
		WindowSystem::bindEvent("btnApply",					PushButton::EventClicked,		WindowSystem::apply);
		WindowSystem::bindEvent("winTabControl",			FrameWindow::EventCloseClicked,	WindowSystem::cancel); // The 'X' button was clicked

		// These events trigger a 'modified' event, activating the 'apply' button
		WindowSystem::bindEvent( "EditBoxPage1",	Editbox::EventTextChanged,	WindowSystem::modified);
		WindowSystem::bindEvent( "EditBoxPage2",	Editbox::EventTextChanged,	WindowSystem::modified);
	}

};

//////////////////////////////////////////

class DemoSample : public CEGuiSample
{
public:
    bool initialiseSample()
	{
		using namespace CEGUI;
		try
		{
			// Retrieve the window manager
			WindowManager& winMgr = WindowManager::getSingleton();

			// Load the TaharezLook scheme and set up the default mouse cursor and font
			SchemeManager::getSingleton().loadScheme("../datafiles/schemes/TaharezLookSkin.scheme");
			System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
			FontManager::getSingleton().createFont("../datafiles/fonts/Commonwealth-10.font");

			// Set the GUI Sheet
			Window* sheet = winMgr.createWindow("DefaultWindow", "root_wnd");
			System::getSingleton().setGUISheet(sheet);

			// Load a layout
			Window* guiLayout = winMgr.loadWindowLayout("../datafiles/layouts/03WidgetGalore.layout");
			sheet->addChildWindow(guiLayout);

			// Initialise the windows
			winWidgets.initWindow();
			winTabControl.initWindow();
		}
		catch(Exception &e)
		{
			#if defined( __WIN32__ ) || defined( _WIN32 )
				MessageBox(NULL, e.getMessage().c_str(), "Error initializing the demo", MB_OK | MB_ICONERROR | MB_TASKMODAL);
			#else
				std::cerr << "Error initializing the demo:" << e.getMessage().c_str() << "\n";
			#endif
		}

		return true;
	}

    void cleanupSample(void)
	{
	}
private:
	WindowWidgets winWidgets;
	WindowTabControl winTabControl;
};

#endif // _WidgetGalore_h_


main.cpp

#if defined( __WIN32__ ) || defined( _WIN32 )
	#define WIN32_LEAN_AND_MEAN
	#define NOMINMAX
	#include "windows.h"
#endif

#include "WidgetGalore.h"


#if defined( __WIN32__ ) || defined( _WIN32 )
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow)
#else
int main(int argc, char *argv[])
#endif
{
    DemoSample app;
    return app.run();
}


WidgetGalore.layout

<?xml version="1.0" encoding="UTF-8"?>
<GUILayout>
<Window Type="DefaultWindow" Name="Root" >
<Property Name="Text" Value="1" />
<Property Name="UnifiedAreaRect" Value="{{0.000000,0.000000},{0.000000,0.000000},{1.000000,0.000000},{1.000000,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
<Window Type="TaharezLook/FrameWindow" Name="winToolbar" >
<Property Name="AlwaysOnTop" Value="True" />
<Property Name="CaptionColour" Value="00FFFFFF" />
<Property Name="CloseButtonEnabled" Value="False" />
<Property Name="EWSizingCursorImage" Value="set:TaharezLook image:MouseEsWeCursor" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTarget" />
<Property Name="NESWSizingCursorImage" Value="set:TaharezLook image:MouseNeSwCursor" />
<Property Name="NSSizingCursorImage" Value="set:TaharezLook image:MouseNoSoCursor" />
<Property Name="NWSESizingCursorImage" Value="set:TaharezLook image:MouseNwSeCursor" />
<Property Name="Text" Value="Toolbar" />
<Property Name="TitlebarEnabled" Value="False" />
<Property Name="TitlebarFont" Value="Commonwealth-10" />
<Property Name="UnifiedAreaRect" Value="{{0.248750,0.000000},{0.010001,0.000000},{0.568749,0.000000},{0.081667,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
<Window Type="TaharezLook/Button" Name="Toolbar_btnWidgets" >
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" />
<Property Name="Text" Value="Widgets" />
<Property Name="UnifiedAreaRect" Value="{{0.065103,0.000000},{0.227595,0.000000},{0.475554,0.000000},{0.686899,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Button" Name="Toolbar_btnTabControl" >
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" />
<Property Name="Text" Value="Tab Control" />
<Property Name="UnifiedAreaRect" Value="{{0.538253,0.000000},{0.227595,0.000000},{0.948703,0.000000},{0.686899,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
</Window>
<Window Type="TaharezLook/TabPane" Name="TabPane2" >
<Property Name="BackgroundEnabled" Value="False" />
<Property Name="Font" Value="Commonwealth-10" />
<Property Name="FrameEnabled" Value="False" />
<Property Name="UnifiedAreaRect" Value="{{0.728750,0.000000},{0.718500,0.000000},{0.978750,0.000000},{0.968500,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
<Window Type="TaharezLook/StaticText" Name="StaticTextPage2" >
<Property Name="BackgroundImage" Value="set:TaharezLook image:StaticBackdrop" />
<Property Name="BottomFrameImage" Value="set:TaharezLook image:StaticBottom" />
<Property Name="BottomLeftFrameImage" Value="set:TaharezLook image:StaticBottomLeft" />
<Property Name="BottomRightFrameImage" Value="set:TaharezLook image:StaticBottomRight" />
<Property Name="Font" Value="Commonwealth-10" />
<Property Name="LeftFrameImage" Value="set:TaharezLook image:StaticLeft" />
<Property Name="RightFrameImage" Value="set:TaharezLook image:StaticRight" />
<Property Name="Text" Value="In Page 2:" />
<Property Name="TopFrameImage" Value="set:TaharezLook image:StaticTop" />
<Property Name="TopLeftFrameImage" Value="set:TaharezLook image:StaticTopLeft" />
<Property Name="TopRightFrameImage" Value="set:TaharezLook image:StaticTopRight" />
<Property Name="UnifiedAreaRect" Value="{{0.060000,0.000000},{0.226667,0.000000},{0.415000,0.000000},{0.476667,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Editbox" Name="EditBoxPage2" >
<Property Name="Font" Value="Commonwealth-10" />
<Property Name="MaxTextLength" Value="1073741823" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTextBar" />
<Property Name="UnifiedAreaRect" Value="{{0.420001,0.000000},{0.220000,0.000000},{0.990000,0.000000},{0.470000,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
</Window>
<Window Type="TaharezLook/FrameWindow" Name="winTabControl" >
<Property Name="CaptionColour" Value="00FFFFFF" />
<Property Name="EWSizingCursorImage" Value="set:TaharezLook image:MouseEsWeCursor" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTarget" />
<Property Name="NESWSizingCursorImage" Value="set:TaharezLook image:MouseNeSwCursor" />
<Property Name="NSSizingCursorImage" Value="set:TaharezLook image:MouseNoSoCursor" />
<Property Name="NWSESizingCursorImage" Value="set:TaharezLook image:MouseNwSeCursor" />
<Property Name="Text" Value="Tab Control Window" />
<Property Name="TitlebarEnabled" Value="True" />
<Property Name="TitlebarFont" Value="Commonwealth-10" />
<Property Name="UnifiedAreaRect" Value="{{0.695627,0.000000},{0.272500,0.000000},{0.993122,0.000000},{0.704167,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
<Window Type="TaharezLook/TabControl" Name="TabControl" >
<Property Name="UnifiedAreaRect" Value="{{0.088566,0.000000},{0.174378,0.000000},{0.931404,0.000000},{0.804637,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Button" Name="btnOk" >
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" />
<Property Name="Text" Value="Ok" />
<Property Name="UnifiedAreaRect" Value="{{0.128412,0.000000},{0.841464,0.000000},{0.365583,0.000000},{0.926003,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Button" Name="btnCancel" >
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" />
<Property Name="Text" Value="Cancel" />
<Property Name="UnifiedAreaRect" Value="{{0.400429,0.000000},{0.841464,0.000000},{0.637601,0.000000},{0.926003,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Button" Name="btnApply" >
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" />
<Property Name="Text" Value="Apply" />
<Property Name="UnifiedAreaRect" Value="{{0.668224,0.000000},{0.843977,0.000000},{0.905394,0.000000},{0.928516,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
</Window>
<Window Type="TaharezLook/TabPane" Name="TabPane1" >
<Property Name="BackgroundEnabled" Value="False" />
<Property Name="ClippedByParent" Value="False" />
<Property Name="FrameEnabled" Value="False" />
<Property Name="UnifiedAreaRect" Value="{{0.728750,0.000000},{0.012178,0.000000},{0.978750,0.000000},{0.262178,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
<Window Type="TaharezLook/StaticText" Name="StaticTextPage1" >
<Property Name="BackgroundImage" Value="set:TaharezLook image:StaticBackdrop" />
<Property Name="BottomFrameImage" Value="set:TaharezLook image:StaticBottom" />
<Property Name="BottomLeftFrameImage" Value="set:TaharezLook image:StaticBottomLeft" />
<Property Name="BottomRightFrameImage" Value="set:TaharezLook image:StaticBottomRight" />
<Property Name="LeftFrameImage" Value="set:TaharezLook image:StaticLeft" />
<Property Name="RightFrameImage" Value="set:TaharezLook image:StaticRight" />
<Property Name="Text" Value="In Page 1:" />
<Property Name="TopFrameImage" Value="set:TaharezLook image:StaticTop" />
<Property Name="TopLeftFrameImage" Value="set:TaharezLook image:StaticTopLeft" />
<Property Name="TopRightFrameImage" Value="set:TaharezLook image:StaticTopRight" />
<Property Name="UnifiedAreaRect" Value="{{0.060000,0.000000},{0.226667,0.000000},{0.415000,0.000000},{0.476667,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Editbox" Name="EditBoxPage1" >
<Property Name="MaxTextLength" Value="1073741823" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTextBar" />
<Property Name="UnifiedAreaRect" Value="{{0.420001,0.000000},{0.220000,0.000000},{0.990000,0.000000},{0.470000,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
</Window>
<Window Type="TaharezLook/FrameWindow" Name="winWidgets" >
<Property Name="CaptionColour" Value="00FFFFFF" />
<Property Name="EWSizingCursorImage" Value="set:TaharezLook image:MouseEsWeCursor" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTarget" />
<Property Name="NESWSizingCursorImage" Value="set:TaharezLook image:MouseNeSwCursor" />
<Property Name="NSSizingCursorImage" Value="set:TaharezLook image:MouseNoSoCursor" />
<Property Name="NWSESizingCursorImage" Value="set:TaharezLook image:MouseNwSeCursor" />
<Property Name="Text" Value="Dave, it's full of widgets!" />
<Property Name="TitlebarEnabled" Value="True" />
<Property Name="TitlebarFont" Value="Commonwealth-10" />
<Property Name="UnifiedAreaRect" Value="{{0.003750,0.000000},{0.143333,0.000000},{0.751248,0.000000},{0.806665,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
<Window Type="TaharezLook/Button" Name="btnClose" >
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" />
<Property Name="Text" Value="Close" />
<Property Name="UnifiedAreaRect" Value="{{0.732397,0.000000},{0.895137,0.000000},{0.976465,0.000000},{0.975697,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Editbox" Name="Editbox" >
<Property Name="Font" Value="Commonwealth-10" />
<Property Name="MaxTextLength" Value="1073741823" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTextBar" />
<Property Name="UnifiedAreaRect" Value="{{0.624420,0.000000},{0.090471,0.000000},{0.969776,0.000000},{0.153443,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Checkbox" Name="Checkbox" >
<Property Name="Text" Value="Check" />
<Property Name="UnifiedAreaRect" Value="{{0.845164,0.000000},{0.396859,0.000000},{0.944201,0.000000},{0.453147,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Combobox" Name="Combobox" >
<Property Name="ActiveEditSelectionColour" Value="FF6060FF" />
<Property Name="InactiveEditSelectionColour" Value="FF808080" />
<Property Name="MaxEditTextLength" Value="1073741823" />
<Property Name="NormalEditTextColour" Value="FFFFFFFF" />
<Property Name="SelectedEditTextColour" Value="FF000000" />
<Property Name="Text" Value="Combo Box" />
<Property Name="UnifiedAreaRect" Value="{{0.183835,0.000000},{0.090471,0.000000},{0.613522,0.000000},{0.413287,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/RadioButton" Name="RadioButton_A" >
<Property Name="Font" Value="Commonwealth-10" />
<Property Name="Text" Value="A" />
<Property Name="UnifiedAreaRect" Value="{{0.652856,0.000000},{0.189876,0.000000},{0.704964,0.000000},{0.246164,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/RadioButton" Name="RadioButton_B" >
<Property Name="Font" Value="Commonwealth-10" />
<Property Name="Text" Value="B" />
<Property Name="UnifiedAreaRect" Value="{{0.707569,0.000000},{0.189876,0.000000},{0.759678,0.000000},{0.246164,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/RadioButton" Name="RadioButton_C" >
<Property Name="Font" Value="Commonwealth-10" />
<Property Name="Text" Value="C" />
<Property Name="UnifiedAreaRect" Value="{{0.761542,0.000000},{0.189876,0.000000},{0.813651,0.000000},{0.246164,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/RadioButton" Name="RadioButton_1" >
<Property Name="Font" Value="Commonwealth-10" />
<Property Name="Text" Value="1" />
<Property Name="UnifiedAreaRect" Value="{{0.845164,0.000000},{0.189876,0.000000},{0.897272,0.000000},{0.246164,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/RadioButton" Name="RadioButton_2" >
<Property Name="Font" Value="Commonwealth-10" />
<Property Name="Text" Value="2" />
<Property Name="UnifiedAreaRect" Value="{{0.845164,0.000000},{0.245152,0.000000},{0.897272,0.000000},{0.301440,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/RadioButton" Name="RadioButton_3" >
<Property Name="Font" Value="Commonwealth-10" />
<Property Name="Text" Value="3" />
<Property Name="UnifiedAreaRect" Value="{{0.845164,0.000000},{0.300429,0.000000},{0.897272,0.000000},{0.356717,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/HorizontalScrollbar" Name="HorizontalScrollbar" >
<Property Name="UnifiedAreaRect" Value="{{0.183835,0.000000},{0.185427,0.000000},{0.613522,0.000000},{0.262060,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/VerticalScrollbar" Name="VerticalScrollbar" >
<Property Name="UnifiedAreaRect" Value="{{0.026087,0.000000},{0.090471,0.000000},{0.082106,0.000000},{0.606802,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Listbox" Name="Listbox" >
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTarget" />
<Property Name="Text" Value="List Box" />
<Property Name="UnifiedAreaRect" Value="{{0.183835,0.000000},{0.626634,0.000000},{0.427903,0.000000},{0.876634,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/MultiColumnList" Name="MultiColumnList" >
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTarget" />
<Property Name="UnifiedAreaRect" Value="{{0.183835,0.000000},{0.271357,0.000000},{0.816779,0.000000},{0.551507,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/MultiLineEditbox" Name="MultiLineEditbox" >
<Property Name="MaxTextLength" Value="1073741823" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTextBar" />
<Property Name="Text" Value="          
" />
<Property Name="UnifiedAreaRect" Value="{{0.462498,0.000000},{0.626634,0.000000},{0.706566,0.000000},{0.876634,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/ProgressBar" Name="ProgressBar" >
<Property Name="UnifiedAreaRect" Value="{{0.183835,0.000000},{0.559296,0.000000},{0.816779,0.000000},{0.608291,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Slider" Name="Slider" >
<Property Name="UnifiedAreaRect" Value="{{0.099415,0.000000},{0.090471,0.000000},{0.155434,0.000000},{0.606802,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Spinner" Name="Spinner" >
<Property Name="UnifiedAreaRect" Value="{{0.845164,0.000000},{0.489950,0.000000},{0.944201,0.000000},{0.551507,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/StaticImage" Name="StaticImage" >
<Property Name="BackgroundImage" Value="set:TaharezLook image:StaticBackdrop" />
<Property Name="BottomFrameImage" Value="set:TaharezLook image:StaticBottom" />
<Property Name="BottomLeftFrameImage" Value="set:TaharezLook image:StaticBottomLeft" />
<Property Name="BottomRightFrameImage" Value="set:TaharezLook image:StaticBottomRight" />
<Property Name="LeftFrameImage" Value="set:TaharezLook image:StaticLeft" />
<Property Name="RightFrameImage" Value="set:TaharezLook image:StaticRight" />
<Property Name="TopFrameImage" Value="set:TaharezLook image:StaticTop" />
<Property Name="TopLeftFrameImage" Value="set:TaharezLook image:StaticTopLeft" />
<Property Name="TopRightFrameImage" Value="set:TaharezLook image:StaticTopRight" />
<Property Name="UnifiedAreaRect" Value="{{0.732397,0.000000},{0.626634,0.000000},{0.976465,0.000000},{0.876634,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/StaticText" Name="StaticText" >
<Property Name="BackgroundImage" Value="set:TaharezLook image:StaticBackdrop" />
<Property Name="BottomFrameImage" Value="set:TaharezLook image:StaticBottom" />
<Property Name="BottomLeftFrameImage" Value="set:TaharezLook image:StaticBottomLeft" />
<Property Name="BottomRightFrameImage" Value="set:TaharezLook image:StaticBottomRight" />
<Property Name="LeftFrameImage" Value="set:TaharezLook image:StaticLeft" />
<Property Name="RightFrameImage" Value="set:TaharezLook image:StaticRight" />
<Property Name="Text" Value="Static Text" />
<Property Name="TopFrameImage" Value="set:TaharezLook image:StaticTop" />
<Property Name="TopLeftFrameImage" Value="set:TaharezLook image:StaticTopLeft" />
<Property Name="TopRightFrameImage" Value="set:TaharezLook image:StaticTopRight" />
<Property Name="UnifiedAreaRect" Value="{{0.462498,0.000000},{0.895137,0.000000},{0.706566,0.000000},{0.975697,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/ScrollablePane" Name="ScrollablePane" >
<Property Name="UnifiedAreaRect" Value="{{0.019063,0.000000},{0.629399,0.000000},{0.157023,0.000000},{0.879399,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
</Window>
</Window>
</GUILayout>