0030619: Draw Harness, ViewerTest - add continuous rendering option to vrepaint command
[occt.git] / src / WNT / WNT_Window.hxx
CommitLineData
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>
42cf5bc1 21
1ce0716b 22#if defined(_WIN32) && !defined(OCCT_UWP)
23
24#include <Standard_Type.hxx>
42cf5bc1 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>
42cf5bc1 34#include <Aspect_Drawable.hxx>
35class WNT_WClass;
36class Aspect_WindowDefinitionError;
37class Aspect_WindowError;
38
39
40class WNT_Window;
41DEFINE_STANDARD_HANDLE(WNT_Window, Aspect_Window)
42
43//! This class defines Windows NT window
44class WNT_Window : public Aspect_Window
45{
46
47public:
48
49
50 //! Creates a Window defined by his position and size
51 //! in pixles from the Parent Window.
52 //! Trigger: Raises WindowDefinitionError if the Position out of the
53 //! Screen Space or the window creation failed.
54 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);
55
56 //! Creates a Window based on the existing window handle.
57 //! This handle equals ( aPart1 << 16 ) + aPart2.
58 Standard_EXPORT WNT_Window(const Aspect_Handle aHandle, const Quantity_NameOfColor aBackColor = Quantity_NOC_MATRAGRAY);
59
e6f550da 60 //! Destroys the Window and all resourses attached to it.
61 Standard_EXPORT ~WNT_Window();
42cf5bc1 62
63 //! Sets cursor <aCursor> for ENTIRE WINDOW CLASS to which
64 //! the Window belongs.
65 Standard_EXPORT void SetCursor (const Aspect_Handle aCursor) const;
66
67 //! Opens the window <me>.
b6bf4ec1 68 Standard_EXPORT virtual void Map() const Standard_OVERRIDE;
42cf5bc1 69
70 //! Opens a window <me> according to <aMapMode>.
71 //! This method is specific to Windows NT.
72 //! <aMapMode> can be one of SW_xxx constants defined
73 //! in <windows.h>. See documentation.
74 Standard_EXPORT void Map (const Standard_Integer aMapMode) const;
75
76 //! Closes the window <me>.
b6bf4ec1 77 Standard_EXPORT virtual void Unmap() const Standard_OVERRIDE;
42cf5bc1 78
79 //! Applies the resizing to the window <me>.
b6bf4ec1 80 Standard_EXPORT virtual Aspect_TypeOfResize DoResize() const Standard_OVERRIDE;
42cf5bc1 81
82 //! Apply the mapping change to the window <me>
83 //! and returns TRUE if the window is mapped at screen.
b6bf4ec1 84 virtual Standard_Boolean DoMapping() const Standard_OVERRIDE;
42cf5bc1 85
86 //! Changes variables due to window position.
87 Standard_EXPORT void SetPos (const Standard_Integer X, const Standard_Integer Y, const Standard_Integer X1, const Standard_Integer Y1);
88
89 //! Returns True if the window <me> is opened
90 //! and False if the window is closed.
b6bf4ec1 91 Standard_EXPORT virtual Standard_Boolean IsMapped() const Standard_OVERRIDE;
42cf5bc1 92
93 //! Returns The Window RATIO equal to the physical
94 //! WIDTH/HEIGHT dimensions.
ee2be2a8 95 Standard_EXPORT virtual Standard_Real Ratio() const Standard_OVERRIDE;
42cf5bc1 96
97 //! Returns The Window POSITION in PIXEL
b6bf4ec1 98 Standard_EXPORT virtual void Position (Standard_Integer& X1, Standard_Integer& Y1, Standard_Integer& X2, Standard_Integer& Y2) const Standard_OVERRIDE;
42cf5bc1 99
100 //! Returns The Window SIZE in PIXEL
b6bf4ec1 101 Standard_EXPORT virtual void Size (Standard_Integer& Width, Standard_Integer& Height) const Standard_OVERRIDE;
42cf5bc1 102
103 //! Returns the Windows NT handle of the created window <me>.
b6bf4ec1 104 Aspect_Handle HWindow() const;
42cf5bc1 105
106 //! Returns the Windows NT handle parent of the created window <me>.
b6bf4ec1 107 Aspect_Handle HParentWindow() const;
42cf5bc1 108
109 //! Returns native Window handle (HWND)
b6bf4ec1 110 virtual Aspect_Drawable NativeHandle() const Standard_OVERRIDE;
42cf5bc1 111
112 //! Returns parent of native Window handle (HWND on Windows, Window with Xlib, and so on)
b6bf4ec1 113 virtual Aspect_Drawable NativeParentHandle() const Standard_OVERRIDE;
42cf5bc1 114
b6bf4ec1 115 //! Returns nothing on Windows
116 virtual Aspect_FBConfig NativeFBConfig() const Standard_OVERRIDE { return NULL; }
42cf5bc1 117
8693dfd0 118 //! Invalidate entire window content by calling InvalidateRect() WinAPI function, resulting in WM_PAINT event put into window message loop.
119 //! Method can be called from non-window thread, and system will also automatically aggregate multiple events into single one.
120 Standard_EXPORT virtual void InvalidateContent (const Handle(Aspect_DisplayConnection)& theDisp = NULL) Standard_OVERRIDE;
121
92efcf78 122 DEFINE_STANDARD_RTTIEXT(WNT_Window,Aspect_Window)
42cf5bc1 123
124protected:
125
42cf5bc1 126 Standard_Integer aXLeft;
127 Standard_Integer aYTop;
128 Standard_Integer aXRight;
129 Standard_Integer aYBottom;
130 Handle(WNT_WClass) myWClass;
131 Aspect_Handle myHWindow;
132 Aspect_Handle myHParentWindow;
133 Standard_Boolean myIsForeign;
134
42cf5bc1 135};
136
42cf5bc1 137#include <WNT_Window.lxx>
138
1ce0716b 139#endif // _WIN32
42cf5bc1 140#endif // _WNT_Window_HeaderFile