Public Member Functions | Protected Attributes | List of all members
evdb::Canvas Class Referenceabstract

#include <Canvas.h>

Inheritance diagram for evdb::Canvas:
evdb::Printable evd::CalorView evd::Display3DView evd::Ortho3DView evd::TWQMultiTPCProjectionView evd::TWQProjectionView evdb::testCanvas1

Public Member Functions

 Canvas (TGMainFrame *mf)
 
virtual ~Canvas ()
 
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...
 
- Public Member Functions inherited from evdb::Printable
 Printable ()
 
virtual ~Printable ()
 

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...
 

Additional Inherited Members

- Static Public Member Functions inherited from evdb::Printable
static void AddToListOfPrintables (const char *name, evdb::Printable *p)
 
static void RemoveFromListOfPrintables (evdb::Printable *p)
 
static std::map< std::string, evdb::Printable * > & GetPrintables ()
 

Detailed Description

Definition at line 22 of file Canvas.h.

Constructor & Destructor Documentation

evdb::Canvas::Canvas ( TGMainFrame *  mf)

Perform the basic setup for a drawing canvas

Definition at line 33 of file Canvas.cxx.

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

Definition at line 78 of file Canvas.cxx.

79  {
80  // IoModule::Instance()->Disconnect(0,this,0);
81  delete fEmbCanvas;
82  delete fLayout;
83  delete fFrame;
84  }
TGCompositeFrame * fFrame
Graphics frame.
Definition: Canvas.h:39
TGLayoutHints * fLayout
Layout hints for frame.
Definition: Canvas.h:40
TRootEmbeddedCanvas * fEmbCanvas
Embedded canvas.
Definition: Canvas.h:41

Member Function Documentation

void evdb::Canvas::Connect ( )

Make signal/slot connections.

Definition at line 68 of file Canvas.cxx.

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

Reimplemented from evdb::Printable.

Reimplemented in evd::TWQProjectionView, evd::TWQMultiTPCProjectionView, evdb::testCanvas1, evd::CalorView, evd::Ortho3DView, and evd::Display3DView.

Definition at line 33 of file Canvas.h.

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

Implements evdb::Printable.

Definition at line 88 of file Canvas.cxx.

88 { fCanvas->Print(f); }
TCanvas * fCanvas
The ROOT drawing canvas.
Definition: Canvas.h:42
virtual const char* evdb::Canvas::PrintTag ( ) const
inlinevirtual

Implements evdb::Printable.

Reimplemented in evd::TWQProjectionView, evd::TWQMultiTPCProjectionView, evdb::testCanvas1, evd::CalorView, evd::Ortho3DView, and evd::Display3DView.

Definition at line 32 of file Canvas.h.

32 {return "sub-class needs print tag"; }

Member Data Documentation

float evdb::Canvas::fAspectRatio
protected

fYsize/fXsize

Definition at line 46 of file Canvas.h.

TCanvas* evdb::Canvas::fCanvas
protected

The ROOT drawing canvas.

Definition at line 42 of file Canvas.h.

TRootEmbeddedCanvas* evdb::Canvas::fEmbCanvas
protected

Embedded canvas.

Definition at line 41 of file Canvas.h.

TGCompositeFrame* evdb::Canvas::fFrame
protected

Graphics frame.

Definition at line 39 of file Canvas.h.

TGLayoutHints* evdb::Canvas::fLayout
protected

Layout hints for frame.

Definition at line 40 of file Canvas.h.

unsigned short evdb::Canvas::fXsize
protected

Size of the canvas;.

Definition at line 44 of file Canvas.h.

unsigned short evdb::Canvas::fYsize
protected

Size of the canvas;.

Definition at line 45 of file Canvas.h.


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