5.2. User interface

For the user interface (UI), Gaphor makes use of the GTK+ 2.0 libraries. All UI stuff is found in the gaphor.ui module.

All windows are inherited from AbstractWindow. This class provides some basic stuff such as window construction and popup menu handling. The classes that are inherited from AbstractWindow all use the gtk.Window and provide some content of themselves.

AbstractWindow also provides an interface for all windows. A window can have three states: INIT, ACTIVE and CLOSED. If a new AbstractWindows deriviate is instantiated it has the state INIT. The construct() method is called to create the actual window on the screen, the state changes to ACTIVE. You can now invoke all operations on the window (such as getting the real UI components and setting a message in the status bar). The last state, CLOSED, is reached when the close() method has been called. The UI components are destroyed and the object is basically useless.

Note that the AbstractWindow UI component, it contains the graphical objects and observes their activities. It is a Mediator.

Figure 5.1. gaphor.ui

As of this writing three windows are provided: a main window, diagram windows and an editor window. The main window is what you get when Gaphor is started.

Figure 5.2. Gaphor's main window

Diagrams are shown in a Diagram window. A Diagram window contains a DiagramView object, which is a specialized version of a DiaCanvasView (which in his turn is a subclass of a GnomeCanvas).

Figure 5.3. Gaphor's diagram window

One of the more neat features is the Editor window. It provides an nice way of trying out new peaces of code and debugging the data model.

Figure 5.4. Gaphor's editor window

Every (well almost every) action that can be done in Gaphor is represented by an Action (gaphor.misc.action.Action).