Logo ROOT  
Reference Guide
X11Drawable.h
Go to the documentation of this file.
1 // @(#)root/graf2d:$Id$
2 // Author: Timur Pocheptsov 16/02/2012
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2012, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_X11Drawable
13 #define ROOT_X11Drawable
14 
15 #include <Cocoa/Cocoa.h>
16 
17 #include "CocoaGuiTypes.h"
18 #include "TVirtualX.h"
19 #include "GuiTypes.h"
20 
21 @class PassiveKeyGrab;
22 @class QuartzWindow;
23 @class QuartzPixmap;
24 @class QuartzImage;
25 @class QuartzView;
26 
27 /////////////////////////////////////////////////////////////////////////////////////
28 // //
29 // Protocol for "drawables". It can be window, view (child window), pixmap. //
30 // X11Drawable is a generic part for both windows and pixmaps. //
31 // //
32 /////////////////////////////////////////////////////////////////////////////////////
33 
34 @protocol X11Drawable
35 @optional
36 
37 @property (nonatomic, assign) unsigned fID; //Drawable's id for GUI and TGCocoa.
38 
39 //In X11 drawable is a window or a pixmap, ROOT's GUI
40 //also has this ambiguity. So I have a property
41 //to check in TGCocoa, what's the object.
42 - (BOOL) fIsPixmap;
43 - (BOOL) fIsOpenGLWidget;
44 - (CGFloat) fScaleFactor;
45 
46 //Either [[NSGraphicsContext currentContext] graphicsPort]
47 //or bitmap context (pixmap).
48 @property (nonatomic, readonly) CGContextRef fContext;
49 
50 //Readonly geometry:
51 - (int) fX;
52 - (int) fY; //top-left corner system.
53 - (unsigned) fWidth;
54 - (unsigned) fHeight;
55 
56 //Functions to copy one drawable into another.
57 - (void) copy : (NSObject<X11Drawable> *) src area : (ROOT::MacOSX::X11::Rectangle) area withMask : (QuartzImage *)mask
58  clipOrigin : (ROOT::MacOSX::X11::Point) origin toPoint : (ROOT::MacOSX::X11::Point) dstPoint;
59 
60 //Get access to pixel data.
61 - (unsigned char *) readColorBits : (ROOT::MacOSX::X11::Rectangle) area;
62 
63 @end
64 
66 @optional
67 
68 //Geometry setters:
69 - (void) setDrawableSize : (NSSize) newSize;
70 - (void) setX : (int) x Y : (int) y width : (unsigned) w height : (unsigned) h;
71 - (void) setX : (int) x Y : (int) y;
72 
73 //I have to somehow emulate X11's behavior to make ROOT's GUI happy,
74 //that's why I have this bunch of properties here to be set/read from a window.
75 //Some of them are used, some are just pure "emulation".
76 //Properties, which are used, are commented in a declaration.
77 
78 /////////////////////////////////////////////////////////////////
79 //SetWindowAttributes_t/WindowAttributes_t
80 
81 @property (nonatomic, assign) long fEventMask; //Specifies which events must be processed by widget.
82 @property (nonatomic, assign) int fClass;
83 @property (nonatomic, assign) int fDepth;
84 @property (nonatomic, assign) int fBitGravity;
85 @property (nonatomic, assign) int fWinGravity;
86 @property (nonatomic, assign) unsigned long fBackgroundPixel;//Used by TGCocoa::ClearArea.
87 @property (nonatomic, retain) QuartzImage *fBackgroundPixmap;//Hmm, image, pixmap ...
88 @property (nonatomic, readonly) int fMapState;
89 @property (nonatomic, assign) BOOL fOverrideRedirect;
90 
91 //End of SetWindowAttributes_t/WindowAttributes_t
92 /////////////////////////////////////////////////////////////////
93 
94 //To emulate keyboard focus change when window is 'unmapped'.
95 @property (nonatomic, assign) BOOL fHasFocus;
96 
97 //"Back buffer" is a bitmap, used by canvas window (only).
98 @property (nonatomic, retain) QuartzPixmap *fBackBuffer;
99 //Parent view can be only QuartzView.
100 @property (nonatomic, assign) QuartzView *fParentView;
101 //Window has a content view, self is a content view for a view.
102 //I NSView is a parent for QuartzView and ROOTOpenGLView.
103 @property (nonatomic, readonly) NSView<X11Window> *fContentView;
104 @property (nonatomic, readonly) QuartzWindow *fQuartzWindow;
105 
106 //Passive button grab emulation.
107 //ROOT's GUI does not use several passive button
108 //grabs on the same window, so no containers,
109 //just one grab.
110 @property (nonatomic, assign) int fPassiveGrabButton;
111 @property (nonatomic, assign) unsigned fPassiveGrabEventMask;
112 @property (nonatomic, assign) unsigned fPassiveGrabKeyModifiers;
113 
114 @property (nonatomic, assign) unsigned fActiveGrabEventMask;
115 
116 @property (nonatomic, assign) BOOL fPassiveGrabOwnerEvents;
117 
120 - (void) activateGrab : (unsigned) eventMask ownerEvents : (BOOL) ownerEvents;
121 - (void) cancelGrab;
122 
123 - (BOOL) acceptsCrossingEvents : (unsigned) eventMask;
124 
125 //Nested views ("windows").
126 //Child can be any view, inherited
127 //from NSView adopting X11Window protocol.
128 - (void) addChild : (NSView<X11Window> *) child;
129 
130 //X11/ROOT GUI's attributes
131 - (void) getAttributes : (WindowAttributes_t *) attr;
132 - (void) setAttributes : (const SetWindowAttributes_t *) attr;
133 
134 //X11's XMapWindow etc.
135 - (void) mapRaised;
136 - (void) mapWindow;
137 - (void) mapSubwindows;
138 - (void) unmapWindow;
139 - (void) raiseWindow;
140 - (void) lowerWindow;
141 
142 - (BOOL) fIsOverlapped;
143 - (void) setOverlapped : (BOOL) overlap;
145 
146 - (void) addPassiveKeyGrab : (unichar) keyCode modifiers : (NSUInteger) modifiers;
147 - (void) removePassiveKeyGrab : (unichar) keyCode modifiers : (NSUInteger) modifiers;
148 - (PassiveKeyGrab *) findPassiveKeyGrab : (unichar) keyCode modifiers : (NSUInteger) modifiers;
149 - (PassiveKeyGrab *) findPassiveKeyGrab : (unichar) keyCode;
150 
151 //Cursors.
152 @property (nonatomic, assign) ECursor fCurrentCursor;
153 
154 @property (nonatomic, assign) BOOL fIsDNDAware;
155 
156 //"Properties" (X11 properties)
157 - (void) setProperty : (const char *) propName data : (unsigned char *) propData size : (unsigned) dataSize
158  forType : (Atom_t) dataType format : (unsigned) format;
159 - (BOOL) hasProperty : (const char *) propName;
160 - (unsigned char *) getProperty : (const char *) propName returnType : (Atom_t *) type
161  returnFormat : (unsigned *) format nElements : (unsigned *) nElements;
162 - (void) removeProperty : (const char *) propName;
163 
164 @end
165 
166 #endif
X11Window-p::fCurrentCursor
ECursor fCurrentCursor
Definition: X11Drawable.h:152
X11Window-p
Definition: X11Drawable.h:65
-[X11Window-p cancelGrab]
void cancelGrab()
NSView
-[X11Drawable-p fScaleFactor]
CGFloat fScaleFactor()
X11Drawable-p
Definition: X11Drawable.h:34
-[X11Window-p mapSubwindows]
void mapSubwindows()
ECursor
ECursor
Definition: GuiTypes.h:371
X11Window-p::fHasFocus
BOOL fHasFocus
Definition: X11Drawable.h:95
WindowAttributes_t
Definition: GuiTypes.h:113
QuartzImage
Definition: QuartzPixmap.h:87
-[X11Drawable-p fX]
int fX()
-[X11Drawable-p fWidth]
unsigned fWidth()
X11Window-p::fEventMask
long fEventMask
Definition: X11Drawable.h:81
X11Window-p::fBitGravity
int fBitGravity
Definition: X11Drawable.h:84
X11Window-p::fBackgroundPixmap
QuartzImage * fBackgroundPixmap
Definition: X11Drawable.h:87
TVirtualX.h
X11Window-p::fMapState
int fMapState
Definition: X11Drawable.h:88
-[X11Window-p unmapWindow]
void unmapWindow()
X11Window-p::fContentView
NSView< X11Window > * fContentView
Definition: X11Drawable.h:103
X11Window-p::fPassiveGrabOwnerEvents
BOOL fPassiveGrabOwnerEvents
Definition: X11Drawable.h:116
X11Window-p::fActiveGrabEventMask
unsigned fActiveGrabEventMask
Definition: X11Drawable.h:114
X11Window-p::fIsDNDAware
BOOL fIsDNDAware
Definition: X11Drawable.h:154
-[X11Window-p raiseWindow]
void raiseWindow()
X11Drawable-p::fID
unsigned fID
Definition: X11Drawable.h:37
-[X11Window-p configureNotifyTree]
void configureNotifyTree()
-[X11Window-p lowerWindow]
void lowerWindow()
QuartzPixmap
Definition: QuartzPixmap.h:31
X11Window-p::fOverrideRedirect
BOOL fOverrideRedirect
Definition: X11Drawable.h:89
GuiTypes.h
Atom_t
Handle_t Atom_t
Definition: GuiTypes.h:36
QuartzView
Definition: QuartzWindow.h:183
-[X11Window-p activateImplicitGrab]
void activateImplicitGrab()
-[X11Drawable-p fHeight]
unsigned fHeight()
X11Window-p::fWinGravity
int fWinGravity
Definition: X11Drawable.h:85
X11Window-p::fBackBuffer
QuartzPixmap * fBackBuffer
Definition: X11Drawable.h:98
X11Window-p::fBackgroundPixel
unsigned long fBackgroundPixel
Definition: X11Drawable.h:86
void
typedef void((*Func_t)())
fClass
Cppyy::TCppType_t fClass
Definition: DeclareConverters.h:259
X11Window-p::fDepth
int fDepth
Definition: X11Drawable.h:83
-[X11Drawable-p fY]
int fY()
-[X11Drawable-p fIsPixmap]
BOOL fIsPixmap()
-[X11Window-p mapRaised]
void mapRaised()
X11Window-p::fPassiveGrabEventMask
unsigned fPassiveGrabEventMask
Definition: X11Drawable.h:111
NSObject
PassiveKeyGrab
Definition: QuartzWindow.h:163
X11Window-p::fParentView
QuartzView * fParentView
Definition: X11Drawable.h:100
-[X11Window-p activatePassiveGrab]
void activatePassiveGrab()
X11Drawable-p::fContext
CGContextRef fContext
Definition: X11Drawable.h:48
X11Window-p::fQuartzWindow
QuartzWindow * fQuartzWindow
Definition: X11Drawable.h:104
X11Window-p::fPassiveGrabKeyModifiers
unsigned fPassiveGrabKeyModifiers
Definition: X11Drawable.h:112
-[X11Window-p fIsOverlapped]
BOOL fIsOverlapped()
ROOT
VSD Structures.
Definition: StringConv.hxx:21
-[X11Window-p mapWindow]
void mapWindow()
CocoaGuiTypes.h
-[X11Drawable-p fIsOpenGLWidget]
BOOL fIsOpenGLWidget()
X11Window-p::fPassiveGrabButton
int fPassiveGrabButton
Definition: X11Drawable.h:110
int
ROOT::MacOSX::X11
Definition: CocoaGuiTypes.h:10
SetWindowAttributes_t
Definition: GuiTypes.h:92
QuartzWindow
Definition: QuartzWindow.h:56