Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 \ingroup Base
14 
15 This ABC is a factory for GUI components. Depending on which
16 factory is active one gets either ROOT native (X11 based with Win95
17 look and feel), Win32 or Mac components.
18 
19 In case there is no platform dependent implementation on can run in
20 batch mode directly using an instance of this base class.
21 */
22 
23 #include "TGuiFactory.h"
24 #include "TApplicationImp.h"
25 #include "TCanvasImp.h"
26 #include "TBrowserImp.h"
27 #include "TContextMenuImp.h"
28 #include "TControlBarImp.h"
29 #include "TInspectorImp.h"
30 #include "TROOT.h"
31 
32 TGuiFactory *gGuiFactory = 0;
33 TGuiFactory *gBatchGuiFactory = 0;
34 
35 ClassImp(TGuiFactory);
36 
37 ////////////////////////////////////////////////////////////////////////////////
38 /// TGuiFactory ctor only called by derived classes.
39 
40 TGuiFactory::TGuiFactory(const char *name, const char *title)
41  : TNamed(name, title)
42 {
43 }
44 
45 ////////////////////////////////////////////////////////////////////////////////
46 /// Create a batch version of TApplicationImp.
47 
48 TApplicationImp *TGuiFactory::CreateApplicationImp(const char *classname, int *argc, char **argv)
49 {
50  return new TApplicationImp(classname, argc, argv);
51 }
52 
53 ////////////////////////////////////////////////////////////////////////////////
54 /// Create a batch version of TCanvasImp.
55 
56 TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height)
57 {
58  return new TCanvasImp(c, title, width, height);
59 }
60 
61 ////////////////////////////////////////////////////////////////////////////////
62 /// Create a batch version of TCanvasImp.
63 
64 TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height)
65 {
66  return new TCanvasImp(c, title, x, y, width, height);
67 }
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Create a batch version of TBrowserImp.
71 
72 TBrowserImp *TGuiFactory::CreateBrowserImp(TBrowser *b, const char *title, UInt_t width, UInt_t height, Option_t *)
73 {
74  return new TBrowserImp(b, title, width, height);
75 }
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 /// Create a batch version of TBrowserImp.
79 
80 TBrowserImp *TGuiFactory::CreateBrowserImp(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *)
81 {
82  return new TBrowserImp(b, title, x, y, width, height);
83 }
84 
85 ////////////////////////////////////////////////////////////////////////////////
86 /// Create a batch version of TContextMenuImp.
87 
88 TContextMenuImp *TGuiFactory::CreateContextMenuImp(TContextMenu *c, const char *, const char *)
89 {
90  return new TContextMenuImp(c);
91 }
92 
93 ////////////////////////////////////////////////////////////////////////////////
94 /// Create a batch version of TControlBarImp.
95 
96 TControlBarImp *TGuiFactory::CreateControlBarImp(TControlBar *c, const char *title)
97 {
98  return new TControlBarImp(c, title);
99 }
100 
101 ////////////////////////////////////////////////////////////////////////////////
102 /// Create a batch version of TControlBarImp.
103 
104 TControlBarImp *TGuiFactory::CreateControlBarImp(TControlBar *c, const char *title, Int_t x, Int_t y)
105 {
106  return new TControlBarImp(c, title, x, y);
107 }
108 
109 ////////////////////////////////////////////////////////////////////////////////
110 /// Create a batch version of TInspectorImp.
111 
112 TInspectorImp *TGuiFactory::CreateInspectorImp(const TObject *obj, UInt_t width, UInt_t height)
113 {
114  if (gROOT->IsBatch()) {
115  return new TInspectorImp(obj, width, height);
116  }
117 
118  gROOT->ProcessLine(Form("TInspectCanvas::Inspector((TObject*)0x%lx);", (ULong_t)obj));
119  return 0;
120 }