File indexing completed on 2026-09-15 09:14:51
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _Aspect_Window_HeaderFile
0017 #define _Aspect_Window_HeaderFile
0018
0019 #include <Aspect_Background.hxx>
0020 #include <Aspect_GradientBackground.hxx>
0021 #include <Aspect_FBConfig.hxx>
0022 #include <Aspect_FillMethod.hxx>
0023 #include <Quantity_Color.hxx>
0024 #include <Aspect_GradientFillMethod.hxx>
0025 #include <Aspect_TypeOfResize.hxx>
0026 #include <Aspect_Drawable.hxx>
0027 #include <NCollection_Vec2.hxx>
0028 #include <Standard_TypeDef.hxx>
0029 #include <Standard.hxx>
0030 #include <Standard_Transient.hxx>
0031 #include <Standard_Type.hxx>
0032 #include <TCollection_AsciiString.hxx>
0033
0034 class Aspect_DisplayConnection;
0035
0036
0037 class Aspect_Window : public Standard_Transient
0038 {
0039 DEFINE_STANDARD_RTTIEXT(Aspect_Window, Standard_Transient)
0040 public:
0041
0042 Standard_EXPORT bool IsVirtual() const;
0043
0044
0045 Standard_EXPORT void SetVirtual(const bool theVirtual);
0046
0047
0048 NCollection_Vec2<int> TopLeft() const
0049 {
0050 NCollection_Vec2<int> aTopLeft, aBotRight;
0051 Position(aTopLeft.x(), aTopLeft.y(), aBotRight.x(), aBotRight.y());
0052 return aTopLeft;
0053 }
0054
0055
0056 NCollection_Vec2<int> Dimensions() const
0057 {
0058 NCollection_Vec2<int> aSize;
0059 Size(aSize.x(), aSize.y());
0060 return aSize;
0061 }
0062
0063
0064 const occ::handle<Aspect_DisplayConnection>& DisplayConnection() const { return myDisplay; }
0065
0066
0067 Standard_EXPORT Aspect_Background Background() const;
0068
0069
0070 Standard_EXPORT Aspect_FillMethod BackgroundFillMethod() const;
0071
0072
0073 Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
0074
0075
0076 Standard_EXPORT void SetBackground(const Aspect_Background& theBack);
0077
0078
0079 Standard_EXPORT void SetBackground(const Quantity_Color& theColor);
0080
0081
0082 Standard_EXPORT void SetBackground(const Aspect_GradientBackground& theBackground);
0083
0084
0085 Standard_EXPORT void SetBackground(const Quantity_Color& theFirstColor,
0086 const Quantity_Color& theSecondColor,
0087 const Aspect_GradientFillMethod theFillMethod);
0088
0089 public:
0090
0091
0092 Standard_EXPORT virtual bool IsMapped() const = 0;
0093
0094
0095 Standard_EXPORT virtual void Map() const = 0;
0096
0097
0098 Standard_EXPORT virtual void Unmap() const = 0;
0099
0100
0101 Standard_EXPORT virtual Aspect_TypeOfResize DoResize() = 0;
0102
0103
0104
0105 Standard_EXPORT virtual bool DoMapping() const = 0;
0106
0107
0108
0109 Standard_EXPORT virtual double Ratio() const = 0;
0110
0111
0112 Standard_EXPORT virtual void Position(int& X1, int& Y1, int& X2, int& Y2) const = 0;
0113
0114
0115 Standard_EXPORT virtual void Size(int& Width, int& Height) const = 0;
0116
0117
0118 Standard_EXPORT virtual Aspect_Drawable NativeHandle() const = 0;
0119
0120
0121 Standard_EXPORT virtual Aspect_Drawable NativeParentHandle() const = 0;
0122
0123
0124 Standard_EXPORT virtual Aspect_FBConfig NativeFBConfig() const = 0;
0125
0126
0127 virtual void SetTitle(const TCollection_AsciiString& theTitle) { (void)theTitle; }
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137 virtual void InvalidateContent(const occ::handle<Aspect_DisplayConnection>& theDisp)
0138 {
0139 (void)theDisp;
0140 }
0141
0142 public:
0143
0144 virtual double DevicePixelRatio() const { return 1.0; }
0145
0146
0147 virtual NCollection_Vec2<double> ConvertPointToBacking(
0148 const NCollection_Vec2<double>& thePnt) const
0149 {
0150 return thePnt * DevicePixelRatio();
0151 }
0152
0153
0154 virtual NCollection_Vec2<double> ConvertPointFromBacking(
0155 const NCollection_Vec2<double>& thePnt) const
0156 {
0157 return thePnt / DevicePixelRatio();
0158 }
0159
0160 public:
0161
0162 Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const;
0163
0164 protected:
0165
0166 Standard_EXPORT Aspect_Window();
0167
0168 protected:
0169 occ::handle<Aspect_DisplayConnection> myDisplay;
0170 Aspect_Background MyBackground;
0171 Aspect_GradientBackground MyGradientBackground;
0172 Aspect_FillMethod MyBackgroundFillMethod;
0173 bool MyIsVirtual;
0174 };
0175
0176 #endif