home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / gik2 / ewyio2eu.d2x / EWYBAEH.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-04  |  12.8 KB  |  213 lines

  1. /*
  2. GIK/2 1.0.1 EWYBAEH.C 5621-432 (C) COPYRIGHT IBM CORP 1993.  ALL RIGHTS RESERVED.  LICENSED MATERIALS - PROPERTY OF IBM.
  3. */
  4. /**********************************************************************/
  5. /*                                                                    */
  6. /*                         MODULE PROLOGUE                            */
  7. /*                                                                    */
  8. /* COMPONENT NAME:   C++ CLASS BROWSER EXAMPLE                        */
  9. /*                                                                    */
  10. /* MODULE NAME:      EWYBAEH.C                                        */
  11. /*                                                                    */
  12. /* DESCRIPTIVE NAME: C++ Parser                                       */
  13. /*                                                                    */
  14. /* PURPOSE:                                                           */
  15. /*                                                                    */
  16. /*   This module contains the event handling functions for the        */
  17. /*   C++ class browser example.                                       */
  18. /*                                                                    */
  19. /* COPYRIGHT:        (C) 1993 IBM Corporation                         */
  20. /*                                                                    */
  21. /* DISCLAIMER OF WARRANTIES.  The following [enclosed] code is        */
  22. /* sample code created by IBM Corporation. This sample code is not    */
  23. /* part of any standard or IBM product and is provided to you solely  */
  24. /* for the purpose of assisting you in the development of your        */
  25. /* applications.  The code is provided "AS IS", without               */
  26. /* warranty of any kind.  IBM shall not be liable for any damages     */
  27. /* arising out of your use of the sample code, even if they have been */
  28. /* advised of the possibility of such damages.                        */
  29. /**********************************************************************/
  30.  
  31. /*--------------------------------------------------------------------*/
  32. /* INCLUDE RELATED DEFINES                                            */
  33. /*--------------------------------------------------------------------*/
  34.  
  35. #define  INCL_DOS                      /* OS/2 definitions            */
  36. #define  INCL_PM                       /* PM definitions              */
  37.  
  38. /*--------------------------------------------------------------------*/
  39. /* HEADER FILES                                                       */
  40. /*--------------------------------------------------------------------*/
  41.  
  42. #include <os2.h>                       /* OS/2 header file            */
  43. #include <ewyga.h>                     /* GIK/2 header file           */
  44. #include "ewybadf.h"                   /* Generated header file       */
  45. #include "ewybacc.h"                   /* toolcode                    */
  46.  
  47. /*--------------------------------------------------------------------*/
  48. /* LOCAL FUNCTION PROTOTYPES                                          */
  49. /*--------------------------------------------------------------------*/
  50.  
  51. SHORT GSENTRY EvDoubleClick(DHND,SHORT,EVS_DOUBLE_CLICK *);
  52. SHORT GSENTRY EvExit(DHND,SHORT,EVS_EXIT *);
  53. SHORT GSENTRY EvOpen(DHND,SHORT,EVS_OPEN *);
  54.  
  55. /**********************************************************************/
  56. /* EvDoubleClick                                                      */
  57. /*                                                                    */
  58. /* Parameters:                                                        */
  59. /*    DHND                     dhnd  (I): Diagram handle.             */
  60. /*    SHORT                    ev_id (I): Identifies the event.       */
  61. /*    EVS_DOUBLE_CLICK         *pEvs (I): Pointer to instance of event*/
  62. /*                                        data type.                  */
  63. /*     SHND   shnd (I):            Handle of the symbol               */
  64. /*     SHORT  part_ref (I):        Reference number of the symbol part*/
  65. /*     USHORT button (I):          Mouse button that is pressed       */
  66. /*                                 It is one of the following:        */
  67. /*                                   GS_MB1                           */
  68. /*                                   GS_MB2                           */
  69. /*                                                                    */
  70. /* Returns:                                                           */
  71. /*   GS_NO        Any changes made to symbols remain and the action   */
  72. /*                stops.                                              */
  73. /*   GS_NO_1      Any changes made to symbols remain and the action   */
  74. /*                stops.                                              */
  75. /*   GS_RESTORE   Any changes made to symbols since the last undo     */
  76. /*                checkpoint are undone and the action stops.         */
  77. /*   GS_RESTORE_1 Any changes made to symbols since the last undo     */
  78. /*                checkpoint are undone and the action stops.         */
  79. /*   GS_YES       The default processing continues.                   */
  80. /*                                                                    */
  81. /* Description:                                                       */
  82. /*    The function handles the event EV_DOUBLE_CLICK.                 */
  83. /*                                                                    */
  84. /*    (if the user double clicks mb1 on a class symbol,               */
  85. /*     the C++ class methods will be displayed)                       */
  86. /**********************************************************************/
  87.  
  88. SHORT GSENTRY EvDoubleClick(DHND dhnd,SHORT ev_id,EVS_DOUBLE_CLICK *pEvs
  89. )
  90. {
  91.  
  92.   /********************************************************************/
  93.   /* ** if button 1 doubleclicked, show the class methods **          */
  94.   /********************************************************************/
  95.  
  96.   if (pEvs->button == GS_MB1)
  97.   {
  98.     ShowClassMethods(dhnd, pEvs->shnd);
  99.     return  GS_NO;
  100.   }
  101.   else
  102.     return  GS_YES;
  103. }
  104.  
  105. /**********************************************************************/
  106. /* EvExit                                                             */
  107. /*                                                                    */
  108. /* Parameters:                                                        */
  109. /*    DHND                     dhnd  (I): Diagram handle.             */
  110. /*    SHORT                    ev_id (I): Identifies the event.       */
  111. /*    EVS_EXIT                 *pEvs (I): Pointer to instance of event*/
  112. /*                                        data type.                  */
  113. /*     SHORT close (I):            Indicator that specifies whether   */
  114. /*                                 the event is triggered during the  */
  115. /*                                 processing of the WM_CLOSE or the  */
  116. /*                                 WM_DESTROY message                 */
  117. /*                                 It is one of the following:        */
  118. /*                                   GS_YES. The WM_CLOSE message is  */
  119. /*                                           processed.               */
  120. /*                                   GS_NO.  The WM_DESTROY message is*/
  121. /*                                           processed.               */
  122. /*     HAB   hab (I):              Handle to anchor block             */
  123. /*     HWND  hwnd_client (I):      Handle to client window            */
  124. /*     HWND  hwnd_frame (I):       Handle to frame window             */
  125. /*     SHORT delay_mode (I):       Indicates whether the function     */
  126. /*                                 GsDelay is currently processing.   */
  127. /*                                 It is GS_YES or GS_NO              */
  128. /*                                                                    */
  129. /* Returns:                                                           */
  130. /*   GS_NO        Any changes made to symbols remain and the action   */
  131. /*                stops.                                              */
  132. /*   GS_NO_1      Any changes made to symbols remain and the action   */
  133. /*                stops.                                              */
  134. /*   GS_RESTORE   Any changes made to symbols since the last undo     */
  135. /*                checkpoint are undone and the action stops.         */
  136. /*   GS_RESTORE_1 Any changes made to symbols since the last undo     */
  137. /*                checkpoint are undone and the action stops.         */
  138. /*   GS_YES       The default processing continues.                   */
  139. /*                                                                    */
  140. /* Description:                                                       */
  141. /*    The function handles the event EV_EXIT.                         */
  142. /*                                                                    */
  143. /*    (just to prevent the ... save diagram ... message, which        */
  144. /*     is not needed in this example as the data comes from the       */
  145. /*     c++ header files)                                              */
  146. /**********************************************************************/
  147.  
  148. SHORT GSENTRY EvExit(DHND dhnd,SHORT ev_id,EVS_EXIT *pEvs)
  149. {
  150.  
  151.   /********************************************************************/
  152.   /* ** to prevent the ... save diagram ... message stuff **          */
  153.   /********************************************************************/
  154.  
  155.   GsPutDiagModify(dhnd, GS_NO);
  156.   return  GS_YES;
  157. }
  158.  
  159. /**********************************************************************/
  160. /* EvOpen                                                             */
  161. /*                                                                    */
  162. /* Parameters:                                                        */
  163. /*    DHND                     dhnd  (I): Diagram handle.             */
  164. /*    SHORT                    ev_id (I): Identifies the event.       */
  165. /*    EVS_OPEN                 *pEvs (I): Pointer to instance of event*/
  166. /*                                        data type.                  */
  167. /*     CHAR *pFile_spec (I/O):     Pointer to a memory block of the   */
  168. /*                                 length GS_FILE_SPEC_LEN+1 bytes    */
  169. /*                                 At input, this member contains the */
  170. /*                                 fully qualified file specification */
  171. /*                                 that was selected with the Open    */
  172. /*                                 dialog box. At output, this member */
  173. /*                                 specifies from where the diagram is*/
  174. /*                                 opened. It can be one of the       */
  175. /*                                 following:                         */
  176. /*                                   A full-qualified file            */
  177. /*                                     specification to open          */
  178. /*                                   A GSS_IO_HANDLER data instance   */
  179. /*                                   NULL to use the formerly defined */
  180. /*                                     file specification.            */
  181. /*                                                                    */
  182. /* Returns:                                                           */
  183. /*   GS_NO        Any changes made to symbols remain and the action   */
  184. /*                stops.                                              */
  185. /*   GS_NO_1      Any changes made to symbols remain and the action   */
  186. /*                stops.                                              */
  187. /*   GS_REJECT    The attempt to end the action is rejected and the   */
  188. /*                graphics editor retries the action processing.      */
  189. /*   GS_RESTORE   Any changes made to symbols since the last undo     */
  190. /*                checkpoint are undone and the action stops.         */
  191. /*   GS_RESTORE_1 Any changes made to symbols since the last undo     */
  192. /*                checkpoint are undone and the action stops.         */
  193. /*   GS_YES       The default processing continues.                   */
  194. /*                                                                    */
  195. /* Description:                                                       */
  196. /*    The function handles the event EV_OPEN.                         */
  197. /*                                                                    */
  198. /*    (overrides the standard diagram open, reads in a c++ header     */
  199. /*     file and draws the class structure)                            */
  200. /**********************************************************************/
  201.  
  202. SHORT GSENTRY EvOpen(DHND dhnd,SHORT ev_id,EVS_OPEN *pEvs)
  203. {
  204.  
  205.   /********************************************************************/
  206.   /* ** build new tree **                                             */
  207.   /********************************************************************/
  208.  
  209.   BuildTree(dhnd, pEvs->pFile_spec);
  210.   GsUpdateGraphics(dhnd);
  211.   return  GS_NO;
  212. }
  213.