ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 TGClient *TQtRootGuiFactory::gfQtClient = 0;
49 ////////////////////////////////////////////////////////////////////////////////
50 /// TQtRootGuiFactory ctor.
51 /// Restore the right TVirtualX pointer
52 
54  : TGuiFactory("QtRootProxy","Qt-based ROOT GUI Factory"),fGuiProxy(0)
55 {
56  if (TGQt::GetVirtualX()) gVirtualX = TGQt::GetVirtualX();
57  // gSystem->Load("libGui");
58  fGuiProxy = new TRootGuiFactory();
59 }
60 
61 ////////////////////////////////////////////////////////////////////////////////
62 /// TQtRootGuiFactory ctor.
63 /// Restore the right TVirtualX pointer
64 
66  : TGuiFactory(name, title),fGuiProxy(0)
67 {
68  if (TGQt::GetVirtualX()) gVirtualX = TGQt::GetVirtualX();
69  // gSystem->Load("libGui");
70  fGuiProxy = new TRootGuiFactory(name,title);
71 }
72 ////////////////////////////////////////////////////////////////////////////////
73 
74 TApplicationImp *TQtRootGuiFactory::CreateApplicationImp(const char *classname, int *argc, char **argv)
75 {
76  TGQt::CreateQtApplicationImp();
77  TApplicationImp *app = 0;
78 #ifdef R__QTWIN32
79 # if ROOT_VERSION_CODE < ROOT_VERSION(5,13,0)
80  app = new TWin32Application(classname, argc, argv);
81 # endif
82 #else
83  app = new TQtRootApplication (classname, argc, argv);
84 #endif
85  CreateQClient();
86  return app;
87 }
88 ////////////////////////////////////////////////////////////////////////////////
89 
91 {
92  gfQtClient = new TGClient();
93  // ((TQt *)TQt::GetVirtualX())->SetQClientFilter(new TQClientFilter(new TGClient()));
94 }
95 
96 ////////////////////////////////////////////////////////////////////////////////
97 
99 { return fGuiProxy ? fGuiProxy->CreateCanvasImp( c, title, width, height) : 0; }
100 
101 ////////////////////////////////////////////////////////////////////////////////
102 
104 { return fGuiProxy ? fGuiProxy->CreateCanvasImp(c, title, x, y, width, height) : 0 ;}
105 
106 ////////////////////////////////////////////////////////////////////////////////
107 
109 {
110  return CreateBrowserImp(b, title, width, height, (Option_t *)0);
111 }
112 
113 ////////////////////////////////////////////////////////////////////////////////
114 
116 {
117  return CreateBrowserImp(b, title, x, y, width, height, (Option_t *)0);
118 }
119 
120 ////////////////////////////////////////////////////////////////////////////////
121 
123 {
124  return fGuiProxy ?
125 #if ROOT_VERSION_CODE < ROOT_VERSION(5,17,5)
126  fGuiProxy->CreateBrowserImp(b, title, width, height)
127 #else
128  fGuiProxy->CreateBrowserImp(b, title, width, height, opt)
129 #endif
130  : 0;
131 }
132 
133 ////////////////////////////////////////////////////////////////////////////////
134 
136 {
137  return fGuiProxy ?
138 #if ROOT_VERSION_CODE < ROOT_VERSION(5,17,5)
139  fGuiProxy->CreateBrowserImp(b, title, x, y, width, height)
140 #else
141  fGuiProxy->CreateBrowserImp(b, title, x, y, width, height, opt)
142 #endif
143  : 0 ;
144 }
145 
146 ////////////////////////////////////////////////////////////////////////////////
147 
149 { return fGuiProxy ? fGuiProxy->CreateContextMenuImp(c, name, title): 0;}
150 
151 ////////////////////////////////////////////////////////////////////////////////
152 
154 { return fGuiProxy ? fGuiProxy->CreateControlBarImp(c,title) : 0;}
155 
156 ////////////////////////////////////////////////////////////////////////////////
157 
159 { return fGuiProxy ? fGuiProxy->CreateControlBarImp(c, title, x, y):0;}
160 
161 ////////////////////////////////////////////////////////////////////////////////
162 
164 { 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
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
This class provides an interface to GUI independent context sensitive popup menus.
return c
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
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
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