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
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);
148
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);
161
162 if (!p) {
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)
207 else
209 }
210 if (button == kButton2)
212 if (button == kButton3) {
214 fButton = 0; // button up is consumed by TContextMenu
215 }
216
217 } else if (event->fType == kButtonRelease) {
218 if (button == kButton1)
220 if (button == kButton2)
222 if (button == kButton3)
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)
248 if (button == kButton2)
250 if (button == kButton3)
252
253 return kTRUE;
254}
255
256////////////////////////////////////////////////////////////////////////////////
257/// Handle configure (i.e. resize) event.
258
267
268////////////////////////////////////////////////////////////////////////////////
269/// Handle keyboard events in the canvas container.
270
272{
274 static UInt_t previous_keysym = 0;
275
276 if (!fCanvas) return kTRUE;
277
278 if (event->fType == kGKeyPress) {
279 fButton = event->fCode;
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();
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) {
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(),
303 mx, my, tx, ty, dum1);
305 // handle case where we got consecutive same keypressed events coming
306 // from auto-repeat on Windows (as it fires only successive keydown events)
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 }
325 }
327 }
328 else {
330 }
331 } else if (event->fType == kKeyRelease) {
333 char str[2];
334 gVirtualX->LookupString(event, str, sizeof(str), keysym);
335
336 if (keysym > 0x1011 && keysym < 0x1016) {
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(),
360 mx, my, tx, ty, dum1);
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)
382 if (fButton == kButton1) {
383 if (event->fState & kKeyShiftMask)
385 else
387 }
388 if (fButton == kButton2)
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)
421
422 return kTRUE;
423}
424
425////////////////////////////////////////////////////////////////////////////////
426/// Handle drop events.
427
429{
430 static Atom_t rootObj = gVirtualX->InternAtom("application/root", kFALSE);
431 static Atom_t uriObj = gVirtualX->InternAtom("text/uri-list", kFALSE);
432
433 if (data->fDataType == rootObj) {
434 TBufferFile buf(TBuffer::kRead, data->fDataLength, (void *)data->fData);
435 buf.SetReadMode();
437 if (!obj) return kTRUE;
438 gPad->Clear();
439 if (obj->InheritsFrom("TKey")) {
440 TObject *object = (TObject *)gROOT->ProcessLine(Form("((TKey *)0x%zx)->ReadObj();", (size_t)obj));
441 if (!object) return kTRUE;
442 if (object->InheritsFrom("TGraph"))
443 object->Draw("ALP");
444 else if (object->InheritsFrom("TImage"))
445 object->Draw("x");
446 else if (object->IsA()->GetMethodAllAny("Draw"))
447 object->Draw();
448 }
449 else if (obj->InheritsFrom("TGraph"))
450 obj->Draw("ALP");
451 else if (obj->IsA()->GetMethodAllAny("Draw"))
452 obj->Draw();
453 gPad->Modified();
454 gPad->Update();
455 return kTRUE;
456 }
457 else if (data->fDataType == uriObj) {
458 TString sfname((char *)data->fData);
459 if (sfname.Length() > 7) {
460 sfname.ReplaceAll("\r\n", "");
461 TUrl uri(sfname.Data());
462 if (sfname.EndsWith(".bmp") ||
463 sfname.EndsWith(".gif") ||
464 sfname.EndsWith(".jpg") ||
465 sfname.EndsWith(".png") ||
466 sfname.EndsWith(".ps") ||
467 sfname.EndsWith(".eps") ||
468 sfname.EndsWith(".pdf") ||
469 sfname.EndsWith(".tiff") ||
470 sfname.EndsWith(".xpm")) {
471 TImage *img = TImage::Open(uri.GetFile());
472 if (img) {
473 img->Draw("x");
474 img->SetEditable(kTRUE);
475 }
476 }
477 gPad->Modified();
478 gPad->Update();
479 }
480 }
481 return kFALSE;
482}
483
484////////////////////////////////////////////////////////////////////////////////
485/// Handle dragging position events.
486
489{
490 Int_t px = 0, py = 0;
492
493 gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(),
494 gVirtualX->GetWindowID(fCanvas->GetCanvasID()),
495 xroot, yroot, px, py, wtarget);
496
497 TPad *pad = fCanvas->Pick(px, py, 0);
498 if (pad) {
499 pad->cd();
500 gROOT->SetSelectedPad(pad);
501 // make sure the pad is highlighted (on Windows)
502 pad->Update();
503 }
504 return action;
505}
506
507////////////////////////////////////////////////////////////////////////////////
508/// Handle drag enter events.
509
511{
512 static Atom_t rootObj = gVirtualX->InternAtom("application/root", kFALSE);
513 static Atom_t uriObj = gVirtualX->InternAtom("text/uri-list", kFALSE);
514 Atom_t ret = kNone;
515 for (int i = 0; typelist[i] != kNone; ++i) {
516 if (typelist[i] == rootObj)
517 ret = rootObj;
518 if (typelist[i] == uriObj)
519 ret = uriObj;
520 }
521 return ret;
522}
523
524////////////////////////////////////////////////////////////////////////////////
525/// Handle drag leave events.
526
531
532////////////////////////////////////////////////////////////////////////////////
533/// Save an embedded canvas as a C++ statement(s) on output stream out.
534
535void TRootEmbeddedCanvas::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
536{
537 if (!GetCanvas())
538 return;
539
541
542 out << "\n // embedded canvas\n";
543 out << " TRootEmbeddedCanvas *" << GetName() << " = new TRootEmbeddedCanvas(0" << "," << fParent->GetName() << ","
544 << GetWidth() << "," << GetHeight() << extra_args << ");\n";
545
546 if (option && strstr(option, "keep_names"))
547 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
548
549 out << " Int_t w" << GetName() << " = " << GetName() << "->GetCanvasWindowId();\n";
550
551 static int n = 123;
552 TString cname = TString::Format("c%d", n);
553
554 out << " TCanvas *" << cname << " = new TCanvas(\"" << cname << "\", 10, 10, w" << GetName() << ");\n";
555 out << " " << GetName() << "->AdoptCanvas(" << cname << ");\n";
556
557 n++;
558 // Next line is a connection to TCanvas::SavePrimitives()
559 // GetCanvas()->SavePrimitive(out,option);
560}
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
Unsigned integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:90
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
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
#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 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:411
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2495
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
#define gGLManager
Definition TVirtualGL.h:159
#define gPad
#define gVirtualX
Definition TVirtualX.h:337
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
TPad * Pick(Int_t px, Int_t py, TObjLink *&pickobj) override
Search for an object at pixel position px,py.
Definition TCanvas.h:183
virtual void Resize(Option_t *option="")
Recompute canvas parameters following a X11 Resize.
Definition TCanvas.cxx:1666
virtual void HandleInput(EEventType button, Int_t x, Int_t y)
Handle Input Events.
Definition TCanvas.cxx:1232
Int_t GetCanvasID() const override
Definition TCanvas.h:157
void Update() override
Update canvas pad buffers.
Definition TCanvas.cxx:2486
void Flush()
Flush canvas buffers.
Definition TCanvas.cxx:1143
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:289
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
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
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
void SetDNDTarget(Bool_t onoff)
Definition TGFrame.h:272
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
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:334
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
An abstract interface to image processing library.
Definition TImage.h:29
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:41
static TClass * Class()
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:543
virtual TClass * IsA() const
Definition TObject.h:246
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 SetBorderMode(Short_t bordermode) override
Definition TPad.h:326
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
friend class TRootEmbeddedContainer
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
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:2384
Bool_t GetCanvasPreferGL() const
Definition TStyle.h:189
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
Definition TStyle.h:345
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
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
Int_t fCount
if non-zero, at least this many more exposes
Definition GuiTypes.h:183
UInt_t fState
key or button mask
Definition GuiTypes.h:181
UInt_t fCode
key or button code
Definition GuiTypes.h:180