Introduction
News
Features
Example
Applications
Documentation
FAQ
Download
Thanks
Contact:
Thierry
EXCOFFIER
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.
Many (nearly all) the functions have been renamed, the script "scripts/zmw-upgrade.py" tries to rename all the changed functions.
Base widgets:
Container widgets:
Composite widgets:
Widget attributes:
Other features:
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 ; }
I programmed 2 applications with the library. A logical-circuit editor and a personal book library management system.
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).
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.
And the change log.
Ask your questions in the Wiki
Question | Answer |
---|---|
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?). |
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.