b311480e |
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 |
5 | // |
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. |
10 | // |
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. |
13 | // |
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. |
20 | |
7fd59977 |
21 | #ifdef WNT |
22 | |
7fd59977 |
23 | #include <windows.h> |
24 | #include <DrawRessource.h> |
25 | #include <init.h> |
26 | #include <MainWindow.h> |
27 | #include <Draw_Window.hxx> |
28 | #include <CommandWindow.h> |
29 | |
bf03eb83 |
30 | Standard_Boolean Draw_Interprete(const char* command); // Implemented in Draw.cxx |
7fd59977 |
31 | extern Standard_Boolean Draw_IsConsoleSubsystem; |
32 | |
33 | //extern "C" int compat_unlink(const char *fname); // Implemente dans TCL |
34 | |
35 | /*--------------------------------------------------------*\ |
36 | | CLIENT WINDOW PROCEDURE |
37 | | |
38 | | |
39 | \*--------------------------------------------------------*/ |
6a7d83c4 |
40 | LRESULT APIENTRY WndProc(HWND hWndFrame, UINT wMsg, WPARAM wParam, LPARAM lParam ) |
7fd59977 |
41 | { |
42 | HWND hWndClient; |
43 | switch(wMsg) |
44 | { |
45 | case WM_CREATE : |
46 | { |
47 | CreateProc(hWndFrame); |
48 | hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND); |
49 | DrawWindow::hWndClientMDI = hWndClient; |
50 | if (!Draw_IsConsoleSubsystem) |
51 | CreateCommandWindow(hWndFrame,0); |
52 | } |
53 | break; |
54 | |
55 | case WM_COMMAND : |
56 | CommandProc(hWndFrame, wParam, lParam); |
57 | break; |
58 | |
59 | case WM_DESTROY : |
60 | Draw_Interprete("exit"); |
61 | DestroyProc(hWndFrame); |
62 | break; |
63 | |
64 | default : |
65 | hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND); |
66 | return(DefFrameProc(hWndFrame, hWndClient, wMsg, wParam, lParam)); |
67 | } |
68 | return(0l); |
69 | } |
70 | |
71 | |
72 | /*--------------------------------------------------------------------------*\ |
73 | | CLIENT CREATE PROCEDURE |
0d969553 |
74 | | Handler for message WM_CREATE. Creation of control window MDI |
7fd59977 |
75 | | |
76 | \*--------------------------------------------------------------------------*/ |
77 | BOOL CreateProc(HWND hWndFrame) |
78 | { |
773f53f1 |
79 | HWND hWnd = CreateMDIClientWindow (hWndFrame); |
80 | if (hWnd != NULL) |
81 | { |
82 | // Save hWnd in the main window in extra memory in 0 |
7fd59977 |
83 | SetWindowLong(hWndFrame, CLIENTWND, (LONG)hWnd); |
773f53f1 |
84 | } |
7fd59977 |
85 | return(TRUE); |
86 | } |
87 | |
88 | |
89 | /*--------------------------------------------------------------------------*\ |
90 | | COMMAND PROCEDURE |
0d969553 |
91 | | Handler for message WM_COMMAND |
7fd59977 |
92 | | |
93 | \*--------------------------------------------------------------------------*/ |
35e08fe8 |
94 | BOOL CommandProc(HWND hWndFrame, WPARAM wParam, LPARAM /*lParam*/) |
7fd59977 |
95 | { |
773f53f1 |
96 | // Handle on window MDI |
97 | HWND hWndClient = (HWND)GetWindowLong (hWndFrame, CLIENTWND); |
7fd59977 |
98 | switch (LOWORD(wParam)) |
99 | { |
100 | case IDM_WINDOW_NEXT : |
773f53f1 |
101 | if(hWndClient) |
102 | { |
103 | HWND hWndActive = (HWND)SendMessage(hWndClient, WM_MDIGETACTIVE, 0, 0l); |
104 | SendMessage(hWndClient, WM_MDINEXT, (WPARAM)hWndActive, 0l); |
105 | } |
7fd59977 |
106 | break; |
107 | |
108 | case IDM_WINDOW_CASCADE : |
773f53f1 |
109 | if(hWndClient) |
7fd59977 |
110 | SendMessage(hWndClient, WM_MDICASCADE, 0, 0l); |
111 | break; |
112 | |
113 | case IDM_WINDOW_TILEHOR : |
773f53f1 |
114 | if(hWndClient) |
7fd59977 |
115 | SendMessage(hWndClient, WM_MDITILE, MDITILE_HORIZONTAL, 0l); |
116 | break; |
117 | |
118 | case IDM_WINDOW_TILEVERT : |
773f53f1 |
119 | if(hWndClient) |
7fd59977 |
120 | SendMessage(hWndClient, WM_MDITILE, MDITILE_VERTICAL, 0l); |
121 | break; |
122 | |
123 | case IDM_FILE_EXIT : |
124 | Draw_Interprete("exit"); |
125 | //compat_unlink(NULL); |
126 | |
127 | DestroyProc(hWndFrame); |
128 | break; |
129 | } |
130 | return(TRUE); |
131 | } |
132 | |
133 | |
134 | /*--------------------------------------------------------------------------*\ |
135 | | CLIENT DESTROY PROCEDURE |
0d969553 |
136 | | Handler for message WM_DESTROY. |
7fd59977 |
137 | | |
138 | \*--------------------------------------------------------------------------*/ |
139 | VOID DestroyProc(HWND hWnd) |
140 | { |
141 | #ifndef _WIN64 |
142 | HINSTANCE hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); |
143 | #else |
144 | HINSTANCE hInst = (HINSTANCE)GetWindowLong(hWnd, GWLP_HINSTANCE); |
145 | #endif |
146 | Destroy_Appli(hInst); |
147 | PostQuitMessage(0); |
148 | } |
149 | #endif |
150 | |