Logo ROOT  
Reference Guide
TVirtualHistPainter.cxx
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Rene Brun 30/08/99
3/*************************************************************************
4 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#include "TROOT.h"
12#include "TVirtualHistPainter.h"
13#include "TPluginManager.h"
14
16
17
19
20/** \class TVirtualHistPainter
21 \ingroup Hist
22 Abstract interface to a histogram painter
23*/
24
25
26////////////////////////////////////////////////////////////////////////////////
27/// Static function returning a pointer to the current histogram painter.
28/// The painter will paint the specified obj. If the histogram painter
29/// does not exist a default painter is created.
30
32{
33 // if no painter set yet, create a default painter via the PluginManager
34 if (!fgPainter) {
36 if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualHistPainter"))) {
37 if (h->LoadPlugin() == -1)
38 return 0;
40 if (!fgPainter) return 0;
41 } else {
42 // fgPainter is still null
43 return 0;
44 }
45 }
46
47 //create an instance of the histogram painter
49 if (p) p->SetHistogram(obj);
50 return p;
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Static function to set an alternative histogram painter.
55
56void TVirtualHistPainter::SetPainter(const char *painter)
57{
58 fgPainter = TClass::GetClass(painter);
59}
#define h(i)
Definition: RSha256.hxx:106
#define ClassImp(name)
Definition: Rtypes.h:361
#define gROOT
Definition: TROOT.h:406
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition: TClass.cxx:4941
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2948
The TH1 histogram class.
Definition: TH1.h:56
Abstract interface to a histogram painter.
static TClass * fgPainter
static void SetPainter(const char *painter)
Static function to set an alternative histogram painter.
virtual void SetHistogram(TH1 *h)=0
static TVirtualHistPainter * HistPainter(TH1 *obj)
Static function returning a pointer to the current histogram painter.