LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
evdb::ObjListCanvas Class Referenceabstract

#include "ObjListCanvas.h"

Inheritance diagram for evdb::ObjListCanvas:
evdb::Printable

Public Member Functions

 ObjListCanvas (TGMainFrame *mf)
 
virtual ~ObjListCanvas ()
 
virtual void Draw (const char *opt=0)=0
 
virtual const char * PrintTag () const
 
virtual const char * Description () const
 
virtual void Print (const char *f)
 
void Connect ()
 Make signal/slot connections. More...
 

Static Public Member Functions

static void AddToListOfPrintables (const char *name, evdb::Printable *p)
 
static void RemoveFromListOfPrintables (evdb::Printable *p)
 
static std::map< std::string, evdb::Printable * > & GetPrintables ()
 

Protected Attributes

TGCompositeFrame * fFrame
 Graphics frame. More...
 
TGLayoutHints * fLayout
 Layout hints for frame. More...
 
TRootEmbeddedCanvas * fEmbCanvas
 Embedded canvas. More...
 
TCanvas * fCanvas
 The ROOT drawing canvas. More...
 
unsigned short fXsize
 Size of the canvas;. More...
 
unsigned short fYsize
 Size of the canvas;. More...
 
float fAspectRatio
 fYsize/fXsize More...
 

Detailed Description

Definition at line 24 of file ObjListCanvas.h.

Constructor & Destructor Documentation

evdb::ObjListCanvas::ObjListCanvas ( TGMainFrame *  mf)

Perform the basic setup for a drawing canvas

Definition at line 30 of file ObjListCanvas.cxx.

References fAspectRatio, fFrame, fLayout, fXsize, fYsize, and PrintTag().

31  {
32  TGDimension sz; // Size of the main frame
33 
34  sz = mf->GetSize();
35  fXsize = sz.fWidth - 10; // Leave small margin on left and right
36  fYsize = sz.fHeight - 58; // Leave small margin on top and bottom
37  fAspectRatio = (float)fYsize/(float)fXsize;
38 
39  // This frame is apparently for holding the buttons on the top; it's
40  // not used for anything else.
41  fFrame = new TGCompositeFrame(mf, 60, 60, kHorizontalFrame);
42 
43  // Define a layout for placing the canvas within the frame.
44  fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX |
45  kLHintsExpandY, 5, 5, 5, 5);
46 
47  // Careful about clashes with root's naming of canvases. Make a name
48  // like "tpcEVDCanvas" using the print tag
49  std::string name(this->PrintTag());
50  name += "evdb::ObjListCanvas";
51 
52  /*
53  // Create the embedded canvas within the main ROOT graphics frame.
54  fEmbCanvas = new TRootEmbeddedCanvas(name.c_str(), mf, fXsize, fYsize,
55  kSunkenFrame, 0);
56  mf->AddFrame(fEmbCanvas, fLayout);
57  */
58  mf->AddFrame(fFrame);
59 
60  // Extract the graphical Canvas from the embedded canvas. The user
61  // will do most of their drawing in this.
62  // fCanvas = fEmbCanvas->GetCanvas();
63 
64  // this->Update();
65  }
unsigned short fYsize
Size of the canvas;.
Definition: ObjListCanvas.h:47
float fAspectRatio
fYsize/fXsize
Definition: ObjListCanvas.h:48
TGLayoutHints * fLayout
Layout hints for frame.
Definition: ObjListCanvas.h:42
virtual const char * PrintTag() const
Definition: ObjListCanvas.h:34
unsigned short fXsize
Size of the canvas;.
Definition: ObjListCanvas.h:46
TGCompositeFrame * fFrame
Graphics frame.
Definition: ObjListCanvas.h:41
evdb::ObjListCanvas::~ObjListCanvas ( )
virtual

Definition at line 79 of file ObjListCanvas.cxx.

References fFrame, and fLayout.

80  {
81  // IoModule::Instance()->Disconnect(0,this,0);
82  // delete fEmbCanvas;
83  delete fLayout;
84  delete fFrame;
85  }
TGLayoutHints * fLayout
Layout hints for frame.
Definition: ObjListCanvas.h:42
TGCompositeFrame * fFrame
Graphics frame.
Definition: ObjListCanvas.h:41

Member Function Documentation

void evdb::Printable::AddToListOfPrintables ( const char *  name,
evdb::Printable p 
)
staticinherited

Definition at line 29 of file Printable.cxx.

References s.

Referenced by evdb::Canvas::Connect(), Connect(), evdb::Printable::Description(), and evdb::testCanvas1::testCanvas1().

31  {
32  std::string s(name);
33 
34  if (gsPrintables[s] == 0) {
35  gsPrintables[s] = p;
36  }
37  else {
38  if (gsPrintables[s] != p) {
39  std::cerr << "Printable: Name " << name << " reused.\n";
40  std::abort();
41  }
42  }
43  }
Float_t s
Definition: plot.C:23
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14
void evdb::ObjListCanvas::Connect ( )

Make signal/slot connections.

Definition at line 69 of file ObjListCanvas.cxx.

References evdb::Printable::AddToListOfPrintables(), and Description().

Referenced by Description(), and evdb::ListWindow::ListWindow().

70  {
71  // Make connections for drawing and printing
72  // IoModule::Instance()->Connect("NewEvent()",
73  // "evdb::ObjListCanvas",this,"Draw()");
75  }
virtual const char * Description() const
Definition: ObjListCanvas.h:35
static void AddToListOfPrintables(const char *name, evdb::Printable *p)
Definition: Printable.cxx:29
virtual const char* evdb::ObjListCanvas::Description ( ) const
inlinevirtual

Reimplemented from evdb::Printable.

Definition at line 35 of file ObjListCanvas.h.

References Connect(), f, and Print().

Referenced by Connect().

35 {return "sub-class needs description"; }
virtual void evdb::ObjListCanvas::Draw ( const char *  opt = 0)
pure virtual

Referenced by evdb::ListWindow::Draw().

std::map< std::string, evdb::Printable * > & evdb::Printable::GetPrintables ( )
staticinherited

Definition at line 61 of file Printable.cxx.

References evdb::gsPrintables.

Referenced by evdb::Printable::Description(), evdb::EventDisplay::postProcessEvent(), and evdb::PrintDialog::PrintDialog().

62  {
63  return gsPrintables;
64  }
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14
void evdb::ObjListCanvas::Print ( const char *  f)
virtual

Implements evdb::Printable.

Definition at line 89 of file ObjListCanvas.cxx.

Referenced by Description().

89 { /*fCanvas->Print(f);*/ }
virtual const char* evdb::ObjListCanvas::PrintTag ( ) const
inlinevirtual

Implements evdb::Printable.

Definition at line 34 of file ObjListCanvas.h.

Referenced by ObjListCanvas().

34 {return "sub-class needs print tag"; }
void evdb::Printable::RemoveFromListOfPrintables ( evdb::Printable p)
staticinherited

Definition at line 47 of file Printable.cxx.

Referenced by evdb::Printable::Description(), evdb::Printable::~Printable(), and evdb::testCanvas1::~testCanvas1().

48  {
51  for (; itr!=itrEnd; ++itr) {
52  if ( itr->second == p) {
53  gsPrintables.erase(itr);
54  return;
55  }
56  }
57  }
intermediate_table::iterator iterator
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14

Member Data Documentation

float evdb::ObjListCanvas::fAspectRatio
protected

fYsize/fXsize

Definition at line 48 of file ObjListCanvas.h.

Referenced by ObjListCanvas().

TCanvas* evdb::ObjListCanvas::fCanvas
protected

The ROOT drawing canvas.

Definition at line 44 of file ObjListCanvas.h.

TRootEmbeddedCanvas* evdb::ObjListCanvas::fEmbCanvas
protected

Embedded canvas.

Definition at line 43 of file ObjListCanvas.h.

TGCompositeFrame* evdb::ObjListCanvas::fFrame
protected

Graphics frame.

Definition at line 41 of file ObjListCanvas.h.

Referenced by ObjListCanvas(), and ~ObjListCanvas().

TGLayoutHints* evdb::ObjListCanvas::fLayout
protected

Layout hints for frame.

Definition at line 42 of file ObjListCanvas.h.

Referenced by ObjListCanvas(), and ~ObjListCanvas().

unsigned short evdb::ObjListCanvas::fXsize
protected

Size of the canvas;.

Definition at line 46 of file ObjListCanvas.h.

Referenced by ObjListCanvas().

unsigned short evdb::ObjListCanvas::fYsize
protected

Size of the canvas;.

Definition at line 47 of file ObjListCanvas.h.

Referenced by ObjListCanvas().


The documentation for this class was generated from the following files: