1 // Created on: 1998-08-06
2 // Created by: Administrateur Atelier MDL
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
28 #include <DrawRessource.h>
30 #include <MainWindow.h>
31 #include <Draw_Window.hxx>
32 #include <CommandWindow.h>
34 Standard_Boolean Draw_Interprete(const char* command); // Implemented in Draw.cxx
35 extern Standard_Boolean Draw_IsConsoleSubsystem;
37 //extern "C" int compat_unlink(const char *fname); // Implemente dans TCL
39 /*--------------------------------------------------------*\
40 | CLIENT WINDOW PROCEDURE
43 \*--------------------------------------------------------*/
44 LRESULT APIENTRY WndProc(HWND hWndFrame, UINT wMsg, WPARAM wParam, LPARAM lParam )
51 CreateProc(hWndFrame);
52 hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND);
53 DrawWindow::hWndClientMDI = hWndClient;
54 if (!Draw_IsConsoleSubsystem)
55 CreateCommandWindow(hWndFrame,0);
60 CommandProc(hWndFrame, wParam, lParam);
64 Draw_Interprete("exit");
65 DestroyProc(hWndFrame);
69 hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND);
70 return(DefFrameProc(hWndFrame, hWndClient, wMsg, wParam, lParam));
76 /*--------------------------------------------------------------------------*\
77 | CLIENT CREATE PROCEDURE
78 | Handler for message WM_CREATE. Creation of control window MDI
80 \*--------------------------------------------------------------------------*/
81 BOOL CreateProc(HWND hWndFrame)
85 // Save hWnd in the main window in extra memory in 0
86 if (hWnd = CreateMDIClientWindow(hWndFrame))
87 SetWindowLong(hWndFrame, CLIENTWND, (LONG)hWnd);
92 /*--------------------------------------------------------------------------*\
94 | Handler for message WM_COMMAND
96 \*--------------------------------------------------------------------------*/
97 BOOL CommandProc(HWND hWndFrame, WPARAM wParam, LPARAM /*lParam*/)
99 HWND hWndClient; // Handle on window MDI
102 hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND);
103 switch (LOWORD(wParam))
105 case IDM_WINDOW_NEXT :
106 if(hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND))
107 hWndActive = (HWND)SendMessage(hWndClient, WM_MDIGETACTIVE, 0, 0l);
108 SendMessage(hWndClient, WM_MDINEXT, (WPARAM)hWndActive, 0l);
111 case IDM_WINDOW_CASCADE :
112 if(hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND))
113 SendMessage(hWndClient, WM_MDICASCADE, 0, 0l);
116 case IDM_WINDOW_TILEHOR :
117 if(hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND))
118 SendMessage(hWndClient, WM_MDITILE, MDITILE_HORIZONTAL, 0l);
121 case IDM_WINDOW_TILEVERT :
122 if(hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND))
123 SendMessage(hWndClient, WM_MDITILE, MDITILE_VERTICAL, 0l);
127 Draw_Interprete("exit");
128 //compat_unlink(NULL);
130 DestroyProc(hWndFrame);
137 /*--------------------------------------------------------------------------*\
138 | CLIENT DESTROY PROCEDURE
139 | Handler for message WM_DESTROY.
141 \*--------------------------------------------------------------------------*/
142 VOID DestroyProc(HWND hWnd)
145 HINSTANCE hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
147 HINSTANCE hInst = (HINSTANCE)GetWindowLong(hWnd, GWLP_HINSTANCE);
149 Destroy_Appli(hInst);