#include <MINFEmbeddedCanvas.h>
Public Member Functions | |
| MINFEmbeddedCanvas (const char *name, const TGWindow *p, UInt_t w, UInt_t h, UInt_t options=kSunkenFrame|kDoubleBorder, ULong_t back=fgDefaultFrameBackground) | |
| virtual | ~MINFEmbeddedCanvas () |
| void | DrawEventStatus (Int_t event, Int_t px, Int_t py, TObject *selected) |
| TCanvas * | GetCanvas () const |
| void | SetShowEventStatus (Bool_t show) |
| void | SetStatusText (Text_t *txt, Int_t partidx) |
| void | SetUnZoomPad (TVirtualPad *pad) |
Private Member Functions | |
| Bool_t | HandleContainerButton (Event_t *ev) |
| Bool_t | HandleContainerDoubleClick (Event_t *ev) |
| Bool_t | HandleContainerConfigure (Event_t *ev) |
| Bool_t | HandleContainerKey (Event_t *ev) |
| Bool_t | HandleContainerMotion (Event_t *ev) |
| Bool_t | HandleContainerExpose (Event_t *ev) |
| Bool_t | HandleContainerCrossing (Event_t *ev) |
Private Attributes | |
| MINFEmbeddedContainer * | fCanvasContainer |
| TCanvas * | fCanvas |
| Bool_t | fAutoFit |
| Int_t | fButton |
| Bool_t | fShowEventStatus |
Friends | |
| class | MINFEmbeddedContainer |
|
||||||||||||||||||||||||||||
|
Definition at line 99 of file MINFEmbeddedCanvas.cxx. References win. 00101 : TGCanvas(p, w, h, options, back)
00102 {
00103 // Create an TCanvas embedded in a TGFrame. A pointer to the TCanvas can
00104 // be obtained via the GetCanvas() member function.
00105
00106 fButton = 0;
00107 fAutoFit = kTRUE;
00108 fShowEventStatus = kFALSE;
00109
00110 Int_t wid = gVirtualX->InitWindow((ULong_t)GetViewPort()->GetId());
00111 Window_t win = gVirtualX->GetWindowID(wid);
00112 fCanvasContainer = new MINFEmbeddedContainer(this, win, GetViewPort());
00113 SetContainer(fCanvasContainer);
00114
00115 fCanvas = new TCanvas(name, 10, 10, wid);
00116 }
|
|
|
Definition at line 119 of file MINFEmbeddedCanvas.cxx. 00120 {
00121 // Delete embedded ROOT canvas.
00122
00123 delete fCanvas;
00124 delete fCanvasContainer;
00125 }
|
|
||||||||||||||||||||
|
Definition at line 128 of file MINFEmbeddedCanvas.cxx. References GetCanvas(), and SetStatusText(). Referenced by HandleContainerButton(), HandleContainerDoubleClick(), HandleContainerKey(), and HandleContainerMotion(). 00129 {
00130
00131 //*-*-*-*-*-*-*Report name and title of primitive below the cursor*-*-*-*-*-*
00132 //*-* ===================================================
00133 //
00134 // This function is called when the option "Event Status"
00135 // in the canvas menu "Options" is selected.
00136 //
00137
00138 const Int_t kTMAX=256;
00139 static char atext[kTMAX];
00140
00141 if (!selected) return;
00142
00143 //#ifndef WIN32
00144 #if 0
00145 static Int_t pxt, pyt;
00146 gPad->SetDoubleBuffer(0); // Turn off double buffer mode
00147 gVirtualX->SetTextColor(1);
00148 gVirtualX->SetTextAlign(11);
00149
00150 pxt = gPad->GetCanvas()->XtoAbsPixel(gPad->GetCanvas()->GetX1()) + 5;
00151 pyt = gPad->GetCanvas()->YtoAbsPixel(gPad->GetCanvas()->GetY1()) - 5;
00152
00153 sprintf(atext,"%s / %s ", selected->GetName()
00154 , selected->GetObjectInfo(px,py));
00155 for (Int_t i=strlen(atext);i<kTMAX-1;i++) atext[i] = ' ';
00156 atext[kTMAX-1] = 0;
00157 gVirtualX->DrawText(pxt, pyt, 0, 1, atext, TGXW::kOpaque);
00158 #else
00159 //gmi if (!fCanvasImp) return; //this may happen when closing a TAttCanvas
00160 SetStatusText((Text_t *)(selected->GetTitle()),0);
00161 SetStatusText((Text_t *)(selected->GetName()),1);
00162 if (event == kKeyPress)
00163 sprintf(atext, "%c", (char) px);
00164 else
00165 sprintf(atext, "%d,%d", px, py);
00166 SetStatusText(atext,2);
00167 SetStatusText((Text_t *)(selected->GetObjectInfo(px,py)),3);
00168 #endif
00169 }
|
|
|
Definition at line 48 of file MINFEmbeddedCanvas.h. Referenced by DrawEventStatus(), MINFGUIPanel::GetCanvas(), and MINFDisplayFrame::GetCanvas(). 00048 { return fCanvas; }
|
|
|
Definition at line 172 of file MINFEmbeddedCanvas.cxx. References DrawEventStatus(), fButton, fCanvas, and SetUnZoomPad(). Referenced by MINFEmbeddedContainer::HandleButton(). 00173 {
00174 // Handle mouse button events in the canvas container.
00175
00176 Int_t button = event->fCode;
00177 Int_t x = event->fX;
00178 Int_t y = event->fY;
00179
00180 if (event->fType == kButtonPress) {
00181 fButton = button;
00182 if (button == kButton1)
00183 fCanvas->HandleInput(kButton1Down, x, y);
00184 if (fShowEventStatus) DrawEventStatus(event->fType, x, y, fCanvas->GetSelected());
00185 if (button == kButton2)
00186 fCanvas->HandleInput(kButton2Down, x, y);
00187 SetUnZoomPad(fCanvas->GetSelectedPad());
00188 if (button == kButton3) {
00189 fCanvas->HandleInput(kButton3Down, x, y);
00190 fButton = 0; // button up is consumed by TContextMenu
00191 }
00192
00193 } else if (event->fType == kButtonRelease) {
00194 if (button == kButton1)
00195 fCanvas->HandleInput(kButton1Up, x, y);
00196 if (fShowEventStatus) DrawEventStatus(event->fType, x, y, fCanvas->GetSelected());
00197 if (button == kButton2)
00198 fCanvas->HandleInput(kButton2Up, x, y);
00199 if (button == kButton3)
00200 fCanvas->HandleInput(kButton3Up, x, y);
00201
00202 fButton = 0;
00203 }
00204
00205 return kTRUE;
00206 }
|
|
|
Definition at line 229 of file MINFEmbeddedCanvas.cxx. References fCanvas. Referenced by MINFEmbeddedContainer::HandleConfigureNotify(). 00230 {
00231 // Handle configure (i.e. resize) event.
00232
00233 if (fAutoFit) {
00234 fCanvas->Resize();
00235 fCanvas->Update();
00236 }
00237 return kTRUE;
00238 }
|
|
|
Definition at line 294 of file MINFEmbeddedCanvas.cxx. References fCanvas. Referenced by MINFEmbeddedContainer::HandleCrossing(). 00295 {
00296 // Handle enter/leave events. Only leave is activated at the moment.
00297
00298 if (event->fType == kLeaveNotify)
00299 fCanvas->HandleInput(kMouseLeave, 0, 0);
00300
00301 return kTRUE;
00302 }
|
|
|
Definition at line 209 of file MINFEmbeddedCanvas.cxx. References DrawEventStatus(), and fCanvas. Referenced by MINFEmbeddedContainer::HandleDoubleClick(). 00210 {
00211 // Handle mouse button double click events in the canvas container.
00212
00213 Int_t button = event->fCode;
00214 Int_t x = event->fX;
00215 Int_t y = event->fY;
00216
00217 if (button == kButton1)
00218 fCanvas->HandleInput(kButton1Double, x, y);
00219 if (fShowEventStatus) DrawEventStatus(event->fType, x, y, fCanvas->GetSelected());
00220 if (button == kButton2)
00221 fCanvas->HandleInput(kButton2Double, x, y);
00222 if (button == kButton3)
00223 fCanvas->HandleInput(kButton3Double, x, y);
00224
00225 return kTRUE;
00226 }
|
|
|
Definition at line 283 of file MINFEmbeddedCanvas.cxx. References fCanvas. Referenced by MINFEmbeddedContainer::HandleExpose(). 00284 {
00285 // Handle expose events.
00286
00287 if (event->fCount == 0)
00288 fCanvas->Flush();
00289
00290 return kTRUE;
00291 }
|
|
|
Definition at line 241 of file MINFEmbeddedCanvas.cxx. References DrawEventStatus(), fButton, and fCanvas. Referenced by MINFEmbeddedContainer::HandleKey(). 00242 {
00243
00244 // Handle mouse motion event in the canvas container.
00245 Int_t x = event->fX;
00246 Int_t y = event->fY;
00247
00248 // Handle keyboard events in the canvas container.
00249 if (event->fType == kGKeyPress) {
00250 fButton = event->fCode;
00251 UInt_t keysym;
00252 char str[2];
00253 gVirtualX->LookupString(event, str, sizeof(str), keysym);
00254 if (str[0] == 3) // ctrl-c sets the interrupt flag
00255 gROOT->SetInterrupt();
00256 fCanvas->HandleInput(kKeyPress, str[0], 0);
00257 if (fShowEventStatus) DrawEventStatus(event->fType, x, y, fCanvas->GetSelected());
00258 } else if (event->fType == kKeyRelease)
00259 fButton = 0;
00260
00261 return kTRUE;
00262 }
|
|
|
Definition at line 265 of file MINFEmbeddedCanvas.cxx. References DrawEventStatus(), fButton, and fCanvas. Referenced by MINFEmbeddedContainer::HandleMotion(). 00266 {
00267 // Handle mouse motion event in the canvas container.
00268
00269 Int_t x = event->fX;
00270 Int_t y = event->fY;
00271
00272 if (fButton == 0)
00273 fCanvas->HandleInput(kMouseMotion, x, y);
00274 if (fShowEventStatus) DrawEventStatus(event->fType, x, y, fCanvas->GetSelected());
00275 if (fButton == kButton1)
00276 fCanvas->HandleInput(kButton1Motion, x, y);
00277 if (fShowEventStatus) DrawEventStatus(event->fType, x, y, fCanvas->GetSelected());
00278
00279 return kTRUE;
00280 }
|
|
|
Definition at line 49 of file MINFEmbeddedCanvas.h. References fShowEventStatus. Referenced by MINFDisplayFrame::ShowStatusBar(). 00049 {fShowEventStatus = show;}
|
|
||||||||||||
|
Definition at line 305 of file MINFEmbeddedCanvas.cxx. Referenced by DrawEventStatus(). 00306 {
00307
00308 // Set text in status bar.
00309 ((MINFDisplayFrame *) fParent)->SetStatusText(txt, partidx);
00310 }
|
|
|
Definition at line 313 of file MINFEmbeddedCanvas.cxx. Referenced by HandleContainerButton(). 00314 {
00315
00316 // Set text in status bar.
00317 ((MINFDisplayFrame *) fParent)->SetUnZoomPad(pad);
00318 }
|
|
|
Definition at line 22 of file MINFEmbeddedCanvas.h. |
|
|
Definition at line 28 of file MINFEmbeddedCanvas.h. |
|
|
Definition at line 29 of file MINFEmbeddedCanvas.h. Referenced by HandleContainerButton(), HandleContainerKey(), and HandleContainerMotion(). |
|
|
Definition at line 26 of file MINFEmbeddedCanvas.h. Referenced by HandleContainerButton(), HandleContainerConfigure(), HandleContainerCrossing(), HandleContainerDoubleClick(), HandleContainerExpose(), HandleContainerKey(), and HandleContainerMotion(). |
|
|
Definition at line 25 of file MINFEmbeddedCanvas.h. |
|
|
Definition at line 30 of file MINFEmbeddedCanvas.h. Referenced by SetShowEventStatus(). |
1.3.9.1