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;
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
Cppyy::TCppType_t fClass
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
Handle_t Atom_t
WM token.
Definition: GuiTypes.h:37
ECursor
Definition: GuiTypes.h:372
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
CGFloat fScaleFactor()
CGContextRef fContext
Definition: X11Drawable.h:48
BOOL fIsOpenGLWidget()
unsigned fHeight()
unsigned fID
Definition: X11Drawable.h:37
unsigned fWidth()
void mapWindow()
QuartzImage * fBackgroundPixmap
Definition: X11Drawable.h:87
unsigned fPassiveGrabEventMask
Definition: X11Drawable.h:111
int fBitGravity
Definition: X11Drawable.h:84
void activateImplicitGrab()
unsigned fPassiveGrabKeyModifiers
Definition: X11Drawable.h:112
NSView< X11Window > * fContentView
Definition: X11Drawable.h:103
unsigned long fBackgroundPixel
Definition: X11Drawable.h:86
QuartzView * fParentView
Definition: X11Drawable.h:100
QuartzWindow * fQuartzWindow
Definition: X11Drawable.h:104
void activatePassiveGrab()
BOOL fHasFocus
Definition: X11Drawable.h:95
void cancelGrab()
void mapSubwindows()
BOOL fOverrideRedirect
Definition: X11Drawable.h:89
void mapRaised()
int fPassiveGrabButton
Definition: X11Drawable.h:110
QuartzPixmap * fBackBuffer
Definition: X11Drawable.h:98
BOOL fPassiveGrabOwnerEvents
Definition: X11Drawable.h:116
void raiseWindow()
BOOL fIsDNDAware
Definition: X11Drawable.h:154
void lowerWindow()
void configureNotifyTree()
long fEventMask
Definition: X11Drawable.h:81
ECursor fCurrentCursor
Definition: X11Drawable.h:152
unsigned fActiveGrabEventMask
Definition: X11Drawable.h:114
BOOL fIsOverlapped()
void unmapWindow()
int fWinGravity
Definition: X11Drawable.h:85
Attributes that can be used when creating or changing a window.
Definition: GuiTypes.h:93
Window attributes that can be inquired.
Definition: GuiTypes.h:114