1 // Created on: 1998-08-06
2 // Created by: Administrateur Atelier MDL
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
21 #include <Draw_Window.hxx>
23 #include "Draw_WNTCommandWindow.pxx"
24 #include "Draw_WNTInit.pxx"
25 #include "Draw_WNTMainWindow.pxx"
26 #include "Draw_WNTRessource.pxx"
28 Standard_Boolean Draw_Interprete(const char* command); // Implemented in Draw.cxx
29 extern Standard_Boolean Draw_IsConsoleSubsystem;
31 /*--------------------------------------------------------*\
32 | CLIENT WINDOW PROCEDURE
35 \*--------------------------------------------------------*/
36 LRESULT APIENTRY WndProc(HWND hWndFrame, UINT wMsg, WPARAM wParam, LPARAM lParam )
42 CreateProc (hWndFrame);
43 HWND hWndClient = (HWND )GetWindowLongPtrW (hWndFrame, CLIENTWND);
44 Draw_Window::hWndClientMDI = hWndClient;
45 if (!Draw_IsConsoleSubsystem)
47 CreateCommandWindow (hWndFrame, 0);
53 CmdProc (hWndFrame, LOWORD(wParam), wParam, lParam);
58 Draw_Interprete ("exit");
59 DestroyProc (hWndFrame);
63 HWND hWndClient = (HWND)GetWindowLongPtrW(hWndFrame, CLIENTWND);
64 return DefFrameProcW(hWndFrame, hWndClient, wMsg, wParam, lParam);
68 /*--------------------------------------------------------------------------*\
69 | CLIENT CREATE PROCEDURE
70 | Handler for message WM_CREATE. Creation of control window MDI
72 \*--------------------------------------------------------------------------*/
73 BOOL CreateProc(HWND hWndFrame)
75 HWND hWnd = CreateMDIClientWindow (hWndFrame);
78 // Save hWnd in the main window in extra memory in 0
79 SetWindowLongPtrW (hWndFrame, CLIENTWND, (LONG_PTR)hWnd);
84 /*--------------------------------------------------------------------------*\
86 | Handler for message WM_COMMAND
87 | It is used when Draw_IsConsoleSubsystem = Standard_False
88 | i.e. in non-console mode (see Draw_main() in Draw_Main.cxx).
89 \*--------------------------------------------------------------------------*/
90 LRESULT APIENTRY CmdProc(HWND hWndFrame, UINT wMsg, WPARAM /*wParam*/, LPARAM /*lParam*/)
92 // Handle on window MDI
93 HWND hWndClient = (HWND )GetWindowLongPtrW (hWndFrame, CLIENTWND);
98 if (hWndClient != NULL)
100 HWND hWndActive = (HWND )SendMessageW (hWndClient, WM_MDIGETACTIVE, 0, 0l);
101 SendMessageW (hWndClient, WM_MDINEXT, (WPARAM )hWndActive, 0l);
105 case IDM_WINDOW_CASCADE:
107 if (hWndClient != NULL)
109 SendMessageW (hWndClient, WM_MDICASCADE, 0, 0l);
113 case IDM_WINDOW_TILEHOR:
115 if (hWndClient != NULL)
117 SendMessageW (hWndClient, WM_MDITILE, MDITILE_HORIZONTAL, 0l);
121 case IDM_WINDOW_TILEVERT:
123 if (hWndClient != NULL)
125 SendMessageW (hWndClient, WM_MDITILE, MDITILE_VERTICAL, 0l);
131 Draw_Interprete ("exit");
132 DestroyProc (hWndFrame);
139 /*--------------------------------------------------------------------------*\
140 | CLIENT DESTROY PROCEDURE
141 | Handler for message WM_DESTROY.
143 \*--------------------------------------------------------------------------*/
144 VOID DestroyProc(HWND hWnd)
146 HINSTANCE hInst = (HINSTANCE )GetWindowLongPtrW (hWnd, GWLP_HINSTANCE);
148 Destroy_Appli(hInst);