GLG Toolkit, C / C++ API Library  Version 4.6
Load, Setup and Display

This group contains methods used to load, set up and display a GLG drawing. More...

Detailed Description

This group contains methods used to load, set up and display a GLG drawing.

Functions

 GlgObjectC (char *filename)
 Constructor: Loads an object from a file. More...
 
 GlgObjectC (void *image, GlgLong size)
 Constructor: loads an object from a generated memory image. More...
 
void DialogInitialDraw (GlgObjectC &parent)
 Displays a GLG drawing as a floating dialog for the first time after it has been created or loaded. More...
 
void DialogSetupHierarchy (GlgObjectC &parent)
 Provides an explicit request to set up the object hierarchy of a drawing displayed in a dialog window. More...
 
void InitialDraw (void)
 Draws a GLG viewport object for the first time after it has been created or loaded. More...
 
GlgBoolean Load (char *filename, char *resource_name=NULL)
 Loads an object from a file or a URL, replacing the previously stored object. More...
 
GlgBoolean Load (void *image, GlgLong size, char *resource_name=NULL)
 Loads an object from a generated memory image, replacing the previously stored object. More...
 
void LoadNullObject (void)
 Releases the stored object. More...
 
GlgBoolean LoadWidget (char *filename)
 Loads a GLG widget from a file or a URL. More...
 
GlgBoolean LoadWidget (GlgObjectC &parent)
 Extracts a GLG widget contained inside another object. More...
 
GlgBoolean LoadWidget (void *image, GlgLong size)
 Loads a GLG widget from a generated memory image. More...
 
GlgBoolean Reset (void)
 Reinitializes the drawing by resetting the drawing hierarchy, then setting it up again and rendering the drawing. More...
 
void ResetHierarchy (void)
 Resets the object hierarchy. More...
 
void SetupHierarchy (void)
 Provides an explicit request to set up the object hierarchy without rendering the object. More...
 
GlgBoolean Sync (void)
 Flushes the windowing system output for this viewport to the display. More...
 
GlgBoolean Update (void)
 Updates a drawing to show new resource values. More...
 

Function Documentation

◆ GlgObjectC() [1/2]

GlgObjectC ( char *  filename)

Constructor: Loads an object from a file.

This is a wrapper for GlgLoadObject.

Parameters
filenameSpecifies the file or the URL to load an object from. For details of using URLs on Linux, see GlgGetURLCB.

◆ GlgObjectC() [2/2]

GlgObjectC ( void *  image,
GlgLong  size 
)

Constructor: loads an object from a generated memory image.

Parameters
imageSpecifies the address of the drawing image generated by the GLG Code Generation Utility gcodegen.
sizeSpecifies the image size. This is also generated by gcodegen.

This is a wrapper for GlgLoadObjectFromImage, see GlgLoadObjectFromImage for more information.

◆ DialogInitialDraw()

void DialogInitialDraw ( GlgObjectC parent)

Displays a GLG drawing as a floating dialog for the first time after it has been created or loaded.

This is a wrapper for GlgDialogInitialDraw.

Parameters
parentSpecifies the viewport of the main drawing the dialog will be a child of.

This method is similar to InitialDraw, with the only difference that the drawing will be displayed as a child dialog of the main drawing specified by the parent parameter.

GlgConfigureWindow may be used to set the dialog's size and position.

◆ DialogSetupHierarchy()

void DialogSetupHierarchy ( GlgObjectC parent)

Provides an explicit request to set up the object hierarchy of a drawing displayed in a dialog window.

This is a wrapper for GlgDialogSetupHierarchy.

Parameters
parentSpecifies the viewport of the main drawing the dialog will be a child of.

This method similar to SetupHierarchy, with the only difference that the drawing will be set up as a child dialog of the main drawing specified by the parent parameter.

This method needs to be invoked only on the initial draw of the dialog. After the dialog has been set up, a generic SetupHierarchy method may be used for all objects, including the dialog.

◆ InitialDraw()

void InitialDraw ( void  )

Draws a GLG viewport object for the first time after it has been created or loaded.

This is a wrapper for GlgInitialDraw.

The method displays a viewport's drawing in a platform-independent way on both Windows and Linux/Unix, and is part of the GLG Generic API.

The method creates a top level window and renders the viewport's drawing in it. Depending on the used version of the GLG library and the configuration settings, different rendering engines may be used for rendering graphics:

  • GDI or OpenGL on Windows
  • GTK, X11 or OpenGL on Linux/Unix.

If GlgWrapperC or GtkmmGlgWidget widgets are used on Linux/Unix, or the GlgControlC control is used on Windows, this method is invoked automatically, and need not be explicitly called.

InitialDraw is equivalent to the following sequence:

GlgBoolean Update(void)
Updates a drawing to show new resource values.
void SetupHierarchy(void)
Provides an explicit request to set up the object hierarchy without rendering the object.

See Generic API Application Example for a cross-platform example of using this method.

◆ Load() [1/2]

GlgBoolean Load ( char *  filename,
char *  resource_name = NULL 
)

Loads an object from a file or a URL, replacing the previously stored object.

This is a wrapper for GlgLoadObject.

Parameters
filenameSpecifies the file or the URL to load the object from. For details of using URLs on Linux, see GlgGetURLCB.
resource_nameAn optional resource path.
  • If NULL, the whole drawing is loaded.
  • If not NULL, the method extracts and loads only an object inside the loaded drawing that is found using the resource_name. GlgGetResourceObject is used to extract the loaded object, which requires Intermediate API.
Returns
Success or failure status.

◆ Load() [2/2]

GlgBoolean Load ( void *  image,
GlgLong  size,
char *  resource_name = NULL 
)

Loads an object from a generated memory image, replacing the previously stored object.

Parameters
imageSpecifies the address of the drawing image generated by the GLG Code Generation Utility gcodegen.
sizeSpecifies the image size. This is also generated by gcodegen.
resource_nameAn optional resource path.
  • If NULL, the whole drawing is loaded.
  • If not NULL, the method extracts and loads only an object inside the loaded drawing that is found using the resource_name. GlgGetResourceObject is used to extract the loaded object, which requires Intermediate API.
Returns
Success or failure status.

This is a wrapper for GlgLoadObjectFromImage, see GlgLoadObjectFromImage for more information.

◆ LoadNullObject()

void LoadNullObject ( void  )

Releases the stored object.

Replaces the currently loaded object with a null object.

◆ LoadWidget() [1/3]

GlgBoolean LoadWidget ( char *  filename)

Loads a GLG widget from a file or a URL.

Loads the "$Widget" viewport from a GLG drawing file or a URL, replacing the previously stored object. This is a wrapper for GlgLoadWidgetFromFile.

Parameters
filenameSpecifies the name of the widget's drawing file or the URL.
For details of using URLs on Linux, see GlgGetURLCB.
Returns
Success or failure status.

◆ LoadWidget() [2/3]

GlgBoolean LoadWidget ( GlgObjectC parent)

Extracts a GLG widget contained inside another object.

Finds the "$Widget"viewport inside the parent object, and stores it, replacing the previously stored object. This is a wrapper for GlgLoadWidgetFromObject.

Parameters
parentThe parent object containing the "$Widget" viewport.
Returns
Success or failure status.

◆ LoadWidget() [3/3]

GlgBoolean LoadWidget ( void *  image,
GlgLong  size 
)

Loads a GLG widget from a generated memory image.

Loads the "$Widget" viewport from a generated memory image, replacing the previously stored object.

Parameters
imageSpecifies the address of the drawing image generated by the GLG Code Generation Utility gcodegen.
sizeSpecifies the image size. This is also generated by gcodegen.
Returns
Success or failure status.

This is a wrapper for GlgLoadWidgetFromImage, see GlgLoadWidgetFromImage for more information.

◆ Reset()

GlgBoolean Reset ( void  )

Reinitializes the drawing by resetting the drawing hierarchy, then setting it up again and rendering the drawing.

This is a wrapper for GlgReset.

Returns
True if the drawing has been successfully reinitialized, otherwise False.

Calling Reset restores all volatile resource changes to the values the resources had when the widget was first drawn. It also discards currently displayed chart data, unless the chart Persistent attribute is set to True.

The method should be invoked only for the top-level viewports, not the child viewports.

◆ ResetHierarchy()

void ResetHierarchy ( void  )

Resets the object hierarchy.

This is a wrapper for GlgResetHierarchy.

Resets the object hierarchy of a top-level viewport or drawing. If the object was displayed using the Generic API, this method must be called before the top-level object is destroyed.

This method should not be called for the top-level viewports used in the integrated GLG widgets, such as the GlgWrapperC or GlgControlC.

Warning: Do not confuse this method with the Reset method, which is used to redraw a displayed drawing and to regenerate the object hierarchy.

◆ SetupHierarchy()

void SetupHierarchy ( void  )

Provides an explicit request to set up the object hierarchy without rendering the object.

This is a wrapper for GlgSetupHierarchy.

When invoked on a drawing which has been loaded but not yet displayed, the method sets up the drawing's object hierarchy to prepare the drawing for rendering. The drawing should contain either a top-level viewport object, or a group containing several top-level viewports.

After the initial draw (when the object hierarchy has already been set up), the method can be used to set up any type of object after its resources were changed. Unlike Update, SetupHierarchy sets up the object without repainting it

◆ Sync()

GlgBoolean Sync ( void  )

Flushes the windowing system output for this viewport to the display.

If OpenGL is used, it also flushes OpenGL buffers. In X11, it also waits for all requests to be processed. This is a wrapper for GlgSync.

Returns
Success or failure status.

◆ Update()

GlgBoolean Update ( void  )

Updates a drawing to show new resource values.

Returns
True if the drawing has been successfully updated, otherwise False.

If this object is a light viewport, an update of its parent viewport will be performed. All resource changes are held until the Update method is called or until the viewport's window receives an expose event. (That is, it must be redrawn because another window that was obscuring a part of the viewport's window has been moved. This causes the viewport to redraw itself, using its new data.)

Note: Some drawing resources affect the object hierarchy of the drawing. For example, the Factor attribute of a series object controls the number of template instances that will be created by the series. If a number of instances is increased by setting the series' Factor, the new instances will be created and their resources can be accessed only after the Update or SetupHierarchy method is invoked. If the series object is not persistent, any change (either increase or decrease) of its Factor attribute recreates its instances, and either the Update or SetupHierarchy method should be called before accessing resources of the series' instances.