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