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); }
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
79{
80 fCanvas = c;
81
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, Pixel_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((ULongptr_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((ULongptr_t)GetViewPort()->GetId());
145
146 Window_t win = gVirtualX->GetWindowID(fCWinId);
149
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) {
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(),
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(),
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();
438 if (!obj) return kTRUE;
439 gPad->Clear();
440 if (obj->InheritsFrom("TKey")) {
441 TObject *object = (TObject *)gROOT->ProcessLine(Form("((TKey *)0x%zx)->ReadObj();", (size_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
536void TRootEmbeddedCanvas::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
537{
538 if (!GetCanvas()) return;
539
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
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}
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
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
EGEventType
Definition GuiTypes.h:59
@ kGKeyPress
Definition GuiTypes.h:60
@ kButtonRelease
Definition GuiTypes.h:60
@ kButtonPress
Definition GuiTypes.h:60
@ kOtherEvent
Definition GuiTypes.h:64
@ kKeyRelease
Definition GuiTypes.h:60
@ kLeaveNotify
Definition GuiTypes.h:61
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
@ kNotifyNormal
Definition GuiTypes.h:219
const Mask_t kExposureMask
Definition GuiTypes.h:165
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
const Mask_t kKeyReleaseMask
Definition GuiTypes.h:160
const Mask_t kAnyModifier
Definition GuiTypes.h:210
const Mask_t kKeyPressMask
Definition GuiTypes.h:159
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
const Mask_t kKeyShiftMask
Definition GuiTypes.h:195
@ kSunkenFrame
Definition GuiTypes.h:383
@ kDoubleBorder
Definition GuiTypes.h:385
const Handle_t kNone
Definition GuiTypes.h:88
const Mask_t kLeaveWindowMask
Definition GuiTypes.h:168
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:166
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
@ kButton4
Definition GuiTypes.h:215
@ kButton2
Definition GuiTypes.h:214
@ kButton5
Definition GuiTypes.h:215
@ kButton3
Definition GuiTypes.h:214
@ kButton1
Definition GuiTypes.h:214
@ kAnyButton
Definition GuiTypes.h:214
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
unsigned long ULongptr_t
Definition RtypesCore.h:83
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:241
#define gClient
Definition TGClient.h:157
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t win
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t Atom_t typelist
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char mx
char name[80]
Definition TGX11.cxx:110
#define gROOT
Definition TROOT.h:405
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2467
R__EXTERN TStyle * gStyle
Definition TStyle.h:414
#define gGLManager
Definition TVirtualGL.h:160
#define gPad
#define gVirtualX
Definition TVirtualX.h:338
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:302
The Canvas class.
Definition TCanvas.h:23
TPad * Pick(Int_t px, Int_t py, TObjLink *&pickobj) override
Search for an object at pixel position px,py.
Definition TCanvas.h:181
virtual void Resize(Option_t *option="")
Recompute canvas parameters following a X11 Resize.
Definition TCanvas.cxx:1656
virtual void HandleInput(EEventType button, Int_t x, Int_t y)
Handle Input Events.
Definition TCanvas.cxx:1223
Int_t GetCanvasID() const override
Definition TCanvas.h:156
void Update() override
Update canvas pad buffers.
Definition TCanvas.cxx:2468
void Flush()
Flush canvas buffers.
Definition TCanvas.cxx:1134
TMethod * GetMethodAllAny(const char *method)
Return pointer to method without looking at parameters.
Definition TClass.cxx:4384
Drag and drop data container.
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition TGCanvas.h:192
virtual void SetContainer(TGFrame *f)
Definition TGCanvas.h:222
TGViewPort * GetViewPort() const
Definition TGCanvas.h:217
void MapSubwindows() override
Map all canvas sub windows.
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:339
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition TGFrame.cxx:443
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
UInt_t fHeight
frame height
Definition TGFrame.h:88
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:683
virtual UInt_t GetOptions() const
Definition TGFrame.h:197
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition TGFrame.cxx:2506
UInt_t fWidth
frame width
Definition TGFrame.h:87
UInt_t GetHeight() const
Definition TGFrame.h:225
void SetDNDTarget(Bool_t onoff)
Definition TGFrame.h:270
UInt_t GetWidth() const
Definition TGFrame.h:224
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2479
Pixel_t fBackground
frame background color
Definition TGFrame.h:95
Handle_t GetId() const
Definition TGObject.h:41
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
ROOT GUI Window base class.
Definition TGWindow.h:23
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
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:336
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:225
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
Definition TImage.cxx:118
Mother of all ROOT objects.
Definition TObject.h:41
static TClass * Class()
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:525
virtual TClass * IsA() const
Definition TObject.h:245
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:274
The most important graphics class in the ROOT system.
Definition TPad.h:28
void Update() override
Update pad.
Definition TPad.cxx:2823
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition TPad.cxx:597
void SetBorderMode(Short_t bordermode) override
Definition TPad.h:320
Longptr_t ExecPlugin(int nargs)
Int_t LoadPlugin()
Load the plugin library for this handler.
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 ~TRootEmbeddedCanvas()
Delete embedded ROOT 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
friend class TRootEmbeddedContainer
virtual Bool_t HandleContainerKey(Event_t *ev)
Handle keyboard events in the canvas container.
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:139
Ssiz_t Length() const
Definition TString.h:421
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2222
const char * Data() const
Definition TString.h:380
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:704
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:2356
Bool_t GetCanvasPreferGL() const
Definition TStyle.h:180
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
Definition TStyle.h:326
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:174