lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Daniel Quintela wrote:
> Because I never built a GUI for the X platform without using wxWidgets 
> or FLTK, I have a question for the experts:
> Is it possible to build a "user friendly", lightweight and nice X GUI 
> (wizard style) in 500 lines ?

[I assume you mean native X11 without any 3rd-party library]

It would be hard (unless the lines are very long *g*).  X11
can be extremely slim (look at some IOCCC entries) but a
modern GUI requires some effort.

A rough outline of what X11 is/does:

X11 provides only rudimental features which are: bare nested
windows, color/font management, drawing primitives, mouse and
keyboard handling, and events.

X11 draws nothing by itself.  Everything you see on an X11
display is drawn by an application.  And, X11 normally doesn't
cache the contents of windows.  If anything is destroyed you
only get some events to tell you which parts need redrawing.

There are no menus, toolbars, radio buttons, or other fancy
stuff.  These have to implemented outside of the X-server in
libraries that are linked to the application.  To name some
of these libraries (aka Toolkits): Xt, Xaw, Motif, GTK, QT,
FLTK, wxWindows.  GTK and QT are the most widely used ones.

The only thing an application doesn't have to take care of is
the decoration of top-level windows.  This is handled by the
"Window Manager" - a regular application which tracks creation
of new top-level windows and adds decoration around them.  It
also decides which top level window gets keyboard/mouse focus.

So, if you only want a simple window to draw some lines or
text - that's easy.  If you want menus, input boxes, etc
you have to implement them yourself...

Ciao, ET.