0031709: Draw Harness - move methods ViewerTest::ParseOnOff()/ParseColor() to package...
[occt.git] / src / Draw / Draw_Main.hxx
1 // Created on: 1999-12-30
2 // Created by: data exchange team
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 // Defines common framework for declaration of main/WinMain functions 
18 // for executbales on UNIX and WNT that extends DRAW Test Harness.
19
20 // In order to create executable in DRAW environment, in the executable
21 // the following line should be added:
22 // DRAW_MAIN
23
24 #ifndef Draw_Main_HeaderFile
25 #define Draw_Main_HeaderFile
26
27 #include <Standard_TypeDef.hxx>
28 #include <Draw_Appli.hxx>
29 #include <Standard_PCharacter.hxx>
30
31 typedef void (*FDraw_InitAppli)(Draw_Interpretor&);
32
33 Standard_EXPORT Standard_Integer Draw_Main (Standard_Integer argc, Standard_PCharacter argv[], const FDraw_InitAppli Draw_InitAppli);
34
35 // Declarations of macros DRAW_MAIN to be used in executables instead of explicit main/WinMain
36 #ifdef _WIN32
37
38 #include <windows.h>
39
40 Standard_EXPORT Standard_Integer Draw_WinMain (HINSTANCE hInstance,
41                                                HINSTANCE hPrevinstance, 
42                                                LPSTR lpCmdLine,
43                                                Standard_Integer nCmdShow,
44                                                const FDraw_InitAppli Draw_InitAppli);
45
46 // WinMain() and main()
47 #define DRAW_MAIN Standard_Integer PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevinstance, LPSTR lpCmdLine, Standard_Integer nCmdShow) \
48 { return Draw_WinMain (hInstance, hPrevinstance, lpCmdLine, nCmdShow, Draw_InitAppli); } \
49 \
50 int main (int argc, char* argv[]) \
51 { return Draw_Main (argc, argv, Draw_InitAppli); }
52
53 #else
54
55 // main()
56 #define DRAW_MAIN int main (Standard_Integer argc, char* argv[]) \
57 { return Draw_Main (argc, argv, Draw_InitAppli); }
58
59 #endif
60
61 #endif