File indexing completed on 2026-10-05 09:21:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef Cocoa_Window_HeaderFile
0017 #define Cocoa_Window_HeaderFile
0018
0019 #if defined(__APPLE__)
0020 #import <TargetConditionals.h>
0021 #endif
0022
0023 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
0024 #ifdef __OBJC__
0025 @class UIView;
0026 @class UIWindow;
0027 #else
0028 struct UIView;
0029 struct UIWindow;
0030 #endif
0031 #else
0032 #ifdef __OBJC__
0033 @class NSView;
0034 @class NSWindow;
0035 #else
0036 struct NSView;
0037 struct NSWindow;
0038 #endif
0039 #endif
0040
0041 #include <Aspect_Window.hxx>
0042
0043 #include <Standard.hxx>
0044 #include <Standard_Type.hxx>
0045
0046 #include <Aspect_FillMethod.hxx>
0047 #include <Aspect_GradientFillMethod.hxx>
0048 #include <Aspect_Handle.hxx>
0049 #include <Aspect_TypeOfResize.hxx>
0050 #include <Aspect_VKey.hxx>
0051 #include <Quantity_NameOfColor.hxx>
0052
0053 class Aspect_WindowDefinitionError;
0054 class Aspect_WindowError;
0055 class Aspect_Background;
0056 class Quantity_Color;
0057 class Aspect_GradientBackground;
0058
0059
0060 class Cocoa_Window : public Aspect_Window
0061 {
0062 public:
0063
0064 Standard_EXPORT static Aspect_VKey VirtualKeyFromNative(int theKey);
0065
0066 public:
0067
0068 Standard_EXPORT Cocoa_Window(const char* const theTitle,
0069 const int thePxLeft,
0070 const int thePxTop,
0071 const int thePxWidth,
0072 const int thePxHeight);
0073
0074 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
0075
0076 Standard_EXPORT Cocoa_Window(UIView* theViewUI);
0077 #else
0078
0079 Standard_EXPORT Cocoa_Window(NSView* theViewNS);
0080 #endif
0081
0082
0083 Standard_EXPORT ~Cocoa_Window();
0084
0085
0086 Standard_EXPORT virtual void Map() const override;
0087
0088
0089 Standard_EXPORT virtual void Unmap() const override;
0090
0091
0092 Standard_EXPORT virtual Aspect_TypeOfResize DoResize() override;
0093
0094
0095 Standard_EXPORT virtual bool DoMapping() const override;
0096
0097
0098 Standard_EXPORT virtual bool IsMapped() const override;
0099
0100
0101 Standard_EXPORT virtual double Ratio() const override;
0102
0103
0104 Standard_EXPORT virtual void Position(int& X1, int& Y1, int& X2, int& Y2) const override;
0105
0106
0107 Standard_EXPORT virtual void Size(int& theWidth, int& theHeight) const override;
0108
0109 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
0110
0111 UIView* HView() const { return myHView; }
0112
0113
0114 Standard_EXPORT void SetHView(UIView* theView);
0115 #else
0116
0117 NSView* HView() const { return myHView; }
0118
0119
0120 Standard_EXPORT void SetHView(NSView* theView);
0121 #endif
0122
0123
0124 virtual Aspect_Drawable NativeHandle() const override { return (Aspect_Drawable)HView(); }
0125
0126
0127 virtual Aspect_Drawable NativeParentHandle() const override { return 0; }
0128
0129
0130 virtual Aspect_FBConfig NativeFBConfig() const override { return nullptr; }
0131
0132
0133 Standard_EXPORT virtual void SetTitle(const TCollection_AsciiString& theTitle) override;
0134
0135
0136
0137 Standard_EXPORT virtual void InvalidateContent(
0138 const occ::handle<Aspect_DisplayConnection>& theDisp = nullptr) override;
0139
0140 protected:
0141 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
0142 UIView* myHView;
0143 #else
0144 NSWindow* myHWindow;
0145 NSView* myHView;
0146 #endif
0147 int myXLeft;
0148 int myYTop;
0149 int myXRight;
0150 int myYBottom;
0151
0152 public:
0153 DEFINE_STANDARD_RTTIEXT(Cocoa_Window, Aspect_Window)
0154 };
0155
0156 #endif