% >From vka@hissi.hut.fi  Fri Apr 19 12:34:13 1991
% Return-Path: <vka@hissi.hut.fi>
% Received: from hissi by ngs.fi (5.61++/SMI-4.0)
% 	id AA13599; Fri, 19 Apr 91 12:34:13 +0300
% Received: by hissi.hut.fi
% 	(15.11/15.6) id AA19167; Fri, 19 Apr 91 12:33:45 eet
% From: Vesa Kautto <vka@hissi.hut.fi>
% Message-Id: <9104190933.AA19167@hissi.hut.fi>
% Subject: no subject (file transmission)
% To: Pekka.Nikander@ngs.fi
% Date: Fri, 19 Apr 91 12:33:43 EETDST
% Mailer: Elm [revision: 64.9]

\chapter{Graphical User Interfaces}
\author{Vesa Kautto}
%by Vesa Kautto, 37995S, Helsinki University of Technology

\section{About Windows and Windowing}

The ability to view things visually and to run several programs at the
time makes windowing such a necessary and attractive way to deal with
the complexity of modern computing.  What a graphical user interface
or a window system can offer --- to both a novice and an expert user ---
is a friendly, easy-to-use work environment.

\subsection{Basics}

The human-computer interaction is based on a computer screen where
there are rectangles (created using graphics) called windows and a
pointing device --- usually a mouse --- within easy reach.  A user can
select, drag and move windows using a mouse that has at least one
button that can be clicked.  When a user presses the button in a
certain area of the screen --- e.g.\ above some window --- he may get a
popup menu.  Popup menus and menus in general contain a collection of
choices that a user can make.  It is up to the application programs
how the windows behave.

The window system itself creates only one window: the root window.
Then there are application programs.  Some of them can have several
windows on-screen simultaneously.  The number of windows per application is
not limited but if there are too many on a screen at the same time you
notice it when you try to get something done and end up searching for
a window from a pile of overlapping windows.


\section{Current Window Systems}

Many vendors have their own window systems for their own computing
platforms.  For example, Apple MacIntosh doesn't have a "traditional"
command-line interface at all but only a graphical user interface.
IBM Personal Computers and their clones have several window systems,
of which the Microsoft Windows is the most popular.  The X Window
System is the {\it de facto} standard of Unix workstations although some
vendor-specific window system could be better suited for some specific
area of use.  Thus some special-purpose graphical workstations have
their own window systems and also interaction devices.

There are utility programs delivered with window systems.  Among them
there are different kinds of graphical toy programs like clocks,
calculators, calendars, eyes that follow the movement of the pointer
and --- of course --- games.  But there are also some useful programs like
file and workspace managers.

A file manager visualizes a file hierarchy.  This helps a user to
navigate through directories and, since files (and directories, too)
are usually represented as icons, ordinary interaction methods can be
used to manipulate both directories and files.

A workspace manager is aimed to avoid {\it window clutter}.  A collection
of windows and icons are arranged as screens.  A workspace manager
collects these screens plus some system utilities to form a single
window.  Selecting a screen means changing a context e.g.\ from CAD to
desktop publishing.


\section{Window Components}

Window Systems can have very different
look-and-feel and thus cannot be used in the same way.  An example
of a window may help to understand what kind of things it might
contain.  Figure \ref{motif} displays a functional frame of a
X11/Motif window.

%<picture here>
\begin{figure}
  \ 
  \vskip10cm 
  \caption{X11/Motif window}
  \label{motif}
\end{figure}

\section{Interaction Methods/Techniques}

Since computers are so lifeless and unimaginative on their own, they
need human to instruct them.  To accomplish this human-computer
dialogue, several methods and devices have been invented.

You can change the window that has the focus of input using a pointer
device --- usually a mouse --- by simply {\bf pointing} at the correct window
(sometimes a click is needed).  The same goes for areas or fields
within a window.

{\bf Clicking} means simply pressing a mouse button.  Multiple button
clicks are sometimes used, too.

{\bf Selection} is one of the most popular methods used in graphical user
interfaces.  When you select something, you point at it and click.  It
enables you to {\bf grab} an object and manipulate it.  Several objects can
be selected and manipulated, too (if there are actions you can take on
several objects).

You can display menus by pressing a button above a menu label.
Pressing and holding the button displays the menu.  A menu selection
is done by moving the pointer above the correct choice and releasing
the button.

Conventional typing is also needed from time to time --- but not as
often as in the past.  There are still some text-oriented applications
like terminal emulators, and editors that occupy a window but support
only limited use of the mouse.  Other applications prefer small
text-entry-boxes, that often expect only a single line of input.


\section{Interaction devices}

{\bf (in the estimated order of popularity)}

\begin{tabular}{lp{3in}}
 \bf Monitor		& the main output device \\
 \bf Keyboard		& the input device that practically all
			  computers have; text entry is the primary function \\
 \bf Mouse		& very popular in computers that have graphical
			  user interfaces \\
 \bf Lightpen		& used to select positions on the screen \\
 \bf Trackball		& replaces mouse in some portables \\
 \bf Joystick		& useful in computer games and other
			  applications that need to ``shoot''  \\
 \bf Tablet		& moving a pencil on a tablet moves a
			  cursor on-screen \\
 \bf Digitizer		& for reading in pictures or sheets of paper \\
 \bf Touch panels 	& not very popular at a moment in
			  general-purpose workstations \\
 \bf Voice system 	& this is the input and output method of the
			  future but very rarely used today \\
\end{tabular}

\section{Application Programs}

Graphical user interfaces are practical in many areas of computing,
especially in the areas where user interaction plays a major role.
Some of these areas where programs already exist are Computer Aided
Design, Desktop Publishing, Integrated System Engineering and
Engineering Database Management.  These programs can, among many other
things, model various systems, show 2- and 3-dimensional views of
designs, simulate different kinds of models or systems and analyse
performances of components and the whole.

\section{Window Programming \& User Interface Design}

User interface programmers use graphical objects --- also called
widgets or gadgets --- to build an interface for an application.
There are several classes of widgets including different kinds of
bulletinboards (object containers), push buttons, various menus,
scrolled windows and text-entry fields.  The first job is to design
the layout of a window i.e.\ what widgets and where, what kinds of
connections are needed between widgets and so on.  That takes some
code-writing but after that the programmer needs to write some more
code to accomplish actions the user can take, and that is hard work.

Window systems are usually event-driven.  That means that if no
user-initialized operation is going on, the application does nothing.
Only user actions or events --- e.g.\ movements of the mouse --- cause
things to happen e.g.\ the focus of input or output to change.  These
user-generated events have to be processed but fortunately not all
events are handled by the programmer.  Low-level window system
software takes care of some of them, but eventually there are some
events that need the attention of the programmer.  Events are usually
handled by invoking special kind of functions (callbacks), that have
to be written according to the context.  Actually, all you need to do
is to design the layout and write the callbacks plus connect them to
your application, but that is a lot easier to say than to make happen.

\section*{Glossary}

\begin{description}

 \item{\bf Callback} is a name used in the X Window System for a function
		 that describes the instructions that must be executed
		 to accomplish some action.

 \item{The active window} has the {\bf focus of input}, i.e.\ it gets all the
		 input events.  Within a window, an area or a field
		 has the focus of input and it is usually the area
		 under the pointer.  An active cursor, a highlight or
		 some other suggestion of activeness indicate the
		 focus of input.

 \item{A \bf portable} is a small computer that is not bound to one place
		 but that can be moved around easily.

 \item{A \bf utility program} can be used for various purposes, e.g., for
		 printing or managing windows.

 \item{\bf Window clutter} means a situation in a windowing environment
		 when there too many windows on-screen simultaneously
		 and they clutter up the screen, interleaving each
		 other.

\end{description}

\section*{References}

{\parindent=0pt\parskip=3pt
M. Pauline Baker and Donald Hearn, {\it Computer Graphics}

{\it Using the X Window System}, Hewlett Packard Manual

Application program brochures from various companies
}





