TQtRootGuiFactory.cxx

Go to the documentation of this file.
00001 // Author: Valeri Fine   21/01/2002
00002 /****************************************************************************
00003 ** $Id: TQtRootGuiFactory.cxx,v 1.12 2007/11/02 17:19:04 fine Exp $
00004 **
00005 ** Copyright (C) 2002 by Valeri Fine. Brookhaven National Laboratory.
00006 **                                    All rights reserved.
00007 **
00008 ** This file may be distributed under the terms of the Q Public License
00009 ** as defined by Trolltech AS of Norway and appearing in the file
00010 ** LICENSE.QPL included in the packaging of this file.
00011 **
00012 *****************************************************************************/
00013 
00014 //________________________________________________________________________
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TQtRootGuiFactory                                                    //
00018 //                                                                      //
00019 // This class is a factory for Qt GUI components. It overrides          //
00020 // the member functions of the ABS TGuiFactory.                         //
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    // TQtRootGuiFactory ctor.
00057    // Restore the right TVirtualX pointer      
00058    if (TGQt::GetVirtualX())  gVirtualX = TGQt::GetVirtualX();
00059    // gSystem->Load("libGui");
00060    fGuiProxy = new TRootGuiFactory(); 
00061 }
00062 
00063 //______________________________________________________________________________
00064 TQtRootGuiFactory::TQtRootGuiFactory(const char *name, const char *title)
00065    : TGuiFactory(name, title),fGuiProxy(0)
00066 {
00067    // TQtRootGuiFactory ctor.
00068    // Restore the right TVirtualX pointer      
00069    if (TGQt::GetVirtualX())  gVirtualX = TGQt::GetVirtualX();
00070    // gSystem->Load("libGui");
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    // ((TQt *)TQt::GetVirtualX())->SetQClientFilter(new TQClientFilter(new TGClient()));
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 ;}

Generated on Tue Jul 5 14:22:21 2011 for ROOT_528-00b_version by  doxygen 1.5.1