Programming in X
Programming in X, due to having several facets and aspects in its operation, can be complex.
Concepts
Some basic X concepts include:
- The X Window System behaves by acting as a "server" for X-enabled applications, called "clients".
- X is a network based system - clients can "draw" on another X server across a network.
Libraries
The X Window System is known for providing basic window drawing and graphics management routines, however, X on its own provides no capabilities to draw typical utilities such as scrollbars. Libraries however exist that make use of the basic facilities that X provides to create extra graphical functionality.
- GNOME, http://www.gnome.org/ - GNOME is a desktop environment for Linux, Unix, and other compatiable operating systems. It uses the GTK+ Toolkit and a Window Manager called Metacity.
- gtk+, http://www.gtk.org/ - The GIMP Toolkit. GTK+ is a multi-platform toolkit for creating graphical user interfaces.
- KDE, http://www.kde.org/ - Another Window Manager that provides a toolkit but this one is based on qt.
- Qt, http://www.trolltech.com/ - A cross platform c++ GUI/API. Free for open source use but to develop commercial applications you need a license
- Motif, http://www.opengroup.org/motif/
- wxWidgets, http://www.wxwindows.org/ - An open source c++ GUI framework.
- XLib provides a C based interface to the basic graphic routines described above.
Qt
Qt is unique in that it uses the idea of signals and slots. What does this mean? Say you create a button widget to quit you program called "close_btn" you would then connect that signal to close().
connect(quit_btn, SIGNAL(clicked()), this, SLOT(close()) );
The above code creates a connection between the button "quit_btn" and the close() slot. Specifically, when the quit_btn emits a clicked() signal the program does the slot close().
There is more to qt than just signals and slots and if you want to find more information, there is a good book called "C++ GUI Programming with Qt4" by Jasmin Blanchette and Mark Summerfield which is part of Bruce Perens' Open Source Series. There are also a number of tutorials on trolltech's, the maker of Qt, site: http://www.trolltech.com/.
XLib
- http://www.ac3.edu.au/SGI_Developer/books/XLib_PG/sgi_html/, Information on the X standard
- http://www.ac3.edu.au/SGI_Developer/books/XLib_PG/sgi_html/ix01.html, more specific information