%ignore CEGUI::WindowManager::loadWindowLayout

DigitalCyborg

04-05-2006 06:25:49

in CEGUIWindowManager.i there is an ignore directive for loadWindowLayout.

%ignore CEGUI::WindowManager::loadWindowLayout

I'd really like to use the xml layout functionality provided by loadWindowLayout.

I managed to find the declaration in CEGUIWindowManager.h ,
but I can't seem to find the code :(

/*!
\brief
Creates a set of windows (a Gui layout) from the information in the specified XML file.

\param filename
String object holding the filename of the XML file to be processed.

\param name_prefix
String object holding the prefix that is to be used when creating the windows in the layout file, this
function allows a layout to be loaded multiple times without having name clashes. Note that if you use
this facility, then all windows defined within the layout must have names assigned; you currently can not
use this feature in combination with automatically generated window names.

\param resourceGroup
Resource group identifier to be passed to the resource provider when loading the layout file.

\param callback
PropertyCallback function to be called for each Property element loaded from the layout. This is
called prior to the property value being applied to the window enabling client code manipulation of
properties.

\param userdata
Client code data pointer passed to the PropertyCallback function.

\return
Pointer to the root Window object defined in the layout.

\exception FileIOException thrown if something goes wrong while processing the file \a filename.
\exception InvalidRequestException thrown if \a filename appears to be invalid.
*/
Window* loadWindowLayout(const String& filename, const String& name_prefix = "", const String& resourceGroup = "", PropertyCallback* callback = NULL, void* userdata = NULL);



So, on blind faith, I removed the ignore directive (since I got lucky last time) and re-swigged and re compiled the cpp solution. so far so good.

When I try to compile the C# version of the solution I get this error:

Error 1 The type or namespace name 'SWIGTYPE_p_f_p_CEGUI__Window_r_String_r_String_p_void__bool' could not be found (are you missing a using directive or an assembly reference?) C:\Ogre\ogreaddons\ogredotnet\CeguiNet\WindowManager.cs 110 93 CeguiNet


Which I take to mean that the PropertyCallback isn't wrapped.

I'm really hoping that someone who knows swig can help me figure out how to fix this.



Thanks
DC

DigitalCyborg

04-05-2006 06:39:21

I found a post which indicates that PyOgre has it wrapped.. maybe someone who speaks a little Python & lot of Swig can take a look can take a look at the python wrapper.

here's the post..
http://www.ogre3d.org/phpBB2addons/view ... ndowlayout

Cheers

rastaman

04-05-2006 15:24:27


When I try to compile the C# version of the solution I get this error:

Error 1 The type or namespace name 'SWIGTYPE_p_f_p_CEGUI__Window_r_String_r_String_p_void__bool' could not be found (are you missing a using directive or an assembly reference?) C:\Ogre\ogreaddons\ogredotnet\CeguiNet\WindowManager.cs 110 93 CeguiNet


Which I take to mean that the PropertyCallback isn't wrapped.

Yes PropertyCallback has not been wrapped (I got half way but realized I'd have to rethink it, its not like the other window events). The Error is because SWIG generated a new file "SWIGTYPE... " you have to include all the files that swig generates. But there is a better way to deal with it. Put the ignore back and extend the class with a new function that does not have the PropertyCallback argument.

First here is the end of CEGUIWindowManager.i, correct yours. Note the new function "LoadWindowLayout", and the ignore for the class's real function "loadWindowLayout" is there too.


CEGUI::PopupMenu * CreatePopupMenu(const String &type, const String &name)
{
return (CEGUI::PopupMenu *)WindowManager::getSingleton().createWindow(type, name);
}

CEGUI::Window* LoadWindowLayout(const CEGUI::String& filename, const CEGUI::String& name_prefix = "",
const CEGUI::String& resourceGroup = "")
{
return self->loadWindowLayout( filename, name_prefix, resourceGroup);
}
}

%rename createWindow CreateWindow;

%ignore CEGUI::WindowManager::PropertyCallback;
%ignore CEGUI::WindowManager::loadWindowLayout;

%include "CEGUIWindowManager.h"


Second, delete the file swig generated befor (the one you forgot to include :) ), 'SWIGTYPE_p_f_p_CEGUI__Window_r_String_r_String_p_void__bool'.

Now run SWIG on CeguiBindings.i again and build the projects.

That's it. I haven't loaded a layout yet but it should work.

DigitalCyborg

05-05-2006 05:24:54

Thanks Rasta,

That seems to work: I can load a layout from an xml filel

I'm having problems with gui event handling & getting wierd exceptions, but I'm pretty sure that its in my code and not OgreDotNet...

anyway,

thanks again. everytime I toss one out there, you knock it out of the park!

Cheers.

DC