home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / msj / msjv4_6 / newwave / nwfig23.c < prev   
Encoding:
Text File  |  1989-11-07  |  3.3 KB  |  96 lines

  1. /*********************************************************************/
  2. /*                         CommandProcessor                          */
  3. /*                                                                   */
  4. /* Handle any of the commands passed from the Action Process or API  */
  5. /*                                                                   */
  6. /*          COPYRIGHT HEWLETT-PACKARD COMPANY 1987, 1988             */
  7. /*********************************************************************/
  8.  
  9. void PASCAL   CommandProcessor (hWnd, message, wParam, lParam, intCmd,
  10.                                 pRtn)
  11.     HWND          hWnd;
  12.     unsigned      message;
  13.     WORD          wParam;
  14.     LONG          lParam;
  15.     PINTCMDSTRUCT intCmd;
  16.     LONG          *pRtn;          /* application return error code */
  17. {
  18.     HMENU         hMenu;          
  19.     RECT          rcRect;
  20.  
  21.     switch( intCmd->wCmd )
  22.         {
  23.         case API_MINIMIZE_WINDOW_CDCMD:
  24.             if (IsIconic(hWnd))
  25.                 NW_Restore(hWnd);
  26.             else
  27.                 {
  28.                 if (!IsZoomed(hWnd))
  29.                      GetWindowRect(hWnd, (LPRECT)&gWinPosn.rcRect);
  30.                 NW_Minimize(hWnd);
  31.                 }
  32.             break;
  33.  
  34.         case API_MAXIMIZE_WINDOW_CDCMD:
  35.             if (IsZoomed(hWnd))
  36.                 NW_Restore(hWnd);
  37.             else
  38.                 {
  39.                 if (!IsIconic(hWnd))
  40.                     GetWindowRect(hWnd, (LPRECT)&gWinPosn.rcRect);
  41.                 NW_Maximize(hWnd);
  42.                 }
  43.             break;
  44.  
  45.         case API_RESTORE_WINDOW_CDCMD:
  46.             NW_Restore(hWnd);
  47.             break;                                      
  48.  
  49.         case API_CLOSE_WINDOW_CDCMD:
  50.  
  51.             SaveWindowPosition(hWnd);
  52.             GetWindowRect(hWnd, (LPRECT) &rcRect);      
  53.             ShowWindow(hWnd, SW_HIDE);
  54.             UpdateWindow(hWnd);
  55.             APINotReady(ghAPI, API_NO_MODE);
  56.             if (!OMF_Closing(ghOMF, (LPRECT) &rcRect))
  57.                NoteError();
  58.             break;
  59.  
  60.         case NEW_SHAPE:
  61.             /* get the handle to the menu of the current window */
  62.             hMenu = GetMenu(hWnd);                                
  63.  
  64.             /* Uncheck the old menu item */
  65.             CheckMenuItem(hMenu, gnShape, MF_UNCHECKED);
  66.  
  67.             /* check the new menu item */
  68.             if ((gnShape = intCmd->internal.ICmd) != SHAPE_NONE)
  69.                 CheckMenuItem(hMenu, gnShape, MF_CHECKED);
  70.  
  71.             /* send a paint message */
  72.             InvalidateRect(hWnd, (LPRECT)NULL, TRUE);
  73.             UpdateWindow(hWnd);  /* Force repaint for every shape,
  74.                                     not just last shape, when playing
  75.                                     back several NEW_SHAPE commands */
  76.                       
  77.             /* are there views of the shape program in any other    */
  78.             /* object?  set the new_data flag for all views of      */
  79.             /* shapes */
  80.  
  81.             if (OMF_SetNewData(ghOMF, 0))
  82.                  {
  83.                  /* notify the destinations */                 
  84.                  if (!OMF_AnnounceNewData(ghOMF))
  85.                       NoteError();
  86.                  }
  87.     
  88.             break;
  89.  
  90.         default:
  91.             NoteError();
  92.             break;
  93.         }
  94.  
  95. } /* end of CommandProcessor */
  96.