Sample code for all Widgets
Written for CEGUI 0.5
Works with versions 0.5.x (obsolete)
Written for CEGUI 0.6
Works with versions 0.6.x (obsolete)
This code goes through every widget and demonstrates how to retrieve and set their data as well as some of their particularities. Please post comments or questions on the message board thread for the Widget Galore
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
There is no StaticText within CEGUI but type of widget can be obtained via the DefaultWindow class.
The currently displayed text can be specified via setText(). The color of this text can be specified via the "TextColours" property. The value of this property contains 4 color definitions: top left, top right, bottom left, and bottom right. Each color is specified as a two-digit hexadecimal value of the format AARRGGBB (alpha, red, green, blue). The text is aligned vertically via the "VertFormatting" property with a value of TopAligned, BottomAligned, or VertCentred. The text is aligned horizontally via the "HorzFormatting" property with a value of LeftAligned, RightAligned, HorzCentred, HorzJustified, WordWrapLeftAligned, WordWrapRightAligned, WordWrapCentred, or WordWrapJustified.
StaticImage
There is no StaticImage within CEGUI but type of widget can be obtained via the DefaultWindow class.
The currently displayed image can be specified via the "Image" property. This property takes two parameters, the imageset ("set") and the image name ("image").
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(false) 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 call to ensureItemIsVisible() ensures that the item is visible; the listbox will automatically scroll down if necessary. The text of the ListboxTextItem can be changed via the setText() function. However this new text will not be displayed until you call the Listbox's handleUpdatedItemData() function.
The selected ListboxItem can be obtained via getFirstSelectedItem() and subsequent selections through getNextSelected(). A selection can be specified via setItemSelectState().
It is possible for a Listbox to contain list items that are not simply composed of text. CheckListboxItem demonstrates this advanced feature. Another approach would be to simulate the behavior of a listbox such that each row is composed of various widgets. PseudoListbox demonstrates this.
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 "DefaultWindow". This window will be placed within the TabControl (in code 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.
Menu & Popup Menu
See Menu and Popup
Files
WidgetGalore.h
#ifndef _WidgetGalore_h_ #define _WidgetGalore_h_ #include "CEGuiSample.h" #include "CEGUI.h" 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("TaharezLook.scheme"); System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow"); if(!FontManager::getSingleton().isFontPresent("Commonwealth-10")) FontManager::getSingleton().createFont("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("WidgetGalore.layout"); sheet->addChildWindow(guiLayout); /* Tooltip */ System::getSingleton().setDefaultTooltip("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 // To set the tooltip text for a window simply call setTooltipText() see staticText for an example /* StaticText */ DefaultWindow* staticText = static_cast<DefaultWindow*>(winMgr.getWindow("StaticText")); staticText->setText("Red Static Text"); // Colors are specified as aarrggbb in Hexadecimal // Where aa is alpha, rr is red, gg is green, and bb is blue // tl: top left, tr: top right, bl: bottom left, br: bottom right staticText->setProperty("TextColours", "tl:FFFF0000 tr:FFFF0000 bl:FFFF0000 br:FFFF0000"); staticText->setProperty("VertFormatting", "VertCentred"); // TopAligned, BottomAligned, VertCentred staticText->setProperty("HorzFormatting", "HorzCentred"); // LeftAligned, RightAligned, HorzCentred // HorzJustified, WordWrapLeftAligned, WordWrapRightAligned, WordWrapCentred, WordWrapJustified staticText->setTooltipText("This is a StaticText widget"); /* StaticImage */ ImagesetManager::getSingleton().createImagesetFromImageFile("ImageForStaticImage", "GPN-2000-001437.tga"); DefaultWindow* staticImage = static_cast<DefaultWindow*>(winMgr.getWindow("StaticImage")); staticImage->setProperty("Image", "set:ImageForStaticImage image:full_image"); // "full_image" is a default name from CEGUIImageset::Imageset() /* ProgressBar */ ProgressBar* progressBar = static_cast<ProgressBar*>(winMgr.getWindow("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("btnClose")); btnClose->setText("Exit"); /* ScrollablePane */ ScrollablePane* scrollablePane = static_cast<ScrollablePane*>(winMgr.getWindow("ScrollablePane")); ImagesetManager::getSingleton().createImagesetFromImageFile("ImageForScrollablePane", "GPN-2000-001437.tga"); DefaultWindow* staticImageInScrollablePane = static_cast<DefaultWindow*>(winMgr.createWindow("TaharezLook/StaticImage", "StaticImageInScrollablePane")); staticImageInScrollablePane->setProperty("Image", "set:ImageForScrollablePane image:full_image"); // "full_image" is a default name from CEGUIImageset::Imageset() staticImageInScrollablePane->setPosition(UVector2(UDim(0.0f, 0.0f), UDim(0.0f, 0.0f))); // Start in the upper left corner staticImageInScrollablePane->setWidth(UDim(2.0f, 0.0f)); // Twice the width of the parent, the ScrollablePane staticImageInScrollablePane->setHeight(UDim(2.0f, 0.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(UVector2(UDim(0.0f, 0.0f), UDim(2.1f, 0.0f))); // Start below the image editboxInScrollablePane->setWidth(UDim(2.0f, 0.0f)); editboxInScrollablePane->setHeight(UDim(0.3f, 0.0f)); scrollablePane->addChildWindow(editboxInScrollablePane); /* Check box */ Checkbox* checkbox = static_cast<Checkbox*>(winMgr.getWindow("Checkbox")); checkbox->setSelected( true ); bool valueCheckbox = checkbox->isSelected(); // Retrieve whether it is checked /* 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(); // Retrieve the value /* 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(); // Retrieve the text /* 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(); // Retrieve the value /* 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(); // Retrieve the scroll position /* 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(); // Retrieve the scroll position /* MultiLineEditbox */ MultiLineEditbox* multiLineEditbox = static_cast<MultiLineEditbox*>(winMgr.getWindow("MultiLineEditbox")); multiLineEditbox->setText("MultiLineEditbox value"); multiLineEditbox->setReadOnly(false); multiLineEditbox->setWordWrapping(true); String valueMultiLineEditbox = multiLineEditbox->getText(); // Retrieve the text /* 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")); // Get handle of one radio button from the group uint valueRadioButtonLetters = radioButton->getSelectedButtonInGroup()->getID(); // Get selected ID radioButton = static_cast<RadioButton*>(winMgr.getWindow("RadioButton_3")); // Can obtain the handle of any radio button in the group uint valueRadioButtonNumbers = radioButton->getSelectedButtonInGroup()->getID(); radioButton->setSelected(true); // Specify which button should appear selected by default /* 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); listbox->ensureItemIsVisible(itemListbox); uint valueListbox = listbox->getFirstSelectedItem()->getID(); // Retrieve the ID of the selected listbox item /* 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(); // Retrieve the displayed text uint idCombobox = combobox->getSelectedItem()->getID(); // Retrieve the ID of the selected combobox item /* MultiColumnList */ MultiColumnList* multiColumnList = static_cast<MultiColumnList*>(winMgr.getWindow("MultiColumnList"));\ multiColumnList->addColumn("Col A", 0, UDim(0.32f, 0)); multiColumnList->addColumn("Col B", 1, UDim(0.32f, 0)); multiColumnList->addColumn("Col C", 2, UDim(0.32f, 0)); 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"); // By commenting the line above a cell does not specify a selection indicator // selecting that line will show a "gap" in the selection. 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(); // Retrieve the value of the selected item from column A listboxItem = multiColumnList->getNextSelected(listboxItem); uint valueColumnB = listboxItem->getID(); // Retrieve the value of the selected item from column B listboxItem = multiColumnList->getNextSelected(listboxItem); uint valueColumnC = listboxItem->getID(); // Retrieve the value of the selected item from column C /* TabControl */ TabControl* winTabControl = static_cast<TabControl*>(winMgr.getWindow("TabControl")); winTabControl->setTabHeight(UDim(0.15f, 0.0f)); // Make the tab buttons a little bigger Window* tabPage = winMgr.getWindow("TabPane1"); tabPage->setText("Page 1"); tabPage->setSize(UVector2(UDim(1.0f, 0.0f), UDim(1.0f, 0.0f))); // Size to 100% of its parent, the TabControl tabPage->setPosition(UVector2(UDim(0.0f, 0.0f), UDim(0.0f, 0.0f))); // Move to the upper left corner of its parent winTabControl->addTab(tabPage); tabPage = winMgr.getWindow("TabPane2"); tabPage->setText("Page 2"); tabPage->setSize(UVector2(UDim(1.0f, 0.0f), UDim(1.0f, 0.0f))); tabPage->setPosition(UVector2(UDim(0.0f, 0.0f), UDim(0.0f, 0.0f))); winTabControl->addTab(tabPage); } 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) { } }; #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" >1</Property> <Property Name="InheritsAlpha" Value="False" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> <Window Type="DefaultWindow" Name="TabPane2" > <Property Name="Font" Value="Commonwealth-10" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.72875,0},{0.7185,0},{0.97875,0},{0.9685,0}}" /> <Window Type="TaharezLook/StaticText" Name="StaticTextPage2" > <Property Name="Font" Value="Commonwealth-10" /> <Property Name="Text" >In Page 2:</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.06,0},{0.226667,0},{0.415,0},{0.476667,0}}" /> </Window> <Window Type="TaharezLook/Editbox" Name="EditBoxPage2" > <Property Name="Font" Value="Commonwealth-10" /> <Property Name="MaxTextLength" Value="1073741823" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.420001,0},{0.22,0},{0.99,0},{0.47,0}}" /> </Window> </Window> <Window Type="TaharezLook/FrameWindow" Name="winTabControl" > <Property Name="Text" >Tab Control Window</Property> <Property Name="TitlebarFont" Value="Commonwealth-10" /> <Property Name="CaptionColour" Value="00FFFFFF" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="TitlebarEnabled" Value="True" /> <Property Name="UnifiedAreaRect" Value="{{0.695627,0},{0.2725,0},{0.993122,0},{0.704167,0}}" /> <Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTarget" /> <Window Type="TaharezLook/TabControl" Name="TabControl" > <Property Name="TabHeight" Value="{0,0}" /> <Property Name="TabTextPadding" Value="{0,0}" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.088566,0},{0.174378,0},{0.931404,0},{0.804637,0}}" /> </Window> <Window Type="TaharezLook/Button" Name="btnOk" > <Property Name="Text" >Ok</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.128412,0},{0.841464,0},{0.365583,0},{0.926003,0}}" /> <Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" /> </Window> <Window Type="TaharezLook/Button" Name="btnCancel" > <Property Name="Text" >Cancel</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.400429,0},{0.841464,0},{0.637601,0},{0.926003,0}}" /> <Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" /> </Window> <Window Type="TaharezLook/Button" Name="btnApply" > <Property Name="Text" >Apply</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.668224,0},{0.843977,0},{0.905394,0},{0.928516,0}}" /> <Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" /> </Window> </Window> <Window Type="DefaultWindow" Name="TabPane1" > <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="ClippedByParent" Value="False" /> <Property Name="UnifiedAreaRect" Value="{{0.72875,0},{0.012178,0},{0.97875,0},{0.262178,0}}" /> <Window Type="TaharezLook/StaticText" Name="StaticTextPage1" > <Property Name="Text" >In Page 1:</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.06,0},{0.226667,0},{0.415,0},{0.476667,0}}" /> </Window> <Window Type="TaharezLook/Editbox" Name="EditBoxPage1" > <Property Name="MaxTextLength" Value="1073741823" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.420001,0},{0.22,0},{0.99,0},{0.47,0}}" /> </Window> </Window> <Window Type="TaharezLook/FrameWindow" Name="winWidgets" > <Property Name="Text" >Dave, it's full of widgets!</Property> <Property Name="TitlebarFont" Value="Commonwealth-10" /> <Property Name="CaptionColour" Value="00FFFFFF" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="TitlebarEnabled" Value="True" /> <Property Name="UnifiedAreaRect" Value="{{0.00375,0},{0.143333,0},{0.751248,0},{0.806665,0}}" /> <Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTarget" /> <Window Type="TaharezLook/Button" Name="btnClose" > <Property Name="Text" >Close</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.732397,0},{0.895137,0},{0.976465,0},{0.975697,0}}" /> <Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" /> </Window> <Window Type="TaharezLook/Editbox" Name="Editbox" > <Property Name="Font" Value="Commonwealth-10" /> <Property Name="MaxTextLength" Value="1073741823" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.62442,0},{0.090471,0},{0.969776,0},{0.153443,0}}" /> </Window> <Window Type="TaharezLook/Checkbox" Name="Checkbox" > <Property Name="Text" >Check</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.845164,0},{0.396859,0},{0.944201,0},{0.453147,0}}" /> </Window> <Window Type="TaharezLook/Combobox" Name="Combobox" > <Property Name="Text" >Combo Box</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.183835,0},{0.090471,0},{0.613522,0},{0.413287,0}}" /> <Property Name="MaxEditTextLength" Value="1073741823" /> </Window> <Window Type="TaharezLook/RadioButton" Name="RadioButton_A" > <Property Name="Font" Value="Commonwealth-10" /> <Property Name="Text" >A</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.652856,0},{0.189876,0},{0.704964,0},{0.246164,0}}" /> </Window> <Window Type="TaharezLook/RadioButton" Name="RadioButton_B" > <Property Name="Font" Value="Commonwealth-10" /> <Property Name="Text" >B</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.707569,0},{0.189876,0},{0.759678,0},{0.246164,0}}" /> </Window> <Window Type="TaharezLook/RadioButton" Name="RadioButton_C" > <Property Name="Font" Value="Commonwealth-10" /> <Property Name="Text" >C</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.761542,0},{0.189876,0},{0.813651,0},{0.246164,0}}" /> </Window> <Window Type="TaharezLook/RadioButton" Name="RadioButton_1" > <Property Name="Font" Value="Commonwealth-10" /> <Property Name="Text" >1</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.845164,0},{0.189876,0},{0.897272,0},{0.246164,0}}" /> </Window> <Window Type="TaharezLook/RadioButton" Name="RadioButton_2" > <Property Name="Font" Value="Commonwealth-10" /> <Property Name="Text" >2</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.845164,0},{0.245152,0},{0.897272,0},{0.30144,0}}" /> </Window> <Window Type="TaharezLook/RadioButton" Name="RadioButton_3" > <Property Name="Font" Value="Commonwealth-10" /> <Property Name="Text" >3</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.845164,0},{0.300429,0},{0.897272,0},{0.356717,0}}" /> </Window> <Window Type="TaharezLook/HorizontalScrollbar" Name="HorizontalScrollbar" > <Property Name="PageSize" Value="0" /> <Property Name="StepSize" Value="1" /> <Property Name="OverlapSize" Value="0" /> <Property Name="DocumentSize" Value="1" /> <Property Name="ScrollPosition" Value="0" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.183835,0},{0.185427,0},{0.613522,0},{0.26206,0}}" /> </Window> <Window Type="TaharezLook/VerticalScrollbar" Name="VerticalScrollbar" > <Property Name="PageSize" Value="0" /> <Property Name="StepSize" Value="1" /> <Property Name="OverlapSize" Value="0" /> <Property Name="DocumentSize" Value="1" /> <Property Name="ScrollPosition" Value="0" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.026087,0},{0.090471,0},{0.082106,0},{0.606802,0}}" /> </Window> <Window Type="TaharezLook/Listbox" Name="Listbox" > <Property Name="Text" >List Box</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.183835,0},{0.626634,0},{0.427903,0},{0.876634,0}}" /> <Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTarget" /> </Window> <Window Type="TaharezLook/MultiColumnList" Name="MultiColumnList" > <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.183835,0},{0.271357,0},{0.816779,0},{0.551507,0}}" /> <Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTarget" /> </Window> <Window Type="TaharezLook/MultiLineEditbox" Name="MultiLineEditbox" > <Property Name="Text" > </Property> <Property Name="MaxTextLength" Value="1073741823" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.462498,0},{0.626634,0},{0.706566,0},{0.876634,0}}" /> </Window> <Window Type="TaharezLook/ProgressBar" Name="ProgressBar" > <Property Name="StepSize" Value="0.01" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="CurrentProgress" Value="0" /> <Property Name="UnifiedAreaRect" Value="{{0.183835,0},{0.559296,0},{0.816779,0},{0.608291,0}}" /> </Window> <Window Type="TaharezLook/Slider" Name="Slider" > <Property Name="CurrentValue" Value="0" /> <Property Name="MaximumValue" Value="1" /> <Property Name="ClickStepSize" Value="0.01" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.099415,0},{0.090471,0},{0.155434,0},{0.606802,0}}" /> </Window> <Window Type="TaharezLook/Spinner" Name="Spinner" > <Property Name="StepSize" Value="1" /> <Property Name="CurrentValue" Value="0" /> <Property Name="MaximumValue" Value="32767" /> <Property Name="MinimumValue" Value="-32768" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.845164,0},{0.48995,0},{0.944201,0},{0.551507,0}}" /> </Window> <Window Type="TaharezLook/StaticImage" Name="StaticImage" > <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.732397,0},{0.626634,0},{0.976465,0},{0.876634,0}}" /> </Window> <Window Type="TaharezLook/StaticText" Name="StaticText" > <Property Name="Text" >Static Text</Property> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="UnifiedAreaRect" Value="{{0.462498,0},{0.895137,0},{0.706566,0},{0.975697,0}}" /> </Window> <Window Type="TaharezLook/ScrollablePane" Name="ScrollablePane" > <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" /> <Property Name="HorzStepSize" Value="0.1" /> <Property Name="VertStepSize" Value="0.1" /> <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> <Property Name="HorzOverlapSize" Value="0.01" /> <Property Name="UnifiedAreaRect" Value="{{0.019063,0},{0.629399,0},{0.157023,0},{0.879399,0}}" /> <Property Name="VertOverlapSize" Value="0.01" /> <Property Name="HorzScrollPosition" Value="0" /> <Property Name="VertScrollPosition" Value="0" /> </Window> </Window> </Window> </GUILayout>