0028223: Projection of closed curve onto cylinder is wrong
[occt.git] / src / Draw / init.cxx
CommitLineData
b311480e 1// Created on: 1998-08-06
2// Created by: Administrateur Atelier MDL
3// Copyright (c) 1998-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
57c28b61 17#ifdef _WIN32
7fd59977 18
19// include windows.h first to have all definitions available
20#include <windows.h>
21
22#include "Draw_Window.hxx"
23#include "DrawRessource.h"
24#include "init.h"
25#include "MainWindow.h"
26#include "CommandWindow.h"
27
28
29#define USEDEFAULT 200
30
31
32/*--------------------------------------------------------*\
33| REGISTER APPLICATION CLASS
34| Enregistrement des classes de fenetres de l'application
35|
36d\*--------------------------------------------------------*/
37
38BOOL RegisterAppClass(HINSTANCE hInstance)
39{
40 WNDCLASS wndClass;
41
42 // Parametres communs aux classes
43 //-----
44 wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_CLASSDC;
45 wndClass.cbClsExtra = 0;
46 wndClass.hCursor = LoadCursor(NULL,IDC_ARROW);
47 wndClass.hInstance = hInstance;
48
49 // Enregistrement de la fenetre principale
50 //-----
51 wndClass.cbWndExtra = sizeof(LONG);
52 wndClass.lpfnWndProc = (WNDPROC)WndProc;
53 wndClass.hIcon = (HICON)LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
54 wndClass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
55 wndClass.lpszMenuName = MAKEINTRESOURCE(APPMENU);
56 wndClass.lpszClassName = APPCLASS;
57
58 if(!RegisterClass(&wndClass))
59 return(FALSE);
60
61 // Enregistrement de la fenetre DrawWindow
62 //------
63 wndClass.cbWndExtra = sizeof(LONG); // Extra Memory
64 wndClass.lpfnWndProc = (WNDPROC)DrawWindow::DrawProc;
65 wndClass.hIcon = 0;
66 wndClass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
67 wndClass.lpszMenuName = NULL;
68 wndClass.lpszClassName = DRAWCLASS;
69
70 if(!RegisterClass(&wndClass))
71 {
72 UnregisterClass(APPCLASS, hInstance);
73 return(FALSE);
74 }
75
76
77 // Enregistrement de la fenetre CommandWindow
78 //------
839b8d3c 79 wndClass.lpfnWndProc = (WNDPROC)CmdProc;
7fd59977 80 wndClass.hIcon = 0;
81 wndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
82 wndClass.lpszMenuName = NULL;
83 wndClass.lpszClassName = COMMANDCLASS;
84
85 if(!RegisterClass(&wndClass))
86 {
87 UnregisterClass(APPCLASS, hInstance);
88 UnregisterClass(DRAWCLASS, hInstance);
89 return(FALSE);
90 }
91
92 return(TRUE);
93}
94
95
96/*--------------------------------------------------------*\
97| UNREGISTER APPLICATION CLASS
98| Suppression des classes de fenetres de l'application
99|
100\*--------------------------------------------------------*/
101VOID UnregisterAppClass(HINSTANCE hInstance)
102{
103 UnregisterClass(APPCLASS, hInstance);
104 UnregisterClass(DRAWCLASS, hInstance);
105}
106
107
108/*--------------------------------------------------------*\
109| CREATE APPLICATION WINDOW
110| Creation de la fenetre Top-Level
111|
112\*--------------------------------------------------------*/
113HWND CreateAppWindow(HINSTANCE hInstance)
114{
115 return(CreateWindow(APPCLASS, APPTITLE,
116 WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
117 400,0,
118 623,767,
119 NULL, NULL, hInstance, NULL));
120}
121
122
123/*--------------------------------------------------------*\
124| CREATE MDI CLIENT WINDOW
125| Creation de la fenetre qui contient des fenetres MDI
126|
127\*--------------------------------------------------------*/
128HWND CreateMDIClientWindow(HWND hWndFrame)
129{
130 HWND hWndClient;
131 HANDLE hInstance;
132 CLIENTCREATESTRUCT ccs;
133
134 // Initialisation de la structure client
135 ccs.hWindowMenu = NULL;
136 ccs.idFirstChild = 0;
137
e89e2d67 138 hInstance = (HANDLE)GetWindowLongPtr(hWndFrame, GWLP_HINSTANCE);
7fd59977 139
140 hWndClient = CreateWindow("MDICLIENT",NULL,
141 WS_CHILD | WS_CLIPSIBLINGS |
142 WS_VISIBLE | MDIS_ALLCHILDSTYLES,
143 0, 0, 1, 1,
144 hWndFrame, NULL,
145 (HINSTANCE)hInstance, (LPVOID)&ccs);
146 return(hWndClient);
147}
148#endif