Пример #1
0
	//--------------------------------------------------------------------------------
	bool CNCController::ProcessMessage( COSWindow& Window, Cmp_long_ptr& lResult, unsigned int uMsg, Cmp_uint_ptr Cmp_uint_ptr, Cmp_long_ptr Cmp_long_ptr )
	{
		_WINQ_FCONTEXT( "CNCController::ProcessMessage" );

		bool bProcessed = ProcessHook( Window, lResult, uMsg, Cmp_uint_ptr, Cmp_long_ptr );

        if( bProcessed )
        {
            return true;
        }

		switch ( uMsg )
		{
		case COSWindow::wmNCCreate:
			{
				OnNCCreate( Window, lResult, Cmp_uint_ptr, Cmp_long_ptr );
				bProcessed = true;
			}
			break;

		case COSWindow::wmNCActivate:
			{
				OnNCActivate( Window, lResult, Cmp_uint_ptr, Cmp_long_ptr );
				bProcessed = true;
			}
			break;

		case COSWindow::wmNCDestroy:
			{
				OnNCDestroy( Window, lResult, Cmp_uint_ptr, Cmp_long_ptr );
				bProcessed = false;//The top level window must see this to clean up
			}
			break;
		}

		return bProcessed;
	}
//---------------------------------------------------------------------
// ClientWindowProc(): 
//---------------------------------------------------------------------
LRESULT WPPALLETE::ClientWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{              
   // Process window message.               
   switch (uMsg)
   {
      case WM_CREATE:
         // Store the window handle for use later.
         SetHandle(hWnd);
         // Let notebook object know that create message is being processed.
         // NOTE: Here is where folder objects have a chance to animate
         //       the zoom effect for window creation.
         OnCreate();
         // Return success so we can continue with the creation of window.
         return ((LRESULT)0);
         
      case WM_ACTIVATE:
         OnActivate(((wParam==WA_INACTIVE)? TRUE : FALSE));
         return (TRUE);
            
      case WM_COMMAND:            
         OnCommand((HWND)LOWORD(lParam),HIWORD(lParam));
         break;
                          
      case WM_SYSCOMMAND:
         // A system command has been requested.
         OnSysCommand((WORD)wParam,lParam);
         break;
         
      case WM_SETTEXT:     
         // Set new window caption text.
         DefWindowProc(hWnd,uMsg,wParam,lParam);
         // Update window caption.
         OnNCPaint();
         break;  
         
      case WM_QUERYDRAGICON:
         return (OnQueryDragIcon());

      case WM_ERASEBKGND:
         OnEraseBackground((HDC)wParam);
         break;
         
      case WM_PAINT:
         OnPaint();
         break;

      case WM_NCACTIVATE: 
         // Handle this message ONLY if the non-client area is becoming active OR
         // the window becoming active or inactive is not a notebook page (modeless dialog).
         // else, do not update non-client area to prevent flickering effect with 
         // notebook window caption.
         OnNCActivate((BOOL)wParam);
         return (TRUE);
           
      case WM_NCPAINT:         
         OnNCPaint();
         return (NULL);
         
      case WM_NCMOUSEMOVE:
         OnNCMouseMove((WORD)wParam,MAKEPOINT(lParam));
         break;
         
      case WM_NCLBUTTONUP:       
      case WM_NCLBUTTONDOWN:
         OnNCLButton(uMsg,(WORD)wParam,MAKEPOINT(lParam));
         break;
         
      case WM_MOUSEMOVE:
         OnMouseMove();
         break;
                   
      case WM_MOVE:
         OnMove(MAKEPOINT(lParam));
         break;                      
                                                              
      case WM_SIZE: 
         OnSize((WORD)wParam,LOWORD(lParam),HIWORD(lParam));
         break;
                    
      case WM_CLOSE:        
         OnClose();
         break;
    
      default:                              
         // Call the default window procedure.
         return (DefWindowProc(hWnd,uMsg,wParam,lParam));
  }                           
                                              
  // We are done processing the window message...                                              
  return (NULL);
}
//---------------------------------------------------------------------
// ClientWindowProc():
//---------------------------------------------------------------------
LRESULT WPNOTEBOOK::ClientWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
   // Process window message.
   switch (uMsg)
   {
      case WM_CREATE:
         // Store the window handle for use later.
         SetHandle(hWnd);
         // Let notebook object know that create message is being processed.
         // NOTE: Here is where folder objects have a chance to animate
         //       the zoom effect for window creation.
         OnCreate();
         // Return success so we can continue with the creation of window.
         return ((LRESULT)0);

      case WM_ACTIVATE:
         OnActivate(((wParam==WA_INACTIVE)? TRUE : FALSE));
         return (TRUE);

      // We don't want the client area to have the focus, since it
      // doesn't accept input.  When it gets the focus, which it will
      // when the window is restored from a minimized state, for
      // instance, post a user message to ourselves to reset the
      // focus to the notebook.  Posting the message is necessary
      // because the focus shouldn't be tampered with when processing
      // a WM_SETFOCUS or WM_KILLFOCUS message.
      case WM_SETFOCUS:
         PostMessage(hWnd,WM_WPS_NOTEBOOK_SETFOCUS,0,0L);
         break;

      case WM_WPS_NOTEBOOK_SETFOCUS:
         // Give focus to notebook control in our client area.
         SetFocus(GetDlgItem(hWnd,IDC_NOTEBOOK));
         break;

      case WM_COMMAND:
         if (wParam==IDC_NOTEBOOK)
            OnCommand((HWND)LOWORD(lParam),HIWORD(lParam));
         break;

      case WM_SYSCOMMAND:
         // A system command has been requested.
         OnSysCommand((WORD)wParam,lParam);
         break;

      case WM_SETTEXT:
         // Set new window caption text.
         DefWindowProc(hWnd,uMsg,wParam,lParam);
         // Update window caption.
         OnNCPaint();
         break;

      case WM_QUERYDRAGICON:
         return (OnQueryDragIcon());

      case WM_ERASEBKGND:
         OnEraseBackground((HDC)wParam);
         break;

      case WM_NCACTIVATE:
         // Handle this message ONLY if the non-client area is becoming active OR
         // the window becoming active or inactive is not a notebook page (modeless dialog).
         // else, do not update non-client area to prevent flickering effect with
         // notebook window caption.
         if ((((BOOL)wParam)==TRUE)||(IsPageWindow((HWND)LOWORD(lParam))==FALSE))
            OnNCActivate((BOOL)wParam);
         return (TRUE);

      case WM_NCPAINT:
         OnNCPaint();
         return (NULL);

      case WM_NCMOUSEMOVE:
         OnNCMouseMove((WORD)wParam,MAKEPOINT(lParam));
         break;

      case WM_NCLBUTTONUP:
      case WM_NCLBUTTONDOWN:
         OnNCLButton(uMsg,(WORD)wParam,MAKEPOINT(lParam));
         break;

      case WM_MOUSEMOVE:
         OnMouseMove();
         break;

      case WM_MOVE:
         OnMove(MAKEPOINT(lParam));
         break;

      case WM_SIZE:
         OnSize((WORD)wParam,LOWORD(lParam),HIWORD(lParam));
         break;

      case WM_CLOSE:
         OnClose();
         break;

      default:
         // Call the default window procedure.
         return (DefWindowProc(hWnd,uMsg,wParam,lParam));
  }

  // We are done processing the window message...
  return (NULL);
}