Logo ROOT  
Reference Guide
TRootEmbeddedCanvas.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 15/07/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 
13 /** \class TRootEmbeddedCanvas
14  \ingroup guiwidgets
15 
16 This class creates a TGCanvas in which a TCanvas is created.
17 Use GetCanvas() to get a pointer to the TCanvas.
18 
19 */
20 
21 
22 #include "TRootEmbeddedCanvas.h"
23 #include "TCanvas.h"
24 #include "TROOT.h"
25 #include "TStyle.h"
26 #include "TPluginManager.h"
27 #include "TVirtualGL.h"
28 #include "TGDNDManager.h"
29 #include "TBufferFile.h"
30 #include "TImage.h"
31 #include "TClass.h"
32 #include "TUrl.h"
33 #include "TVirtualX.h"
34 
35 #include <iostream>
36 
37 
38 /** \class TRootEmbeddedContainer
39  \ingroup guiwidgets
40 
41 Utility class used by TRootEmbeddedCanvas. The TRootEmbeddedContainer
42 is the frame embedded in the TGCanvas widget. The ROOT graphics goes
43 into this frame. This class is used to enable input events on this
44 graphics frame and forward the events to the TRootEmbeddedCanvas
45 handlers.
46 
47 */
48 
49 
50 class TRootEmbeddedContainer : public TGCompositeFrame {
51 private:
52  TRootEmbeddedCanvas *fCanvas; // pointer back to embedded canvas
53 public:
54  TRootEmbeddedContainer(TRootEmbeddedCanvas *c, Window_t id, const TGWindow *parent);
55 
57  { return fCanvas->HandleContainerButton(ev); }
59  { return fCanvas->HandleContainerDoubleClick(ev); }
62  return fCanvas->HandleContainerConfigure(ev); }
64  { return fCanvas->HandleContainerKey(ev); }
66  { return fCanvas->HandleContainerMotion(ev); }
68  { return fCanvas->HandleContainerExpose(ev); }
70  { return fCanvas->HandleContainerCrossing(ev); }
71  void SetEditable(Bool_t) { }
72 };
73 
74 ////////////////////////////////////////////////////////////////////////////////
75 /// Create a canvas container.
76 
77 TRootEmbeddedContainer::TRootEmbeddedContainer(TRootEmbeddedCanvas *c, Window_t id,
78  const TGWindow *p) : TGCompositeFrame(gClient, id, p)
79 {
80  fCanvas = c;
81 
82  gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
85 
88 
90 }
91 
93 
94 ////////////////////////////////////////////////////////////////////////////////
95 /// Create an TCanvas embedded in a TGFrame. A pointer to the TCanvas can
96 /// be obtained via the GetCanvas() member function. To embed a canvas
97 /// derived from a TCanvas do the following:
98 /// TRootEmbeddedCanvas *embedded = new TRootEmbeddedCanvas(0, p, w, h);
99 /// [note name must be 0, not null string ""]
100 /// Int_t wid = embedded->GetCanvasWindowId();
101 /// TMyCanvas *myc = new TMyCanvas("myname", 10, 10, wid);
102 /// embedded->AdoptCanvas(myc);
103 /// [ the MyCanvas is adopted by the embedded canvas and will be
104 /// destroyed by it ]
105 
107  UInt_t w, UInt_t h, UInt_t options, ULong_t back)
108  : TGCanvas(p, w, h, options, back)
109 {
110  fCanvas = 0;
111  fButton = 0;
112  fAutoFit = kTRUE;
114 
115  fCWinId = -1;
116 
117  if (gStyle->GetCanvasPreferGL()) {
118  //first, initialize GL (if not yet)
119  if (!gGLManager) {
120  TString x = "win32";
121  if (gVirtualX->InheritsFrom("TGX11"))
122  x = "x11";
123  else if (gVirtualX->InheritsFrom("TGCocoa"))
124  x = "osx";
125 
126  TPluginHandler *ph = gROOT->GetPluginManager()->FindHandler("TGLManager", x);
127 
128  if (ph && ph->LoadPlugin() != -1) {
129  if (!ph->ExecPlugin(0)) {
130  Warning("CreateCanvas",
131  "Cannot load GL, will use default canvas imp instead\n");
132  }
133  }
134  }
135 
136  if (gGLManager)
137  fCWinId = gGLManager->InitGLWindow((ULong_t)GetViewPort()->GetId());
138  //Context creation deferred till TCanvas creation (since there is no way to pass it to TCanvas).
139 
140  if (!gGLManager || fCWinId == -1)
141  gStyle->SetCanvasPreferGL(kFALSE);//TCanvas should not use gl.
142  }
143  if (fCWinId == -1)
144  fCWinId = gVirtualX->InitWindow((ULong_t)GetViewPort()->GetId());
145 
146  Window_t win = gVirtualX->GetWindowID(fCWinId);
149 
150  TString cname;
151  if (name) cname = name;
152  else cname = TString::Format("%s_canvas", GetName());
153  fCanvas = new TCanvas(cname.Data(), w, h, fCWinId);
154 
155  // define DND types
156  fDNDTypeList = new Atom_t[3];
157  fDNDTypeList[0] = gVirtualX->InternAtom("application/root", kFALSE);
158  fDNDTypeList[1] = gVirtualX->InternAtom("text/uri-list", kFALSE);
159  fDNDTypeList[2] = 0;
160  gVirtualX->SetDNDAware(fId, fDNDTypeList);
162 
163  if (!p) {
165  MapSubwindows();
166  Resize(100, 100);
167  }
168 }
169 
170 ////////////////////////////////////////////////////////////////////////////////
171 /// Delete embedded ROOT canvas.
172 
174 {
175  if (!MustCleanup()) {
176  delete fCanvas;
177  delete fCanvasContainer;
178  }
179  delete [] fDNDTypeList;
180 }
181 
182 ////////////////////////////////////////////////////////////////////////////////
183 /// Canvas c is adopted from this embedded canvas.
184 
186 {
187  if(c == 0) return;
188  c->EmbedInto(fCWinId, fWidth, fHeight);
189  fCanvas = c;
190 }
191 
192 ////////////////////////////////////////////////////////////////////////////////
193 /// Handle mouse button events in the canvas container.
194 
196 {
197  if (!fCanvas) return kTRUE;
198 
199  Int_t button = event->fCode;
200  Int_t x = event->fX;
201  Int_t y = event->fY;
202 
203  if (event->fType == kButtonPress) {
204  fButton = button;
205  if (button == kButton1) {
206  if (event->fState & kKeyShiftMask)
208  else
210  }
211  if (button == kButton2)
213  if (button == kButton3) {
215  fButton = 0; // button up is consumed by TContextMenu
216  }
217 
218  } else if (event->fType == kButtonRelease) {
219  if (button == kButton1)
221  if (button == kButton2)
223  if (button == kButton3)
225  if (button == kButton4)
226  fCanvas->HandleInput(EEventType(5), x, y);//hack
227  if (button == kButton5)
228  fCanvas->HandleInput(EEventType(6), x, y);//hack
229 
230  fButton = 0;
231  }
232 
233  return kTRUE;
234 }
235 
236 ////////////////////////////////////////////////////////////////////////////////
237 /// Handle mouse button double click events in the canvas container.
238 
240 {
241  if (!fCanvas) return kTRUE;
242 
243  Int_t button = event->fCode;
244  Int_t x = event->fX;
245  Int_t y = event->fY;
246 
247  if (button == kButton1)
249  if (button == kButton2)
251  if (button == kButton3)
253 
254  return kTRUE;
255 }
256 
257 ////////////////////////////////////////////////////////////////////////////////
258 /// Handle configure (i.e. resize) event.
259 
261 {
262  if (fAutoFit && fCanvas) {
263  fCanvas->Resize();
264  fCanvas->Update();
265  }
266  return kTRUE;
267 }
268 
269 ////////////////////////////////////////////////////////////////////////////////
270 /// Handle keyboard events in the canvas container.
271 
273 {
274  static EGEventType previous_event = kOtherEvent;
275  static UInt_t previous_keysym = 0;
276 
277  if (!fCanvas) return kTRUE;
278 
279  if (event->fType == kGKeyPress) {
280  fButton = event->fCode;
281  UInt_t keysym;
282  char str[2];
283  gVirtualX->LookupString(event, str, sizeof(str), keysym);
284 
285  if (str[0] == kESC){ // ESC sets the escape flag
286  gROOT->SetEscape();
289  gPad->Modified();
290  return kTRUE;
291  }
292  if (str[0] == 3) // ctrl-c sets the interrupt flag
293  gROOT->SetInterrupt();
294 
295  // handle arrow keys
296  if (keysym > 0x1011 && keysym < 0x1016) {
297  Window_t dum1, dum2, wid;
298  UInt_t mask = 0;
299  Int_t mx, my, tx, ty;
300  wid = gVirtualX->GetDefaultRootWindow();
301  gVirtualX->QueryPointer(wid, dum1, dum2, mx, my, mx, my, mask);
302  gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(),
303  fCanvasContainer->GetId(),
304  mx, my, tx, ty, dum1);
306  // handle case where we got consecutive same keypressed events coming
307  // from auto-repeat on Windows (as it fires only successive keydown events)
308  if ((previous_keysym == keysym) && (previous_event == kGKeyPress)) {
309  switch (keysym) {
310  case 0x1012: // left
311  gVirtualX->Warp(--mx, my, wid); --tx;
312  break;
313  case 0x1013: // up
314  gVirtualX->Warp(mx, --my, wid); --ty;
315  break;
316  case 0x1014: // right
317  gVirtualX->Warp(++mx, my, wid); ++tx;
318  break;
319  case 0x1015: // down
320  gVirtualX->Warp(mx, ++my, wid); ++ty;
321  break;
322  default:
323  break;
324  }
326  }
327  previous_keysym = keysym;
328  }
329  else {
330  fCanvas->HandleInput(kKeyPress, str[0], keysym);
331  }
332  } else if (event->fType == kKeyRelease) {
333  UInt_t keysym;
334  char str[2];
335  gVirtualX->LookupString(event, str, sizeof(str), keysym);
336 
337  if (keysym > 0x1011 && keysym < 0x1016) {
338  Window_t dum1, dum2, wid;
339  UInt_t mask = 0;
340  Int_t mx, my, tx, ty;
341  wid = gVirtualX->GetDefaultRootWindow();
342  gVirtualX->QueryPointer(wid, dum1, dum2, mx, my, mx, my, mask);
343  switch (keysym) {
344  case 0x1012: // left
345  gVirtualX->Warp(--mx, my, wid);
346  break;
347  case 0x1013: // up
348  gVirtualX->Warp(mx, --my, wid);
349  break;
350  case 0x1014: // right
351  gVirtualX->Warp(++mx, my, wid);
352  break;
353  case 0x1015: // down
354  gVirtualX->Warp(mx, ++my, wid);
355  break;
356  default:
357  break;
358  }
359  gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(),
360  fCanvasContainer->GetId(),
361  mx, my, tx, ty, dum1);
363  previous_keysym = keysym;
364  }
365  fButton = 0;
366  }
367  previous_event = event->fType;
368  return kTRUE;
369 }
370 
371 ////////////////////////////////////////////////////////////////////////////////
372 /// Handle mouse motion event in the canvas container.
373 
375 {
376  if (!fCanvas) return kTRUE;
377 
378  Int_t x = event->fX;
379  Int_t y = event->fY;
380 
381  if (fButton == 0)
383  if (fButton == kButton1) {
384  if (event->fState & kKeyShiftMask)
386  else
388  }
389  if (fButton == kButton2)
391 
392  return kTRUE;
393 }
394 
395 ////////////////////////////////////////////////////////////////////////////////
396 /// Handle expose events.
397 
399 {
400  if (!fCanvas) return kTRUE;
401 
402  if (event->fCount == 0)
403  fCanvas->Flush();
404 
405  return kTRUE;
406 }
407 
408 ////////////////////////////////////////////////////////////////////////////////
409 /// Handle enter/leave events. Only leave is activated at the moment.
410 
412 {
413  if (!fCanvas) return kTRUE;
414 
415  Int_t x = event->fX;
416  Int_t y = event->fY;
417 
418  // pointer grabs create also an enter and leave event but with fCode
419  // either kNotifyGrab or kNotifyUngrab, don't propagate these events
420  if (event->fType == kLeaveNotify && event->fCode == kNotifyNormal)
422 
423  return kTRUE;
424 }
425 
426 ////////////////////////////////////////////////////////////////////////////////
427 /// Handle drop events.
428 
430 {
431  static Atom_t rootObj = gVirtualX->InternAtom("application/root", kFALSE);
432  static Atom_t uriObj = gVirtualX->InternAtom("text/uri-list", kFALSE);
433 
434  if (data->fDataType == rootObj) {
435  TBufferFile buf(TBuffer::kRead, data->fDataLength, (void *)data->fData);
436  buf.SetReadMode();
437  TObject *obj = (TObject *)buf.ReadObjectAny(TObject::Class());
438  if (!obj) return kTRUE;
439  gPad->Clear();
440  if (obj->InheritsFrom("TKey")) {
441  TObject *object = (TObject *)gROOT->ProcessLine(Form("((TKey *)0x%lx)->ReadObj();", (ULong_t)obj));
442  if (!object) return kTRUE;
443  if (object->InheritsFrom("TGraph"))
444  object->Draw("ALP");
445  else if (object->InheritsFrom("TImage"))
446  object->Draw("x");
447  else if (object->IsA()->GetMethodAllAny("Draw"))
448  object->Draw();
449  }
450  else if (obj->InheritsFrom("TGraph"))
451  obj->Draw("ALP");
452  else if (obj->IsA()->GetMethodAllAny("Draw"))
453  obj->Draw();
454  gPad->Modified();
455  gPad->Update();
456  return kTRUE;
457  }
458  else if (data->fDataType == uriObj) {
459  TString sfname((char *)data->fData);
460  if (sfname.Length() > 7) {
461  sfname.ReplaceAll("\r\n", "");
462  TUrl uri(sfname.Data());
463  if (sfname.EndsWith(".bmp") ||
464  sfname.EndsWith(".gif") ||
465  sfname.EndsWith(".jpg") ||
466  sfname.EndsWith(".png") ||
467  sfname.EndsWith(".ps") ||
468  sfname.EndsWith(".eps") ||
469  sfname.EndsWith(".pdf") ||
470  sfname.EndsWith(".tiff") ||
471  sfname.EndsWith(".xpm")) {
472  TImage *img = TImage::Open(uri.GetFile());
473  if (img) {
474  img->Draw("x");
475  img->SetEditable(kTRUE);
476  }
477  }
478  gPad->Modified();
479  gPad->Update();
480  }
481  }
482  return kFALSE;
483 }
484 
485 ////////////////////////////////////////////////////////////////////////////////
486 /// Handle dragging position events.
487 
489  Int_t xroot, Int_t yroot)
490 {
491  Int_t px = 0, py = 0;
492  Window_t wtarget;
493 
494  gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(),
495  gVirtualX->GetWindowID(fCanvas->GetCanvasID()),
496  xroot, yroot, px, py, wtarget);
497 
498  TPad *pad = fCanvas->Pick(px, py, 0);
499  if (pad) {
500  pad->cd();
501  gROOT->SetSelectedPad(pad);
502  // make sure the pad is highlighted (on Windows)
503  pad->Update();
504  }
505  return action;
506 }
507 
508 ////////////////////////////////////////////////////////////////////////////////
509 /// Handle drag enter events.
510 
512 {
513  static Atom_t rootObj = gVirtualX->InternAtom("application/root", kFALSE);
514  static Atom_t uriObj = gVirtualX->InternAtom("text/uri-list", kFALSE);
515  Atom_t ret = kNone;
516  for (int i = 0; typelist[i] != kNone; ++i) {
517  if (typelist[i] == rootObj)
518  ret = rootObj;
519  if (typelist[i] == uriObj)
520  ret = uriObj;
521  }
522  return ret;
523 }
524 
525 ////////////////////////////////////////////////////////////////////////////////
526 /// Handle drag leave events.
527 
529 {
530  return kTRUE;
531 }
532 
533 ////////////////////////////////////////////////////////////////////////////////
534 /// Save an embedded canvas as a C++ statement(s) on output stream out.
535 
536 void TRootEmbeddedCanvas::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
537 {
538  if (!GetCanvas()) return;
539 
540  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
541 
542  char quote ='"';
543 
544  out << std::endl << " // embedded canvas" << std::endl;
545  out << " TRootEmbeddedCanvas *";
546  out << GetName() << " = new TRootEmbeddedCanvas(0" << "," << fParent->GetName()
547  << "," << GetWidth() << "," << GetHeight();
548 
550  if (GetOptions() == (kSunkenFrame | kDoubleBorder)) {
551  out <<");" << std::endl;
552  } else {
553  out << "," << GetOptionString() <<");" << std::endl;
554  }
555  } else {
556  out << "," << GetOptionString() << ",ucolor);" << std::endl;
557  }
558  if (option && strstr(option, "keep_names"))
559  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
560 
561  out << " Int_t w" << GetName() << " = " << GetName()
562  << "->GetCanvasWindowId();" << std::endl;
563 
564  static int n = 123;
565  TString cname = TString::Format("c%d", n);
566 
567  out << " TCanvas *";
568  out << cname << " = new TCanvas(";
569  out << quote << cname.Data() << quote << ", 10, 10, w"
570  << GetName() << ");" << std::endl;
571  out << " " << GetName() << "->AdoptCanvas(" << cname
572  << ");" << std::endl;
573 
574  n++;
575  //Next line is a connection to TCanvas::SavePrimitives()
576  //GetCanvas()->SavePrimitive(out,option);
577 }
TRootEmbeddedCanvas::HandleDNDEnter
virtual Atom_t HandleDNDEnter(Atom_t *typelist)
Handle drag enter events.
Definition: TRootEmbeddedCanvas.cxx:511
TStyle::SetCanvasPreferGL
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
Definition: TStyle.h:325
c
#define c(i)
Definition: RSha256.hxx:101
kMouseLeave
@ kMouseLeave
Definition: Buttons.h:23
Event_t::fType
EGEventType fType
of event (see EGEventType)
Definition: GuiTypes.h:175
kButton3Double
@ kButton3Double
Definition: Buttons.h:24
n
const Int_t n
Definition: legend1.C:16
kButton2
@ kButton2
Definition: GuiTypes.h:214
Event_t::fState
UInt_t fState
key or button mask
Definition: GuiTypes.h:181
TRootEmbeddedCanvas::HandleDNDPosition
virtual Atom_t HandleDNDPosition(Int_t, Int_t, Atom_t action, Int_t, Int_t)
Handle dragging position events.
Definition: TRootEmbeddedCanvas.cxx:488
TGFrame::GetHeight
UInt_t GetHeight() const
Definition: TGFrame.h:225
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TRootEmbeddedCanvas::fDNDTypeList
Atom_t * fDNDTypeList
handles DND types
Definition: TRootEmbeddedCanvas.h:34
TImage::SetEditable
virtual void SetEditable(Bool_t=kTRUE)
Definition: TImage.h:225
TDNDData::fDataLength
Int_t fDataLength
Length of data.
Definition: TGDNDManager.h:77
kAnyModifier
const Mask_t kAnyModifier
Definition: GuiTypes.h:210
Option_t
const char Option_t
Definition: RtypesCore.h:66
kButton2Double
@ kButton2Double
Definition: Buttons.h:24
TPad
The most important graphics class in the ROOT system.
Definition: TPad.h:26
kLeaveNotify
@ kLeaveNotify
Definition: GuiTypes.h:61
TBuffer::kRead
@ kRead
Definition: TBuffer.h:73
kPointerMotionMask
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:163
TRootEmbeddedCanvas::HandleContainerMotion
virtual Bool_t HandleContainerMotion(Event_t *ev)
Handle mouse motion event in the canvas container.
Definition: TRootEmbeddedCanvas.cxx:374
kButton1Motion
@ kButton1Motion
Definition: Buttons.h:20
TRootEmbeddedCanvas::HandleContainerExpose
virtual Bool_t HandleContainerExpose(Event_t *ev)
Handle expose events.
Definition: TRootEmbeddedCanvas.cxx:398
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
kAnyButton
@ kAnyButton
Definition: GuiTypes.h:214
TString::Data
const char * Data() const
Definition: TString.h:369
TRootEmbeddedCanvas::TRootEmbeddedContainer
friend class TRootEmbeddedContainer
Definition: TRootEmbeddedCanvas.h:26
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
Form
char * Form(const char *fmt,...)
kNotifyNormal
@ kNotifyNormal
Definition: GuiTypes.h:219
TGFrame::fWidth
UInt_t fWidth
frame width
Definition: TGFrame.h:87
TRootEmbeddedCanvas::AdoptCanvas
void AdoptCanvas(TCanvas *c)
Canvas c is adopted from this embedded canvas.
Definition: TRootEmbeddedCanvas.cxx:185
TGCompositeFrame::SetEditable
virtual void SetEditable(Bool_t on=kTRUE)
Switch ON/OFF edit mode.
Definition: TGFrame.cxx:948
TGWindow::kEditDisableLayout
@ kEditDisableLayout
window layout cannot be edited
Definition: TGWindow.h:53
kButton1Up
@ kButton1Up
Definition: Buttons.h:19
kButton4
@ kButton4
Definition: GuiTypes.h:215
TRootEmbeddedCanvas::~TRootEmbeddedCanvas
virtual ~TRootEmbeddedCanvas()
Delete embedded ROOT canvas.
Definition: TRootEmbeddedCanvas.cxx:173
TGCompositeFrame::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *)
Definition: TGFrame.h:326
TStyle.h
EEventType
EEventType
Definition: Buttons.h:15
TGCompositeFrame::HandleButton
virtual Bool_t HandleButton(Event_t *)
Definition: TGFrame.h:324
TImage
An abstract interface to image processing library.
Definition: TImage.h:29
TString::EndsWith
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition: TString.cxx:2199
x
Double_t x[n]
Definition: legend1.C:17
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TClass.h
kButton1
@ kButton1
Definition: GuiTypes.h:214
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:683
TVirtualX.h
TPad::Update
void Update() override
Update pad.
Definition: TPad.cxx:2856
kMouseMotion
@ kMouseMotion
Definition: Buttons.h:23
TString::Format
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2333
TCanvas.h
TImage::Open
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
Definition: TImage.cxx:118
TRootEmbeddedCanvas::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an embedded canvas as a C++ statement(s) on output stream out.
Definition: TRootEmbeddedCanvas.cxx:536
TGDNDManager.h
TString
Basic string class.
Definition: TString.h:136
kButtonPressMask
const Mask_t kButtonPressMask
Definition: GuiTypes.h:161
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGObject::GetId
Handle_t GetId() const
Definition: TGObject.h:37
kDoubleBorder
@ kDoubleBorder
Definition: GuiTypes.h:385
TGWindow::HandleExpose
virtual Bool_t HandleExpose(Event_t *event)
Definition: TGWindow.h:94
TObject::InheritsFrom
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
bool
kLeaveWindowMask
const Mask_t kLeaveWindowMask
Definition: GuiTypes.h:168
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
TGFrame::GetWidth
UInt_t GetWidth() const
Definition: TGFrame.h:224
object
id
XFontStruct * id
Definition: TGX11.cxx:109
TCanvas::HandleInput
virtual void HandleInput(EEventType button, Int_t x, Int_t y)
Handle Input Events.
Definition: TCanvas.cxx:1223
TImage.h
TGFrame::GetOptionString
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2480
TGFrame::GetOptions
virtual UInt_t GetOptions() const
Definition: TGFrame.h:197
TStyle::GetCanvasPreferGL
Bool_t GetCanvasPreferGL() const
Definition: TStyle.h:179
TROOT.h
gClient
#define gClient
Definition: TGClient.h:157
TDNDData::fDataType
Atom_t fDataType
Data type description.
Definition: TGDNDManager.h:74
TPluginHandler
Definition: TPluginManager.h:101
TGFrame::AddInput
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:339
kNone
const Handle_t kNone
Definition: GuiTypes.h:88
TRootEmbeddedCanvas::fCanvas
TCanvas * fCanvas
pointer to TCanvas
Definition: TRootEmbeddedCanvas.h:31
TPad::cd
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition: TPad.cxx:604
TGCompositeFrame::HandleDoubleClick
virtual Bool_t HandleDoubleClick(Event_t *)
Definition: TGFrame.h:325
kSunkenFrame
@ kSunkenFrame
Definition: GuiTypes.h:383
TRootEmbeddedCanvas::fCWinId
Int_t fCWinId
window id used by embedded TCanvas
Definition: TRootEmbeddedCanvas.h:29
TBuffer::SetReadMode
void SetReadMode()
Set buffer in read mode.
Definition: TBuffer.cxx:302
TDNDData::fData
void * fData
Actual data.
Definition: TGDNDManager.h:76
TGWindow::kEditDisableGrab
@ kEditDisableGrab
window grab cannot be edited
Definition: TGWindow.h:52
gStyle
R__EXTERN TStyle * gStyle
Definition: TStyle.h:412
kButton1Double
@ kButton1Double
Definition: Buttons.h:24
kOtherEvent
@ kOtherEvent
Definition: GuiTypes.h:64
kKeyRelease
@ kKeyRelease
Definition: GuiTypes.h:60
h
#define h(i)
Definition: RSha256.hxx:106
kGKeyPress
@ kGKeyPress
Definition: GuiTypes.h:60
kButton3
@ kButton3
Definition: GuiTypes.h:214
TGWindow::GetName
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:336
TGFrame::Resize
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:605
TGObject::fId
Handle_t fId
X11/Win32 Window identifier.
Definition: TGObject.h:26
TRootEmbeddedCanvas::TRootEmbeddedCanvas
TRootEmbeddedCanvas(const TRootEmbeddedCanvas &)=delete
Atom_t
Handle_t Atom_t
WM token.
Definition: GuiTypes.h:37
Event_t::fCode
UInt_t fCode
key or button code
Definition: GuiTypes.h:180
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TRootEmbeddedCanvas::HandleContainerCrossing
virtual Bool_t HandleContainerCrossing(Event_t *ev)
Handle enter/leave events. Only leave is activated at the moment.
Definition: TRootEmbeddedCanvas.cxx:411
kButtonPress
@ kButtonPress
Definition: GuiTypes.h:60
TRootEmbeddedCanvas::fAutoFit
Bool_t fAutoFit
canvas container keeps same size as canvas
Definition: TRootEmbeddedCanvas.h:32
kButtonReleaseMask
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:162
kButtonRelease
@ kButtonRelease
Definition: GuiTypes.h:60
TBufferFile::ReadObjectAny
void * ReadObjectAny(const TClass *cast) override
Read object from I/O buffer.
Definition: TBufferFile.cxx:2348
TGFrame::SaveUserColor
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2453
TPad::SetBorderMode
void SetBorderMode(Short_t bordermode) override
Definition: TPad.h:317
gGLManager
#define gGLManager
Definition: TVirtualGL.h:162
Window_t
Handle_t Window_t
Window handle.
Definition: GuiTypes.h:29
y
Double_t y[n]
Definition: legend1.C:17
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TDNDData
Drag and drop data container.
Definition: TGDNDManager.h:64
kButton2Motion
@ kButton2Motion
Definition: Buttons.h:20
TGCompositeFrame::HandleKey
virtual Bool_t HandleKey(Event_t *)
Definition: TGFrame.h:328
kButton3Down
@ kButton3Down
Definition: Buttons.h:17
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:879
TUrl
This class represents a WWW compatible URL.
Definition: TUrl.h:33
kKeyPressMask
const Mask_t kKeyPressMask
Definition: GuiTypes.h:159
TPluginHandler::ExecPlugin
Longptr_t ExecPlugin(int nargs, const T &... params)
Definition: TPluginManager.h:165
unsigned int
TRootEmbeddedCanvas::HandleContainerKey
virtual Bool_t HandleContainerKey(Event_t *ev)
Handle keyboard events in the canvas container.
Definition: TRootEmbeddedCanvas.cxx:272
TCanvas::Pick
TPad * Pick(Int_t px, Int_t py, TObjLink *&pickobj) override
Search for an object at pixel position px,py.
Definition: TCanvas.h:180
TUrl::GetFile
const char * GetFile() const
Definition: TUrl.h:69
TRootEmbeddedCanvas.h
kArrowKeyPress
@ kArrowKeyPress
Definition: Buttons.h:21
TGWindow::MustCleanup
virtual Int_t MustCleanup() const
Definition: TGWindow.h:109
TObject::Draw
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:197
TPluginHandler::LoadPlugin
Int_t LoadPlugin()
Load the plugin library for this handler.
Definition: TPluginManager.cxx:254
kButton1Down
@ kButton1Down
Definition: Buttons.h:17
kExposureMask
const Mask_t kExposureMask
Definition: GuiTypes.h:165
TVirtualGL.h
TPluginManager.h
TCanvas
The Canvas class.
Definition: TCanvas.h:23
TRootEmbeddedCanvas::HandleContainerConfigure
virtual Bool_t HandleContainerConfigure(Event_t *ev)
Handle configure (i.e. resize) event.
Definition: TRootEmbeddedCanvas.cxx:260
TCanvas::Resize
virtual void Resize(Option_t *option="")
Recompute canvas parameters following a X11 Resize.
Definition: TCanvas.cxx:1668
TRootEmbeddedCanvas::fButton
Int_t fButton
currently pressed button
Definition: TRootEmbeddedCanvas.h:33
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TBufferFile.h
TGFrame::HandleConfigureNotify
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition: TGFrame.cxx:443
kKeyReleaseMask
const Mask_t kKeyReleaseMask
Definition: GuiTypes.h:160
TGFrame::SetDNDTarget
void SetDNDTarget(Bool_t onoff)
Definition: TGFrame.h:270
kESC
@ kESC
Definition: Buttons.h:22
Event_t
Event structure.
Definition: GuiTypes.h:174
name
char name[80]
Definition: TGX11.cxx:110
kButton5
@ kButton5
Definition: GuiTypes.h:215
TGCanvas::SetContainer
virtual void SetContainer(TGFrame *f)
Definition: TGCanvas.h:222
TRootEmbeddedCanvas::HandleDNDDrop
virtual Bool_t HandleDNDDrop(TDNDData *data)
Handle drop events.
Definition: TRootEmbeddedCanvas.cxx:429
gPad
#define gPad
Definition: TVirtualPad.h:287
TRootEmbeddedCanvas::GetCanvas
TCanvas * GetCanvas() const
Definition: TRootEmbeddedCanvas.h:55
TRootEmbeddedCanvas::HandleDNDLeave
virtual Bool_t HandleDNDLeave()
Handle drag leave events.
Definition: TRootEmbeddedCanvas.cxx:528
kStructureNotifyMask
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:166
kButton2Up
@ kButton2Up
Definition: Buttons.h:19
kKeyPress
@ kKeyPress
Definition: Buttons.h:20
TGFrame::fHeight
UInt_t fHeight
frame height
Definition: TGFrame.h:88
TGFrame::fBackground
Pixel_t fBackground
frame background color
Definition: TGFrame.h:95
TRootEmbeddedCanvas::HandleContainerDoubleClick
virtual Bool_t HandleContainerDoubleClick(Event_t *ev)
Handle mouse button double click events in the canvas container.
Definition: TRootEmbeddedCanvas.cxx:239
kButton2Down
@ kButton2Down
Definition: Buttons.h:17
TRootEmbeddedCanvas::fCanvasContainer
TRootEmbeddedContainer * fCanvasContainer
container in canvas widget
Definition: TRootEmbeddedCanvas.h:30
TGWindow::fEditDisabled
UInt_t fEditDisabled
flags used for "guibuilding"
Definition: TGWindow.h:32
Event_t::fCount
Int_t fCount
if non-zero, at least this many more exposes
Definition: GuiTypes.h:183
TCanvas::GetCanvasID
Int_t GetCanvasID() const override
Definition: TCanvas.h:155
TGCanvas::GetViewPort
TGViewPort * GetViewPort() const
Definition: TGCanvas.h:217
Class
void Class()
Definition: Class.C:29
TGCompositeFrame
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
TGCanvas
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition: TGCanvas.h:192
kArrowKeyRelease
@ kArrowKeyRelease
Definition: Buttons.h:21
TCanvas::Flush
void Flush()
Flush canvas buffers.
Definition: TCanvas.cxx:1132
TGCompositeFrame::HandleMotion
virtual Bool_t HandleMotion(Event_t *)
Definition: TGFrame.h:327
TBufferFile
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Definition: TBufferFile.h:47
TUrl.h
EGEventType
EGEventType
Definition: GuiTypes.h:59
TGWindow::fParent
const TGWindow * fParent
Parent window.
Definition: TGWindow.h:28
kKeyShiftMask
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:195
TCanvas::Update
void Update() override
Update canvas pad buffers.
Definition: TCanvas.cxx:2502
TRootEmbeddedCanvas
This class creates a TGCanvas in which a TCanvas is created.
Definition: TRootEmbeddedCanvas.h:24
TGCanvas::MapSubwindows
virtual void MapSubwindows()
Map all canvas sub windows.
Definition: TGCanvas.cxx:2165
kButton3Up
@ kButton3Up
Definition: Buttons.h:19
gROOT
#define gROOT
Definition: TROOT.h:406
int
TRootEmbeddedCanvas::HandleContainerButton
virtual Bool_t HandleContainerButton(Event_t *ev)
Handle mouse button events in the canvas container.
Definition: TRootEmbeddedCanvas.cxx:195