Function Reference

Function GUINotify( s:String ) Displays a notification alert with the supplied string.


Function GUIYesNo:Int( s:String ) Displays a yes/no alert with the supplied string.

Returns: True if Yes selected, otherwise False.



Function GUIMenu( title:String, options:String[],x,y ) Displays a pop-up menu.

Returns: The index of the selected option, -1 for none.

title is the menu title, options the options to display and x and y specify its position,.



Type Reference

Type TGUIFont Defines the TBitmapFont to be used by the GUI.

Global font:TBitmapFont The font to use.



Type TWidget Abstract The base widget type.

Field enabled:Int If true the widget is displayed and can be used.


Field text:String The text displayed in the widget.


Field x:Int The X co-ordinate of the widget.


Field y:Int The Y co-ordinate of the widget.


Field w:Int The width of the widget.


Field h:Int The height of the widget.


Field callback(w:TWidget) Callback to call when clicked.


Field mouse_over:Int True if the mouse is over this widget, False otherwise.


Field owner:TGUIHandler The TGUIHandler that owns this widget.


Method HandleKey( k:Int ) Override this accept keypresses


Method MouseEnter() Override this for when the mouse enters. Call this parent version to handle mouse_over too.


Method MouseLeave() Override this for when the mouse leaves. Call this parent version to handle mouse_over too.


Method HandleClick() Override to handle a mouse button press.


Method Draw() Must be provided by a widget to draw itself.


Function DrawBox( x:Int, y:Int, w:Int, h:Int ) Helper to draw a wireframe rectangle.


Function Draw3DBox( x:Int, y:Int, w:Int, h:Int, invert:Int, size:Int=2 ) Helper to draw a 3D rectangle.



Type TLabel Extends TWidget The label widget (simply displays the supplied string)

Function Create:TLabel( gui:TGUIHandler,x:Int, y:Int, text:String ) Create a TLabel widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x and y are its position and text is the text to display in the label.




Type TText Extends TWidget The text entry widget

Function Create:TText( gui:TGUIHandler,x:Int, y:Int, text:String, maxlen:Int, callback(w:TWidget)=Null ) Create a TText widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x and y are its position and text is the initial text in the widget. maxlen is the maximum number of characters allowed. callback is called when RETURN is pressed in the text field.




Type TCheckbox Extends TWidget The checkbox widget

Field checked:Int True if the box is checked, False otherwise.


Function Create:TCheckbox( gui:TGUIHandler, x:Int, y:Int, text:String, callback(w:TWidget)=Null ) Create a TCheckox widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x and y are its position and text is the text to display by the checkbox. callback is called when the checkbox is toggled.




Type TButton Extends TWidget The button widget

Function Create:TButton( gui:TGUIHandler, x:Int, y:Int, w:Int, h:Int, text:String, callback(w:TWidget) ) Create a TButton widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x, y, w and h are its position and size, and text is the text to display in the button. callback is called when the button is pressed.




Type TButtonList Extends TWidget A drop down list type widget

Field selected:Int The selected item.


Function Create:TButtonList( gui:TGUIHandler, x:Int, y:Int, options:String[], selected:Int, callback(w:TWidget) ) Create a TButtonList widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x and y are its position. options are the options for the list and selected is the currently selected item. callback is called when the selection changes.




Type TGUIHandler Handles the GUI.

Method Register( w:TWidget ) Register a widget.

Widgets call this themselves.



Method Clear() Remove all widgets.


Method SetFocus( w:TWidget ) Sets the keyboard focus to the supplied widget. Pass null for no focus.


Method GetFocus:TWidget() Gets the keyboard focus.

Returns: The currently focused TWidget, or null for no focus.



Method Clicked:TWidget() Gets the last clicked widget.

Returns: The last clicked TWidget. Null is returned if this is called again before another widget is clicked.



Method EventLoop() Perform the event loop and pass any necessary events.

KeyHit(KEY_MOUSELEFT) and GetChar() are used to consume events for the interface.



Function Create:TGUIHandler() Create a GUI Handler.

Returns: The GUI Hanbler.




Module Information

Framework (Very) Simple GUI
Copyright Public Domain
Author Ian Cowburn
Version $Revision$