12 #ifndef ROOT_QuartzWindow
13 #define ROOT_QuartzWindow
15 #include <Cocoa/Cocoa.h>
28 @class ROOTOpenGLView;
31 @interface QuartzWindow : NSWindow<X11Window, NSWindowDelegate> {
33 QuartzWindow *fMainWindow;
36 QuartzView *fContentView;
37 BOOL fDelayedTransient;
38 QuartzImage *fShapeCombineMask;
42 - (id) initWithContentRect : (NSRect) contentRect styleMask : (NSUInteger) windowStyle
43 backing : (NSBackingStoreType) bufferingType defer : (BOOL) deferCreation
44 windowAttributes : (const SetWindowAttributes_t *) attr;
46 - (id) initWithGLView : (ROOTOpenGLView *) glView;
56 - (void) setFIsDeleted : (BOOL) deleted;
59 - (void) forwardInvocation : (NSInvocation *) anInvocation;
60 - (NSMethodSignature*) methodSignatureForSelector : (
SEL) selector;
63 @property (nonatomic, assign) QuartzWindow *fMainWindow;
64 - (void) addTransientWindow : (QuartzWindow *) window;
67 @property (nonatomic, assign) QuartzImage *fShapeCombineMask;
73 - (BOOL) fIsOpenGLWidget;
74 - (CGFloat) fScaleFactor;
83 - (void) setDrawableSize : (NSSize) newSize;
84 - (void) setX : (
int) x Y : (
int) y width : (
unsigned) w height : (
unsigned) h;
85 - (void) setX : (
int) x Y : (
int) y;
88 - (void) copy : (NSObject<X11Drawable> *) src area : (ROOT::MacOSX::X11::Rectangle) area withMask : (QuartzImage *) mask
89 clipOrigin : (ROOT::MacOSX::X11::Point) origin toPoint : (ROOT::MacOSX::X11::Point) dstPoint;
91 - (
unsigned char *) readColorBits : (ROOT::MacOSX::X11::Rectangle) area;
98 @property (nonatomic, assign)
unsigned long fBackgroundPixel;
99 @property (nonatomic, readonly)
int fMapState;
104 @property (nonatomic, assign) BOOL fHasFocus;
107 @property (nonatomic, assign) QuartzView *fParentView;
108 @property (nonatomic, readonly) NSView<X11Window> *fContentView;
109 @property (nonatomic, readonly) QuartzWindow *fQuartzWindow;
112 - (void) addChild : (NSView<X11Window> *) child;
115 - (void) getAttributes : (WindowAttributes_t *) attr;
116 - (void) setAttributes : (const SetWindowAttributes_t *) attr;
121 - (void) mapSubwindows;
122 - (void) unmapWindow;
132 @interface PassiveKeyGrab : NSObject {
135 NSUInteger fModifiers;
137 - (unichar) fKeyCode;
138 - (NSUInteger) fModifiers;
139 - (id) initWithKey : (unichar) keyCode modifiers : (NSUInteger) modifiers;
140 - (BOOL) matchKey : (unichar) keyCode modifiers : (NSUInteger) modifiers;
141 - (BOOL) matchKey : (unichar) keyCode;
152 @interface QuartzView : NSView<X11Window> {
155 CGContextRef fContext;
161 unsigned long fBackgroundPixel;
162 BOOL fOverrideRedirect;
165 QuartzView *fParentView;
167 int fPassiveGrabButton;
168 unsigned fPassiveGrabEventMask;
169 unsigned fPassiveGrabKeyModifiers;
170 unsigned fActiveGrabEventMask;
171 BOOL fPassiveGrabOwnerEvents;
173 ECursor fCurrentCursor;
176 QuartzPixmap *fBackBuffer;
177 NSMutableArray *fPassiveKeyGrabs;
180 NSMutableDictionary *fX11Properties;
181 QuartzImage *fBackgroundPixmap;
183 ROOT::MacOSX::X11::PointerGrab fCurrentGrabType;
185 BOOL fActiveGrabOwnerEvents;
189 - (id) initWithFrame : (NSRect) frame windowAttributes : (const SetWindowAttributes_t *) attr;
193 @property (nonatomic, assign)
unsigned fID;
196 - (BOOL) fIsOpenGLWidget;
197 - (CGFloat) fScaleFactor;
199 @property (nonatomic, assign) CGContextRef fContext;
205 - (unsigned) fHeight;
206 - (void) setDrawableSize : (NSSize) newSize;
207 - (void) setX : (
int) x Y : (
int) y width : (
unsigned) w height : (
unsigned) h;
208 - (void) setX : (
int) x Y : (
int) y;
210 - (void) copy : (NSObject<X11Drawable> *) src area : (ROOT::MacOSX::X11::Rectangle) area withMask : (QuartzImage *)mask
211 clipOrigin : (ROOT::MacOSX::X11::Point) origin toPoint : (ROOT::MacOSX::X11::Point) dstPoint;
212 - (
unsigned char *) readColorBits : (ROOT::MacOSX::X11::Rectangle) area;
219 @property (nonatomic, assign)
long fEventMask;
220 @property (nonatomic, assign)
int fClass;
221 @property (nonatomic, assign)
int fDepth;
222 @property (nonatomic, assign)
int fBitGravity;
223 @property (nonatomic, assign)
int fWinGravity;
224 @property (nonatomic, assign)
unsigned long fBackgroundPixel;
225 @property (nonatomic, retain) QuartzImage *fBackgroundPixmap;
226 @property (nonatomic, readonly)
int fMapState;
227 @property (nonatomic, assign) BOOL fOverrideRedirect;
232 @property (nonatomic, assign) BOOL fHasFocus;
235 @property (nonatomic, retain) QuartzPixmap *fBackBuffer;
236 @property (nonatomic, assign) QuartzView *fParentView;
237 @property (nonatomic, readonly) NSView<X11Window> *fContentView;
238 @property (nonatomic, readonly) QuartzWindow *fQuartzWindow;
240 @property (nonatomic, assign)
int fPassiveGrabButton;
241 @property (nonatomic, assign)
unsigned fPassiveGrabEventMask;
242 @property (nonatomic, assign)
unsigned fPassiveGrabKeyModifiers;
244 @property (nonatomic, assign) BOOL fPassiveGrabOwnerEvents;
246 - (void) activatePassiveGrab;
247 - (void) activateImplicitGrab;
248 - (void) activateGrab : (
unsigned) eventMask ownerEvents : (BOOL) ownerEvents;
251 - (BOOL) acceptsCrossingEvents : (
unsigned) eventMask;
254 - (void) addChild : (NSView<X11Window> *)child;
257 - (void) getAttributes : (WindowAttributes_t *) attr;
258 - (void) setAttributes : (const SetWindowAttributes_t *) attr;
262 - (void) mapSubwindows;
264 - (void) unmapWindow;
266 - (void) raiseWindow;
267 - (void) lowerWindow;
269 - (BOOL) fIsOverlapped;
270 - (void) setOverlapped : (BOOL) overlap;
271 - (void) configureNotifyTree;
275 @property (nonatomic, assign) BOOL fSnapshotDraw;
279 - (void) addPassiveKeyGrab : (unichar) keyCode modifiers : (NSUInteger) modifiers;
280 - (void) removePassiveKeyGrab : (unichar) keyCode modifiers : (NSUInteger) modifiers;
281 - (PassiveKeyGrab *) findPassiveKeyGrab : (unichar) keyCode modifiers : (NSUInteger) modifiers;
282 - (PassiveKeyGrab *) findPassiveKeyGrab : (unichar) keyCode;
285 @property (nonatomic, assign) ECursor fCurrentCursor;
288 - (void) setProperty : (const
char *) propName data : (
unsigned char *) propData size : (
unsigned) dataSize
289 forType : (Atom_t) dataType format : (
unsigned) format;
290 - (BOOL) hasProperty : (const
char *) propName;
291 - (
unsigned char *) getProperty : (const
char *) propName returnType : (Atom_t *) type
292 returnFormat : (
unsigned *) format nElements : (
unsigned *) nElements;
293 - (void) removeProperty : (const
char *) propName;
296 @property (nonatomic, assign) BOOL fIsDNDAware;
298 - (NSDragOperation) draggingEntered : (
id<NSDraggingInfo>) sender;
299 - (BOOL) performDragOperation : (
id<NSDraggingInfo>) sender;
307 QuartzWindow *CreateTopLevelWindow(Int_t x, Int_t y, UInt_t w, UInt_t h, UInt_t border, Int_t depth,
308 UInt_t clss,
void *visual, SetWindowAttributes_t *attr, UInt_t);
309 QuartzView *CreateChildView(QuartzView *parent, Int_t x, Int_t y, UInt_t w, UInt_t h, UInt_t border, Int_t depth,
310 UInt_t clss,
void *visual, SetWindowAttributes_t *attr, UInt_t wtype);
312 void GetRootWindowAttributes(WindowAttributes_t *attr);
313 void GetWindowAttributes(NSObject<X11Window> *window, WindowAttributes_t *dst);
319 NSPoint ConvertPointFromBaseToScreen(NSWindow *window, NSPoint windowPoint);
320 NSPoint ConvertPointFromScreenToBase(NSPoint screenPoint, NSWindow *window);
322 int GlobalXCocoaToROOT(CGFloat xCocoa);
323 int GlobalYCocoaToROOT(CGFloat yCocoa);
324 int GlobalXROOTToCocoa(CGFloat xROOT);
325 int GlobalYROOTToCocoa(CGFloat yROOT);
327 int LocalYCocoaToROOT(NSView<X11Window> *parentView, CGFloat yCocoa);
328 int LocalYROOTToCocoa(NSView<X11Window> *parentView, CGFloat yROOT);
329 int LocalYROOTToCocoa(NSObject<X11Drawable> *parentView, CGFloat yROOT);
331 NSPoint TranslateToScreen(NSView<X11Window> *from, NSPoint point);
332 NSPoint TranslateFromScreen(NSPoint point, NSView<X11Window> *to);
333 NSPoint TranslateCoordinates(NSView<X11Window> *fromView, NSView<X11Window> *toView, NSPoint sourcePoint);
335 bool ViewIsTextViewFrame(NSView<X11Window> *view,
bool checkParent);
336 bool ViewIsHtmlViewFrame(NSView<X11Window> *view,
bool checkParent);
337 bool LockFocus(NSView<X11Window> *view);
338 void UnlockFocus(NSView<X11Window> *view);
340 bool ScreenPointIsInView(NSView<X11Window> *view, Int_t x, Int_t y);
341 QuartzWindow *FindWindowInPoint(Int_t x, Int_t y);
342 NSView<X11Window> *FindDNDAwareViewInPoint(NSView *parentView, Window_t dragWinID, Window_t inputWinID, Int_t x, Int_t y, Int_t maxDepth);
349 QuartzWindow *FindWindowUnderPointer();
350 NSView<X11Window> *FindViewUnderPointer();
353 QuartzWindow *FindWindowForPointerEvent(NSEvent *pointerEvent);
354 NSView<X11Window> *FindViewForPointerEvent(NSEvent *pointerEvent);
355 void WindowLostFocus(Window_t winID);
358 void ClipToShapeMask(NSView<X11Window> *view, CGContextRef ctx);