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.
19 // include windows.h first to have all definitions available
22 #include "Draw_Window.hxx"
23 #include "Draw_WNTRessource.pxx"
24 #include "Draw_WNTInit.pxx"
25 #include "Draw_WNTMainWindow.pxx"
26 #include "Draw_WNTCommandWindow.pxx"
28 #define USEDEFAULT 200
30 /*--------------------------------------------------------*\
31 | REGISTER APPLICATION CLASS
32 | Enregistrement des classes de fenetres de l'application
34 \*--------------------------------------------------------*/
35 BOOL RegisterAppClass (HINSTANCE theInstance)
39 // Parametres communs aux classes
41 wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_CLASSDC;
42 wndClass.cbClsExtra = 0;
43 wndClass.hCursor = LoadCursor (NULL, IDC_ARROW);
44 wndClass.hInstance = theInstance;
46 // Enregistrement de la fenetre principale
48 wndClass.cbWndExtra = sizeof(void*);
49 wndClass.lpfnWndProc = (WNDPROC)WndProc;
50 wndClass.hIcon = LoadIconW (theInstance, MAKEINTRESOURCEW(IDI_ICON1));
51 wndClass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
52 wndClass.lpszMenuName = MAKEINTRESOURCEW(APPMENU);
53 wndClass.lpszClassName = APPCLASS;
54 if (!RegisterClassW (&wndClass))
59 // Enregistrement de la fenetre DrawWindow
61 wndClass.cbWndExtra = sizeof(void*); // Extra Memory
62 wndClass.lpfnWndProc = (WNDPROC)Draw_Window::DrawProc;
64 wndClass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
65 wndClass.lpszMenuName = NULL;
66 wndClass.lpszClassName = DRAWCLASS;
67 if (!RegisterClassW (&wndClass))
69 UnregisterClassW (APPCLASS, theInstance);
73 // Enregistrement de la fenetre CommandWindow
75 wndClass.lpfnWndProc = (WNDPROC)CommandProc;
77 wndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
78 wndClass.lpszMenuName = NULL;
79 wndClass.lpszClassName = COMMANDCLASS;
80 if (!RegisterClassW (&wndClass))
82 UnregisterClassW (APPCLASS, theInstance);
83 UnregisterClassW (DRAWCLASS, theInstance);
90 /*--------------------------------------------------------*\
91 | UNREGISTER APPLICATION CLASS
92 | Suppression des classes de fenetres de l'application
94 \*--------------------------------------------------------*/
95 VOID UnregisterAppClass (HINSTANCE theInstance)
97 UnregisterClassW (APPCLASS, theInstance);
98 UnregisterClassW (DRAWCLASS, theInstance);
101 /*--------------------------------------------------------*\
102 | CREATE APPLICATION WINDOW
103 | Creation de la fenetre Top-Level
105 \*--------------------------------------------------------*/
106 HWND CreateAppWindow (HINSTANCE theInstance)
108 return CreateWindowW (APPCLASS, APPTITLE,
109 WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
112 NULL, NULL, theInstance, NULL);
115 /*--------------------------------------------------------*\
116 | CREATE MDI CLIENT WINDOW
117 | Creation de la fenetre qui contient des fenetres MDI
119 \*--------------------------------------------------------*/
120 HWND CreateMDIClientWindow (HWND theWndFrame)
122 CLIENTCREATESTRUCT ccs;
123 ccs.hWindowMenu = NULL;
124 ccs.idFirstChild = 0;
126 HINSTANCE hInstance = (HINSTANCE )GetWindowLongPtrW (theWndFrame, GWLP_HINSTANCE);
127 HWND hWndClient = CreateWindowW (L"MDICLIENT", NULL,
128 WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | MDIS_ALLCHILDSTYLES,
131 hInstance, (LPVOID )&ccs);