00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "TQtRootGuiFactory.h"
00025 #include "TRootGuiFactory.h"
00026 #include "TQtRConfig.h"
00027
00028 #include "TApplication.h"
00029 #include "TQtApplication.h"
00030
00031 #include "TSystem.h"
00032 #ifdef R__QTWIN32
00033 # if ROOT_VERSION_CODE < ROOT_VERSION(5,13,0)
00034 # include "TWin32Application.h"
00035 # endif
00036 #else
00037 # include "TROOT.h"
00038 # include "TQtRootApplication.h"
00039 #endif
00040
00041 #include "TGClient.h"
00042 #include "TRootCanvas.h"
00043 #include "TRootBrowser.h"
00044 #include "TRootControlBar.h"
00045 #include "TContextMenu.h"
00046 #include "TRootContextMenu.h"
00047
00048 #include "TGQt.h"
00049
00050 TGClient *TQtRootGuiFactory::gfQtClient = 0;
00051 ClassImp(TQtRootGuiFactory)
00052
00053 TQtRootGuiFactory::TQtRootGuiFactory()
00054 : TGuiFactory("QtRootProxy","Qt-based ROOT GUI Factory"),fGuiProxy(0)
00055 {
00056
00057
00058 if (TGQt::GetVirtualX()) gVirtualX = TGQt::GetVirtualX();
00059
00060 fGuiProxy = new TRootGuiFactory();
00061 }
00062
00063
00064 TQtRootGuiFactory::TQtRootGuiFactory(const char *name, const char *title)
00065 : TGuiFactory(name, title),fGuiProxy(0)
00066 {
00067
00068
00069 if (TGQt::GetVirtualX()) gVirtualX = TGQt::GetVirtualX();
00070
00071 fGuiProxy = new TRootGuiFactory(name,title);
00072 }
00073
00074 TApplicationImp *TQtRootGuiFactory::CreateApplicationImp(const char *classname, int *argc, char **argv)
00075 {
00076 TGQt::CreateQtApplicationImp();
00077 TApplicationImp *app = 0;
00078 #ifdef R__QTWIN32
00079 # if ROOT_VERSION_CODE < ROOT_VERSION(5,13,0)
00080 app = new TWin32Application(classname, argc, argv);
00081 # endif
00082 #else
00083 app = new TQtRootApplication (classname, argc, argv);
00084 #endif
00085 CreateQClient();
00086 return app;
00087 }
00088
00089 void TQtRootGuiFactory::CreateQClient()
00090 {
00091 gfQtClient = new TGClient();
00092
00093 }
00094
00095
00096 TCanvasImp *TQtRootGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height)
00097 { return fGuiProxy ? fGuiProxy->CreateCanvasImp( c, title, width, height) : 0; }
00098
00099
00100 TCanvasImp *TQtRootGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height)
00101 { return fGuiProxy ? fGuiProxy->CreateCanvasImp(c, title, x, y, width, height) : 0 ;}
00102
00103
00104 TBrowserImp *TQtRootGuiFactory::CreateBrowserImp(TBrowser *b, const char *title, UInt_t width, UInt_t height)
00105 {
00106 return CreateBrowserImp(b, title, width, height, (Option_t *)0);
00107 }
00108
00109
00110 TBrowserImp *TQtRootGuiFactory::CreateBrowserImp(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height)
00111 {
00112 return CreateBrowserImp(b, title, x, y, width, height, (Option_t *)0);
00113 }
00114
00115
00116 TBrowserImp *TQtRootGuiFactory::CreateBrowserImp(TBrowser *b, const char *title, UInt_t width, UInt_t height,Option_t *opt)
00117 {
00118 return fGuiProxy ?
00119 #if ROOT_VERSION_CODE < ROOT_VERSION(5,17,5)
00120 fGuiProxy->CreateBrowserImp(b, title, width, height)
00121 #else
00122 fGuiProxy->CreateBrowserImp(b, title, width, height, opt)
00123 #endif
00124 : 0;
00125 }
00126
00127
00128 TBrowserImp *TQtRootGuiFactory::CreateBrowserImp(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height,Option_t *opt)
00129 {
00130 return fGuiProxy ?
00131 #if ROOT_VERSION_CODE < ROOT_VERSION(5,17,5)
00132 fGuiProxy->CreateBrowserImp(b, title, x, y, width, height)
00133 #else
00134 fGuiProxy->CreateBrowserImp(b, title, x, y, width, height, opt)
00135 #endif
00136 : 0 ;
00137 }
00138
00139
00140 TContextMenuImp *TQtRootGuiFactory::CreateContextMenuImp(TContextMenu *c, const char *name, const char *title)
00141 { return fGuiProxy ? fGuiProxy->CreateContextMenuImp(c, name, title): 0;}
00142
00143
00144 TControlBarImp *TQtRootGuiFactory::CreateControlBarImp(TControlBar *c, const char *title)
00145 { return fGuiProxy ? fGuiProxy->CreateControlBarImp(c,title) : 0;}
00146
00147
00148 TControlBarImp *TQtRootGuiFactory::CreateControlBarImp(TControlBar *c, const char *title, Int_t x, Int_t y)
00149 { return fGuiProxy ? fGuiProxy->CreateControlBarImp(c, title, x, y):0;}
00150
00151
00152 TInspectorImp *TQtRootGuiFactory::CreateInspectorImp(const TObject *obj, UInt_t width, UInt_t height)
00153 { return fGuiProxy ? fGuiProxy->CreateInspectorImp(obj, width, height) :0 ;}