GLG Toolkit, C / C++ API Library  Version 4.5
GlgWrapper Widget

Linux/Unix only: A native X11 and Motif based widget for legacy X11 applications. More...

Detailed Description

Linux/Unix only: A native X11 and Motif based widget for legacy X11 applications.

The widget allows embedding GLG drawings into the X11 widget hierarchy.

Creating GlgWrapper Widget

To use the widget, include GlgWrapper.h file in your source code. The widget is created by using glgWrapperWidgetClass as the widget class parameter of XtCreateWidget. The XtNglgDrawingFile Xt argument is used to specify the filename of the widget's drawing:

Cardinal ac = 0;
Arg al[5];
// Specify a drawing to be displayed in the widget.
XtSetArg( al[ac], XtNglgDrawingFile, "dashboard.g" ); ac++;
// Create an instance of a GLG Wrapper widget.
Widget glgWrapper = XtCreateWidget( "GlgWrapper", glgWrapperWidgetClass, parent, al, ac );
WidgetClass glgWrapperWidgetClass
A widget class that can be used as the widget_class parameter of the XtCreateWidget function to creat...

Alternatively, the XtNglgDrawingObject Xt argument may be used to specify the viewport object containing the widget's drawing directly instead of using a drawing filename.

The examples_c_cpp/Dashboard/GlgDashboardX.c file in the GLG installation directory on Linux/Unix provides an example of using the GlgWrapper widget in an X11/Motif application.

Wrapper Widget Resources

Like other X widgets, the GLG Wrapper Widget is controlled by X resources. These resources are different from the resources of a GLG drawing. The following table lists the supported X resources.

Name Type Default Description
XtNglgDrawingFile String NULL Name of the file containing a GLG drawing.
XtNglgDrawingImage XtPointer NULL Address of the memory image of a GLG drawing.
XtNglgImageSize long 0 Size of the memory image.
XtNglgHResource0
XtNglgHResource1
...
XtNglgHResource19
String NULL Entry points for accessing H resources of graphical objects in the drawing using the same syntax as corresponding properties in the GLG Builder's Object Property Dialog.
XtNglgVResource0
XtNglgVResource1
...
XtNglgVResource19
String NULL Entry points for accessing V resources of graphical objects in the drawing.
XtNglgHInitCB XtCallback list NULL Callback list for setting initial values of H resources using convenience functions.
XtNglgVInitCB XtCallback list NULL Callback list for setting initial values of V resources using convenience functions.
XtNglgInputCB XtCallback list NULL Callback list for the input activity in the widget.
XtNglgSelectCB XtCallback list NULL Callback list for selecting objects in the widget.
XtNglgTraceCB XtCallback list NULL Callback list for trace callbacks.
XtNglgTrace2CB XtCallback list NULL Callback list for trace2 callbacks
XtNglgMotifSelectCB XtCallback list NULL Callback list for selecting objects in the widget, uses Motif-style callback structure GlgSelectCBStruct.
XtNglgMotifInputCB XtCallback list NULL Callback list for the input activity in the widget, uses Motif-style callback structure GlgInputCBStruct.

The XtNglgHResource<N> resources can be used to set resources of the drawing before its object hierarchy has been set up. The resources use the following syntax:

<resource_name> <resource_type> <values>

For example, the following string may be used to set the color of minor ticks of a dial named "Dial1" to red:

"Dial1/Axis/MajorTick/EdgeColor g 1. 0. 0"

Similarly, the XtNglgVResource<N> resources can be used to set resources of the drawing after the drawing's object hierarchy has been set up but before the graphics is drawn.

Include file: GlgWrapper.h

Types

WidgetClass glgWrapperWidgetClass
 A widget class that can be used as the widget_class parameter of the XtCreateWidget function to create a GlgWrapper Widget. More...
 

Structures and Classes

struct  GlgInputCBStruct
 Data structure used by the Motif-style Input callback. More...
 
struct  GlgSelectCBStruct
 Data structure used by the Motif-style Select callback. More...
 

Functions

GlgObject XglgGetWidgetViewport (Widget widget)
 Returns the top-level viewport containing the widget's drawing. More...
 

Class Documentation

◆ GlgInputCBStruct

struct GlgInputCBStruct

Data structure used by the Motif-style Input callback.

Class Members
GlgObject message_obj Message object.
GlgCallbackType reason The reason the callback was invoked.
GlgObject viewport Wrapper widget's viewport.
Widget widget Wrapper's widget ID.

◆ GlgSelectCBStruct

struct GlgSelectCBStruct

Data structure used by the Motif-style Select callback.

Class Members
XEvent * event the Event that triggered the callback
GlgLong num_selected The length of the selection list.
GlgCallbackType reason The reason the callback was invoked.
char ** selection_list The list of selected object names.
GlgObject viewport Wrapper widget's viewport.
Widget widget Wrapper's widget ID.

Function Documentation

◆ XglgGetWidgetViewport()

GlgObject XglgGetWidgetViewport ( Widget  widget)

Returns the top-level viewport containing the widget's drawing.

Parameters
widgetThe widget.
Returns
The viewport, or NULL if the viewport has not been assigned.

Variable Documentation

◆ glgWrapperWidgetClass

WidgetClass glgWrapperWidgetClass
extern

A widget class that can be used as the widget_class parameter of the XtCreateWidget function to create a GlgWrapper Widget.