0028316: Coding Rules - Elimilate confusing aliases of Standard_Real type in V3d_View
[occt.git] / src / Aspect / Aspect_NeutralWindow.hxx
CommitLineData
1ce0716b 1// Copyright (c) 2016 OPEN CASCADE SAS
2//
3// This file is part of Open CASCADE Technology software library.
4//
5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
10//
11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
13
14#ifndef _Aspect_NeutralWindow_HeaderFile
15#define _Aspect_NeutralWindow_HeaderFile
16
17#include <Aspect_Window.hxx>
18
19//! Defines a platform-neutral window.
20//! This class is intended to be used in context when window management (including OpenGL context creation)
21//! is performed on application side (e.g. using external framework).
22//!
23//! Window properties should be managed by application and assigned to this class as properties.
24class Aspect_NeutralWindow : public Aspect_Window
25{
26 DEFINE_STANDARD_RTTIEXT(Aspect_NeutralWindow, Aspect_Window)
27public:
28
29 //! Empty constructor.
30 //! Note that window is considered "mapped" by default.
31 Standard_EXPORT Aspect_NeutralWindow();
32
33 //! Return native handle of this drawable.
34 virtual Aspect_Drawable NativeHandle() const Standard_OVERRIDE { return myHandle; }
35
36 //! Return native handle of the parent drawable.
37 virtual Aspect_Drawable NativeParentHandle() const Standard_OVERRIDE { return myParentHandle; }
38
39 //! Return FBConfig.
40 virtual Aspect_FBConfig NativeFBConfig() const Standard_OVERRIDE { return myFBConfig; }
41
42 //! Set native handle.
43 //! @return true if definition has been changed
44 Standard_EXPORT Standard_Boolean SetNativeHandle (Aspect_Drawable theWindow) { return SetNativeHandles (theWindow, 0, 0); }
45
46 //! Set native handles.
47 //! @return true if definition has been changed
48 Standard_EXPORT Standard_Boolean SetNativeHandles (Aspect_Drawable theWindow,
49 Aspect_Drawable theParentWindow,
50 Aspect_FBConfig theFbConfig);
51
52 //! Return true if window is not hidden.
53 virtual Standard_Boolean IsMapped() const Standard_OVERRIDE { return myIsMapped; }
54
55 //! Change window mapped flag to TRUE.
56 virtual void Map() const Standard_OVERRIDE { myIsMapped = Standard_True; }
57
58 //! Change window mapped flag to FALSE.
59 virtual void Unmap() const Standard_OVERRIDE { myIsMapped = Standard_False; }
60
61 //! Resize window - do nothing.
62 virtual Aspect_TypeOfResize DoResize() const Standard_OVERRIDE { return Aspect_TOR_UNKNOWN; }
63
64 //! Map window - do nothing.
65 virtual Standard_Boolean DoMapping() const Standard_OVERRIDE { return Standard_True; }
66
67 //! Returns window ratio equal to the physical width/height dimensions.
ee2be2a8 68 virtual Standard_Real Ratio() const Standard_OVERRIDE
1ce0716b 69 {
70 return (myWidth != 0 && myHeight != 0)
ee2be2a8 71 ? Standard_Real(myWidth) / Standard_Real(myHeight)
1ce0716b 72 : 1.0;
73 }
74
75 //! Return the window position.
76 virtual void Position (Standard_Integer& theX1, Standard_Integer& theY1,
77 Standard_Integer& theX2, Standard_Integer& theY2) const Standard_OVERRIDE
78 {
79 theX1 = myPosX;
80 theX2 = myPosX + myWidth;
81 theY1 = myPosY;
82 theY2 = myPosY + myHeight;
83 }
84
85 //! Set the window position.
86 //! @return true if position has been changed
87 Standard_EXPORT Standard_Boolean SetPosition (Standard_Integer theX1,
88 Standard_Integer theY1);
89
90 //! Set the window position.
91 //! @return true if position has been changed
92 Standard_EXPORT Standard_Boolean SetPosition (Standard_Integer theX1, Standard_Integer theY1,
93 Standard_Integer theX2, Standard_Integer theY2);
94
95 //! Return the window size.
96 virtual void Size (Standard_Integer& theWidth,
97 Standard_Integer& theHeight) const Standard_OVERRIDE
98 {
99 theWidth = myWidth;
100 theHeight = myHeight;
101 }
102
103 //! Set the window size.
104 //! @return true if size has been changed
105 Standard_EXPORT Standard_Boolean SetSize (const Standard_Integer theWidth,
106 const Standard_Integer theHeight);
107
108protected:
109
110 Aspect_Drawable myHandle;
111 Aspect_Drawable myParentHandle;
112 Aspect_FBConfig myFBConfig;
113 Standard_Integer myPosX;
114 Standard_Integer myPosY;
115 Standard_Integer myWidth;
116 Standard_Integer myHeight;
117 mutable Standard_Boolean myIsMapped;
118
119};
120
121DEFINE_STANDARD_HANDLE(Aspect_NeutralWindow, Aspect_Window)
122
123#endif // _Aspect_NeutralWindow_HeaderFile