//
//
// Irrlicht Wrapper for Imperative Languages
// Frank Dodd (2006)
//
// Additional Work
// Michael Taupitz (2006)
//
// This wrapper DLL encapsulates a sub-set of the features of the powerful
// Irrlicht 3D Graphics Engine exposing the Object Oriented architecture and
// providing a functional 3D SDK for languages that are not object oriented.
//
// This source was created with the help of the great examples in the Irrlicht
// SDK and the excellent Irrlicht documentation. This software was developed
// using the GCC compiler and Code::Blocks IDE
//

/* ////////////////////////////////////////////////////////////////////////////
includes
*/
#include "irrlichtwrapper.h"
#include "CGUIImageSkin.h"

/* ////////////////////////////////////////////////////////////////////////////
global variables
*/

/* ////////////////////////////////////////////////////////////////////////////
external variables
*/
extern IrrlichtDevice *device;
extern IVideoDriver* driver;
extern ISceneManager* smgr;
extern IGUIEnvironment* guienv;


/* ////////////////////////////////////////////////////////////////////////////
Global Function Declarations

all of the below functions are declared as C functions and are exposed without
any mangled names so that they can be easily imported into imperative
languages like FreeBasic
*/
extern "C"
{

/* ////////////////////////////////////////////////////////////////////////////
GUI FUNCTIONS
*/
/****f* GUI/IrrGuiAddStaticText
* NAME
*    IrrGuiAddStaticText - Adds a static text.
* SYNOPSIS
*    *element.l = IrrGuiAddStaticText(Text.s, topX.l, topY.l, bottomX.l, bottomY.l, [bBorder, [bWordWrap.l, [bFillBackground.l, [*parent.l, [id.l]]]])
* INPUTS
*   Text.s               - Text to display
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   bBorder.l           - Has to be set to #True if the static text should have a 3d border.  (default=#False)
*   bWordWrap.l         - specifies, if the text should be wrapped into multiple lines. (default = #True)
*   bFillBackground.l   - specifies if the background will be filled. (default=#False)
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the static text directly in the environment.
*   id.l                - identify the static text element.  (default=-1)
* FUNCTION
*   add a static text object to the GUI
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddStaticText(Text.p-unicode, topX.l, topY.l, bottomX.l, bottomY.l, bBorder=#False, bWordWrap.l = #True, bFillBackground.l=#False, *parent.l=#Null, id.l=-1)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddStaticText(
                                const wchar_t * wcptrText,
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                bool boBorder, bool boWordWrap, bool fillBackground,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addStaticText(
            wcptrText,
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            boBorder, boWordWrap ,parent,id,fillBackground );
}


/****f* GUI/IrrGuiAddButton
* NAME
*    IrrGuiAddButton - Adds a button.
* SYNOPSIS
*    *element.l = IrrGuiAddButton(Text.s, topX.l, topY.l, bottomX.l, bottomY.l,  [*parent.l, [id.l]])
* INPUTS
*   Text.s               - Text on Button
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the button directly in the environment.
*   id.l                - identify the button element.  (default=-1)
* FUNCTION
*   add a button object to the GUI
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddButton(Text.p-unicode, topX.l, topY.l, bottomX.l, bottomY.l, *parent.l=#Null, id.l=-1)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddButton(
                                const wchar_t * wcptrText,
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addButton(
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            parent, id,
            wcptrText );
}


/* ----------------------------------------------------------------------------
add a checkbox object to the GUI
*/
/****f* GUI/IrrGuiAddCheckBox
* NAME
*    IrrGuiAddCheckBox - Adds a checkbox.
* SYNOPSIS
*    *element.l = IrrGuiAddCheckBox(bChecked.l, topX.l, topY.l, bottomX.l, bottomY.l, Text.s, [*parent.l, [id.l]])
* INPUTS
*   bChecked.l           - #True if the Box should be ckecked, otherwise #False
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   Text.s               - Text for the Checkbox
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the checkbox directly in the environment.
*   id.l                - identify the checkbox element.  (default=-1)
* FUNCTION
*   add a checkbox object to the GUI
* RESULT
*    Returns pointer to the Element when Success
* HISTORY
*   Changed position of the Text in IrrlichtWrapper 1.05 (M.Taupitz)
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddCheckBox(bChecked.l, topX.l, topY.l, bottomX.l, bottomY.l,Text.p-unicode, *parent.l=#Null, id.l=-1)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddCheckBox(
                                bool checked,
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                const wchar_t * wcptrText,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addCheckBox(
            checked,
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            parent, id ,wcptrText);
}

/****f* GUI/IrrGuiAddComboBox
* NAME
*    IrrGuiAddComboBox - Adds a ComboBox.
* SYNOPSIS
*    *element.l = IrrGuiAddComboBox(topX.l, topY.l, bottomX.l, bottomY.l,[*parent.l, [id.l]])
* INPUTS
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the ComboBox directly in the environment.
*   id.l                - identify the ComboBox element.  (default=-1)
* FUNCTION
*   add a ComboBox object to the GUI
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddComboBox(topX.l, topY.l, bottomX.l, bottomY.l, *parent.l=#Null, id.l=-1)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddComboBox(
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addComboBox(
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            parent, id );
}

/****f* GUI/IrrGuiAddContextMenu
* NAME
*    IrrGuiAddContextMenu - Adds a ContextMenu
* SYNOPSIS
*    *element.l = IrrGuiAddContextMenu(topX.l, topY.l, bottomX.l, bottomY.l,[*parent.l, [id.l]])
* INPUTS
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the ContextMenu directly in the environment.
*   id.l                - identify the ContextMenu element.  (default=-1)
* FUNCTION
*   add a ContextMenu object to the GUI
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddContextMenu(topX.l, topY.l, bottomX.l, bottomY.l, *parent.l=#Null, id.l=-1)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddContextMenu (
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addContextMenu (
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            parent, id );
}

/****f* GUI/IrrGuiAddEditBox
* NAME
*    IrrGuiAddEditBox - Adds a EditBox.
* SYNOPSIS
*    *element.l = IrrGuiAddEditBox(Text.s, topX.l, topY.l, bottomX.l, bottomY.l, [bBorder.l, [*parent.l, [id.l]]])
* INPUTS
*   Text.s               - Text in EditBox
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the EditBox directly in the environment.
*   id.l                - identify the EditBox element.  (default=-1)
* FUNCTION
*   add a button object to the GUI
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddEditBox(Text.p-unicode, topX.l, topY.l, bottomX.l, bottomY.l, bBorder=#False,*parent.l=#Null, id.l=-1)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddEditBox(
                                const wchar_t * wcptrText,
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                bool boBorder,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addEditBox(
            wcptrText,
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            boBorder,
            parent, id
            );
}


/****f* GUI/IrrGuiAddFileOpenDialog
* NAME
*    IrrGuiAddFileOpenDialog - Adds a FileOpenDialog.
* SYNOPSIS
*    *element.l = IrrGuiAddFileOpenDialog(Text.s, [bModal.l, [*parent.l, [id.l]]])
* INPUTS
*   Text.s               - Title
*   bModal.l            - Defines if the dialog is modal.  (default=#True)
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the FileOpenDialog directly in the environment.
*   id.l                - identify the FileOpenDialog element.  (default=-1)
* FUNCTION
*   add a button object to the GUI
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddFileOpenDialog(Text.p-unicode,  bModal=#True,*parent.l=#Null, id.l=-1)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddFileOpenDialog(
                                const wchar_t * wcptrTitle,
                                bool boModal,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addFileOpenDialog(
            wcptrTitle,
            boModal,
            parent, id
            );
}


/****f* GUI/IrrGuiAddImage
* NAME
*    IrrGuiAddImage - Adds a Image.
* SYNOPSIS
*    *element.l = IrrGuiAddImage(topX.l, topY.l, bottomX.l, bottomY.l,  [*parent.l, [id.l]])
* INPUTS
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the Image directly in the environment.
*   id.l                - identify the Image element.  (default=-1)
* FUNCTION
*   add a Image object to the GUI
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddImage(topX.l, topY.l, bottomX.l, bottomY.l,*parent.l=#Null, id.l=-1)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddImage(
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addImage(
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            parent, id
            );
}

/****f* GUI/IrrGuiAddImageFromTexture
* NAME
*    IrrGuiAddImageFromTexture - Adds a Image with a Texture
* SYNOPSIS
*    *element.l = IrrGuiAddImageFromTexture(*texture.l, posX.l, posY.l,[bUseAlphaChannel,   [*parent.l, [id.l]]])
* INPUTS
*   *texture.l          - pointer to a Texture
*   posX.l,posY.l       - position of the Element
*   bUseAlphaChannel.l  - Sets if the image should use the alpha channel of the texture to draw itself.
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the Image directly in the environment.
*   id.l                - identify the Image element.  (default=-1)
* FUNCTION
*   Add a Image with a Texture (previously loaded). The Size of this Element is defined by the size of the Texture.
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddImageFromTexture(*texture.l,posX.l, posY.l, bUseAlphaCHannel.l=#True,*parent.l=#Null, id.l=-1)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddImageFromTexture(
                                ITexture* tex,
                                int iPosX, int iPosY,
                                bool bUseAlphaChannel,
                                IGUIElement* parent, int id )
{
    if (!tex)
        return NULL;
	return (void *)guienv->addImage(
            tex,
            core::position2d<s32>(iPosX,iPosY),
            bUseAlphaChannel,
            parent, id
            );
}


/****f* GUI/IrrGuiAddImageFromFile
* NAME
*    IrrGuiAddImageFromFile - Adds a Image with a Texture-File.
* SYNOPSIS
*    *element.l = IrrGuiAddImageFromFile(filename.s, posX.l, posY.l,[bUseAlphaChannel,   [*parent.l, [id.l]]])
* INPUTS
*   filename.s          - file to Display in the Image-Element
*   posX.l,posY.l       - position of the Element
*   bUseAlphaChannel.l  - Sets if the image should use the alpha channel of the texture to draw itself.
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the Image directly in the environment.
*   id.l                - identify the Image element.  (default=-1)
* FUNCTION
*   add a button object to the GUI
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddImageFromFile(filename.p-ascii,posX.l, posY.l, bUseAlphaCHannel.l=#True,*parent.l=#Null, id.l=-1)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddImageFromFile(
                                const c8* filename,
                                int iPosX, int iPosY,
                                bool bUseAlphaChannel,
                                IGUIElement* parent, int id )
{
    ITexture* tex = driver->getTexture(filename);
    if (!tex)
        return NULL;

	return IrrGuiAddImageFromTexture(tex,iPosX,iPosY,bUseAlphaChannel,parent,id);
}




/* ----------------------------------------------------------------------------
add a InOutFader object to the GUI
*/
/*
void DLL_EXPORT * IrrGuiAddInOutFader(
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addInOutFader(
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            parent, id
            );
}
*/
/* ----------------------------------------------------------------------------
add a InOutFader object to the GUI
*/

/****f* GUI/IrrGuiAddInOutFader
* NAME
*    IrrGuiAddInOutFader - Element for fading out or in.
* SYNOPSIS
*    *element.l = IrrGuiAddInOutFader()
* FUNCTION
*   Element for fading out or in.[BR]
*   See the small example on how it is used. In this example we fade in from a total red screen in the beginning.
*   As you can see, the fader is not only useful for dramatic in and out fading, but also to show that the player
*   is hit in a first person shooter game for example.
* EXAMPLE
*   *fader.l = IrrGuiAddInOutFader()
*   IrrGuiFaderSetColor(*fader, 0,255,0,0)
*   IrrGuiFaderFadeIn(*fader,4000)
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddInOutFader()
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddInOutFader()
{
	return (void *)guienv->addInOutFader();
}

/****f* GUI/IrrGuiFaderFadeIn
* NAME
*    IrrGuiFaderFadeIn - Starts the fade in process.
* SYNOPSIS
*    IrrGuiFaderFadeIn(*fader, time.l)
* INPUTS
*   *fader.l  - pointer to a  FadeInOut-Element, created by IrrGuiAddInOutFader()
*   time.l    - Time specifing how long it should need to fade in, in milliseconds.
* FUNCTION
*   Starts the fade in process. In the beginning the whole rect is drawn by
*   the set color (black by default) and at the end of the overgiven time the
*   color has faded out.
* EXAMPLE
*   *fader.l = IrrGuiAddInOutFader()
*   IrrGuiFaderSetColor(*fader, 0,255,0,0)
*   IrrGuiFaderFadeIn(*fader,4000)
* RESULT
*    nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiFaderFadeIn(*fader, time.l)
*/
STATIC_EXPORT void DLL_EXPORT  IrrGuiFaderFadeIn(IGUIInOutFader* iof, u32 time)
{
	iof->fadeIn(time);
}

/****f* GUI/IrrGuiFaderFadeOut
* NAME
*    IrrGuiFaderFadeOut - Starts the fade out process.
* SYNOPSIS
*    IrrGuiFaderFadeOut(*fader, time.l)
* INPUTS
*   *fader.l  - pointer to a  FadeInOut-Element, created by IrrGuiAddInOutFader()
*   time.l    - Time specifing how long it should need to fade out, in milliseconds.
* FUNCTION
*   Starts the fade out process.
*   In the beginning everything is visible, and at the end of the time only the set
*   color (black by the fault) will be drawn.
* EXAMPLE
*   *fader.l = IrrGuiAddInOutFader()
*   IrrGuiFaderSetColor(*fader, 0,255,0,0)
*   IrrGuiFaderFadeOut(*fader,4000)
* RESULT
*    nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiFaderFadeOut(*fader, time.l)
*/
STATIC_EXPORT void DLL_EXPORT  IrrGuiFaderFadeOut(IGUIInOutFader* iof, u32 time)
{
	iof->fadeOut(time);
}

/****f* GUI/IrrGuiFaderGetColor
* NAME
*    IrrGuiFaderGetColor - Gets the color
* SYNOPSIS
*    IrrGuiFaderGetColor(*fader, *alpha.l,*r.l,*g.l,*b.l)
* INPUTS
*   *fader.l  - pointer to a  FadeInOut-Element, created by IrrGuiAddInOutFader()
*   *alpha.l,*r.l,*g.l,*b.l - Color
* FUNCTION
*   Gets the color to fade out to or to fade in from.
* EXAMPLE
*   IrrGuiFaderGetColor(*fader, @aCol, @rCol.l, @gCol.l, @bCol.l)
* RESULT
*    nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiFaderGetColor(*fader, *alpha.l,*r.l,*g.l,*b.l)
*/
STATIC_EXPORT void DLL_EXPORT  IrrGuiFaderGetColor(IGUIInOutFader* iof, s32 &alpha, s32& red, s32 &green, s32 &blue)
{
    SColor sc = iof->getColor();
    alpha = sc.getAlpha();
    red = sc.getRed();
    green = sc.getGreen();
    blue = sc.getBlue();
}

/****f* GUI/IrrGuiFaderSetColor
* NAME
*    IrrGuiFaderSetColor - Sets the color
* SYNOPSIS
*    IrrGuiFaderSetColor(*fader, alpha.l,r.l,g.l,b.l)
* INPUTS
*   *fader.l  - pointer to a  FadeInOut-Element, created by IrrGuiAddInOutFader()
*   alpha.l,r.l,g.l,b.l - Color
* FUNCTION
*   Gets the color to fade out to or to fade in from.
* EXAMPLE
*   IrrGuiFaderSetColor(*fader, 0,0,255,0)
* RESULT
*    nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiFaderSetColor(*fader, alpha.l,r.l,g.l,b.l)
*/
STATIC_EXPORT void DLL_EXPORT  IrrGuiFaderSetColor(IGUIInOutFader* iof, s32 alpha, s32 red, s32 green, s32 blue)
{
    iof->setColor(SColor(alpha,red,green,blue));
}

/****f* GUI/IrrGuiFaderIsReady
* NAME
*    IrrGuiFaderIsReady - Is process done
* SYNOPSIS
*    bool.l = IrrGuiFaderIsReady(*fader)
* INPUTS
*   *fader.l  - pointer to a  FadeInOut-Element, created by IrrGuiAddInOutFader()
* FUNCTION
*   Returns #True if the fade in or out process is done.
* EXAMPLE
*   bool.l = IrrGuiFaderIsReady(*fader)
* RESULT
*    nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiFaderIsReady(*fader)
*/

STATIC_EXPORT bool DLL_EXPORT  IrrGuiFaderIsReady(IGUIInOutFader* iof)
{
    return iof->isReady();
}


/****f* GUI/IrrGuiAddListBox
* NAME
*    IrrGuiAddListBox - add a ListBox object to the GUI
* SYNOPSIS
*   *element.l = IrrGuiAddListBox(topX.l, topY.l, bottomX.l, bottomY.l, [ *parent.l, [ id.l ] ] )
* INPUTS
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the Image directly in the environment.
*   id.l                - identify the Image element.  (default=-1)
* FUNCTION
*   add a ListBox object to the GUI
* EXAMPLE
*   *element.l = IrrGuiAddListBox(10,10,200,200)
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddListBox(topX.l, topY.l, bottomX.l, bottomY.l, *parent.l = #Null, id.l=-1 )
*/

STATIC_EXPORT void DLL_EXPORT * IrrGuiAddListBox(
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addListBox(
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            parent, id
            );
}


/****f* GUI/IrrGuiAddMenu
* NAME
*    IrrGuiAddMenu - add a Menu object to the GUI
* SYNOPSIS
*   *element.l = IrrGuiAddMenu( [ *parent.l, [ id.l ] ] )
* INPUTS
*   *parent.l           - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the Image directly in the environment.
*   id.l                - identify the Image element.  (default=-1)
* FUNCTION
*   add a Menu object to the GUI
* EXAMPLE
*   *element.l = IrrGuiAddMenu()
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddMenu( *parent.l = #Null, id.l=-1 )
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddMenu(
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addMenu(
            parent, id
            );
}


/****f* GUI/IrrGuiAddMessageBox
* NAME
*    IrrGuiAddMessageBox - add a MessageBox object to the GUI
* SYNOPSIS
*   *element.l = IrrGuiAddMessageBox(Caption.s, Text.s, [ bModal.l, [ flags.l, [ *parent.l, [ id.l ] ] ] ])
* INPUTS
*   Caption.s       - Caption
*   Text.s          - Text in the Box
*   bModal          - #True (default) makes it modal
*   flags.l         - Flags specifying the layout of the message box. For example to create a message box with an OK and a CANCEL button on it, set this to (#IRR_EMBF_OK | #IRR_EMBF_CANCEL).
*   *parent.l       - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the Image directly in the environment.
*   id.l            - identify the Image element.  (default=-1)
* FUNCTION
*   add a MessageBox object to the GUI
* EXAMPLE
*   *element.l = IrrGuiAddMessageBox("Here we go!", "Hello World !"))
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddMessageBox( Caption.p-unicode, Text.p-unicode, bModal=#True, flags.l = #IRR_EMBF_OK, *parent.l=#Null, id.l=-1 )
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddMessageBox(
                                const wchar_t * wcptrCaption,
                                const wchar_t * wcptrText,
                                bool boModal,
                                int iFlags,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addMessageBox(
            wcptrCaption,
            wcptrText,
            boModal,
            iFlags,
            parent, id
            );
}


/****f* GUI/IrrGuiAddScrollBar
* NAME
*    IrrGuiAddScrollBar - add a ScrollBar object to the GUI
* SYNOPSIS
*   *element.l = IrrGuiAddScrollBar(bHorizontal.l, topX.l, topY.l, bottomX.l, bottomY.l [ *parent.l, [ id.l ] ] )
* INPUTS
*   bHorizontal     - Horizontal = #True
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   *parent.l       - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the Image directly in the environment.
*   id.l            - identify the Image element.  (default=-1)
* FUNCTION
*   add a ScrollBar object to the GUI
* EXAMPLE
*   *element.l = IrrGuiAddScrollBar("Here we go!", "Hello World !"))
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddScrollBar( bHorizontal.l, topX.l, topY.l, bottomX.l, bottomY.l, *parent.l=#Null, id.l=-1 )
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddScrollBar(
                                bool boHorizontal,
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addScrollBar(
            boHorizontal,
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            parent, id
            );
}


/****f* GUI/IrrGuiAddTab
* NAME
*    IrrGuiAddTab - add a Tab object to the GUI
* SYNOPSIS
*   *element.l = IrrGuiAddTab( topX.l, topY.l, bottomX.l, bottomY.l [ *parent.l, [ id.l ] ] )
* INPUTS
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   *parent.l       - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the Image directly in the environment.
*   id.l            - identify the Image element.  (default=-1)
* FUNCTION
*   add a Tab object to the GUI
* EXAMPLE
*   *element.l = IrrGuiAddTab(10,10,200,200)
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddTab( topX.l, topY.l, bottomX.l, bottomY.l, *parent.l=#Null, id.l=-1 )
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddTab(
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                IGUIElement* parent, int id )
{
	return (void *)guienv->addTab(
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            parent, id
            );
}

/****f* GUI/IrrGuiAddTabControl
* NAME
*    IrrGuiAddTab - add a TabControl object to the GUI
* SYNOPSIS
*   *element.l = IrrGuiAddTabControl( topX.l, topY.l, bottomX.l, bottomY.l , [ bFillBackground.l, [bBorder.l, [ *parent.l, [ id.l ] ] )
* INPUTS
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   bFillBackground.l   - should the Background filled (#True/#False)
*   bBorder.l           - show the border  (#True/#False)
*   *parent.l       - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the Image directly in the environment.
*   id.l            - identify the Image element.  (default=-1)
* FUNCTION
*   add a TabControl object to the GUI
* EXAMPLE
*   *element.l = IrrGuiAddTabControl(10,10,200,200)
* RESULT
*    Returns pointer to the Element when Success
* HISTORY
*   Changed position of the parameter in Version 1.05
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddTabControl( topX.l, topY.l, bottomX.l, bottomY.l, bFillBackground.l=#True, bBorder.l=#True, *parent.l=#Null, id.l=-1 )
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddTabControl(
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                bool boFillBackground,
                                bool boBorder,
                                IGUIElement* parent,
                                int id )
{
	return (void *)guienv->addTabControl(
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            parent,
            boFillBackground,
            boBorder,
            id
            );
}

/****f* GUI/IrrGuiAddToolBar
* NAME
*    IrrGuiAddToolBar - add a ToolBar object to the GUI
* SYNOPSIS
*   *element.l = IrrGuiAddToolBar( [ *parent.l, [ id.l ] ] )
* INPUTS
*   *parent.l       - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the Image directly in the environment.
*   id.l            - identify the Image element.  (default=-1)
* FUNCTION
*   add a ToolBar object to the GUI
* EXAMPLE
*   *element.l = IrrGuiAddToolBar()
* RESULT
*    Returns pointer to the Element when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddToolBar( *parent.l=#Null, id.l=-1 )
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddToolBar(
                                IGUIElement* parent,
                                int id )
{
	return (void *)guienv->addToolBar(
            parent,
            id
            );
}

/****f* GUI/IrrGuiAddWindow
* NAME
*    IrrGuiAddTab - add a Window object to the GUI
* SYNOPSIS
*   *element.l = IrrGuiAddWindow( topX.l, topY.l, bottomX.l, bottomY.l , Text.s, [ bModal.l, [ *parent.l, [ id.l ] ] ])
* INPUTS
*   topX.l,topY.l        - upper left corner
*   bottomX.l,bottomY.l - lower right corner
*   Text.s              - Title of the Window
*   bModal.l           - is window modal  (#True/#False)
*   *parent.l       - is the parent item of the element. E.g. a window. Set it to #Null (default) to place the Image directly in the environment.
*   id.l            - identify the Image element.  (default=-1)
* FUNCTION
*   add a Window object to the GUI
* EXAMPLE
*   *element.l = IrrGuiAddWindow(10,10,200,200)
* RESULT
*    Returns pointer to the Element when Success
* HISTORY
*   Changed position of the parameter in Version 1.05
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddWindow( topX.l, topY.l, bottomX.l, bottomY.l, Text.p-unicode, bModal.l=#False, *parent.l=#Null, id.l=-1 )
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiAddWindow(
                                int iTopX, int iTopY, int iBotX, int iBotY,
                                const wchar_t * wcptrText,
                                bool boModal,
                                IGUIElement* parent,
                                int id )
{
	return (void *)guienv->addWindow(
            rect<int>(iTopX, iTopY, iBotX, iBotY),
            boModal,
            wcptrText,
            parent,
            id
            );
}

/****f* GUI/IrrGuiCreateSkin
* NAME
*    IrrGuiCreateSkin - Creates a new GUI Skin based on a template
* SYNOPSIS
*   *ptr2IrrlichtSkin.l = IrrGuiCreateSkin( SkinTemplateType.l)
* INPUTS
*   SkinTemplateType.l    - one of the follwoing :
*                           [TAB]
*                           #IRR_EGST_WINDOWS_CLASSIC  - Default windows look and feel.
*                           #IRR_EGST_WINDOWS_METALLIC - Like EGST_WINDOWS_CLASSIC, but with metallic shaded windows and buttons.
*                           #IRR_EGST_BURNING_SKIN
*                           [/TAB]
* FUNCTION
*   Creates a new GUI Skin based on a template
* EXAMPLE
*   *ptr2IrrlichtSkin.l = IrrGuiCreateSkin(EGST_BURNING_SKIN)
* RESULT
*    Returns pointer to the Skin when Success
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiCreateSkin( SkinTemplateType.l)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiCreateSkin(
                                    EGUI_SKIN_TYPE iSkinType
                                  )
{
	return (void *)guienv->createSkin(
            iSkinType);
}

/****f* GUI/IrrGuiGetSkin
* NAME
*    IrrGuiGetSkin - Returns pointer to the current gui skin.
* SYNOPSIS
*   *ptr2IrrlichtSkin.l = IrrGuiGetSkin( )
* FUNCTION
*   Returns pointer to the current gui skin.
* EXAMPLE
*   *ptr2IrrlichtSkin.l = IrrGuiGetSkin()
* RESULT
*    Returns pointer to the current gui skin.
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiGetSkin()
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiGetSkin()
{
	return (void *)guienv->getSkin();
}


/****f* GUI/IrrGuiSetSkin
* NAME
*    IrrGuiSetSkin - set the current gui skin.
* SYNOPSIS
*   IrrGuiSetSkin( *ptr2IrrlichtSkin.l )
* INPUTS
*   *ptr2IrrlichtSkin.l - pointer to a irrlicht-gui-skin (created via IrrGuiCreateSkin() or IrrGuiGetSkin() )
* FUNCTION
*   set the current gui skin.
* EXAMPLE
*   ;Create first the Skin
*   *ptr2IrrlichtSkin.l = IrrGuiCreateSkin(EGST_BURNING_SKIN)
*   ;then set it as current.
*   IrrGuiSetSkin(*ptr2IrrlichtSkin)
* RESULT
*    nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiSetSkin(*ptr2IrrlichtSkin.l)
*/
STATIC_EXPORT void DLL_EXPORT  IrrGuiSetSkin(IGUISkin *  skin    )
{
	guienv->setSkin(skin);
}

/****f* GUI/IrrGuiGetRootGUIElement
* NAME
*    IrrGuiGetRootGUIElement - returns the gui rootelement
* SYNOPSIS
*   IrrGuiGetRootGUIElement( )
* FUNCTION
*   returns the gui rootelement
* EXAMPLE
*   none at the moment
* RESULT
*    pointer to the GUI-Root-Element
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiGetRootGUIElement()
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiGetRootGUIElement()
{
	return (void *)guienv->getRootGUIElement();
}


//-----------------------------------------------------------------------------
// Standard-Methods for the GUIElements
//-----------------------------------------------------------------------------
/****f* GUI/IrrGuiSetText
* NAME
*    IrrGuiSetText - Set text for a GUI-Element
* SYNOPSIS
*   IrrGuiSetText(*ptr2IrrGuiElement.l, text.s)
* INPUTS
*   *ptr2IrrGuiElement.l - pointer to a Irrlicht-GUI-Element
*   text.s  - new text for that Element
* FUNCTION
*   Set text for a GUI-Element
* EXAMPLE
*   none at the moment
* RESULT
*   nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiSetText(*ptr2IrrGuiElement.l, text.p-unicode)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiSetText(IGUIElement* element,const wchar_t * wcptrText)
{
    if (element)
        element->setText(wcptrText);
}

/****f* GUI/IrrGuiGetText
* NAME
*    IrrGuiGetText - get text of an element
* SYNOPSIS
*   IrrGuiGetText(*ptr2IrrGuiElement.l)
* INPUTS
*   *ptr2IrrGuiElement.l - pointer to a Irrlicht-GUI-Element
* FUNCTION
*   get text of an element
* EXAMPLE
*   none at the moment
* RESULT
*   pointer to a text in unicode !
* PBINLINE
*   Macro IrrGuiGetText(__ELEMENT__)
*       PeekS(IrrGuiGetText_byMacro(__ELEMENT__),-1,#PB_Unicode)
*   EndMacro
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiGetText_byMacro(*ptr2IrrGuiElement.l)
*/
STATIC_EXPORT const wchar_t  DLL_EXPORT * IrrGuiGetText_byMacro(IGUIElement* element)
{
//    if (element)
        return (const wchar_t *)element->getText();
//	return 0;
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiSetId(*ptr2IrrGuiElement.l, id.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiSetId(IGUIElement* element,int id)
{
    if (element)
        element->setID(id);
}


/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiGetId(*ptr2IrrGuiElement.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiGetId(IGUIElement* element)
{
//    if (element)
	return element->getID();
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiAddChild(*ptr2IrrGuiElementParent.l, *ptr2IrrGuiElementChild.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiAddChild(IGUIElement* parent, IGUIElement* child)
{
    if (parent && child)
        parent->addChild(child);
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiBringToFront(*ptr2IrrGuiElementParent.l, *ptr2IrrGuiElement.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiBringToFront(IGUIElement* parent,IGUIElement* element)
{
    if (parent)
        parent->bringToFront(element);
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiGetElementFromId(*ptr2IrrGuiElementt.l, idToSearch.l, boolSerachChildren.l=#True)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiGetElementFromId(IGUIElement* element,int id,bool searchchildren)
{
    if (element==0)
        element = guienv->getRootGUIElement() ;
    return (void *)element->getElementFromId(id,searchchildren);
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiGetElementFromPoint(*ptr2IrrGuiElementt.l, x.l, y.l)
*/
STATIC_EXPORT void DLL_EXPORT * IrrGuiGetElementFromPoint(IGUIElement* element,int x, int y)
{
    return (void *)element->getElementFromPoint(position2d<s32>(x,y));
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiGetType(*ptr2IrrGuiElementt.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiGetType(IGUIElement* element)
{
    return element->getType();
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiSetEnabled(*ptr2IrrGuiElementt.l, boolEnable.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiSetEnabled(IGUIElement* element, bool boEnable)
{
    element->setEnabled(boEnable);
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiIsEnabled(*ptr2IrrGuiElementt.l)
*/
STATIC_EXPORT bool DLL_EXPORT IrrGuiIsEnabled(IGUIElement* element)
{
    return element->isEnabled();
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiSetVisible(*ptr2IrrGuiElement.l, boolVisible.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiSetVisible(IGUIElement* element, bool boVisible)
{
    element->setVisible(boVisible);
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiIsVisible(*ptr2IrrGuiElement.l)
*/
STATIC_EXPORT bool DLL_EXPORT IrrGuiIsVisible(IGUIElement* element)
{
    return element->isVisible();
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGetBuitInFont()
*/
STATIC_EXPORT void DLL_EXPORT * IrrGetBuitInFont()
{
    return (void *)guienv->getBuiltInFont();
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiHasFocus(*ptr2IrrGuiElement.l)
*/
STATIC_EXPORT bool DLL_EXPORT IrrGuiHasFocus(IGUIElement* element)
{
    return guienv->hasFocus(element);
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiSetFocus(*ptr2IrrGuiElement.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiSetFocus(IGUIElement* element)
{
    guienv->setFocus(element);
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiRemoveFocus(*ptr2IrrGuiElement.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiRemoveFocus(IGUIElement* element)
{
    guienv->removeFocus(element);
}

/* *************************************************
    Here come functions for Buttons
*/
/****f* GUI/IrrGuiButtonGetUseAlphaChannels
* NAME
*    IrrGuiButtonGetUseAlphaChannels - Returns if the alpha channel
* SYNOPSIS
*   IrrGuiButtonGetUseAlphaChannels(*ptr2IrrGuiButton.l)
* INPUTS
*   *ptr2IrrGuiButton.l - pointer to a Irrlicht-Gui Button
* FUNCTION
*   Returns if the alpha channel should be used for drawing images on the button.
* EXAMPLE
*   none at the moment
* RESULT
*  returns #True is alphaChannel
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiButtonGetUseAlphaChannels(*ptr2IrrGuiButton.l)
*/
STATIC_EXPORT bool DLL_EXPORT IrrGuiButtonGetUseAlphaChannels(IGUIButton* button)
{
    return button->isAlphaChannelUsed();
}

/****f* GUI/IrrGuiButtonIsPressed
* NAME
*    IrrGuiButtonIsPressed - Returns if the button is currently pressed.
* SYNOPSIS
*   IrrGuiButtonIsPressed(*ptr2IrrGuiButton.l)
* INPUTS
*   *ptr2IrrGuiButton.l - pointer to a Irrlicht-Gui Button
* FUNCTION
*   Returns if the button is currently pressed.
* EXAMPLE
*   none at the moment
* RESULT
*  'true if Button is pressed
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiButtonIsPressed(*ptr2IrrGuiButton.l)
*/
STATIC_EXPORT bool DLL_EXPORT IrrGuiButtonIsPressed(IGUIButton* button)
{
    return button->isPressed();
}

/****f* GUI/IrrGuiButtonSetImage2
* NAME
*    IrrGuiButtonSetImage2 - Sets an image
* SYNOPSIS
*   IrrGuiButtonSetImage2(*ptr2IrrGuiButton.l, *ptr2IrrlichtTexture.l, topX.l, topY.l, bottomX.l, bottomY.l)
* INPUTS
*   *ptr2IrrGuiButton.l    - pointer to a Irrlicht-Gui Button
*   *ptr2IrrlichtTexture.l - pointer to a Irrlicht-Texture
*   topX.l, topY.l         - Uper-left corner of texturepart used
*   bottomX.l, bottomY.l   - lower-right corner of texturepart used
* FUNCTION
*   Sets an image which should be displayed on the button when it is in normal state.
* EXAMPLE
*   none at the moment
* RESULT
*   nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiButtonSetImage2(*ptr2IrrGuiButton.l, *ptr2IrrlichtTexture.l, topX.l, topY.l, bottomX.l, bottomY.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiButtonSetImage2(IGUIButton* button, ITexture* image, int iTopX, int iTopY, int iBotX, int iBotY )
{
    button->setImage( image,
                      rect<int>(iTopX, iTopY, iBotX, iBotY));
}

/****f* GUI/IrrGuiButtonSetImage
* NAME
*    IrrGuiButtonSetImage - Sets an image
* SYNOPSIS
*   IrrGuiButtonSetImage(*ptr2IrrGuiButton.l, *ptr2IrrlichtTexture.l )
* INPUTS
*   *ptr2IrrGuiButton.l    - pointer to a Irrlicht-Gui Button
*   *ptr2IrrlichtTexture.l - pointer to a Irrlicht-Texture
* FUNCTION
*   Sets an image which should be displayed on the button when it is in normal state.
*   This uses the comple Texture as Image of the Button. If you want to use only a part of the Texture,
*   you can use IrrGuiButtonSetImage2().
* EXAMPLE
*   none at the moment
* RESULT
*   nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiButtonSetImage(*ptr2IrrGuiButton.l, *ptr2IrrlichtTexture.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiButtonSetImage(IGUIButton* button, ITexture* image)
{
    button->setImage( image );
}

/****f* GUI/IrrGuiButtonSetIsPushButton
* NAME
*    IrrGuiButtonSetIsPushButton - Sets if the button should behave like a push button.
* SYNOPSIS
*   IrrGuiButtonSetIsPushButton(*ptr2IrrGuiButton.l,boolIsPushButton.l)
* INPUTS
*   *ptr2IrrGuiButton.l    - pointer to a Irrlicht-Gui Button
*   boolIsPushButton.l     -
* FUNCTION
*   Sets if the button should behave like a push button.
*   Which means it can be in two states: Normal or Pressed.
*   With a click on the button, the user can change the state of the button.
* EXAMPLE
*   none at the moment
* RESULT
*   nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiButtonSetIsPushButton(*ptr2IrrGuiButton.l, boolIsPushButton.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiButtonSetIsPushButton(IGUIButton* button, bool isPushButton)
{
    button->setIsPushButton( isPushButton );
}

/****f* GUI/IrrGuiButtonSetOverrideFont
* NAME
*    IrrGuiButtonSetOverrideFont - Sets another skin independent font
* SYNOPSIS
*   IrrGuiButtonSetOverrideFont(*ptr2IrrGuiButton.l, *ptr2IrrlichtFont.l)
* INPUTS
*   *ptr2IrrGuiButton.l    - pointer to a Irrlicht-Gui Button
*   *ptr2IrrlichtFont.l    - pointer to a Irrlicht-Font
* FUNCTION
*   Sets another skin independent font
* EXAMPLE
*   none at the moment
* RESULT
*   nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiButtonSetOverrideFont(*ptr2IrrGuiButton.l, *ptr2IrrlichtFont.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiButtonSetOverrideFont(IGUIButton* button, IGUIFont *font)
{
    button->setOverrideFont( font );
}

/****f* GUI/IrrGuiButtonSetPressed
* NAME
*   IrrGuiButtonSetPressed - Sets the pressed state
* SYNOPSIS
*   IrrGuiButtonSetPressed(*ptr2IrrGuiButton.l, boolPressed.l)
* INPUTS
*   *ptr2IrrGuiButton.l    - pointer to a Irrlicht-Gui Button
*   boolPressed.l          - #True if the Button is pressed
* FUNCTION
*   Sets the pressed state of the button if this is a pushbutton.
* EXAMPLE
*   none at the moment
* RESULT
*   none
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiButtonSetPressed(*ptr2IrrGuiButton.l, boolPressed.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiButtonSetPressed(IGUIButton* button, bool pressed)
{
    button->setPressed( pressed );
}

/****f* GUI/IrrGuiButtonSetPressedImage2
* NAME
*    IrrGuiButtonSetPressedImage2 - Sets an image
* SYNOPSIS
*   IrrGuiButtonSetPressedImage2(*ptr2IrrGuiButton.l, *ptr2IrrlichtTexture.l, topX.l, topY.l, bottomX.l, bottomY.l)
* INPUTS
*   *ptr2IrrGuiButton.l    - pointer to a Irrlicht-Gui Button
*   *ptr2IrrlichtTexture.l - pointer to a Irrlicht-Texture
*   topX.l, topY.l         - Uper-left corner of texturepart used
*   bottomX.l, bottomY.l   - lower-right corner of texturepart used
* FUNCTION
*   Sets an image which should be displayed on the button when it is in pressed state.
* EXAMPLE
*   none at the moment
* RESULT
*   nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiButtonSetPressedImage2(*ptr2IrrGuiButton.l, *ptr2IrrlichtTexture.l, topX.l, topY.l, bottomX.l, bottomY.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiButtonSetPressedImage2(IGUIButton* button, ITexture* image, int iTopX, int iTopY, int iBotX, int iBotY )
{
    button->setPressedImage( image,
                      rect<int>(iTopX, iTopY, iBotX, iBotY));
}

/****f* GUI/IrrGuiButtonSetPressedImage
* NAME
*     IrrGuiButtonSetPressedImage - Sets an image
* SYNOPSIS
*   IrrGuiButtonSetPressedImage(*ptr2IrrGuiButton.l, *ptr2IrrlichtTexture.l )
* INPUTS
*   *ptr2IrrGuiButton.l    - pointer to a Irrlicht-Gui Button
*   *ptr2IrrlichtTexture.l - pointer to a Irrlicht-Texture
* FUNCTION
*   Sets an image which should be displayed on the button when it is in pressed state.
*   This uses the comple Texture as Image of the Button. If you want to use only a part of the Texture,
*   you can use IrrGuiButtonSetPressedImage2().
* EXAMPLE
*   none at the moment
* RESULT
*   nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiButtonSetPressedImage(*ptr2IrrGuiButton.l, *ptr2IrrlichtTexture.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiButtonSetPressedImage(IGUIButton* button, ITexture* image)
{
    button->setPressedImage( image );
}

/****f* GUI/IrrGuiButtonSetUseAlphaChannel
* NAME
*    IrrGuiButtonSetUseAlphaChannel - Sets if the alpha channel should be used
* SYNOPSIS
*   IrrGuiButtonSetUseAlphaChannel(*ptr2IrrGuiButton.l, boolUseAlphaChannel.l)
* INPUTS
*   *ptr2IrrGuiButton.l    - pointer to a Irrlicht-Gui Button
*   boolUseAlphaChannel.l  -
* FUNCTION
*   Sets if the alpha channel should be used for drawing images on the button (default is false).
* EXAMPLE
*   none at the moment
* RESULT
*   nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiButtonSetUseAlphaChannel(*ptr2IrrGuiButton.l, boolUseAlphaChannel.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiButtonSetUseAlphaChannel(IGUIButton* button, bool useAlphaChannel)
{
    button->setUseAlphaChannel( useAlphaChannel );
}


/*
    Here are Methods for the CheckBox
*/
/****f* GUI/IrrGuiCheckBoxIsChecked
* name
*    IrrGuiCheckBoxIsChecked - Returns #true if box is checked.
* SYNOPSIS
*   IrrGuiCheckBoxIsChecked(*ptr2IrrlichtCheckbox.l)
* INPUTS
*   *ptr2IrrlichtCheckbox.l - pointer too a Irrlicht-Gui Checkbox
* FUNCTION
*   Returns #True if box is checked.
* EXAMPLE
*   none at the moment
* RESULT
*    #True if box is checked.
****
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiCheckBoxIsChecked(*ptr2IrrlichtCheckbox.l)
*/
STATIC_EXPORT bool DLL_EXPORT IrrGuiCheckBoxIsChecked(IGUICheckBox* checkbox)
{
    return checkbox->isChecked();
}

/****f* GUI/IrrGuiCheckBoxSetChecked
* name
*    IrrGuiCheckBoxSetChecked - Set checked state
* SYNOPSIS
*   IrrGuiCheckBoxSetChecked(*ptr2IrrlichtCheckbox.l, boolChecked.l)
* INPUTS
*   *ptr2IrrlichtCheckbox.l - pointer too a Irrlicht-Gui Checkbox
*   boolChecked.l           - state (#True or #False)
* FUNCTION
*   Set checked state
* EXAMPLE
*   none at the moment
* RESULT
*    nothing
****
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiCheckBoxSetChecked(*ptr2IrrlichtCheckbox.l, boolChecked.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiCheckBoxSetChecked(IGUICheckBox* checkbox,bool checked)
{
    checkbox->setChecked(checked);
}

/*
    Here are Methods for the ComboBox
*/

/****f* GUI/IrrGuiComboBoxAddItem
* NAME
*    IrrGuiComboBoxAddItem - adds an item and returns the index of it
* SYNOPSIS
*   IrrGuiComboBoxAddItem(*ptr2IrrGuiCombo.l, itemText.s)
* INPUTS
*   *ptr2IrrGuiCombo.l    - pointer to a Irrlicht-Gui Combobox
*   itemText.s            - text of the Item
* FUNCTION
*   adds an item and returns the index of it
* EXAMPLE
*   none at the moment
* RESULT
*   index of item
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiComboBoxAddItem(*ptr2IrrGuiCombo.l, itemText.p-unicode)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiComboBoxAddItem(IGUIComboBox* combobox,const wchar_t * wcptrText)
{
    return combobox->addItem(wcptrText);
}

/****f* GUI/IrrGuiComboBoxClear
* NAME
*    IrrGuiComboBoxClear - deletes all items in the combo box
* SYNOPSIS
*   IrrGuiComboBoxClear(*ptr2IrrGuiCombo.l)
* INPUTS
*   *ptr2IrrGuiCombo.l    - pointer to a Irrlicht-Gui Combobox
* FUNCTION
*   deletes all items in the combo box
* EXAMPLE
*   none at the moment
* RESULT
*   nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiComboBoxClear(*ptr2IrrGuiCombo.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiComboBoxClear(IGUIComboBox* combobox)
{
    combobox->clear();
}

/****f* GUI/IrrGuiComboBoxGetItem
* NAME
*    IrrGuiComboBoxGetItem - returns string of an item
* SYNOPSIS
*   IrrGuiComboBoxGetItem(*ptr2IrrGuiCombo.l, index.l)
* INPUTS
*   *ptr2IrrGuiCombo.l    - pointer to a Irrlicht-Gui Combobox
*   index.l               - the index may be a value from 0 to itemCount-1
* FUNCTION
*   returns string of an item. the idx may be a value from 0 to itemCount-1
* EXAMPLE
*   none at the moment
* RESULT
*   String with Item name
* PBINLINE
*   Macro IrrGuiComboBoxGetItem(__ELEMENT__, __INDEX__)
*       PeekS(IrrGuiComboBoxGetItem_byMacro(__ELEMENT__,__INDEX__),-1,#PB_Unicode)
*   EndMacro
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiComboBoxGetItem_byMacro(*ptr2IrrGuiCombo.l, index.l)
*/

STATIC_EXPORT const wchar_t * DLL_EXPORT IrrGuiComboBoxGetItem_byMacro(IGUIComboBox* combobox,int idx)
{
    return combobox->getItem(idx);
}

/****f* GUI/IrrGuiComboBoxGetItemCount
* NAME
*    IrrGuiComboBoxGetItemCount - Returns amount of items in box.
* SYNOPSIS
*   IrrGuiComboBoxGetItemCount(*ptr2IrrGuiCombo.l)
* INPUTS
*   *ptr2IrrGuiCombo.l    - pointer to a Irrlicht-Gui Combobox
* FUNCTION
*   Returns amount of items in box.
* EXAMPLE
*   none at the moment
* RESULT
*   amount of items in box.
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiComboBoxGetItemCount(*ptr2IrrGuiCombo.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiComboBoxGetItemCount(IGUIComboBox* combobox)
{
    return combobox->getItemCount();
}

/****f* GUI/IrrGuiComboBoxGetSelected
* NAME
*    IrrGuiComboBoxGetSelected - returns id of selected item.
* SYNOPSIS
*   IrrGuiComboBoxGetSelected(*ptr2IrrGuiCombo.l)
* INPUTS
*   *ptr2IrrGuiCombo.l    - pointer to a Irrlicht-Gui Combobox
* FUNCTION
*   returns id of selected item. returns -1 if no item is selected.
* EXAMPLE
*   none at the moment
* RESULT
*   id of selected item
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiComboBoxGetSelected(*ptr2IrrGuiCombo.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiComboBoxGetSelected(IGUIComboBox* combobox)
{
    return combobox->getSelected();
}

/****f* GUI/IrrGuiComboBoxSetSelected
* NAME
*    IrrGuiComboBoxSetSelected - sets the selected item.
* SYNOPSIS
*   IrrGuiComboBoxSetSelected(*ptr2IrrGuiCombo.l, index.l)
* INPUTS
*   *ptr2IrrGuiCombo.l    - pointer to a Irrlicht-Gui Combobox
* FUNCTION
*   sets the selected item. Set this to -1 if no item should be selected
* EXAMPLE
*   none at the moment
* RESULT
*   nothing
****
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiComboBoxSetSelected(*ptr2IrrGuiCombo.l, index.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiComboBoxSetSelected(IGUIComboBox* combobox,int id)
{
    combobox->setSelected(id);
}


/*
    Here are Methods for the ContextMenu
*/

//Adds a menu item.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuAddItem(*ptr2IrrGuiContextMenu.l, text.p-unicode, id.l, boolEnable.l = #True, boolHasSubmenu.l = #False)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiContextMenuAddItem(IGUIContextMenu* contextmenu,const wchar_t * text,s32 id, bool enabled, bool hasSubmenu )
{
   return contextmenu->addItem(text,id,enabled,hasSubmenu);
}

//Adds a separator item to the menu.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuAddSeparator(*ptr2IrrGuiContextMenu.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiContextMenuAddSeparator(IGUIContextMenu* contextmenu)
{
   return contextmenu->addSeparator();
}

//Returns command id of a menu item.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuGetItemCommandId(*ptr2IrrGuiContextMenu.l,index.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiContextMenuGetItemCommandId(IGUIContextMenu* contextmenu,int idx)
{
   return contextmenu->getItemCommandId(idx);
}

//Returns amount of menu items.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuGetItemCount(*ptr2IrrGuiContextMenu.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiContextMenuGetItemCount(IGUIContextMenu* contextmenu)
{
   return contextmenu->getItemCount();
}

//Returns text of the menu item..
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuGetItemtext(*ptr2IrrGuiContextMenu.l,index.l)
*/
STATIC_EXPORT const wchar_t * DLL_EXPORT IrrGuiContextMenuGetItemtext(IGUIContextMenu* contextmenu,int idx)
{
   return contextmenu->getItemText(idx);
}

//Returns the selected item in the menu.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuGetSelectedItem(*ptr2IrrGuiContextMenu.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiContextMenuGetSelectedItem(IGUIContextMenu* contextmenu)
{
   return contextmenu->getSelectedItem();
}

//Returns the selected item in the menu.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuIsItemEnabled(*ptr2IrrGuiContextMenu.l, index.l)
*/
STATIC_EXPORT bool DLL_EXPORT IrrGuiContextMenuIsItemEnabled(IGUIContextMenu* contextmenu,int idx)
{
   return contextmenu->isItemEnabled(idx);
}

//Removes all menu items.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuRemoveAllItems(*ptr2IrrGuiContextMenu.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiContextMenuRemoveAllItems(IGUIContextMenu* contextmenu)
{
   contextmenu->removeAllItems();
}

//Removes all menu items.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuRemoveItem(*ptr2IrrGuiContextMenu.l,index.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiContextMenuRemoveItem(IGUIContextMenu* contextmenu,int idx)
{
   contextmenu->removeItem(idx);
}

//Sets the command id of a menu item.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuSetItemCommandId(*ptr2IrrGuiContextMenu.l,index.l, id.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiContextMenuSetItemCommandId(IGUIContextMenu* contextmenu,int idx,int id)
{
   contextmenu->setItemCommandId(idx,id);
}

//Sets if the menu item should be enabled.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuSetItemEnabled(*ptr2IrrGuiContextMenu.l,index.l, boolEnabled.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiContextMenuSetItemEnabled(IGUIContextMenu* contextmenu,int idx,bool enabled )
{
   contextmenu->setItemEnabled(idx,enabled);
}

//Sets text of the menu item.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuSetItemText(*ptr2IrrGuiContextMenu.l,index.l, text.p-unicode)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiContextMenuSetItemText(IGUIContextMenu* contextmenu,int idx, const wchar_t *text)
{
   contextmenu->setItemText(idx,text);
}

//Sets text of the menu item.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiContextMenuGetSubMenu(*ptr2IrrGuiContextMenu.l,index.l)
*/
STATIC_EXPORT void*  DLL_EXPORT IrrGuiContextMenuGetSubMenu(IGUIContextMenu* contextmenu,int idx)
{
   return contextmenu->getSubMenu(idx);
}

/*
    Here are the Methods for the Edit-Box
*/

//Sets if the text should use the overide color or the color in the gui skin.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiEditBoxEnableOverrideColor(*ptr2IrrGuiEditBox.l, boolEnable.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiEditBoxEnableOverrideColor(IGUIEditBox* editbox,bool enable)
{
   editbox->enableOverrideColor(enable);
}

//Returns maximum amount of characters, previously set by setMax();.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiEditBoxGetMax(*ptr2IrrGuiEditBox.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiEditBoxGetMax(IGUIEditBox* editbox)
{
   return editbox->getMax();
}

//Sets the maximum amount of characters which may be entered in the box.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiEditBoxSetMax(*ptr2IrrGuiEditBox.l, max.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiEditBoxSetMax(IGUIEditBox* editbox, int max)
{
   editbox->setMax(max);
}

//Sets another color for the text.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiEditBoxSetOverrideColor(*ptr2IrrGuiEditBox.l, red.l, green.l, blue.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiEditBoxSetOverrideColor(IGUIEditBox* editbox, int red, int green, int blue)
{
   editbox->setOverrideColor(SColor(255,red,green,blue));
}

//Sets another color for the text.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiEditBoxSetOverrideFont(*ptr2IrrGuiEditBox.l, *ptr2IrrFont)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiEditBoxSetOverrideFont(IGUIEditBox* editbox, IGUIFont *font)
{
   editbox->setOverrideFont(font);
}


/*
    Here are the Methods for the FileOpenDialog
*/

//Returns the filename of the selected file. Returns NULL, if no file was selected.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiFileOpenDialogGetFilename(*ptr2IrrGuiFileOpenDialog.l)
*/
STATIC_EXPORT const wchar_t * DLL_EXPORT IrrGuiFileOpenDialogGetFilename(IGUIFileOpenDialog* fod)
{
//    printf("%d\n",fod);
//    if (fod->getType() == EGUIET_FILE_OPEN_DIALOG) {
   return fod->getFileName();
}


/*
    Here are vthe Methods for Image
*/

//sets an image
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiImageSetImage(*ptr2IrrGuiImage.l, *ptr2IrrTexture.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiImageSetImage(IGUIImage* gi,ITexture *image )
{
   gi->setImage(image);
}

//sets if the image should use its alpha channel to draw itself
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiImageSetUseAlphaChannel(*ptr2IrrGuiImage.l, boolUse.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiImageSetUseAlphaChannel(IGUIImage* gi,bool use )
{
   gi->setUseAlphaChannel(use);
}

/*
    Here the Methods for the Listbox
*/

//adds an list item, returns id of item
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiListBoxAddItem(*ptr2IrrGuiListBox.l, text.p-unicode)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiListBoxAddItem(IGUIListBox* lb,const wchar_t *text)
{
   return lb->addItem(text);
}

//clears the list, deletes all items in the listbox
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiListBoxClear(*ptr2IrrGuiListBox.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiListBoxClear(IGUIListBox* lb)
{
   lb->clear();
}

//returns amount of list items
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiListBoxGetItemCount(*ptr2IrrGuiListBox.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiListBoxGetItemCount(IGUIListBox* lb)
{
   return lb->getItemCount();
}

//returns string of a list item. the may id be a value from 0 to itemCount-1
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiListBoxGetListItem(*ptr2IrrGuiListBox.l, index.l)
*/
STATIC_EXPORT const wchar_t * DLL_EXPORT IrrGuiListBoxGetListItem(IGUIListBox* lb, int id)
{
   return lb->getListItem(id);
}

//returns id of selected item. returns -1 if no item is selected.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiListBoxGetSelected(*ptr2IrrGuiListBox.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiListBoxGetSelected(IGUIListBox* lb)
{
   return lb->getSelected();
}


//sets the selected item. Set this to -1 if no item should be selected
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiListBoxSetSelected(*ptr2IrrGuiListBox.l, index.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiListBoxSetSelected(IGUIListBox* lb, int id)
{
   lb->setSelected(id);
}

/*
virtual void  setIconFont (IGUIFont *font)=0
  Sets the font which should be used as icon font.

*/

/*
    Here the Methods for the ScrollBar
*/

//gets the current position of the scrollbar
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiScrollBarGetPos(*ptr2IrrGuiScrollBar.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiScrollBarGetPos(IGUIScrollBar* sb)
{
   return sb->getPos();
}

//sets the current position of the scrollbar
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiScrollBarSetPos(*ptr2IrrGuiScrollBar.l, pos.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiScrollBarSetPos(IGUIScrollBar* sb,int pos)
{
   sb->setPos(pos);
}

//sets the maximum value of the scrollbar. must be > 0
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiScrollBarSetMax(*ptr2IrrGuiScrollBar.l, max.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiScrollBarSetMax(IGUIScrollBar* sb,int max)
{
   sb->setMax(max);
}


/*
 Here the Methods for StaticText
 */

//Sets if the static text should use the overide color or the color in the gui skin.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiStaticEnableOverrideColor(*ptr2IrrGuiStaticText.l, boolEnable.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiStaticEnableOverrideColor(IGUIStaticText* st,bool enable)
{
   st->enableOverrideColor(enable);
}

//Returns the height of the text in pixels when it is drawn.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiStaticGetTextHeight(*ptr2IrrGuiStaticText.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiStaticGetTextHeight(IGUIStaticText* st)
{
   return st->getTextHeight();
}

//Sets another color for the text.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiStaticSetOverrideColor(*ptr2IrrGuiStaticText.l, red.l, green.l, blue.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiStaticSetOverrideColor(IGUIStaticText* st, int red, int green, int blue)
{
    st->setOverrideColor(SColor(255,red,green,blue));
}

//Sets another skin independent font.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiStaticSetOverrideFont(*ptr2IrrGuiStaticText.l, *ptr2IrrFont.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiStaticSetOverrideFont(IGUIStaticText* st, IGUIFont *font)
{
    st->setOverrideFont(font);
}

//Enables or disables word wrap for using the static text as multiline text control.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiStaticSetWordWrap(*ptr2IrrGuiStaticText.l, boolEnable.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiStaticSetWordWrap(IGUIStaticText* st, bool enable)
{
    st->setWordWrap(enable);
}


/* ***************************************
  Here come the Methods for Tab
*/

//Returns number of tab if in tabcontrol.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiTabGetNumber(*ptr2IrrGuiTab.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiTabGetNumber(IGUITab* tab)
{
    return tab->getNumber();
}

//sets the color of the background, if it should be drawn.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiTabSetBackgroundColor(*ptr2IrrGuiTab.l, red.l, green.l, blue.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiTabSetBackgroundColor(IGUITab* tab,int red,int green,int blue)
{
     tab->setBackgroundColor(SColor(255,red,green,blue));
}

//sets if the tab should draw its background
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiTabSetDrawBackground(*ptr2IrrGuiTab.l, boolDraw.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiTabSetDrawBackground(IGUITab* tab,bool draw)
{
     tab->setDrawBackground(draw);
}


/* ***************************************
  Here come the Methods for TabControl
*/

//Adds a tab.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiTabControlAddTab(*ptr2IrrGuiTabControl.l, caption.p-unicode)
*/
STATIC_EXPORT void * DLL_EXPORT IrrGuiTabControlAddTab(IGUITabControl* tc,wchar_t *caption)
{
     return (void *)tc->addTab(caption);
}

//Returns which tab is currently active.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiTabControlGetActiveTab(*ptr2IrrGuiTabControl.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiTabControlGetActiveTab(IGUITabControl* tc)
{
    return tc->getActiveTab();
}

//Returns a tab based on zero based index.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiTabControlGetTab(*ptr2IrrGuiTabControl.l, index.l)
*/
STATIC_EXPORT void *  DLL_EXPORT IrrGuiTabControlGetTab(IGUITabControl* tc,int idx)
{
    return tc->getTab(idx);
}

//Returns amount of tabs in the tabcontrol.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiTabControlGetCount(*ptr2IrrGuiTabControl.l)
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiTabControlGetCount(IGUITabControl* tc)
{
    return tc->getTabCount();
}

//  Brings a tab to front.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiTabControlSetActiveTab(*ptr2IrrGuiTabControl.l, index.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiTabControlSetActiveTab(IGUITabControl* tc,int idx)
{
     tc->setActiveTab(idx);
}


/* ***************************************
  Here come the Methods for ToolBar
*/

//  Adds a button to the tool bar.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiToolBarAddButton(*ptr2IrrGuiToolBar.l, id.l, text.p-unicode, *ptr2IrrTexture.l,*ptr2IrrTexturePressed.l,boolIsPushButton.l, boolUseAlphaChannel.l )
*/
STATIC_EXPORT void *  DLL_EXPORT IrrGuiToolBarAddButton(IGUIToolBar* tb,s32 id, const wchar_t *text, ITexture *img, ITexture *pressedimg, bool isPushButton, bool useAlphaChannel)
{
     return tb->addButton(id,text,NULL, img,pressedimg,isPushButton,useAlphaChannel);
}


/* ***************************************
  Here come the Methods for Window
*/

//  Returns pointer to the close button.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiWindowGetCloseButton(*ptr2IrrGuiWindow.l )
*/
STATIC_EXPORT void *  DLL_EXPORT IrrGuiWindowGetCloseButton(IGUIWindow* window)
{
     return window->getCloseButton();
}

// Returns pointer to the maximize button.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiWindowGetMaximizeButton(*ptr2IrrGuiWindow.l )
*/
STATIC_EXPORT void *  DLL_EXPORT IrrGuiWindowGetMaximizeButton(IGUIWindow* window)
{
     return window->getMaximizeButton();
}

//  Returns pointer to the minimize button.
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiWindowGetMinimzeButton(*ptr2IrrGuiWindow.l )
*/
STATIC_EXPORT void *  DLL_EXPORT IrrGuiWindowGetMinimzeButton(IGUIWindow* window)
{
     return window->getMinimizeButton();
}



/*
    Here Comes Skin
*/
//  Changes the Alpha-Value of the current Skin
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiSetAlpha(alpha.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiSetAlpha(int alpha)
{
    for (s32 i=0; i<EGDC_COUNT ; ++i)
    {
        SColor col = guienv->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
        col.setAlpha(alpha);
        guienv->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
    }
}

//  Returns the Alpha-Value of the current Skin
/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiGetAlpha()
*/
STATIC_EXPORT int DLL_EXPORT IrrGuiGetAlpha()
{
   return guienv->getSkin()->getColor((EGUI_DEFAULT_COLOR)0).getAlpha();
}


/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiSetSkinFont(*ptr2IrrFont.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiSetSkinFont(IGUIFont* font)
{
   guienv->getSkin()->setFont(font);
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiSetSkinDefaultColor(color.l, alpha.l, red.l, green.l, blue.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiSetSkinDefaultColor(EGUI_DEFAULT_COLOR color, s32 alpha, s32 red, s32 green, s32 blue )
{
   guienv->getSkin()->setColor(color,SColor(alpha,red,green,blue));
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiRemoveElement(*ptr2IrrGuiElement.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiRemoveElement(IGUIElement* element)
{
   element->remove();
}


/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiSetRelativePosition(*ptr2IrrGuiElement.l, topX.l,topY.l,bottomX.l,bottomY.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiSetRelativePosition(IGUIElement* element, int iTopX, int iTopY, int iBotX, int iBotY)
{
   element->setRelativePosition(rect<s32>(iTopX,iTopY,iBotX,iBotY));
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiGetRelativePosition(*ptr2IrrGuiElement.l, *topX.l,*topY.l,*bottomX.l,*bottomY.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiGetRelativePosition(IGUIElement* element, int &iTopX, int &iTopY, int &iBotX, int &iBotY)
{
   rect<s32> elmSize = element->getRelativePosition();
   iTopX = elmSize.UpperLeftCorner.X;
   iTopY = elmSize.UpperLeftCorner.Y;
   iBotX = elmSize.LowerRightCorner.X;
   iBotY = elmSize.LowerRightCorner.Y;
}

/**
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiMoveElement(*ptr2IrrGuiElement.l, topX.l,topY.l)
*/
STATIC_EXPORT void DLL_EXPORT IrrGuiMoveElement(IGUIElement* element, int iTopX, int iTopY)
{
   rect<s32> elmSize = element->getRelativePosition();
   element->setRelativePosition(rect<s32>(iTopX,iTopY,iTopX+elmSize.getWidth(),iTopY+elmSize.getHeight()));
}



// Here starts the Image-Skin
/*
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiCreateImageSkin()
STATIC_EXPORT void* DLL_EXPORT IrrGuiCreateImageSkin() {
    return new CGUIImageSkin(driver, smgr, device->getTimer());
}
*/

/*
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiImageSkinLoad(*ptr2IrrGuiImageSkin.l, elemenzTape.l, filename.p-ascii, Ax.l, Ay.l, Aw.l, aH.l, frmWidth.l, frmHeight.l, boolUseColorKey.l)

STATIC_EXPORT bool DLL_EXPORT IrrGuiImageSkinLoad(CGUIImageSkin* skin, EGUI_ELEMENT_IMAGE_TYPE Type, c8* filename, s32 Ax,s32 Ay,s32 Aw,s32 Ah,s32 frmWidth,s32 frmHeight,bool useClrKey)
{
    return skin->Load(Type,filename, Ax,Ay,Aw,Ah, frmWidth, frmHeight, useClrKey);
}
*/

/*
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiImageSkinSetAnimSpeed(*ptr2IrrGuiImageSkin.l, elemenzTape.l, speed.l)

STATIC_EXPORT void DLL_EXPORT IrrGuiImageSkinSetAnimSpeed(CGUIImageSkin* skin, EGUI_ELEMENT_IMAGE_TYPE Type, s32 spd)
{
    skin->setAnimationSpeed(Type,spd);
}
*/

/*
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiImageSkinGetAnimSpeed(*ptr2IrrGuiImageSkin.l, elemenzTape.l)

STATIC_EXPORT s32 DLL_EXPORT IrrGuiImageSkinGetAnimSpeed(CGUIImageSkin* skin, EGUI_ELEMENT_IMAGE_TYPE Type)
{
    return skin->getAnimationSpeed(Type);
}
*/

/*
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiImageSkinSetLoop(*ptr2IrrGuiImageSkin.l, elementType.l, boolLooped.l)

STATIC_EXPORT void DLL_EXPORT IrrGuiImageSkinSetLoop(CGUIImageSkin* skin, EGUI_ELEMENT_IMAGE_TYPE Type, bool l)
{
    skin->setLoop(Type,l);
}
*/

/*
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiImageSkinGetLoop(*ptr2IrrGuiImageSkin.l, elementType.l)

STATIC_EXPORT bool DLL_EXPORT IrrGuiImageSkinGetLoop(CGUIImageSkin* skin, EGUI_ELEMENT_IMAGE_TYPE Type)
{
    return skin->getLoop(Type);
}
*/

/*
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiImageSkinPlayForward(*ptr2IrrGuiImageSkin.l, elementType.l)

STATIC_EXPORT void DLL_EXPORT IrrGuiImageSkinPlayForward(CGUIImageSkin* skin, EGUI_ELEMENT_IMAGE_TYPE Type)
{
    skin->playForward(Type);
}
*/

/*
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiImageSkinPlayBackward(*ptr2IrrGuiImageSkin.l, elementType.l)

STATIC_EXPORT void DLL_EXPORT IrrGuiImageSkinPlayBackward(CGUIImageSkin* skin, EGUI_ELEMENT_IMAGE_TYPE Type)
{
    skin->playBackward(Type);
}
*/

/*
* This is for creating the PB-Importfile, and avoiding to make everything manual
#PBIMPORT:IrrGuiImageSkinResetAnim(*ptr2IrrGuiImageSkin.l, elementType.l)

STATIC_EXPORT void DLL_EXPORT IrrGuiImageSkinResetAnim(CGUIImageSkin* skin, EGUI_ELEMENT_IMAGE_TYPE Type)
{
    skin->resetAnimation(Type);
}
*/


/* ////////////////////////////////////////////////////////////////////////////
all of the above functions are declared as C functions and are exposed without
any mangled names
*/
}
