Loads and creates a complete GUI interface from an XML designer file.
Takes filename (String).
Returns collection ID, or 0 if file open failed.
BGI GUI
Parameters & Returns
Parameters
filenameString
Returns
Int
Quick Summary
Loads and creates a complete GUI interface from an XML designer file.
Takes filename (String).
Returns collection ID, or 0 if file open failed.
Technical Exegesis...
Loads and creates a complete GUI interface from an XML designer file. Opens filename with ifstream. Reads entire file into string buffer. Creates GizmoCollection with unique ID from gizmoCollectionIDCount++. Parses <Dialog> tag to extract title, width, height, name, onClose attributes. Calls bgiCreateWindow() to create main dialog window. Stores dialog in collection as GizmoEntry.
Loads and creates a complete GUI interface from an XML designer file. Opens filename with ifstream. Reads entire file into string buffer. Creates GizmoCollection with unique ID from gizmoCollectionIDCount++. Parses <Dialog> tag to extract title, width, height, name, onClose attributes. Calls bgiCreateWindow() to create main dialog window. Stores dialog in collection as GizmoEntry. Parses all <Control> tags, extracting type, name, text, imagePath, fontName, fontSize, bgColor, fgColor, parent, x, y, width, height, onClick, onChange, onSelect attributes. Resolves parent name to parent handle (defaults to dialog if not found). Converts absolute coordinates to relative coordinates by subtracting parent position. Creates appropriate gizmo based on type attribute (Button, Label, TextBox, CheckBox, RadioButton, ListBox, ComboBox, Trackbar, VScrollbar, HScrollbar, Spinner, TabControl, MultiLineTextbox, ProgressBar, TreeView, RadioGroup, GroupBox, StatusBar, Panel, ScrollPanel, ListView, Toolbar, PictureBox, RichTextBox, Link, HTMLView, Canvas, Menu, DatePicker, TimePicker). For container controls (TabControl, ListView, Toolbar, Menu), parses child elements (TabItem, Column, ToolbarItem, MenuItem). Stores each created gizmo as GizmoEntry with name, handle, and event handlers. Stores collection in gizmoCollections map. Returns collection ID, or 0 if file open failed.
This function implements a complete XML-based GUI designer system. XML format uses <Dialog> as root element with <Control> children. Control types map directly to bgiCreate* functions. Parent attribute enables nested control hierarchies (panels containing buttons, etc.). Coordinate conversion handles parent positioning automatically - designer uses absolute coords, runtime needs relative. Event attributes (onClick, onChange, onSelect, onClose) store handler function names as strings (not actual function pointers). TabControl parses <TabItem> children. ListView parses <Column> children. Toolbar parses <ToolbarItem> with imageStrip support. Menu parses recursive <MenuItem> hierarchy with separators and submenus. RichTextBox supports HTML color format (#RRGGBB) for bgColor/fgColor. ScrollPanel supports virtualWidth/virtualHeight/scrollX/scrollY attributes. Spinner supports min/max/value initialization. HTMLView supports url or htmlContent attributes. Link supports url and isEvent attributes. PictureBox auto-loads image from imagePath. GizmoCollection structure stores all controls and dialog handle together. Use bgiGetGizmoHandle to retrieve control handles by name. Use bgiProcessGizmoEvents to dispatch events to handler functions. Common pattern: load XML at startup, get handles for controls you need to manipulate, poll bgiProcessGizmoEvents in main loop.