Logo ROOT   6.18/05
Reference Guide
CocoaPrivate.h
Go to the documentation of this file.
1// @(#)root/graf2d:$Id$
2// Author: Timur Pocheptsov 29/11/2011
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
13#ifndef ROOT_CocoaPrivate
14#define ROOT_CocoaPrivate
15
16#include <vector>
17#include <map>
18
19#include "CocoaUtils.h"
20#include "X11Colors.h"
21#include "X11Events.h"
22#include "X11Buffer.h"
23#include "GuiTypes.h"
24#include "FontCache.h"
25
26@protocol X11Drawable;
27@protocol X11Window;
28
30@class NSOpenGLContext;
31@class NSObject;
32
33@class QuartzWindow;
34
35class TGQuartz;
36class TGCocoa;
37
38///////////////////////////////////////////////
39// //
40// CocoaPrivate. Hidden implementation //
41// details for TGCocoa. //
42// //
43///////////////////////////////////////////////
44
45namespace ROOT {
46namespace MacOSX {
47namespace Details {
48
50 friend class ::TGCocoa;
51 friend class ::TGQuartz;
52 friend class X11::CommandBuffer;
53public:
55private:
57
59 bool IsRootWindow(Window_t windowID)const;
60
63
64 Drawable_t RegisterDrawable(NSObject *nsObj);
65 NSObject<X11Drawable> *GetDrawable(Drawable_t drawableD)const;
66 NSObject<X11Window> *GetWindow(Window_t windowID)const;
67 void DeleteDrawable(Drawable_t drawableID);
68
69 Handle_t RegisterGLContext(NSOpenGLContext *glContext);
70 void DeleteGLContext(Handle_t contextID);
71 NSOpenGLContext *GetGLContextForHandle(Handle_t contextID);
72 Handle_t GetHandleForGLContext(NSOpenGLContext *glContext);
73
76
77 //This function resets strong reference, if you still want NSObject for drawableID to live,
78 //you have to retain the pointer (probably) and also drawableID will become id for nsObj (replacement).
79 void ReplaceDrawable(Drawable_t drawableID, NSObject *nsObj);
80
81 //Color "parser": either parse string like "#ddeeaa", or
82 //search rgb.txt like table for named color.
84 //Event translator, converts Cocoa events into X11 events
85 //and generates X11 events.
87 //Command buffer - for "buffered" drawing commands.
89 //Font manager - cache CTFontRef for GUI.
91
92 //Id for the new registered drawable.
94 //"Cache" of ids.
95 std::vector<Drawable_t> fFreeDrawableIDs;
96 //Cocoa objects (views, windows, "pixmaps").
97 std::map<unsigned, Util::NSStrongReference<NSObject<X11Drawable> > > fDrawables;
98 typedef std::map<unsigned, Util::NSStrongReference<NSObject<X11Drawable> > >::iterator drawable_iterator;
99 typedef std::map<unsigned, Util::NSStrongReference<NSObject<X11Drawable> > >::const_iterator const_drawable_iterator;
100
101 typedef std::map<Handle_t, Util::NSStrongReference<NSOpenGLContext> > handle2ctx_map;
102 typedef std::map<NSOpenGLContext *, Handle_t> ctx2handle_map;
103
106
109
111};
112
113}//Details
114}//MacOSX
115}//ROOT
116
117#endif
ULong_t Handle_t
Definition: GuiTypes.h:25
Handle_t Drawable_t
Definition: GuiTypes.h:30
Handle_t Window_t
Definition: GuiTypes.h:28
void SetFakeGLWindow(QuartzWindow *fakeWin)
Drawable_t RegisterDrawable(NSObject *nsObj)
void DeleteDrawable(Drawable_t drawableID)
CocoaPrivate & operator=(const CocoaPrivate &rhs)
Handle_t GetHandleForGLContext(NSOpenGLContext *glContext)
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > >::iterator drawable_iterator
Definition: CocoaPrivate.h:98
std::map< NSOpenGLContext *, Handle_t > ctx2handle_map
Definition: CocoaPrivate.h:102
Util::NSStrongReference< QuartzWindow > fFakeGLWindow
Definition: CocoaPrivate.h:108
std::map< Handle_t, Util::NSStrongReference< NSOpenGLContext > > handle2ctx_map
Definition: CocoaPrivate.h:101
NSObject< X11Drawable > * GetDrawable(Drawable_t drawableD) const
X11::CommandBuffer fX11CommandBuffer
Definition: CocoaPrivate.h:88
X11::EventTranslator fX11EventTranslator
Definition: CocoaPrivate.h:86
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > >::const_iterator const_drawable_iterator
Definition: CocoaPrivate.h:99
void DeleteGLContext(Handle_t contextID)
std::vector< Drawable_t > fFreeDrawableIDs
Definition: CocoaPrivate.h:95
Util::NSScopeGuard< ROOTApplicationDelegate > fApplicationDelegate
Definition: CocoaPrivate.h:110
Handle_t RegisterGLContext(NSOpenGLContext *glContext)
NSObject< X11Window > * GetWindow(Window_t windowID) const
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > > fDrawables
Definition: CocoaPrivate.h:97
void ReplaceDrawable(Drawable_t drawableID, NSObject *nsObj)
CocoaPrivate(const CocoaPrivate &rhs)
NSOpenGLContext * GetGLContextForHandle(Handle_t contextID)
bool IsRootWindow(Window_t windowID) const
This class implements TVirtualX interface for MacOS X, using Cocoa and Quartz 2D.
Definition: TGCocoa.h:58
This is non-GUI part of TVirtualX interface, implemented for MacOS X, using CoreGraphics (Quartz).
Definition: TGQuartz.h:28
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21