Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Xt/X11 event loops.

Support for Xt/X11 event loops allows framework software to take advantage of the rich GUI functionality offered by Xwindows widget libraries such as the Athena widget library or Motif widgets. The Xt event loop is fully synchronized with the application. The event loop structure looks like:

  while(!m_fExit) {
    XEvent event;

    XtAppNextEvent(m_AppContext, &event);
    pMutex->Lock(); {           //--> Begin Critical region.
      XtDispatchEvent(&event);
    }
    pMutex->UnLock();           //<-- End Critical region.

  }

Xt event dispatch is bracketed by Lock and Unlock calls on the application serialization mutex ensuring that all Xt Event processing is done synchronized to the application.

To include an Xt event loop in your application you must:

Application initialization.

If the default application initialization is not sufficient, you can implement an override to this function. The default contents of the function are:
Widget
CXtEventLoop::InitializeApplication(int& argc, char** argv)
{
  m_TopLevel = XtAppInitialize(&m_AppContext,
                               m_sClass.c_str(),
                               m_pOptionTable,
                               m_nOptionCount,
                               &argc, argv,
                               m_ppcFallbackResources,
                               NULL, 0);
  return m_TopLevel;

}

This initializes the Xt library, and produces the application top level widget. You can write your member to modify the class (m_sClass), the option table (m_pOptionTable), and the application fallback resources (m_ppcFallbackResources) prior to calling CXtEventLoop::InitializeApplication

You can also detect and process application specific "Command line parameters."

Setting up the application resource

database.

The attributes of widgets and classes of widgets are defined both by explicit properties at widget creation or modification time, and by a set of defaults or "resources." The resources are loaded into a resource database from several sources:

The function SetupApplicationResources() provides a hook to allow default application resources to be loaded into the system. The call signature for this member is:

void   SetupApplicationResources (Widget TopLevel);
Where:
Parameters:
Toplevel is the top level widget created in InitializeApplication()
The default behavior of this member is empty. For more information on X11 resources and the resource database, consult the relevant Xt and X11 programming documentation.

Setting up the application's initial widget tree.

Xt applications consist of a hierachical set of GUI components called "widgets." SetupWidgetTree allows the initial set of widgets to be created.

The call signature of this member is:

void 
CXtEventLoop::SetupWidgetTree(Widget TopLevel)

Where:

Parameters:
TopLevel is the toplevel widget. All application widgets have this widget as an ultimate parent.
The default implementation of SetupWidgetTree is empty. It is up to the application to determine its user interface
Generated on Thu Jan 6 16:58:46 2005 for Spectrodaq External Event Framework by  doxygen 1.3.9.1