Monet Update

I’ve added some quite interesting features to Monet recently. Monet is my effort at a replacement for Gtk+ theming, and also a generic widget drawing architecture using cairo that can be used by different toolkits.

The first thing is a new MnConfig object, which is responsible for loading configuration files for Monet (i.e. “themes”). These are written in XML format. It’s fairly similar to SVG, but with several extensions to make it easier to identify the various widgets and states.

For example, the following code:

<widget type="button">
 <rect x="0.5" y="0.5" width="-1" height="-1" stroke-width="1" stroke="#988c7c" corner-radius="4">
   <gradient x1="0" y1="0" x2="0" y1="50">
     <stop color="#fcfbfa" position="1"/>
     <stop color="#e7e2da" position="0"/>
   </gradient>
 </rect>
 <rect x="1.5" y="1.5" width="-3" height="-3" stroke-width="1" stroke="#fff" corner-radius="3"></rect>
</widget>

renders buttons that look like this:

Obviously the XML format is not complete yet, and there support needs to be added for expressions such as x=”width / 2″. I also want to keep the drawing aspect as close to SVG as convenience allows.

As far as API goes, there are currently two important objects:

  • MnStyle implements drawing all the widgets. It includes all the top level widget drawing, such as mn_style_paint_button. It will also have a set of more generic drawing operations to implement stylised shadows, lines, arrows, etc.
  • MnConfig will load a description of how to draw the widgets (as described above). This will allow theme designers full control over the look and feel for widgets. By using a XML based description it means that theme authors no longer have to understand C and GTK+ before they can write themes! Hylke has volunteered to look at writing a visual editor too, which will be really important for wider adoption.

There is still a way to go before Monet is production ready, but there is a GTK+2 theme engine available to test it out with. For now this provides a compatibility layer, but I hope in the future, many toolkits will be able to use Monet directly.

If you want to check out the progress, all the code is available in the monet-xml branch of the git repository at git.gnome.org/monet, but do bear in mind it still needs a lot of work before it’s ready for every day use!

One thought on “Monet Update”

  1. Seems that your aproach removes the idea of engines, rigth?

    So theme authors only have to write a XML file, is this correct?

Comments are closed.