Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages | Examples

FGX dynamic GUI builder from XML file


Detailed Description

Instead of generating code from the XML interface description, FGX loads and parses the description at runtime. It also provides functions that can be used to connect signal handlers to parts of the interface. In this way, it allows you to separate your program code from the interface code. Of course, you would also add your own signal handlers to the code. Note that the signals are connected the same way as if you had hand coded the interface. There is no extra overhead to interfaces generated by FGX (after the initial generating of course, and this is not much of an overhead) when compared to a hand crafted interface.

The file format that describes GUI is XML flavour and is called XUI. It looks like that:

    <?xml version="1.0" standalone="yes" ?>
    <xui>
        <widget id="id0" label="This is my Window!" w="400" h="600" foreground="000000" background="FFFFFF" handler="MyHandler" frame="0">
            <pushbutton id="id3" label="New Window" x="32" y="30" w="128" h="25" onclick="CreateWindow" hotkey="78" />
            <pushbutton id="id4" label="Close Window" x="32" y="70" w="128" h="25" onclick="CloseWindow" hotkey="67" />
            <pushbutton id="id5" label="Close Application" x="32" y="120" w="128" h="25" onclick="__CloseApplication" hotkey="65" selected="1" />
            <editbox id="id7" label="Text Entry :" x="120" y="220" w="128" h="25" onclick="MyTextEntry" hotkey="84" scrambled="1" />
            <editbox id="id8" label="Integer Entry :" x="120" y="250" w="128" h="25" onclick="MyIntegerEntry" hotkey="84" hexadecimal="1" />
            <editbox id="id9" label="Double Entry :" x="120" y="280" w="128" h="25" onclick="MyDoubleEntry" hotkey="84" />
            <checkbox id="id10" label="CheckBox" x="32" y="320" onclick="MyIntegerEntry" hotkey="67" />
            <slidebar id="id15" x="32" y="350" onclick="MyIntegerEntry" horizontal="1" step="10" minimum="-100" maximum="100" />
            <listbox id="id16" x="32" y="380" w="100" h="20" onclick="MyIntegerEntry" dropdown="5" />
            <radiogroup id="id12" x="200" y="20" onclick="MyIntegerEntry" span="40">
                <radiobutton label="prvy" x="200" y="20" hotkey="112" />
                <radiobutton label="druhy" x="200" y="60" hotkey="100" />
                <radiobutton label="treti" x="200" y="100" />
                <radiobutton label="stvrty" x="200" y="140" />
                <radiobutton label="piaty" x="200" y="180" />
            </radiogroup>
            <menubar>
                <menu id="id13" label="File" hotkey="70" popup="id13_1">
                    <menupopup id="id13_1" w="200" h="74">
                        <menuitem id="id13_1_1" label="Item 1" hotkey="1" />
                        <menuitem id="id13_1_2" label="Item 2" hotkey="2" />
                        <menuitem id="id13_1_3" label="Quit" onclick="__CloseApplication" hotkey="113" selected="1" />
                    </menupopup>
                </menu>
                <menu id="id14" label="Edit" onclick="__CloseApplication" hotkey="69">
                    <menupopup />
                </menu>
            </menubar>
        </widget>
        <widget id="id1" label="Yet another window" x="400" w="400" h="600" foreground="000000" background="FFFFFF" persistent="1" resize="1">
            <text label="A text label" x="32" y="32" foreground="000000" background="FFFFFF" />
        </widget>
    </xui>

There are three ways to create XUI file:

Syntax of XUI file

Todo.

Generating XUI file pragramatically

Todo.

Visual creating of XUI file

Todo.


Classes

struct  fgl::FGClosure
class  fgl::XUIComponent
class  fgl::XUIComposite
class  fgl::XUIControl
class  fgl::XUIText
class  fgl::XUIPushButton
class  fgl::XUIEditBox
class  fgl::XUICheckBox
class  fgl::XUISlideBar
class  fgl::XUIRadioButton
class  fgl::XUIListBox
class  fgl::XUIRadioGroup
class  fgl::XUIMenuItem
class  fgl::XUIPopupMenu
class  fgl::XUIMenu
class  fgl::XUIMenuBar
class  fgl::XUIWindow
class  fgl::XUIBuilder

Typedefs

typedef void(* XUIEventHandler )(CallBack cb, void *user_data)
typedef void(* XUIEnterHandlerText )(CallBack cb, const char *text, void *user_data)
typedef void(* XUIEnterHandlerInteger )(CallBack cb, const int integer, void *user_data)
typedef void(* XUIEnterHandlerDouble )(CallBack cb, const double integer, void *user_data)
typedef void(* XUIWindowHandler )(FGEvent *event, void *user_data)

Functions

void fgl::GetTempName (char *buffer, int size)
void fgl::RegisterOnClickSignal (const char *signal_name, XUIEventHandler fnc, void *user_data)
void fgl::RegisterOnEnterSignal (const char *signal_name, XUIEnterHandlerText fnc, void *user_data)
void fgl::RegisterOnEnterSignal (const char *signal_name, XUIEnterHandlerInteger fnc, void *user_data)
void fgl::RegisterOnEnterSignal (const char *signal_name, XUIEnterHandlerDouble fnc, void *user_data)
void fgl::RegisterControl (FGControl *ctrl, XUIEventHandler fnc, void *user_data)
void fgl::RegisterWindowHandler (const char *handler_name, XUIWindowHandler fnc, void *user_data)
bool fgl::ChangeSignalData (const char *signal_name, void *func, void *user_data)
bool fgl::DeregisterSignal (const char *signal_name, void *func)
bool fgl::DeregisterSignal (const char *signal_name, void *func, void *data)


Function Documentation

bool fgl::ChangeSignalData const char *  signal_name,
void *  func,
void *  user_data
 

Changes the user data pointer for already registere named signal (aka callback) + function address.

Parameters:
signal_name the ASCIIZ string
func funcion address
user_data user data pointer
Returns:
true if signal is found and data pointer changed.

bool fgl::DeregisterSignal const char *  signal_name,
void *  func,
void *  data
 

Removes the named signal (aka callback) for function address and user data pointer combination from the registered events.

Parameters:
signal_name the ASCIIZ string
func funcion address
data user data pointer
Returns:
true if signal is found and removed.
Note:
use this functon if you have got used more than one event+callback for multiple data instances.

bool fgl::DeregisterSignal const char *  signal_name,
void *  func
 

Removes the named signal (aka callback) for function address from the registered events.

Parameters:
signal_name the ASCIIZ string
func funcion address
Returns:
true if signal is found and removed.

void fgl::GetTempName char *  buffer,
int  size
 

A special utility function - generates random text strings - ASCIIZ - (with codes from 32 to 127).

Parameters:
buffer pointer to the allocated user memory
size the size of allocated memory. The string will be (size-1) in size.

void fgl::RegisterControl FGControl *  ctrl,
XUIEventHandler  fnc,
void *  user_data
 

Registers FGControl* type object with function within user data pointer.

Parameters:
ctrl object to register
fnc funcion address (XUIEnterHandlerText type callback)
user_data user data pointer
See also:
FGControl::AttachSignalName()

void fgl::RegisterOnClickSignal const char *  signal_name,
XUIEventHandler  fnc,
void *  user_data = 0
 

Registers callback for this signal_name within user data pointer.

Parameters:
signal_name the ASCIIZ string
fnc funcion address (XUIEventHandler type callback)
user_data user data pointer
Examples:
fgxtest.cpp.

void fgl::RegisterOnEnterSignal const char *  signal_name,
XUIEnterHandlerDouble  fnc,
void *  user_data = 0
 

Registers callback (double EditBox type) for this signal_name within user data pointer.

Parameters:
signal_name the ASCIIZ string
fnc funcion address (XUIEnterHandlerDouble type callback)
user_data user data pointer

void fgl::RegisterOnEnterSignal const char *  signal_name,
XUIEnterHandlerInteger  fnc,
void *  user_data = 0
 

Registers callback (integer EditBox or Slider type) for this signal_name within user data pointer.

Parameters:
signal_name the ASCIIZ string
fnc funcion address (XUIEnterHandlerInteger type callback)
user_data user data pointer

void fgl::RegisterOnEnterSignal const char *  signal_name,
XUIEnterHandlerText  fnc,
void *  user_data = 0
 

Registers callback (text EditBox type) for this signal_name within user data pointer.

Parameters:
signal_name the ASCIIZ string
fnc funcion address (XUIEnterHandlerText type callback)
user_data user data pointer
Examples:
fgxtest.cpp.

void fgl::RegisterWindowHandler const char *  handler_name,
XUIWindowHandler  fnc,
void *  user_data = 0
 

Registers FGWindow handler type object with function within user data pointer.

Parameters:
handler_name the ASCIIZ string
fnc funcion address (XUIWindowHandler type callback)
user_data user data pointer


Generated on Wed Feb 9 11:31:37 2005 for OpenGUI by  doxygen 1.4.0