ROOT  6.06/09
Reference Guide
TQtRootGuiFactory.cxx
Go to the documentation of this file.
1 // Author: Valeri Fine 21/01/2002
2 /****************************************************************************
3 ** $Id: TQtRootGuiFactory.cxx,v 1.12 2007/11/02 17:19:04 fine Exp $
4 **
5 ** Copyright (C) 2002 by Valeri Fine. Brookhaven National Laboratory.
6 ** All rights reserved.
7 **
8 **
9 *****************************************************************************/
10 
11 //________________________________________________________________________
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TQtRootGuiFactory //
15 // //
16 // This class is a factory for Qt GUI components. It overrides //
17 // the member functions of the ABS TGuiFactory. //
18 // //
19 //////////////////////////////////////////////////////////////////////////
20 
21 #include "TQtRootGuiFactory.h"
22 #include "TRootGuiFactory.h"
23 #include "TQtRConfig.h"
24 
25 #include "TApplication.h"
26 #include "TQtApplication.h"
27 
28 #include "TSystem.h"
29 #ifdef R__QTWIN32
30 # if ROOT_VERSION_CODE < ROOT_VERSION(5,13,0)
31 # include "TWin32Application.h"
32 # endif
33 #else
34 # include "TROOT.h"
35 # include "TQtRootApplication.h"
36 #endif
37 
38 #include "TGClient.h"
39 #include "TRootCanvas.h"
40 #include "TRootBrowser.h"
41 #include "TRootControlBar.h"
42 #include "TContextMenu.h"
43 #include "TRootContextMenu.h"
44 
45 #include "TGQt.h"
46 
47 //////////////////////////////////////////////////////////////////////////
48 /// PluginManager creation function
49 
51  return new TQtRootGuiFactory();
52 }
53 
54 
55 TGClient *TQtRootGuiFactory::gfQtClient = 0;
57 ////////////////////////////////////////////////////////////////////////////////
58 /// TQtRootGuiFactory ctor.
59 /// Restore the right TVirtualX pointer
60 
62  : TGuiFactory("QtRootProxy","Qt-based ROOT GUI Factory"),fGuiProxy(0)
63 {
64  if (TGQt::GetVirtualX()) gVirtualX = TGQt::GetVirtualX();
65  // gSystem->Load("libGui");
66  fGuiProxy = new TRootGuiFactory();
67 }
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// TQtRootGuiFactory ctor.
71 /// Restore the right TVirtualX pointer
72 
73 TQtRootGuiFactory::TQtRootGuiFactory(const char *name, const char *title)
74  : TGuiFactory(name, title),fGuiProxy(0)
75 {
76  if (TGQt::GetVirtualX()) gVirtualX = TGQt::GetVirtualX();
77  // gSystem->Load("libGui");
78  fGuiProxy = new TRootGuiFactory(name,title);
79 }
80 ////////////////////////////////////////////////////////////////////////////////
81 
82 TApplicationImp *TQtRootGuiFactory::CreateApplicationImp(const char *classname, int *argc, char **argv)
83 {
84  TGQt::CreateQtApplicationImp();
85  TApplicationImp *app = 0;
86 #ifdef R__QTWIN32
87 # if ROOT_VERSION_CODE < ROOT_VERSION(5,13,0)
88  app = new TWin32Application(classname, argc, argv);
89 # endif
90 #else
91  app = new TQtRootApplication (classname, argc, argv);
92 #endif
93  CreateQClient();
94  return app;
95 }
96 ////////////////////////////////////////////////////////////////////////////////
97 
99 {
100  gfQtClient = new TGClient();
101  // ((TQt *)TQt::GetVirtualX())->SetQClientFilter(new TQClientFilter(new TGClient()));
102 }
103 
104 ////////////////////////////////////////////////////////////////////////////////
105 
107 { return fGuiProxy ? fGuiProxy->CreateCanvasImp( c, title, width, height) : 0; }
108 
109 ////////////////////////////////////////////////////////////////////////////////
110 
112 { return fGuiProxy ? fGuiProxy->CreateCanvasImp(c, title, x, y, width, height) : 0 ;}
113 
114 ////////////////////////////////////////////////////////////////////////////////
115 
117 {
118  return CreateBrowserImp(b, title, width, height, (Option_t *)0);
119 }
120 
121 ////////////////////////////////////////////////////////////////////////////////
122 
124 {
125  return CreateBrowserImp(b, title, x, y, width, height, (Option_t *)0);
126 }
127 
128 ////////////////////////////////////////////////////////////////////////////////
129 
131 {
132  return fGuiProxy ?
133 #if ROOT_VERSION_CODE < ROOT_VERSION(5,17,5)
134  fGuiProxy->CreateBrowserImp(b, title, width, height)
135 #else
136  fGuiProxy->CreateBrowserImp(b, title, width, height, opt)
137 #endif
138  : 0;
139 }
140 
141 ////////////////////////////////////////////////////////////////////////////////
142 
144 {
145  return fGuiProxy ?
146 #if ROOT_VERSION_CODE < ROOT_VERSION(5,17,5)
147  fGuiProxy->CreateBrowserImp(b, title, x, y, width, height)
148 #else
149  fGuiProxy->CreateBrowserImp(b, title, x, y, width, height, opt)
150 #endif
151  : 0 ;
152 }
153 
154 ////////////////////////////////////////////////////////////////////////////////
155 
157 { return fGuiProxy ? fGuiProxy->CreateContextMenuImp(c, name, title): 0;}
158 
159 ////////////////////////////////////////////////////////////////////////////////
160 
162 { return fGuiProxy ? fGuiProxy->CreateControlBarImp(c,title) : 0;}
163 
164 ////////////////////////////////////////////////////////////////////////////////
165 
167 { return fGuiProxy ? fGuiProxy->CreateControlBarImp(c, title, x, y):0;}
168 
169 ////////////////////////////////////////////////////////////////////////////////
170 
172 { return fGuiProxy ? fGuiProxy->CreateInspectorImp(obj, width, height) :0 ;}
virtual TContextMenuImp * CreateContextMenuImp(TContextMenu *c, const char *name, const char *title)
Create a batch version of TContextMenuImp.
virtual TBrowserImp * CreateBrowserImp(TBrowser *b, const char *title, UInt_t width, UInt_t height, Option_t *opt="")
Create a batch version of TBrowserImp.
Definition: TGuiFactory.cxx:71
TGuiFactory * ROOT_Plugin_TQtRootGuiFactory()
PluginManager creation function.
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
Definition: TControlBar.h:37
ClassImp(TQtRootGuiFactory) TQtRootGuiFactory
TQtRootGuiFactory ctor.
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area)...
Definition: TCanvasImp.h:32
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
This class provides an interface to GUI independent context sensitive popup menus.
const char Option_t
Definition: RtypesCore.h:62
virtual TCanvasImp * CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height)
Create a batch version of TCanvasImp.
ABC describing GUI independent control bar.
int Int_t
Definition: RtypesCore.h:41
virtual TContextMenuImp * CreateContextMenuImp(TContextMenu *c, const char *name, const char *title)
Create a batch version of TContextMenuImp.
Definition: TGuiFactory.cxx:87
virtual TControlBarImp * CreateControlBarImp(TControlBar *c, const char *title)
Create a batch version of TControlBarImp.
ABC describing GUI independent application implementation protocol.
Double_t x[n]
Definition: legend1.C:17
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
static TGClient * gfQtClient
This class provides an interface to context sensitive popup menus.
Definition: TContextMenu.h:44
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual TInspectorImp * CreateInspectorImp(const TObject *obj, UInt_t width, UInt_t height)
Create a batch version of TInspectorImp.
#define gVirtualX
Definition: TVirtualX.h:362
TGuiFactory * fGuiProxy
The Canvas class.
Definition: TCanvas.h:48
Double_t y[n]
Definition: legend1.C:17
virtual TCanvasImp * CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height)
Create a batch version of TCanvasImp.
Definition: TGuiFactory.cxx:55
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
This ABC is a factory for GUI components.
Definition: TGuiFactory.h:44
virtual TInspectorImp * CreateInspectorImp(const TObject *obj, UInt_t width, UInt_t height)
Create a batch version of TInspectorImp.
virtual TBrowserImp * CreateBrowserImp(TBrowser *b, const char *title, UInt_t width, UInt_t height)
static void CreateQClient()
virtual TApplicationImp * CreateApplicationImp(const char *classname, int *argc, char **argv)
Create a batch version of TApplicationImp.
ABC describing GUI independent object inspector (abstraction mainly needed for Win32.
Definition: TInspectorImp.h:32
TObject * obj
virtual TControlBarImp * CreateControlBarImp(TControlBar *c, const char *title)
Create a batch version of TControlBarImp.
Definition: TGuiFactory.cxx:95
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:31