Logo ROOT  
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 
35 class TGQuartz;
36 class TGCocoa;
37 
38 ///////////////////////////////////////////////
39 // //
40 // CocoaPrivate. Hidden implementation //
41 // details for TGCocoa. //
42 // //
43 ///////////////////////////////////////////////
44 
45 namespace ROOT {
46 namespace MacOSX {
47 namespace Details {
48 
49 class CocoaPrivate {
50  friend class ::TGCocoa;
51  friend class ::TGQuartz;
52  friend class X11::CommandBuffer;
53 public:
54  ~CocoaPrivate();
55 private:
56  CocoaPrivate();
57 
59  bool IsRootWindow(Window_t windowID)const;
60 
61  CocoaPrivate(const CocoaPrivate &rhs);
63 
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 
74  void SetFakeGLWindow(QuartzWindow *fakeWin);
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
ROOT::MacOSX::Details::CocoaPrivate::DeleteGLContext
void DeleteGLContext(Handle_t contextID)
X11Window-p
Definition: X11Drawable.h:65
ROOT::MacOSX::Details::CocoaPrivate::fFakeGLWindow
Util::NSStrongReference< QuartzWindow > fFakeGLWindow
Definition: CocoaPrivate.h:108
ROOT::MacOSX::Details::CocoaPrivate::fCurrentDrawableID
Drawable_t fCurrentDrawableID
Definition: CocoaPrivate.h:93
ROOT::MacOSX::Util::NSStrongReference< QuartzWindow >
CocoaUtils.h
X11Drawable-p
Definition: X11Drawable.h:34
ROOT::MacOSX::Details::CocoaPrivate::GetWindow
NSObject< X11Window > * GetWindow(Window_t windowID) const
ROOT::MacOSX::Details::CocoaPrivate::GetRootWindowID
Window_t GetRootWindowID() const
ROOT::MacOSX::Details::CocoaPrivate::fGLContextToHandle
ctx2handle_map fGLContextToHandle
Definition: CocoaPrivate.h:105
X11Buffer.h
ROOT::MacOSX::Details::CocoaPrivate::IsRootWindow
bool IsRootWindow(Window_t windowID) const
ROOT::MacOSX::Details::CocoaPrivate::CocoaPrivate
CocoaPrivate()
ROOT::MacOSX::Details::CocoaPrivate::ctx2handle_map
std::map< NSOpenGLContext *, Handle_t > ctx2handle_map
Definition: CocoaPrivate.h:102
ROOT::MacOSX::Details::CocoaPrivate::SetFakeGLWindow
void SetFakeGLWindow(QuartzWindow *fakeWin)
ROOT::MacOSX::Details::CocoaPrivate::RegisterDrawable
Drawable_t RegisterDrawable(NSObject *nsObj)
ROOT::MacOSX::Details::CocoaPrivate::fApplicationDelegate
Util::NSScopeGuard< ROOTApplicationDelegate > fApplicationDelegate
Definition: CocoaPrivate.h:110
ROOT::MacOSX::Details::CocoaPrivate::ReplaceDrawable
void ReplaceDrawable(Drawable_t drawableID, NSObject *nsObj)
ROOT::MacOSX::Details::CocoaPrivate::fFreeGLContextID
Handle_t fFreeGLContextID
Definition: CocoaPrivate.h:107
ROOT::MacOSX::Details::CocoaPrivate::fX11EventTranslator
X11::EventTranslator fX11EventTranslator
Definition: CocoaPrivate.h:86
ROOT::MacOSX::Details::FontCache
Definition: FontCache.h:57
ROOT::MacOSX::Details::CocoaPrivate::handle2ctx_map
std::map< Handle_t, Util::NSStrongReference< NSOpenGLContext > > handle2ctx_map
Definition: CocoaPrivate.h:101
ROOT::MacOSX::Details::CocoaPrivate::~CocoaPrivate
~CocoaPrivate()
ROOT::MacOSX::Details::CocoaPrivate::DeleteDrawable
void DeleteDrawable(Drawable_t drawableID)
Drawable_t
Handle_t Drawable_t
Definition: GuiTypes.h:30
FontCache.h
TGQuartz
Definition: TGQuartz.h:28
ROOT::MacOSX::Details::CocoaPrivate::fFreeDrawableIDs
std::vector< Drawable_t > fFreeDrawableIDs
Definition: CocoaPrivate.h:95
ROOT::MacOSX::Details::CocoaPrivate::RegisterGLContext
Handle_t RegisterGLContext(NSOpenGLContext *glContext)
TGCocoa
Definition: TGCocoa.h:58
X11Events.h
GuiTypes.h
ROOT::MacOSX::Details::CocoaPrivate::fHandleToGLContext
handle2ctx_map fHandleToGLContext
Definition: CocoaPrivate.h:104
ROOT::MacOSX::Details::CocoaPrivate::fDrawables
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > > fDrawables
Definition: CocoaPrivate.h:97
Window_t
Handle_t Window_t
Definition: GuiTypes.h:28
ROOT::MacOSX::Details::CocoaPrivate
Definition: CocoaPrivate.h:49
ROOT::MacOSX::Details::CocoaPrivate::GetGLContextForHandle
NSOpenGLContext * GetGLContextForHandle(Handle_t contextID)
ROOT::MacOSX::Details::CocoaPrivate::fX11ColorParser
X11::ColorParser fX11ColorParser
Definition: CocoaPrivate.h:83
ROOT::MacOSX::Details
Definition: TMacOSXSystem.h:42
ROOT::MacOSX::Util::NSScopeGuard< ROOTApplicationDelegate >
ROOT::MacOSX::Details::CocoaPrivate::GetDrawable
NSObject< X11Drawable > * GetDrawable(Drawable_t drawableD) const
ROOT::MacOSX::Details::CocoaPrivate::GetHandleForGLContext
Handle_t GetHandleForGLContext(NSOpenGLContext *glContext)
Handle_t
ULong_t Handle_t
Definition: GuiTypes.h:25
ROOT::MacOSX::X11::ColorParser
Definition: X11Colors.h:52
NSObject
ROOT::MacOSX::Details::CocoaPrivate::operator=
CocoaPrivate & operator=(const CocoaPrivate &rhs)
ROOT::MacOSX::Details::CocoaPrivate::GetFakeGLWindow
QuartzWindow * GetFakeGLWindow()
ROOT::MacOSX::Details::CocoaPrivate::drawable_iterator
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > >::iterator drawable_iterator
Definition: CocoaPrivate.h:98
ROOT::MacOSX::Details::CocoaPrivate::fX11CommandBuffer
X11::CommandBuffer fX11CommandBuffer
Definition: CocoaPrivate.h:88
X11Colors.h
ROOT::MacOSX::X11::CommandBuffer
Definition: X11Buffer.h:237
ROOT::MacOSX::X11::EventTranslator
Definition: X11Events.h:51
ROOT::MacOSX::Details::CocoaPrivate::fFontManager
FontCache fFontManager
Definition: CocoaPrivate.h:90
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOTApplicationDelegate
Definition: ROOTApplicationDelegate.h:6
ROOT::MacOSX::Details::CocoaPrivate::const_drawable_iterator
std::map< unsigned, Util::NSStrongReference< NSObject< X11Drawable > > >::const_iterator const_drawable_iterator
Definition: CocoaPrivate.h:99
QuartzWindow
Definition: QuartzWindow.h:56