ROOT  6.06/09
Reference Guide
TGuiFactory.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Fons Rademakers 15/11/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TGuiFactory
13 
14 This ABC is a factory for GUI components. Depending on which
15 factory is active one gets either ROOT native (X11 based with Win95
16 look and feel), Win32 or Mac components.
17 
18 In case there is no platform dependent implementation on can run in
19 batch mode directly using an instance of this base class.
20 */
21 
22 #include "TGuiFactory.h"
23 #include "TApplicationImp.h"
24 #include "TCanvasImp.h"
25 #include "TBrowserImp.h"
26 #include "TContextMenuImp.h"
27 #include "TControlBarImp.h"
28 #include "TInspectorImp.h"
29 #include "TROOT.h"
30 
31 TGuiFactory *gGuiFactory = 0;
32 TGuiFactory *gBatchGuiFactory = 0;
33 
35 
36 ////////////////////////////////////////////////////////////////////////////////
37 /// TGuiFactory ctor only called by derived classes.
38 
39 TGuiFactory::TGuiFactory(const char *name, const char *title)
40  : TNamed(name, title)
41 {
42 }
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// Create a batch version of TApplicationImp.
46 
47 TApplicationImp *TGuiFactory::CreateApplicationImp(const char *classname, int *argc, char **argv)
48 {
49  return new TApplicationImp(classname, argc, argv);
50 }
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 /// Create a batch version of TCanvasImp.
54 
55 TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height)
56 {
57  return new TCanvasImp(c, title, width, height);
58 }
59 
60 ////////////////////////////////////////////////////////////////////////////////
61 /// Create a batch version of TCanvasImp.
62 
63 TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height)
64 {
65  return new TCanvasImp(c, title, x, y, width, height);
66 }
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 /// Create a batch version of TBrowserImp.
70 
71 TBrowserImp *TGuiFactory::CreateBrowserImp(TBrowser *b, const char *title, UInt_t width, UInt_t height, Option_t *)
72 {
73  return new TBrowserImp(b, title, width, height);
74 }
75 
76 ////////////////////////////////////////////////////////////////////////////////
77 /// Create a batch version of TBrowserImp.
78 
80 {
81  return new TBrowserImp(b, title, x, y, width, height);
82 }
83 
84 ////////////////////////////////////////////////////////////////////////////////
85 /// Create a batch version of TContextMenuImp.
86 
88 {
89  return new TContextMenuImp(c);
90 }
91 
92 ////////////////////////////////////////////////////////////////////////////////
93 /// Create a batch version of TControlBarImp.
94 
96 {
97  return new TControlBarImp(c, title);
98 }
99 
100 ////////////////////////////////////////////////////////////////////////////////
101 /// Create a batch version of TControlBarImp.
102 
104 {
105  return new TControlBarImp(c, title, x, y);
106 }
107 
108 ////////////////////////////////////////////////////////////////////////////////
109 /// Create a batch version of TInspectorImp.
110 
112 {
113  if (gROOT->IsBatch()) {
114  return new TInspectorImp(obj, width, height);
115  }
116 
117  gROOT->ProcessLine(Form("TInspectCanvas::Inspector((TObject*)0x%lx);", (ULong_t)obj));
118  return 0;
119 }
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
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.
const char Option_t
Definition: RtypesCore.h:62
ABC describing GUI independent control bar.
#define gROOT
Definition: TROOT.h:340
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
ABC describing GUI independent application implementation protocol.
Double_t x[n]
Definition: legend1.C:17
virtual TApplicationImp * CreateApplicationImp(const char *classname, int *argc, char **argv)
Create a batch version of TApplicationImp.
Definition: TGuiFactory.cxx:47
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
ClassImp(TGuiFactory) TGuiFactory
TGuiFactory ctor only called by derived classes.
Definition: TGuiFactory.cxx:34
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
This class provides an interface to context sensitive popup menus.
Definition: TContextMenu.h:44
unsigned int UInt_t
Definition: RtypesCore.h:42
char * Form(const char *fmt,...)
virtual TInspectorImp * CreateInspectorImp(const TObject *obj, UInt_t width, UInt_t height)
Create a batch version of TInspectorImp.
The Canvas class.
Definition: TCanvas.h:48
unsigned long ULong_t
Definition: RtypesCore.h:51
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
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