PDA

View Full Version : GUIManager ClanLib 3.0 set_theme



rassweiler
07-07-2013, 04:32 AM
Hello again.

I was wondering how to access the set theme command shown here: http://clanlib.org/docs/clanlib-3.0/reference_doxygen/classclan_1_1GUIManager.html

Originally I was starting the gui like so in a function:
clan::GUIManager gui(themeLocation);

However I'd like to declare it in my classes header then set the theme in the start function: Header -
clan::GUIManager gui; and start -
gui.add_theme(themeLocation); gui.set_theme(themeLocation);



The problem is gui has no set_theme() function for me. And simply using add_theme() throws a runtime error about the Resource Manager not having a cache (I would copypaste but I can't select the text).


Thanks for the help gents,


Kyle Rassweiler

rombust
07-07-2013, 10:02 PM
I think that's because...

The GUI Manager add_theme contains


XMLResourceManager::get_doc(impl->resources).add_resources(XMLResourceDocument("resources.xml", vfs));


That assumes that the GUI resources have already been set.

"clan::GUIManager gui;" does not set the xml resources, thus add_theme does not work.

A GUI expert needs to look at this to decide the best way of fixing it.

Maybe adding
" impl->resources = XMLResourceManager::create(XMLResourceDocument());" to the constructor would work?

I'm not an expert in the area, so I am unsure

rassweiler
07-07-2013, 10:48 PM
Thanks for the response.

I seem to have found a different way of doing it (and it works so far).

app.h:
clan::GUIManager gui;
app.cpp:
gui = clan::GUIManager(display_window, theme_location);

I saw something similar used on another component in one of the examples and gave it a shot. I'm not sure if it's proper but it works.


Thanks,


Kyle Rassweiler