A new Clutter Widget Toolkit

If you’ve been following Moblin development closely, you’ll know that we have been using a library called “Nbtk” (netbook toolkit) to implement the common user interface elements. People have been quite interested in this, since it is based on Clutter. However, Nbtk was developed with very short term goals, so that we could accomplish the Moblin 2.0 UI as quickly as possible. Now that Moblin 2.0 (and indeed, 2.1) is out, we have some time before 2.2 to start thinking about a more serious toolkit.

The Moblin Toolkit

The first goal was to rename the library to something less specific to the “netbook” platform. We chose ‘mx’ as the name space, because the goal of toolkit is to support the Moblin User Experience. Mx provides a set of standard user interface elements, including buttons, progress bars, tooltips, scroll bars and others. It also implements some standard layout managers, although some of these will be available in Clutter itself when Clutter 1.2 is available. One other interesting feature is the possibility of setting style properties from a css-like file.

What’s New

Followers of Nbtk will be interested to know what’s new compared to Nbtk. The latest additions include:

  • notebook – a multi-child container that shows only one child at a time (similar to a slide show). The notebook widget itself does not implement tabs, but these can easily be added by hooking it up to the new button-group widget.
  • button group – allows buttons to be grouped so that the toggle state can be mutually exclusive across the buttons in the group (e.g. such as a group of radio buttons might behave.). Also features a property to allow no buttons to be toggled if desired.
  • toggle widget – a widget that implements a boolean state and looks similar to a light switch or slider switch. This is a Clutter version of the MxGtkLightSwitch already available. The advantages of the Clutter version are that it provides better animated feedback on user interaction.

There have also been some behind the scenes clean ups, including:

  • re-written table layout algorithm – this had much better support for correct minimum and preferred sizes, especially related to columns spanning.
  • the stylable interface is now much simpler and has less dependencies
  • the Widget base class implements hover and active states (if the actor is reactive)
  • all constructors return ClutterActor, since this is the most useful base type.

Try It

Although the new project started as a branch in the Nbtk source code repository, it now has it’s own git repository at git.moblin.org. I am also making tarball releases on the brand new download.moblin.org. I have released a first version for testing purposes and it is important to note that the project is not API stable yet.

12 Responses to “A new Clutter Widget Toolkit”

  1. buz says:

    Sounds awesome! I already wondered about the mx branch in nbtk :)
    Does this mean nbtk will be deprecated at some point?

  2. Xav says:

    Excellent !

    Are there Vala bindings yet ?

  3. Rahul Sundaram says:

    I am curious. Will GTK 3 and Clutter and MX development all continue in parallel and will the latter supercede the former at some point? When we get OpenGL support working with free and open source drivers everywhere, would there be a need for for both?

  4. john says:

    Hello Thomas.

    Please elaborate on any copyright assignment policy regarding Nbtk.

  5. thos says:

    buz: nbtk will be deprecated in Moblin 2.2. It is already in maintenance only mode.

    Xav: no, although gobject introspection is available.

    Rahul: I don’t expect this new toolkit to supersede GTK+ any time soon.

    john: the copyright waiver for patches applies to both mx and nbtk (http://bugzilla.moblin.org/waiver.html)

  6. chpe says:

    Any chance to have it licensed under LGPL 2.1+ instead of 2.1-only ?

  7. Evan Nemerson says:

    I just wrote some Vala bindings, though all I’ve done with them so far is port the test-expander.c to make sure they owrk. Any interest in distributing them with Mx, or would you prefer they be distributed with vala?

  8. Roger says:

    That’s great! I’d like to try it.

  9. Victor Poluceno says:

    Hello Thomas,

    Great work!

    any plans to have python bindings?

  10. buz says:

    @victor: You can use GObject-Introspection and PyGI (http://live.gnome.org/PyGI) to use the mx library from Python.
    I also made some native python bindings for nbtk some month ago (http://netbuz.org/git/pynbtk) which I might port to mx as soon there’s something like a stable API for mx

  11. Victor Poluceno says:

    @buz: I will try mx + PyGI.

    I have some experience with pyton binding. So, I would like help on port pynbtk to mx, like you said when mx have a stable API.

  12. daniel V says:

    Hi Thomas, nice work! I’ll cross my fingers for the python binding to come along!

    A question, even if Mx is on an early stage: I’m preparing material for teaching about Clutter next year and wonder which is Mx roadmap….
    Thanks in advance.