Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

evdb::Canvas Class Reference

#include <Canvas.h>

Inheritance diagram for evdb::Canvas:

evdb::Printable evd::DetectorView evd::PlaneView testCanvas1 testCanvas2 TestDisplay List of all members.

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)
 Print the object to a file.

void Connect ()
 Make signal/slot connections.


Protected Attributes

TGCompositeFrame * fFrame
 Graphics frame.

TGLayoutHints * fLayout
 Layout hints for frame.

TRootEmbeddedCanvas * fEmbCanvas
 Embedded canvas.

TCanvas * fCanvas
 The ROOT drawing canvas.

unsigned short fXsize
 Size of the canvas;.

unsigned short fYsize
 Size of the canvas;.

float fAspectRatio
 fYsize/fXsize


Constructor & Destructor Documentation

Canvas::Canvas TGMainFrame *  mf  ) 
 

Perform the basic setup for a drawing canvas

Definition at line 23 of file Canvas.cxx.

References fAspectRatio, fCanvas, fEmbCanvas, fFrame, fLayout, fXsize, and fYsize.

00024 {
00025   TGDimension sz;     // Size of the main frame
00026   
00027   sz           = mf->GetSize();
00028   fXsize       = sz.fWidth  - 10; // Leave small margin on left and right 
00029   fYsize       = sz.fHeight - 58; // Leave small margin on top and bottom
00030   fAspectRatio = (float)fYsize/(float)fXsize;
00031   
00032   fFrame  = new TGCompositeFrame(mf, 60, 60, kHorizontalFrame);
00033   fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX |
00034                               kLHintsExpandY, 5, 5, 5, 5);
00035   
00036   // Careful about clashes with root's naming of canvases. Make a name
00037   // like "tpcEVDCanvas" using the print tag
00038   std::string name(this->PrintTag());
00039   name += "evdb::Canvas";
00040   fEmbCanvas = new TRootEmbeddedCanvas(name.c_str(), fFrame, fXsize, fYsize,
00041                                        kSunkenFrame, 0);
00042   fFrame->AddFrame(fEmbCanvas, fLayout);
00043   mf->AddFrame(fFrame);
00044   
00045   fCanvas = fEmbCanvas->GetCanvas();
00046 }

Canvas::~Canvas  )  [virtual]
 

Definition at line 60 of file Canvas.cxx.

References fEmbCanvas, fFrame, and fLayout.

00061 {
00062   IoModule::Instance()->Disconnect(0,this,0);
00063   delete fEmbCanvas;
00064   delete fLayout;    
00065   delete fFrame;
00066 }


Member Function Documentation

void Canvas::Connect  ) 
 

Make signal/slot connections.

Definition at line 50 of file Canvas.cxx.

Referenced by evdb::DisplayWindow::DisplayWindow().

00051 {
00052   // Make connections for drawing and printing
00053   IoModule::Instance()->Connect("NewEvent()",
00054                                 "evdb::Canvas",this,"Draw()");
00055   Printable::AddToListOfPrintables(this->Description(),this);
00056 }

virtual const char* evdb::Canvas::Description  )  const [inline, virtual]
 

Give a medium length description of what the view holds to be printed. Examples: "Full view of experiment", "3D View", ...

Reimplemented from evdb::Printable.

Reimplemented in evd::DetectorView, evd::PlaneView, testCanvas1, and testCanvas2.

Definition at line 34 of file Canvas.h.

00034 {return "sub-class needs description"; }

virtual void evdb::Canvas::Draw const char *  opt = 0  )  [pure virtual]
 

Implemented in evd::DetectorView, evd::PlaneView, testCanvas1, testCanvas2, and TestDisplay.

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

void Canvas::Print const char *  f  )  [virtual]
 

Print the object to a file.

Implements evdb::Printable.

Definition at line 70 of file Canvas.cxx.

References fCanvas.

00070 { fCanvas->Print(f); }

virtual const char* evdb::Canvas::PrintTag  )  const [inline, virtual]
 

Give a short tag which can be included in filename to ID object printed Keep to ~4 characters

Implements evdb::Printable.

Reimplemented in evd::DetectorView, evd::PlaneView, testCanvas1, and testCanvas2.

Definition at line 33 of file Canvas.h.

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


Member Data Documentation

float evdb::Canvas::fAspectRatio [protected]
 

fYsize/fXsize

Definition at line 47 of file Canvas.h.

Referenced by Canvas().

TCanvas* evdb::Canvas::fCanvas [protected]
 

The ROOT drawing canvas.

Definition at line 43 of file Canvas.h.

Referenced by Canvas(), and Print().

TRootEmbeddedCanvas* evdb::Canvas::fEmbCanvas [protected]
 

Embedded canvas.

Definition at line 42 of file Canvas.h.

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

TGCompositeFrame* evdb::Canvas::fFrame [protected]
 

Graphics frame.

Definition at line 40 of file Canvas.h.

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

TGLayoutHints* evdb::Canvas::fLayout [protected]
 

Layout hints for frame.

Definition at line 41 of file Canvas.h.

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

unsigned short evdb::Canvas::fXsize [protected]
 

Size of the canvas;.

Definition at line 45 of file Canvas.h.

Referenced by Canvas().

unsigned short evdb::Canvas::fYsize [protected]
 

Size of the canvas;.

Definition at line 46 of file Canvas.h.

Referenced by Canvas().


The documentation for this class was generated from the following files:
Generated on Fri Jul 25 02:05:53 2008 for NOvA Offline by doxygen 1.3.5