Logo ROOT   6.16/01
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#include "TClass.h"
15
17
18
20
21/** \class TVirtualHistPainter
22 \ingroup Hist
23 Abstract interface to a histogram painter
24*/
25
26
27////////////////////////////////////////////////////////////////////////////////
28/// Static function returning a pointer to the current histogram painter.
29/// The painter will paint the specified obj. If the histogram painter
30/// does not exist a default painter is created.
31
33{
34 // if no painter set yet, create a default painter via the PluginManager
35 if (!fgPainter) {
37 if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualHistPainter"))) {
38 if (h->LoadPlugin() == -1)
39 return 0;
41 if (!fgPainter) return 0;
42 } else {
43 // fgPainter is still null
44 return 0;
45 }
46 }
47
48 //create an instance of the histogram painter
50 if (p) p->SetHistogram(obj);
51 return p;
52}
53
54////////////////////////////////////////////////////////////////////////////////
55/// Static function to set an alternative histogram painter.
56
57void TVirtualHistPainter::SetPainter(const char *painter)
58{
59 fgPainter = TClass::GetClass(painter);
60}
#define h(i)
Definition: RSha256.hxx:106
#define ClassImp(name)
Definition: Rtypes.h:363
#define gROOT
Definition: TROOT.h:410
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition: TClass.cxx:4824
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:2885
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.