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