Previous Next Up Title Contents Index Top Library

3.1.1. EXAMPLE

   Most simple programs for GPHIGS toolkit

   Steps are :

     - Initialize toplevel		-> XtInitialize
     - Open PHIGS			-> popen_phigs
     - Specify wk is resizeable	-> XtSetArg
     - Create GPHIGS widget		-> XtCreateManagedWidget
     - Realize toplevel		-> XtRealizeWidget
     - loop forever			-> XtMainLoop
   Use :
      <shift> button3	-> popup menu GPHIGS_GUI

#include <Xm/Xm.h>
#include <GPhigsW.h>

main () 
{
  Widget toplevel, gphigs ;
  int    n, ac = 0;
  Arg    args[2] ;

  toplevel = XtInitialize ("demo", "XGphigsgui", NULL, 0, &ac, NULL);

  popen_phigs(PDEF_ERR_FILE, PDEF_MEM_SIZE);
  n = 0;
  XtSetArg(args[n], XmNresizeWs, XmGPHIGS_RESIZE_WS); n++;
  gphigs = XtCreateManagedWidget("GPHIGS",xmGPhigsWidgetClass,toplevel,args,n);

  XtRealizeWidget  (toplevel);
  XtMainLoop();
}

This program sets up a GPHIGS workstation widget with no display, using the default driver (X11 8887) or the driver specified in the resource file XGphigsgui.

In order to access GPHIGS-GUI simply position the cursor in the graphic window (widget) and press the keys <shift> and 3rd mouse button.

A popup-menu is displayed which enables all GPHIGS-GUI functions to be used.

In this case, the program is written using the MOTIF toolkit and includes an XtMainLoop. The user interactions are managed using Motif or GPHIGS_GUI widgets, particularly if the program requires the use of GPHIGS. Create a widget graphic using the GPHIGS_GUI widget workstation. This widget ensures the integration of PHIGS with Motif. It is used to manage expose and resize, and simplifies the management of actions in the graphic window, particularly locator and pick with the Motif callback mechanism. The use of this widget enables high-level CSS manipulation functions to be accessed.

Thus the programing of graphics is carried out in the same way as the interface, and is completely homogenous.

NB : GPHIGS_GUI workstation widget is based on the GPHIGS widget supplied with GPHIGS version 6.0, but has additional functions and allows access to CSS manipulation utilities. If an application used the widget from version 6.0, the introduction of GPHIGS_GUI to the libgphigsgui.a library will not interfere with the existing applications.


Previous Next Up Title Contents Index Top Library