|
GLG Toolkit, C / C++ API Library
Version 4.5
|
Windows only: A Win32 control that may be used to integrate GLG drawings in a Windows program. More...
Windows only: A Win32 control that may be used to integrate GLG drawings in a Windows program.
GLG Custom Control is a Windows wrapper designed for embedding GLG drawings in the programs using a Win32 API. It allows embedding GLG drawings into the Windows interface hierarchy as a custom window control (a window with a custom window type).
The control's class name is "GlgControl". The GLG library registers it when the library is initialized with GlgInit.
Creating GLG Custom Control
The control is created by passing "GlgControl" as the class name parameter of CreateWindow. The viewport object containing the control's drawing is assigned to the control via GlgSetDefaultViewport:
Alternatively, GlgSetWindowViewport may be used to assign the control's drawing after the control has been created instead of using GlgSetDefaultViewport before a call to CreateWindow.
The examples_c_cpp\animation\GlgAnimationW.c file in the GLG installation directory on Windows provides an example of using the control in a Windows application.
Include file: GlgApi.h
Functions | |
| GlgLong CALLBACK | GlgControlWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
| Windows only: Passes messages to the GLG Custom Control. More... | |
| GlgObject | GlgGetWindowViewport (HWND window) |
| Windows only: Returns a viewport object used by the GLG Custom Control. More... | |
| void | GlgSetDefaultViewport (GlgObject viewport) |
| Windows only: Sets a drawing to be used by the GLG Custom Control. More... | |
| void | GlgSetWindowViewport (HWND window, GlgObject viewport) |
| Windows only: Sets or replaces the viewport of the GLG Custom Control after its window has been created. More... | |
| GlgLong CALLBACK GlgControlWindowProc | ( | HWND | hwnd, |
| UINT | msg, | ||
| WPARAM | wParam, | ||
| LPARAM | lParam | ||
| ) |
Windows only: Passes messages to the GLG Custom Control.
This function is used by the window procedure of the control's parent window to pass messages to the control.
The examples_c_cpp\animation\GlgAnimationW.c file in the GLG installation directory on Windows provides an example of using this function.
| hwnd | The window ID of the GLG Control. |
| msg | The message to be passed. |
| wParam | The message parameter. |
| lParam | The message parameter. |
| GlgObject GlgGetWindowViewport | ( | HWND | window | ) |
Windows only: Returns a viewport object used by the GLG Custom Control.
| window | A window handle of the GLG Custom Control. |
| void GlgSetDefaultViewport | ( | GlgObject | viewport | ) |
Windows only: Sets a drawing to be used by the GLG Custom Control.
| viewport | Specifies a viewport object containing a drawing to be displayed in the GLG Custom Control. |
The function is used to pass the viewport to the CreateWindow function that creates the custom control. The viewport will be assigned to the custom control created by the next call to CreateWindow after GlgSetDefaultViewport is invoked.
Alternatively, GlgSetWindowViewport may be used to assign the control's drawing after the control has been created instead of using GlgSetDefaultViewport before a call to CreateWindow.
Since every custom control needs its own copy of the viewport, a viewport instance may be used to create only one GLG Custom Control. To create several custom controls with the same drawing, load a new instance of the drawing for each control or use GlgCopyObject to create copies of the viewport, then select them using GlgSetDefaultViewport before creating each control or widget. This function references the viewport object using GlgReferenceObject.
The examples_c_cpp\animation\GlgAnimationW.c file in the GLG installation directory on Windows provides an example of using this function.
| void GlgSetWindowViewport | ( | HWND | window, |
| GlgObject | viewport | ||
| ) |
Windows only: Sets or replaces the viewport of the GLG Custom Control after its window has been created.
| window | The window handle of the GLG Custom Control. |
| viewport | The viewport to be used as the control's drawing. |
Each custom control has to have its own instance of the viewport. To display the same drawing in several custom controls, load a new instance of the drawing for each control or use GlgCopyObject to create copies of the viewport. This function references the viewport object using GlgReferenceObject.