31.05.2013 Views

think-cell technical report TC2003/01 A GUI-based Interaction ...

think-cell technical report TC2003/01 A GUI-based Interaction ...

think-cell technical report TC2003/01 A GUI-based Interaction ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.1 Program Architecture IMPLEMENTATION<br />

driven by the document window.<br />

5.1.2 Hierarchy and Interfaces of UI Classes<br />

Some selected class diagrams are depicted in figure 38. The root class CUIObject<br />

holds a reference to its document window and offers an interface to process all<br />

kinds of low level user interface messages. The subclasses realize different UI wid-<br />

gets by implementing the processing of those messages differently. In particular,<br />

the subclasses of CHotZone offer specific functions that provide a high-level in-<br />

terpretation of the low-level UI input, <strong>based</strong> on notions like hit test, mouse capture<br />

and the like. For example, in the case of the CHotButton class, a sequence<br />

of the OnLButtonDown()/OnLButtonUp() mouse messages triggers a call to the<br />

OnClick() method, if at the times of both events the mouse pointer is found within<br />

the UI object’s responsive area.<br />

The application specific methods like OnClick() are abstract, meaning that the<br />

respective class itself cannot be instantiated. To use the functionality provided by<br />

the UI classes, each UI widget is programmed as its own subclass, implementing its<br />

specific behavior in those abstract methods. Other UI components are too specific to<br />

be derived from CHotZone or its subclasses. Examples are CFeatureOutline and<br />

CUIGridLine. These classes implement the interpretation of low-level messages<br />

themselves, deriving directly from class CUIObject (Fig. 38(a)).<br />

The inheritance graph of CVisualElement (Fig. 38(b)) partly parallels the<br />

hierarchy of subclasses of CUIObject. Most UI objects have some visual represen-<br />

tation that is made up of one or more visual elements. The methods and attributes<br />

of visual elements serve to create an appropriate texture mapping, transforming<br />

coordinates from a precompiled texture bitmap to document-oriented coordinates<br />

and finally to on-screen coordinates, taking zooming and scrolling into account. The<br />

subclasses of CVisualElement are tailored to their specific use with the objective<br />

to minimize the interface to their respective subclass of CUIObject.<br />

As can be seen in figure 37, features are contained by a smart element and<br />

smart elements are contained by a container. Now, figure 38(c)) shows that smart<br />

elements also are features and that containers also are smart elements. The class<br />

CSmartElement derives from CFeature, because the latter provides function-<br />

ality to show user interface components, and smart elements need to have a user<br />

interface, too. On the other hand, the relationship between CSmartElement and<br />

CContainerSE enables hierarchical layouts with gridlines at different levels.<br />

5.1.3 Windows Message Processing<br />

User input processing in my prototype is <strong>based</strong> on Microsoft Windows messages.<br />

In Windows, messages are responsible for inter-process communication. Messages<br />

that originate in the operating system are queued in thread-specific message queues<br />

and are processed whenever a thread makes a system call to PeekMessage() or<br />

GetMessage(). The user thread then typically makes a call to DispatchMessage(),<br />

72

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!