004a8c3079384772df0bcf5b857f79bbc7a62895
[occt.git] / src / Draw / Draw_Appli.hxx
1 // Created on: 1992-04-07
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1992-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
21
22 // JR 21 Oct 1999 : Change for Draw_Init_Appli which is in main and is
23 //                  called from Draw ===> undefined symbol on UNIX
24 //                                   ===> duplication of code on NT :
25 //                  One argument added to DrawAppli : Draw_Init_Appli ===>
26 //                  Draw_Appli of Draw/TKDraw may call Draw_Init_Appli
27
28 #ifndef Draw_Appli_HeaderFile
29 #define Draw_Appli_HeaderFile
30
31
32 #include <Draw_Viewer.hxx>
33 #include <Draw.hxx>
34
35 typedef void (*FDraw_InitAppli)(Draw_Interpretor&);
36
37 #ifdef WNT
38 #include <windows.h>
39 //extern void Draw_Appli(HINSTANCE,HINSTANCE,LPSTR,int);
40 Standard_EXPORT void Draw_Appli(HINSTANCE,HINSTANCE,LPSTR,int,
41                        const FDraw_InitAppli Draw_InitAppli);
42 #else
43 extern void Draw_Appli(Standard_Integer argc, char** argv,
44                        const FDraw_InitAppli Draw_InitAppli);
45 #endif
46
47
48
49 #if defined(WNT) && !defined(HAVE_NO_DLL)
50 #ifndef __Draw_API
51 # ifdef __Draw_DLL
52 #  define __Draw_API __declspec ( dllexport )
53 # else
54 #  define __Draw_API __declspec ( dllimport )
55 # endif
56 #endif
57 #else
58 #  define __Draw_API  
59 #endif
60
61
62 #ifndef WNT
63 extern Draw_Viewer dout;
64 extern Standard_Boolean Draw_Batch;
65 #endif
66
67 class Draw_SaveAndRestore {
68
69   public :
70
71 //    __Draw_API Draw_SaveAndRestore 
72     Standard_EXPORT Draw_SaveAndRestore 
73       (const char* name,
74        Standard_Boolean (*test)(const Handle(Draw_Drawable3D)&),
75        void (*save)(const Handle(Draw_Drawable3D)&, ostream&),
76        Handle(Draw_Drawable3D) (*restore) (istream&),
77        Standard_Boolean display = Standard_True);
78
79
80   const char* Name() const {return myName;}
81   Standard_Boolean Test(const Handle(Draw_Drawable3D)&d);
82   void Save(const Handle(Draw_Drawable3D)& d, ostream& os) const;
83   Handle(Draw_Drawable3D) Restore(istream&) const;
84   Standard_Boolean Disp() const {return myDisplay;}
85   Draw_SaveAndRestore* Next() {return myNext;}
86
87   private :
88     
89     const char* myName;
90     Standard_Boolean (*myTest)(const Handle(Draw_Drawable3D)&);
91     void (*mySave)(const Handle(Draw_Drawable3D)&, ostream&);
92     Handle(Draw_Drawable3D) (*myRestore) (istream&);
93     Standard_Boolean myDisplay;
94     Draw_SaveAndRestore* myNext;
95     
96 };
97
98 #endif
99
100
101