ZMW logo

Introduction
News
Features
Example
Applications
Documentation
FAQ
Download
Wiki
Thanks

 
Contact:
Thierry
EXCOFFIER

 

Last modified: Sat Feb 14 16:41:17 CET 2009

Page counter

Zero Memory Widget

Widget libraries have now been developed and used for years. In all these libraries, widget instances require computer memory. But this memory is not really required, We have implemented a widget library to prove that it is possible to use zero bytes of memory per widget. In such a library, there is no widget reference, so widget programming is easier even in a low level language such as C. Programs are more robust because they do not use pointers, make no memory management and do not translate data between application and widget. To set the attributes of a widget, it is not possible to use the widget's pointer so a current state is used as in OpenGL. Most classic widgets were integrated into the library, and it is possible to integrate widgets of all kinds without any problem.

This library license is the GNU GPL. Beware: it is alpha software. It works but the API is not yet stable.

News

2009-02-14
0.2.1 release. It works with the current GDK/GTK versions.
2005-07-04
0.2.0 release. It is a big step toward beta status. Now the library can be packaged in distributions, because a library update does not imply the recompilation of the applications. Even contributed widgets can be compiled this way. The drawback is that it needs more CPU time.

Many (nearly all) the functions have been renamed, the script "scripts/zmw-upgrade.py" tries to rename all the changed functions.

2005-05-19
0.1.0 release. Now it is possible to change the focused widget with the keyboard Many code clean up and some function/data type renaming.
2005-05-04
0.0.12 release. API change to use names closers than GTK. This release is much faster because it can use a cache to store Pango text sizes.
2005-01-11
I am renaming functions in order to have ZMW functions name close to their GTK equivalent. I found out that even if ZMW have ``all´´ the GTK functionalities it will have about only a third of the function. About 60% of major GTK functionalities and widgets are yet in ZMW.
2004-09-23
0.0.11 release uses Pango to display texts. A new application example has been added: an XML GUI editor working without memory because the XML tree is not created in memory.
2004-07-28
0.0.10 release with an event dispatcher algorithm an order of magnitude cleaner.
2004-07-07
Add a Wiki to the web site
0.0.9 release
2004-07-06
Add the release evolution page in the web site
2004-07-05
Add the benchmarks page in the web site
2004-06-20
The display time is in O(n log(n)) where n is the number of widgets

Features

Base widgets:

Container widgets:

Composite widgets:

Widget attributes:

Other features:

Example

Hello World screenshot

The following example displays a window with a "Hello World!" and a quit button. An help bubble (tip) appears if the cursor stay over the button.

#include "zmw/zmw.h"

void hello_world(void)
{
  static GdkWindow *id_window = NULL, *id_tip = NULL ;
  
  ZMW(zmw_window_with_id(&id_window, "My Window"))
    {
      ZMW(zmw_box_vertical())
	{
	  zmw_text("Hello World!") ;
	  zmw_button("Quit") ;               
	  if ( zmw_activated() )
	    zmw_exit(0) ;
	  ZMW( zmw_tip() )
	    {
	      zmw_border_width(2) ;
	      ZMW(zmw_window_popup_right_with_id(&id_tip))
		{
		  ZMW(zmw_decorator(Zmw_Decorator_Border_Solid))
		    {
		      zmw_text("Click here to close the application") ;
		    }
		}
	    }
	}
    }
}

int main(int argc, char *argv[])
{
  zmw_init(&argc, &argv) ;
  zmw_run(hello_world) ;
  return 0 ;
}

The former example use really not a single bit of memory per widget. But it is a little complex because the programmer needs to store window id in the application data (a static variable in the example). The library allows to store this kind of information inside a resource database. The example rewritten to use the resource database:

#include "zmw/zmw.h"

void hello_world(void)
{
  ZMW(zmw_window("My Window"))
    {
      ZMW(zmw_box_vertical())
	{
	  zmw_text("Hello World!") ;
	  zmw_button("Quit") ;               
	  if ( zmw_activated() )
	    zmw_exit(0) ;
	  ZMW( zmw_tip() )
	    {
	      zmw_border_width(2) ;
	      ZMW(zmw_window_popup_right())
		{
		  ZMW(zmw_decorator(Zmw_Decorator_Border_Solid))
		    {
		      zmw_text("Click here to close the application") ;
		    }
		}
	    }
	}
    }
}

int main(int argc, char *argv[])
{
  zmw_init(&argc, &argv) ;
  zmw_run(hello_world) ;
  return 0 ;
}

Applications

I programmed 2 applications with the library. A logical-circuit editor and a personal book library management system.

Circuit editor screenshot Book management application screenshot

The book managing software GUI features are: I18N, preferences load/save, columns sortable, columns are draggable in order to change their order, plenty of filters and a draggable semantic len allowing you to see the GUI of the application with another language (french/english).

Documentation

You can start by read the research report on ZMW.

Or read the user documentation for the last released version with many examples and screen shots.

In order to help myself debuging the kernel of the library I created some figures explaining how it works.

Some benchmarks.

Some graphics on the evolution of the releases.

A ZMW Wiki.

And the change log.

FAQ

Ask your questions in the Wiki
QuestionAnswer
How does it works? There is some information in the research report and a detailed execution trace with figures.
You must use memory because you use GTK This library does not use GTK, only GDK. In the future, it will use OpenGL in place of GDK to draw the widgets.
The library hides a big table with all widget data. No, only a stack containing data about the widgets being traversed. The stack size is the widget tree depth. Once the tree is traversed, the stack is empty.
When the user API will be stable? I wait that an english-native-speaker widget-guru give me advice about the function names.
When the internal API will be stable? Not before some months because many things needs to be rewritten in a better way.
It is usable on my 150MHz computer? If there is no hundreds of widgets: yes. When the library architecture will be stable, it will be optimized for speed.
May I contribute? Yes with great pleasure. For the widgets there is no problems. But for the library kernel, I advice to wait a more stable version (July 2004?).

Download

Source Date Prerequises Comment
zmw-0.0.0.tgz 2003/03/12 Unix
gdk-1.2.10
gdk-pixbuf-0.17.0
Initial version for the ACM TOCHI reviewers
zmw-0.0.1.tgz 2003/10/24 Unix
gdk-1.2.10
gdk-pixbuf-0.17.0
First public release
zmw-0.0.2.tgz 2003/10/31 Unix, GTK 2
zmw-0.0.3.tgz 2003/11/12 Unix, GTK 2
zmw-0.0.4.tgz 2003/11/27 Unix, GTK 2
zmw-0.0.5.tgz 2003/12/15 Unix, GTK 2
zmw-0.0.6.tgz 2004/05/18 Unix, GTK 2 API change for tips and popup
zmw-0.0.7.tgz 2004/06/02 Unix, GTK 2 API change for drag and drop
zmw-0.0.8.tgz 2004/06/15 Unix, GTK 2
zmw-0.0.9.tgz 2004/07/07 Unix, GTK 2 Indexes are replaced by a hash key on the widget name
zmw-0.0.10.tgz 2004/07/28 Unix, GTK 2 A new event dispatcher
zmw-0.0.11.tgz 2004/09/23 Unix, GTK 2 Pango texts
zmw-0.0.12.tgz 2005/05/04 Unix, GTK 2 Accelerated with a Pango cache
zmw-0.1.0.tgz 2005/05/19 Unix, GTK 2 Focus navigation with keyboard
zmw-0.2.0.tgz 2005/07/04 Unix, GTK 2 The applications do not need to be recompiled with each new library release
zmw-0.2.1.tgz 2009/02/14 Unix, GTK 2 Works with the current GTK/GDK versions.

Thanks

I thank the University Claude Bernard and the LIRIS for allowing me to put the GNU GPL on this work.

I thank Yannick Perret for telling me it was impossible and Jean-Michel Moreau for its help writting a better english.

I would like to thanks sites referencing this page: