CS 66-460
Introduction to Graphical Human Machine Interfaces

An Overview of User Interface Software
(Part 2)

WEDNESDAY, FEBRUARY 5, 1997

Instructor: G. Bowden Wise
Rensselaer Polytechnic Institute
Spring 1997


Recall The Component Layers of UI Software

  


  
Next we look at toolkits ...


Toolkits


Toolkits: Advantages and Disadvantages

Advantages:

Disadvantages:


Toolkits: Layers

Because designers of X could not agree on a single look-and-feel, they created an intrinsics layer on which to build different widget sets.


Toolkits: Intrinsic Layer

Procedural


Toolkits: Intrinsic Layer

Object-Oriented

Object-Oriented toolkits must implement the objects either by inventing its own object system or using an existing object system:


Toolkits: Widget Sets


A Brief Look at Widgets From Different Toolkits


Virtual Toolkits


Virtual Toolkits (continued)

There are two styles of virtual toolkits:

Actual widgets


Virtual Toolkits (continued)

Re-implemented widgets


Application Frameworks

Toolkits are difficult for programmers to use:

Application frameworks are very popular now:


Application Frameworks: Examples

Other frameworks are for specific types of applications:


Event Driven Programming


Event Driven Model of Interaction


Event Handling: switch/case statements


A Typical Event Loop on the Macintosh

   // initialize application
   ...

  // main event loop
   do 
   {
      // get an event from the queue
      getnextevent (eventmask, &event);

      // handle the event
      switch (event.type)
      {
      case mousedown:
         DoMouseDown(event);
         break;

      //  lots and lots of case statements !

      // quit
      case quitmessage:
         done = true;
         break;
      }

   } while (!done);


Microsoft Windows


Microsoft Windows: Event Handling


Microsoft Windows: Message Loop



X Window System Protocol

   


Notes:


Event Handling in X Windows



Event Handling in Object-Oriented Frameworks

Event Handling in Object-Oriented Frameworks

For example, if we were using Microsoft Foundation Classes, and we wanted to add code so that when the ``submit'' button is pressed, we would add a handler for the BN_CLICKED message so that it would call the OnClickSubmit() method when the message is received:

void CMyDialog::OnClickSubmit()
{
// ...
}

Some classes already provide a virtual function for certain messages. For example, all windows have a routine called OnPaint() that is called whenever a WM_PAINT message is received. This method is part of the class tt CWnd. So if you want to specialize the redrawing behavior of your window, you need only provide a method called OnPaint() in your derived class. You do not necessarily need to add the handler since one is already provided by the base class.



Bowden Wise
Wed Feb 12 13:10:08 EST 1997