0027811: Configuration - allow building TKOpenGl with OpenGL ES on Windows
[occt.git] / src / WNT / WNT_Window.hxx
1 // Created on: 1996-01-26
2 // Created by: PLOTNIKOV Eugeny
3 // Copyright (c) 1996-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 #ifndef _WNT_Window_HeaderFile
18 #define _WNT_Window_HeaderFile
19
20 #include <Standard.hxx>
21
22 #if defined(_WIN32) && !defined(OCCT_UWP)
23
24 #include <Standard_Type.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Aspect_Handle.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Aspect_Window.hxx>
29 #include <Standard_CString.hxx>
30 #include <WNT_Dword.hxx>
31 #include <Quantity_NameOfColor.hxx>
32 #include <Standard_Address.hxx>
33 #include <Aspect_TypeOfResize.hxx>
34 #include <Quantity_Ratio.hxx>
35 #include <Aspect_Drawable.hxx>
36 class WNT_WClass;
37 class Aspect_WindowDefinitionError;
38 class Aspect_WindowError;
39
40
41 class WNT_Window;
42 DEFINE_STANDARD_HANDLE(WNT_Window, Aspect_Window)
43
44 //! This class defines Windows NT window
45 class WNT_Window : public Aspect_Window
46 {
47
48 public:
49
50   
51   //! Creates a Window defined by his position and size
52   //! in pixles from the Parent Window.
53   //! Trigger: Raises WindowDefinitionError if the Position out of the
54   //! Screen Space or the window creation failed.
55   Standard_EXPORT WNT_Window(const Standard_CString theTitle, const Handle(WNT_WClass)& theClass, const WNT_Dword& theStyle, const Standard_Integer thePxLeft, const Standard_Integer thePxTop, const Standard_Integer thePxWidth, const Standard_Integer thePxHeight, const Quantity_NameOfColor theBackColor = Quantity_NOC_MATRAGRAY, const Aspect_Handle theParent = 0, const Aspect_Handle theMenu = 0, const Standard_Address theClientStruct = 0);
56   
57   //! Creates a Window based on the existing window handle.
58   //! This handle equals ( aPart1 << 16 ) + aPart2.
59   Standard_EXPORT WNT_Window(const Aspect_Handle aHandle, const Quantity_NameOfColor aBackColor = Quantity_NOC_MATRAGRAY);
60   
61   //! Destroys the Window and all resourses attached to it.
62   Standard_EXPORT ~WNT_Window();
63   
64   //! Sets cursor <aCursor> for ENTIRE WINDOW CLASS to which
65   //! the Window belongs.
66   Standard_EXPORT void SetCursor (const Aspect_Handle aCursor) const;
67   
68   //! Opens the window <me>.
69   Standard_EXPORT virtual void Map() const Standard_OVERRIDE;
70   
71   //! Opens a window <me> according to <aMapMode>.
72   //! This method is specific to Windows NT.
73   //! <aMapMode> can be one of SW_xxx constants defined
74   //! in <windows.h>. See documentation.
75   Standard_EXPORT void Map (const Standard_Integer aMapMode) const;
76   
77   //! Closes the window <me>.
78   Standard_EXPORT virtual void Unmap() const Standard_OVERRIDE;
79   
80   //! Applies the resizing to the window <me>.
81   Standard_EXPORT virtual Aspect_TypeOfResize DoResize() const Standard_OVERRIDE;
82   
83   //! Apply the mapping change to the window <me>
84   //! and returns TRUE if the window is mapped at screen.
85   virtual Standard_Boolean DoMapping() const Standard_OVERRIDE;
86   
87   //! Changes variables due to window position.
88   Standard_EXPORT void SetPos (const Standard_Integer X, const Standard_Integer Y, const Standard_Integer X1, const Standard_Integer Y1);
89   
90   //! Returns True if the window <me> is opened
91   //! and False if the window is closed.
92   Standard_EXPORT virtual Standard_Boolean IsMapped() const Standard_OVERRIDE;
93   
94   //! Returns The Window RATIO equal to the physical
95   //! WIDTH/HEIGHT dimensions.
96   Standard_EXPORT virtual Quantity_Ratio Ratio() const Standard_OVERRIDE;
97   
98   //! Returns The Window POSITION in PIXEL
99   Standard_EXPORT virtual void Position (Standard_Integer& X1, Standard_Integer& Y1, Standard_Integer& X2, Standard_Integer& Y2) const Standard_OVERRIDE;
100   
101   //! Returns The Window SIZE in PIXEL
102   Standard_EXPORT virtual void Size (Standard_Integer& Width, Standard_Integer& Height) const Standard_OVERRIDE;
103   
104   //! Returns the Windows NT handle of the created window <me>.
105   Aspect_Handle HWindow() const;
106   
107   //! Returns the Windows NT handle parent of the created window <me>.
108   Aspect_Handle HParentWindow() const;
109   
110   //! Returns native Window handle (HWND)
111   virtual Aspect_Drawable NativeHandle() const Standard_OVERRIDE;
112   
113   //! Returns parent of native Window handle (HWND on Windows, Window with Xlib, and so on)
114   virtual Aspect_Drawable NativeParentHandle() const Standard_OVERRIDE;
115
116   //! Returns nothing on Windows
117   virtual Aspect_FBConfig NativeFBConfig() const Standard_OVERRIDE { return NULL; }
118
119   DEFINE_STANDARD_RTTIEXT(WNT_Window,Aspect_Window)
120
121 protected:
122
123   Standard_Integer aXLeft;
124   Standard_Integer aYTop;
125   Standard_Integer aXRight;
126   Standard_Integer aYBottom;
127   Handle(WNT_WClass) myWClass;
128   Aspect_Handle myHWindow;
129   Aspect_Handle myHParentWindow;
130   Standard_Boolean myIsForeign;
131
132 };
133
134 #include <WNT_Window.lxx>
135
136 #endif // _WIN32
137 #endif // _WNT_Window_HeaderFile