Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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//Graphical attributes
57@property (nonatomic, readonly) TAttLine *attLine;
58@property (nonatomic, readonly) TAttFill *attFill;
59@property (nonatomic, readonly) TAttMarker *attMarker;
60@property (nonatomic, readonly) TAttText *attText;
61
62// new graphics methods
63- (void) setDrawMode : (TVirtualX::EDrawMode) newMode;
64- (TVirtualX::EDrawMode) getDrawMode;
65- (void) setDirectDraw : (BOOL) mode;
66- (BOOL) isDirectDraw;
67
68//Functions to copy one drawable into another.
69- (void) copy : (NSObject<X11Drawable> *) src area : (ROOT::MacOSX::X11::Rectangle) area withMask : (QuartzImage *)mask
70 clipOrigin : (ROOT::MacOSX::X11::Point) origin toPoint : (ROOT::MacOSX::X11::Point) dstPoint;
71
72//Get access to pixel data.
73- (unsigned char *) readColorBits : (ROOT::MacOSX::X11::Rectangle) area;
74
75@end
76
78@optional
79
80//Geometry setters:
81- (void) setDrawableSize : (NSSize) newSize;
82- (void) setX : (int) x Y : (int) y width : (unsigned) w height : (unsigned) h;
83- (void) setX : (int) x Y : (int) y;
84
85//I have to somehow emulate X11's behavior to make ROOT's GUI happy,
86//that's why I have this bunch of properties here to be set/read from a window.
87//Some of them are used, some are just pure "emulation".
88//Properties, which are used, are commented in a declaration.
89
90/////////////////////////////////////////////////////////////////
91//SetWindowAttributes_t/WindowAttributes_t
92
93@property (nonatomic, assign) long fEventMask; //Specifies which events must be processed by widget.
94@property (nonatomic, assign) int fClass;
95@property (nonatomic, assign) int fDepth;
96@property (nonatomic, assign) int fBitGravity;
97@property (nonatomic, assign) int fWinGravity;
98@property (nonatomic, assign) unsigned long fBackgroundPixel;//Used by TGCocoa::ClearArea.
99@property (nonatomic, retain) QuartzImage *fBackgroundPixmap;//Hmm, image, pixmap ...
100@property (nonatomic, readonly) int fMapState;
101@property (nonatomic, assign) BOOL fOverrideRedirect;
102
103//End of SetWindowAttributes_t/WindowAttributes_t
104/////////////////////////////////////////////////////////////////
105
106//To emulate keyboard focus change when window is 'unmapped'.
107@property (nonatomic, assign) BOOL fHasFocus;
108
109//"Back buffer" is a bitmap, used by canvas window (only).
110@property (nonatomic, retain) QuartzPixmap *fBackBuffer;
111//Parent view can be only QuartzView.
112@property (nonatomic, assign) QuartzView *fParentView;
113//Window has a content view, self is a content view for a view.
114//I NSView is a parent for QuartzView and ROOTOpenGLView.
115@property (nonatomic, readonly) NSView<X11Window> *fContentView;
116@property (nonatomic, readonly) QuartzWindow *fQuartzWindow;
117
118//Passive button grab emulation.
119//ROOT's GUI does not use several passive button
120//grabs on the same window, so no containers,
121//just one grab.
122@property (nonatomic, assign) int fPassiveGrabButton;
123@property (nonatomic, assign) unsigned fPassiveGrabEventMask;
124@property (nonatomic, assign) unsigned fPassiveGrabKeyModifiers;
125
126@property (nonatomic, assign) unsigned fActiveGrabEventMask;
127
128@property (nonatomic, assign) BOOL fPassiveGrabOwnerEvents;
129
130- (void) activatePassiveGrab;
131- (void) activateImplicitGrab;
132- (void) activateGrab : (unsigned) eventMask ownerEvents : (BOOL) ownerEvents;
133- (void) cancelGrab;
134
135- (BOOL) acceptsCrossingEvents : (unsigned) eventMask;
136
137//Nested views ("windows").
138//Child can be any view, inherited
139//from NSView adopting X11Window protocol.
140- (void) addChild : (NSView<X11Window> *) child;
141
142//X11/ROOT GUI's attributes
143- (void) getAttributes : (WindowAttributes_t *) attr;
144- (void) setAttributes : (const SetWindowAttributes_t *) attr;
145
146//X11's XMapWindow etc.
147- (void) mapRaised;
148- (void) mapWindow;
149- (void) mapSubwindows;
150- (void) unmapWindow;
151- (void) raiseWindow;
152- (void) lowerWindow;
153
154- (BOOL) fIsOverlapped;
155- (void) setOverlapped : (BOOL) overlap;
156- (void) configureNotifyTree;
157
158- (void) addPassiveKeyGrab : (unichar) keyCode modifiers : (NSUInteger) modifiers;
159- (void) removePassiveKeyGrab : (unichar) keyCode modifiers : (NSUInteger) modifiers;
160- (PassiveKeyGrab *) findPassiveKeyGrab : (unichar) keyCode modifiers : (NSUInteger) modifiers;
161- (PassiveKeyGrab *) findPassiveKeyGrab : (unichar) keyCode;
162
163//Cursors.
164@property (nonatomic, assign) ECursor fCurrentCursor;
165
166@property (nonatomic, assign) BOOL fIsDNDAware;
167
168//"Properties" (X11 properties)
169- (void) setProperty : (const char *) propName data : (unsigned char *) propData size : (unsigned) dataSize
170 forType : (Atom_t) dataType format : (unsigned) format;
171- (BOOL) hasProperty : (const char *) propName;
172- (unsigned char *) getProperty : (const char *) propName returnType : (Atom_t *) type
173 returnFormat : (unsigned *) format nElements : (unsigned *) nElements;
174- (void) removeProperty : (const char *) propName;
175
176@end
177
178#endif
Cppyy::TCppType_t fClass
Handle_t Atom_t
WM token.
Definition GuiTypes.h:38
ECursor
Definition GuiTypes.h:373
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Fill Area Attributes class.
Definition TAttFill.h:21
Line Attributes class.
Definition TAttLine.h:21
Marker Attributes class.
Definition TAttMarker.h:21
Text Attributes class.
Definition TAttText.h:21
Semi-Abstract base class defining a generic interface to the underlying, low level,...
Definition TVirtualX.h:46
Attributes that can be used when creating or changing a window.
Definition GuiTypes.h:94
Window attributes that can be inquired.
Definition GuiTypes.h:115