Xterminal Home Page Class index · Functions · Class hierarchy

Xterminal Programmer's Manual

  • Description
  • Installation procedures
  • The foundation class: XObject
  • The geometrical classes: XPoint and XRect
  • Events: XEvent, XKeyboardEvent, XMouseEvent, XMessage
  • Accessing the terminal: XTerminal class
  • Using the library
  • Classes hierarchy

    Description

    First of all, Xterminal is a hierarchy of objects, based on a client- server model. That means there is one or more objects acting like servers, each one having some clients. Each of these clients may act as servers too, having each one some clients. The various events that comes from the system (keyboard, mouse events, signals, messages, and so on) are going to a server and he decide which of his clients must receive the event, and so forth. If a server is redrawn, he asks it's clients to redraw themselves, too, for example. Events are not passed syncronous to objects, but using a queue, so if the system is busy with other tasks, events are not loosed.
    Each object have an unique identificator, and Xterminal maintains an internal table to keep track of these objects. Objects can communicate one with other using messages. Messages are translated into events and inserted into the queue, too.


    Installation procedures

  • The steps in order to compile the package
    1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself.

    Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for.

    The `configure' script is generated from `configure.in' by GNU's autoconf and it attempts to guess correct values for various system-dependent variables used during compilation. It also creates the Makefiles needed to compile the package and a `.h' file containing system-dependent definitions;

    2. Type `make' to compile the package;

    3. Type `make install' to install the library, the header files and the documentation. This operation should be done as root;

    4. Type `make examples' if you wish to see some test programs. This will create some `ex*' files in the `example' directory;

    5. You can remove the library and object files from the source directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of system), type `make distclean';

    6. Type `make uninstall' to remove the library, the header files and the documentation from the destionation directories.
  • Installation directories
    By default, `make install' will install the package's files in `/usr/include', `/usr/lib', etc. You can specify an installation prefix other than `/usr' by giving `configure' the option `--prefix=PATH'.

  • Other features and options
    If you want to compile a static version of the library instead of a shared one, you should use the option `--disable-shared'.
    If you don't want mouse support, use the option `--without-gpm'.
    For other options, type `./configure --help'.


    The foundation class: XObject

    Every class is derived from an abstract class, XObject. Each instantiated XObject have an object id (identificator) associated to it. The library itself maintains an internal table of instantiated classes. There are three types of objects:
    - abstract objects, which cannot be instantiated, but only declared; their purpose is to provide a general manipulation to a class of objects;
    - passive objects, which only displays something, but the user cannot control them;
    - active objects, which the user can do something with them, and which knows to answer in a way to the user input.

    Learn more about XObject.

    The geometrical classes: XPoint and XRect

    XPoint is an abstraction for a geometrical two-dimensional "point", having an x field (horizontal coordinate) and an y field (vertical coordinate).

    Learn more about XPoint.

    XRect is an abstraction for a geometrical two-dimensional "rectangle", having an a field of type XPoint (the upper-left corner), and an b field of type XPoint too (the bottom-right corner).

    Learn more about XRect.


    Events

    The events are not passed syncronously to the objects to which are addressed, but using a event queue. That doesn't mean the events will be delayed, anyway. The application will automatically query the system for events (from keyboard, from mouse, messages from other objects, UNIX signals), will find the object that event is addressed to, and will insert them into the queue.
    There is a basic event class, XEvent, and the other event classes are derived from it.

  • Event "classes":
    - EV_NOTHING, no event for an object;
    - EV_KEYBOARD, an event from keyboard;
    - EV_MOUSE, an event from mouse;
    - EV_SIGNAL, a UNIX system signal;
    - EV_MESSAGE, a message from an other object;
    - EV_BROADCAST, an event received by all objects.

    The Xterminal's event model is suggested by the picture below:

    [Xterminal's Event Model]


    Learn more about XEvent.

    Accessing the terminal

    The terminal is accessed using the XTerminal class, which abstractize the input/output operations with the terminal. This class is globally instantiated as XTerminal *Terminal. This class allows you to control the terminal input/output state, and provides methods to write to the terminal and to get events (from keyboard or mouse) from it. Always remember that writing something to the terminal does not imply screen update; the update is made only at the XTerminal.Refresh() call.

    Learn more about XTerminal.

    Using the library

    In order to use the library, you must include Xterminal.h in your C++ programs. At the linking phase, you must have -lXterminal as parameter when calling the C++ compiler. You may also need to use -lncurses -lgpm.
    Any Xterminal application must first call XInit() that initialize the terminal. The program also must call XDone() before exit.

    Learn more about using Xterminal:
    Alphabetical list of classes
    Functions
    Classes hierarchy



    Copyright ©1997-2001 Dragos Acostachioaie
    Last update on October 27, 2001