Logo ROOT   6.14/05
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 
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:72
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:22
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area)...
Definition: TCanvasImp.h:30
This class provides an interface to GUI independent context sensitive popup menus.
const char Option_t
Definition: RtypesCore.h:62
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
Definition: TGaxis.cxx:2551
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:88
virtual TControlBarImp * CreateControlBarImp(TControlBar *c, const char *title)
Create a batch version of TControlBarImp.
ABC describing GUI independent application implementation protocol.
TQtRootGuiFactory()
TQtRootGuiFactory ctor.
Double_t x[n]
Definition: legend1.C:17
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
static TGClient * gfQtClient
This class provides an interface to context sensitive popup menus.
Definition: TContextMenu.h:40
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:350
TGuiFactory * fGuiProxy
The Canvas class.
Definition: TCanvas.h:31
#define ClassImp(name)
Definition: Rtypes.h:359
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:56
Mother of all ROOT objects.
Definition: TObject.h:37
This ABC is a factory for GUI components.
Definition: TGuiFactory.h:42
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)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
#define c(i)
Definition: RSha256.hxx:101
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:30
virtual TControlBarImp * CreateControlBarImp(TControlBar *c, const char *title)
Create a batch version of TControlBarImp.
Definition: TGuiFactory.cxx:96
char name[80]
Definition: TGX11.cxx:109
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:29