// @(#)root/base:$Id$
// Author: Fons Rademakers   15/11/95

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGuiFactory                                                          //
//                                                                      //
// This ABC is a factory for GUI components. Depending on which         //
// factory is active one gets either ROOT native (X11 based with Win95  //
// look and feel), Win32 or Mac components.                             //
// In case there is no platform dependent implementation on can run in  //
// batch mode directly using an instance of this base class.            //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TGuiFactory.h"
#include "TApplicationImp.h"
#include "TCanvasImp.h"
#include "TBrowserImp.h"
#include "TContextMenuImp.h"
#include "TControlBarImp.h"
#include "TInspectorImp.h"
#include "TROOT.h"

TGuiFactory *gGuiFactory = 0;
TGuiFactory *gBatchGuiFactory = 0;

ClassImp(TGuiFactory)

//______________________________________________________________________________
TGuiFactory::TGuiFactory(const char *name, const char *title)
    : TNamed(name, title)
{
   // TGuiFactory ctor only called by derived classes.
}

//______________________________________________________________________________
TApplicationImp *TGuiFactory::CreateApplicationImp(const char *classname, int *argc, char **argv)
{
   // Create a batch version of TApplicationImp.

   return new TApplicationImp(classname, argc, argv);
}

//______________________________________________________________________________
TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height)
{
   // Create a batch version of TCanvasImp.

   return new TCanvasImp(c, title, width, height);
}

//______________________________________________________________________________
TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height)
{
   // Create a batch version of TCanvasImp.

   return new TCanvasImp(c, title, x, y, width, height);
}

//______________________________________________________________________________
TBrowserImp *TGuiFactory::CreateBrowserImp(TBrowser *b, const char *title, UInt_t width, UInt_t height, Option_t *)
{
   // Create a batch version of TBrowserImp.

   return new TBrowserImp(b, title, width, height);
}

//______________________________________________________________________________
TBrowserImp *TGuiFactory::CreateBrowserImp(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *)
{
   // Create a batch version of TBrowserImp.

   return new TBrowserImp(b, title, x, y, width, height);
}

//______________________________________________________________________________
TContextMenuImp *TGuiFactory::CreateContextMenuImp(TContextMenu *c, const char *, const char *)
{
   // Create a batch version of TContextMenuImp.

   return new TContextMenuImp(c);
}

//______________________________________________________________________________
TControlBarImp *TGuiFactory::CreateControlBarImp(TControlBar *c, const char *title)
{
   // Create a batch version of TControlBarImp.

   return new TControlBarImp(c, title);
}

//______________________________________________________________________________
TControlBarImp *TGuiFactory::CreateControlBarImp(TControlBar *c, const char *title, Int_t x, Int_t y)
{
   // Create a batch version of TControlBarImp.

   return new TControlBarImp(c, title, x, y);
}

//______________________________________________________________________________
TInspectorImp *TGuiFactory::CreateInspectorImp(const TObject *obj, UInt_t width, UInt_t height)
{
   // Create a batch version of TInspectorImp.

   if (gROOT->IsBatch()) {
      return new TInspectorImp(obj, width, height);
   }

   gROOT->ProcessLine(Form("TInspectCanvas::Inspector((TObject*)0x%lx);", (ULong_t)obj));
   return 0;
}
 TGuiFactory.cxx:1
 TGuiFactory.cxx:2
 TGuiFactory.cxx:3
 TGuiFactory.cxx:4
 TGuiFactory.cxx:5
 TGuiFactory.cxx:6
 TGuiFactory.cxx:7
 TGuiFactory.cxx:8
 TGuiFactory.cxx:9
 TGuiFactory.cxx:10
 TGuiFactory.cxx:11
 TGuiFactory.cxx:12
 TGuiFactory.cxx:13
 TGuiFactory.cxx:14
 TGuiFactory.cxx:15
 TGuiFactory.cxx:16
 TGuiFactory.cxx:17
 TGuiFactory.cxx:18
 TGuiFactory.cxx:19
 TGuiFactory.cxx:20
 TGuiFactory.cxx:21
 TGuiFactory.cxx:22
 TGuiFactory.cxx:23
 TGuiFactory.cxx:24
 TGuiFactory.cxx:25
 TGuiFactory.cxx:26
 TGuiFactory.cxx:27
 TGuiFactory.cxx:28
 TGuiFactory.cxx:29
 TGuiFactory.cxx:30
 TGuiFactory.cxx:31
 TGuiFactory.cxx:32
 TGuiFactory.cxx:33
 TGuiFactory.cxx:34
 TGuiFactory.cxx:35
 TGuiFactory.cxx:36
 TGuiFactory.cxx:37
 TGuiFactory.cxx:38
 TGuiFactory.cxx:39
 TGuiFactory.cxx:40
 TGuiFactory.cxx:41
 TGuiFactory.cxx:42
 TGuiFactory.cxx:43
 TGuiFactory.cxx:44
 TGuiFactory.cxx:45
 TGuiFactory.cxx:46
 TGuiFactory.cxx:47
 TGuiFactory.cxx:48
 TGuiFactory.cxx:49
 TGuiFactory.cxx:50
 TGuiFactory.cxx:51
 TGuiFactory.cxx:52
 TGuiFactory.cxx:53
 TGuiFactory.cxx:54
 TGuiFactory.cxx:55
 TGuiFactory.cxx:56
 TGuiFactory.cxx:57
 TGuiFactory.cxx:58
 TGuiFactory.cxx:59
 TGuiFactory.cxx:60
 TGuiFactory.cxx:61
 TGuiFactory.cxx:62
 TGuiFactory.cxx:63
 TGuiFactory.cxx:64
 TGuiFactory.cxx:65
 TGuiFactory.cxx:66
 TGuiFactory.cxx:67
 TGuiFactory.cxx:68
 TGuiFactory.cxx:69
 TGuiFactory.cxx:70
 TGuiFactory.cxx:71
 TGuiFactory.cxx:72
 TGuiFactory.cxx:73
 TGuiFactory.cxx:74
 TGuiFactory.cxx:75
 TGuiFactory.cxx:76
 TGuiFactory.cxx:77
 TGuiFactory.cxx:78
 TGuiFactory.cxx:79
 TGuiFactory.cxx:80
 TGuiFactory.cxx:81
 TGuiFactory.cxx:82
 TGuiFactory.cxx:83
 TGuiFactory.cxx:84
 TGuiFactory.cxx:85
 TGuiFactory.cxx:86
 TGuiFactory.cxx:87
 TGuiFactory.cxx:88
 TGuiFactory.cxx:89
 TGuiFactory.cxx:90
 TGuiFactory.cxx:91
 TGuiFactory.cxx:92
 TGuiFactory.cxx:93
 TGuiFactory.cxx:94
 TGuiFactory.cxx:95
 TGuiFactory.cxx:96
 TGuiFactory.cxx:97
 TGuiFactory.cxx:98
 TGuiFactory.cxx:99
 TGuiFactory.cxx:100
 TGuiFactory.cxx:101
 TGuiFactory.cxx:102
 TGuiFactory.cxx:103
 TGuiFactory.cxx:104
 TGuiFactory.cxx:105
 TGuiFactory.cxx:106
 TGuiFactory.cxx:107
 TGuiFactory.cxx:108
 TGuiFactory.cxx:109
 TGuiFactory.cxx:110
 TGuiFactory.cxx:111
 TGuiFactory.cxx:112
 TGuiFactory.cxx:113
 TGuiFactory.cxx:114
 TGuiFactory.cxx:115
 TGuiFactory.cxx:116
 TGuiFactory.cxx:117
 TGuiFactory.cxx:118
 TGuiFactory.cxx:119
 TGuiFactory.cxx:120