home *** CD-ROM | disk | FTP | other *** search
- /*
- GIK/2 1.0.1 EWYHAEH.C 5621-432 (C) COPYRIGHT IBM CORP 1991, 1993. ALL RIGHTS RESERVED. LICENSED MATERIALS - PROPERTY OF IBM.
- */
- /**********************************************************************/
- /* */
- /* MODULE PROLOGUE */
- /* */
- /* COMPONENT NAME: CLOCK EXAMPLE */
- /* */
- /* MODULE NAME: EWYHAEH.C */
- /* */
- /* DESCRIPTIVE NAME: Graphics Interface Kit/2 - Clock Example */
- /* */
- /* PURPOSE: Event handle functions */
- /* */
- /* COPYRIGHT: (C) 1991, 1993 IBM Corporation */
- /* */
- /* DISCLAIMER OF WARRANTIES. The following [enclosed] code is */
- /* sample code created by IBM Corporation. This sample code is not */
- /* part of any standard or IBM product and is provided to you solely */
- /* for the purpose of assisting you in the development of your */
- /* applications. The code is provided "AS IS", without */
- /* warranty of any kind. IBM shall not be liable for any damages */
- /* arising out of your use of the sample code, even if they have been */
- /* advised of the possibility of such damages. */
- /* */
- /**********************************************************************/
-
- ;
-
- /*--------------------------------------------------------------------*/
- /* INCLUDE RELATED DEFINES */
- /*--------------------------------------------------------------------*/
-
- #define INCL_DOS /* OS/2 definitions */
- #define INCL_PM /* PM definitions */
-
- /*--------------------------------------------------------------------*/
- /* HEADER FILES */
- /*--------------------------------------------------------------------*/
-
- #include <os2.h> /* OS/2 header file */
- #include <ewyga.h> /* GIK/2 header file */
- #include <string.h>
- #include "EWYHADF.H" /* Generated header file */
- #include "EWYHA.H" /* Header file */
-
- /*--------------------------------------------------------------------*/
- /* Module Data */
- /*--------------------------------------------------------------------*/
-
- extern PFNWP M_OldWinProc;
-
- /*--------------------------------------------------------------------*/
- /* LOCAL FUNCTION PROTOTYPES */
- /*--------------------------------------------------------------------*/
-
- SHORT GSENTRY EvExit(DHND,SHORT,EVS_EXIT *);
- SHORT GSENTRY EvInit(DHND,SHORT,EVS_INIT *);
-
- /**********************************************************************/
- /* EvExit */
- /* */
- /* Parameters: */
- /* DHND dhnd (I): Diagram handle. */
- /* SHORT ev_id (I): Identifies the event. */
- /* EVS_EXIT *pEvs (I): Pointer to instance of event*/
- /* data type. */
- /* SHORT close (I): Indicator that specifies whether */
- /* the event is triggered during the */
- /* processing of the WM_CLOSE or the */
- /* WM_DESTROY message */
- /* It is one of the following: */
- /* GS_YES. The WM_CLOSE message is */
- /* processed. */
- /* GS_NO. The WM_DESTROY message is*/
- /* processed. */
- /* HAB hab (I): Handle to anchor block */
- /* HWND hwnd_client (I): Handle to client window */
- /* HWND hwnd_frame (I): Handle to frame window */
- /* SHORT delay_mode (I): Indicates whether the function */
- /* GsDelay is currently processing. */
- /* It is GS_YES or GS_NO */
- /* */
- /* Returns: */
- /* GS_NO Any changes made to symbols remain and the action */
- /* stops. */
- /* GS_NO_1 Any changes made to symbols remain and the action */
- /* stops. */
- /* GS_RESTORE Any changes made to symbols since the last undo */
- /* checkpoint are undone and the action stops. */
- /* GS_RESTORE_1 Any changes made to symbols since the last undo */
- /* checkpoint are undone and the action stops. */
- /* GS_YES The default processing continues. */
- /* */
- /* Description: */
- /* The function handles the event EV_EXIT. */
- /**********************************************************************/
-
- SHORT GSENTRY EvExit(DHND dhnd,SHORT ev_id,EVS_EXIT *pEvs)
- {
- GsPutDiagModify(dhnd, GS_NO); /* tricky supress the
- SaveUnsaved changes pop-up */
- WinStopTimer(pEvs->hab,
- pEvs->hwnd_client,
- 0); /* stop timer */
-
- /*------------------------------------------------------------------*/
- /* Bye */
- /*------------------------------------------------------------------*/
-
- return (GS_YES);
- }
-
- /**********************************************************************/
- /* EvInit */
- /* */
- /* Parameters: */
- /* DHND dhnd (I): Diagram handle. */
- /* SHORT ev_id (I): Identifies the event. */
- /* EVS_INIT *pEvs (I): Pointer to instance of event*/
- /* data type. */
- /* VOID *pInit_data (I): Pointer passed from the customizing*/
- /* code to the parameter pInit_data of*/
- /* the GIK/2 function GsInitWin */
- /* HAB hab (I): Handle to anchor block */
- /* HWND hwnd_client (I): Handle to client window */
- /* HWND hwnd_frame (I): Handle to frame window */
- /* */
- /* Returns: */
- /* GS_NO The window is closed. */
- /* GS_YES The initialization of the GIK/2 window continues. */
- /* */
- /* Description: */
- /* The function handles the event EV_INIT. */
- /**********************************************************************/
-
- SHORT GSENTRY EvInit(DHND dhnd,SHORT ev_id,EVS_INIT *pEvs)
- {
- SHORT i;
- SHORT f;
- ULONG cst;
-
- /*------------------------------------------------------------------*/
- /* Do some beeping at startup */
- /*------------------------------------------------------------------*/
-
- f = 440;
- for (i = 0; i < 9; i++, f = f+f)
- {
- DosBeep(f,
- 30);
- }
-
- /*------------------------------------------------------------------*/
- /* Disable the drag select and adding of bendpoitns */
- /*------------------------------------------------------------------*/
-
- GsGetDiagConstraint(dhnd, &cst);
- cst &= ~(GS_CST_DIAG_DRAG_SELECT|GS_CST_DIAG_ADD_BP|
- GS_CST_DIAG_DELETION|GS_CST_DIAG_MOVEMENT|GS_CST_DIAG_SIZE|
- GS_CST_DIAG_SELECTION);
- GsPutDiagConstraint(dhnd, cst);
-
- /*------------------------------------------------------------------*/
- /* Initialize a clock style */
- /*------------------------------------------------------------------*/
-
- ActionH(dhnd, AID_STYLE_MARS, 0, 0); /* use action handler itself to
- initialize the clock style */
-
- /*------------------------------------------------------------------*/
- /* Subclass the window to get timer ticks and /* start the system */
- /* timer to get a WM_TIMER message ever 500ms */
- /*------------------------------------------------------------------*/
-
- M_OldWinProc = WinSubclassWindow(pEvs->hwnd_client,
- (PFNWP)MyWinProc);
- WinStartTimer(pEvs->hab,
- pEvs->hwnd_client,
- 0,
- 500);
-
- /*------------------------------------------------------------------*/
- /* Bye */
- /*------------------------------------------------------------------*/
-
- return (GS_YES);
- }