5 if ( TVirtualPad::Pad() ) {
7 c->Connect(
"ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
"ClickCollector",
9 "DoCollect(Int_t,Int_t,Int_t,TObject*)");
10 cout <<
" - Start collecting clicks in " << c->GetName() <<
endl ;
15 cout <<
" - Cannot collect clicks, there is no current pad !!! " <<
endl ;
19 #include <RQ_OBJECT.h>
23 RQ_OBJECT(
"ClickCollector")
29 Int_t fLastPx, fLastPy;
30 EEventType fCollectMode;
42 void SetMode(Bool_t mode =
true) { fIsActive = mode; }
49 void DoCollect(Int_t event, Int_t px, Int_t py, TObject *obj);
55 ClickCollector::ClickCollector() : fLastPx(0), fLastPy(0), fCollectMode(kKeyPress), fMarker()
58 fMarker.SetMarkerStyle(20); fMarker.SetMarkerColor(2); gfCollector =
this;
64 if ( gfCollector == NULL )
new ClickCollector();
return gfCollector;
74 if ( event == kMouseMotion ) { fLastPx = px; fLastPy = py;
return; }
76 if ( event == fCollectMode && fIsActive ) {
77 if ( gROOT->GetSelectedPad() ) {
78 fMarker.DrawMarker(gROOT->GetSelectedPad()->AbsPixeltoX(fLastPx),
79 gROOT->GetSelectedPad()->AbsPixeltoY(fLastPy));
80 gROOT->GetSelectedPad()->Update();
void DoCollect(Int_t event, Int_t px, Int_t py, TObject *obj)
void SetMode(Bool_t mode=true)
static ClickCollector * TheCollector()
void SetMarker(TMarker m)
ADF::LogMessage & endl(ADF::LogMessage &log)