Menu/GUI with themes

Started by
2 comments, last by Emmanuel Deloget 18 years, 10 months ago
I thought of creating a nice themesystem for my GUI. (Like the one found in winamp 2.x and other programs).. Is it complex to use XML files for this, and how should I think?
----------------------------------------------Petter Nordlander"There are only 10 kinds of people in the world. They who understand binary and those who do not"
Advertisement
(more a general programming question than a graphic theory one but..)

XML gives a pretty good description of what the gui should look like. Glade (the GTK+ GUI builder) uses it to describe very complex interfaces.

The second question, "How should I think" is a bit strange. I assume that you need to know how you would do to make it work.

1) one XML is here to describe the GUI of our program. It tells where the different controls are and what their type are. When reading this file, you can instantiate the right objects to build your window.
2) you have to apply your theme on this representation before drawing it. Here, the drawing policy might be another object which can be whatever it want.

HTH,
Okay, I already have a gui with buttons, lists and so on. What I want is to split up my controls and make the look of the editable in an xml file. Not where to put them..
----------------------------------------------Petter Nordlander"There are only 10 kinds of people in the world. They who understand binary and those who do not"
Sorry, I misunderstood you [ashamed].

So your question is: how to store theme informations in a XML file. It depends. If you are defining a theme which is based on textures, then I guess that uv coords + some other pixel-based values (such as alpha test or alpha value) should be OK:
<control typename="button">  <texturefile src="texturepath.jpg"/>  <uv>    <topleft u="..." v="..."/>    <topright u="..." v="..."/>    ...  </uv></button>

And so on.

Anyway, it will depend on your organisation and on your drawing policy. Without these informations, I beleive I can't say much. The thing I know is that if you managed to write acomplete GUI manager, you really won't have any problem to change the drawing policy to match your needs.

I hope I got it right this time ;)

This topic is closed to new replies.

Advertisement