Bookshelf Contents Previous Next Glossary Index Search

Module Widget Interfaces

When a module becomes part of a pipeline in MotionSampler, it can install a widget interface for direct control of some internal variables in the toolbox area of the MotionSampler interface. The widget interface can be a simple button or slider, or a complicated panel of controls as in the following example:

Before a module can install a widget interface, it must detect when it is added to a pipeline using the PipelineAttach() method. MotionSampler calls this module method when it adds a module to a pipeline. By default this method does nothing, but you can provide a new definition in your subclass. Inside this method you can create and install a user interface.

The header PDLMotSamp.h declares the class PDLMotionSampler which contains methods for interacting directly with the MotionSampler application. Four of these methods are used for managing module widget interfaces.

  1. The method NewSceneTool() requests that MotionSampler create a new widget which can be used for a module interface. The widget interface that MotionSampler creates for your module is part of a slightly more complicated widget. Each module widget is inside a widget with a title and an arrow button which users can use to show and hide the module widget. The title is specified as an argument to NewSceneTool(), and can be changed later using SetSceneToolTitle(). The widget returned by NewSceneTool() is a Motif Form widget.
  2. InstallSceneTool() tells MotionSampler that the interface is ready to be installed. This method should only be called after your interface is completely built and ready to be managed.
  3. When a module is removed from a pipeline, you must also remove any widgets you have installed. If you don't, user interfaces which are no longer connected to a module will clutter MotionSampler. The method to remove the module is PipelineDetach(). Redefine this method to remove any interfaces installed in PipelineAttach().
  4. The PDLMotionSampler method DeleteSceneTool() deletes the widget interface.

Example: Creating and Installing a Widget Interface

The following example creates and installs a widget interface that consists of a simple push button widget and then deletes the widget interface if the module is removed from a pipeline.

#include <X11/Intrinsic.h>
#include <Xm/PushB.h>
#include <PDLMotSamp.h>
...
void
ExampleFilt::PipelineAttach()
{
	widget = PDLMotionSampler::NewSceneTool("Example Filter");
switch = XtVaCreateManagedWidget("Switch", xmPushButtonWidgetClass,
		widget, 0);
	PDLMotionSampler::InstallSceneTool(widget);
}
void
ExampleFilt::PipelineDetach()
{
	PDLMotionSampler::DeleteSceneTool(widget);
}


Bookshelf Contents Previous Next Glossary Index Search

[email protected]
Copyright © 1998, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved.