Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TRootCanvas.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id: b4c21444ab4f787f65b2b44199fc0440c3c2ce81 $
2// Author: Fons Rademakers 15/01/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 TRootCanvas
14 \ingroup guiwidgets
15
16This class creates a main window with menubar, scrollbars and a
17drawing area. The widgets used are the new native ROOT GUI widgets.
18
19*/
20
21
22#include "RConfigure.h"
23
24#include "TRootCanvas.h"
25#include "TRootApplication.h"
26#include "TRootHelpDialog.h"
27#include "TGClient.h"
28#include "TGCanvas.h"
29#include "TGMenu.h"
30#include "TGWidget.h"
31#include "TGFileBrowser.h"
32#include "TGFileDialog.h"
33#include "TGStatusBar.h"
34#include "TGTextEditDialogs.h"
35#include "TROOT.h"
36#include "TClass.h"
37#include "TSystem.h"
38#include "TCanvas.h"
39#include "TBrowser.h"
40#include "TClassTree.h"
41#include "TMarker.h"
42#include "TStyle.h"
43#include "TColorWheel.h"
44#include "TVirtualX.h"
45#include "TApplication.h"
46#include "TFile.h"
47#include "TInterpreter.h"
48#include "TEnv.h"
49#include "TMath.h"
50#include <iostream>
51#include "TGDockableFrame.h"
52
53#include "TG3DLine.h"
54#include "TGToolBar.h"
55#include "TGToolTip.h"
56#include "TVirtualPadEditor.h"
57#include "TRootControlBar.h"
58#include "TGuiBuilder.h"
59#include "TImage.h"
60#include "TError.h"
61#include "TGDNDManager.h"
62#include "TBufferFile.h"
63#include "TRootBrowser.h"
64#include "TGTab.h"
65#include "TGedEditor.h"
66
67#include "TPluginManager.h"
68#include "TVirtualGL.h"
69
70#ifdef WIN32
71#include "TWin32SplashThread.h"
72#endif
73
74#include "HelpText.h"
75
76namespace {
77
78bool IsGeometryPrimitive(TObject *obj)
79{
80 static TClass *geoVolumeClass = TClass::GetClass("TGeoVolume");
81 static TClass *geoShapeClass = TClass::GetClass("TGeoShape");
82 static TClass *geoOverlapClass = TClass::GetClass("TGeoOverlap");
83 static TClass *geoTrackClass = TClass::GetClass("TGeoTrack");
84
85 if (!obj)
86 return false;
87
88 return (geoVolumeClass && obj->InheritsFrom(geoVolumeClass)) ||
89 (geoShapeClass && obj->InheritsFrom(geoShapeClass)) ||
90 (geoOverlapClass && obj->InheritsFrom(geoOverlapClass)) ||
91 (geoTrackClass && obj->InheritsFrom(geoTrackClass));
92}
93
94bool PadHasGeometryContent(TVirtualPad *pad)
95{
96 if (!pad)
97 return false;
98
99 TList *primitives = pad->GetListOfPrimitives();
100 if (!primitives)
101 return false;
102
103 TIter next(primitives);
104 while (TObject *obj = next()) {
105 if (IsGeometryPrimitive(obj))
106 return true;
107 if (obj->InheritsFrom(TVirtualPad::Class()) && PadHasGeometryContent(static_cast<TVirtualPad *>(obj)))
108 return true;
109 }
110
111 return false;
112}
113
114} // namespace
115
116// Canvas menu command ids
203// clang-format off
204static const char *gOpenTypes[] = { "ROOT files", "*.root",
205 "All files", "*",
206 0, 0 };
207
208static const char *gSaveAsTypes[] = { "PDF", "*.pdf",
209 "SVG", "*.svg",
210 "TeX", "*.tex",
211 "PostScript", "*.ps",
212 "Encapsulated PostScript", "*.eps",
213 "PNG", "*.png",
214 "JPEG", "*.jpg",
215 "GIF", "*.gif",
216 "BMP", "*.bmp",
217 "ROOT macros", "*.C",
218 "ROOT files", "*.root",
219 "XML", "*.xml",
220 "HTML", "*.html",
221 "XPM", "*.xpm",
222 "TIFF", "*.tiff",
223 "XCF", "*.xcf",
224 "All files", "*",
225 0, 0 };
226
228 // { filename, tooltip, staydown, id, button}
229 { "newcanvas.xpm", "New", kFALSE, kFileNewCanvas, 0 },
230 { "open.xpm", "Open", kFALSE, kFileOpen, 0 },
231 { "save.xpm", "Save As", kFALSE, kFileSaveAs, 0 },
232 { "printer.xpm", "Print", kFALSE, kFilePrint, 0 },
233 { "", "", kFALSE, -1, 0 },
234 { "interrupt.xpm", "Interrupt", kFALSE, kOptionInterrupt,0 },
235 { "refresh2.xpm", "Refresh", kFALSE, kOptionRefresh, 0 },
236 { "", "", kFALSE, -1, 0 },
237 { "inspect.xpm", "Inspect", kFALSE, kInspectRoot, 0 },
238 { "browser.xpm", "Browser", kFALSE, kToolsBrowser, 0 },
239 { 0, 0, kFALSE, 0, 0 }
240};
241
243 { "pointer.xpm", "Modify", kFALSE, kToolModify, 0 },
244 { "arc.xpm", "Arc", kFALSE, kToolArc, 0 },
245 { "line.xpm", "Line", kFALSE, kToolLine, 0 },
246 { "arrow.xpm", "Arrow", kFALSE, kToolArrow, 0 },
247 { "diamond.xpm", "Diamond", kFALSE, kToolDiamond, 0 },
248 { "ellipse.xpm", "Ellipse", kFALSE, kToolEllipse, 0 },
249 { "pad.xpm", "Pad", kFALSE, kToolPad, 0 },
250 { "pave.xpm", "Pave", kFALSE, kToolPave, 0 },
251 { "pavelabel.xpm", "Pave Label", kFALSE, kToolPLabel, 0 },
252 { "pavetext.xpm", "Pave Text", kFALSE, kToolPText, 0 },
253 { "pavestext.xpm", "Paves Text", kFALSE, kToolPsText, 0 },
254 { "graph.xpm", "Graph", kFALSE, kToolGraph, 0 },
255 { "curlyline.xpm", "Curly Line", kFALSE, kToolCurlyLine, 0 },
256 { "curlyarc.xpm", "Curly Arc", kFALSE, kToolCurlyArc, 0 },
257 { "latex.xpm", "Text/Latex", kFALSE, kToolLatex, 0 },
258 { "marker.xpm", "Marker", kFALSE, kToolMarker, 0 },
259 { "cut.xpm", "Graphical Cut", kFALSE, kToolCutG, 0 },
260 { 0, 0, kFALSE, 0, 0 }
261};
262// clang-format on
263
264//////////////////////////////////////////////////////////////////////////
265// //
266// TRootContainer //
267// //
268// Utility class used by TRootCanvas. The TRootContainer is the frame //
269// embedded in the TGCanvas widget. The ROOT graphics goes into this //
270// frame. This class is used to enable input events on this graphics //
271// frame and forward the events to the TRootCanvas handlers. //
272// //
273//////////////////////////////////////////////////////////////////////////
274
276private:
277 TRootCanvas *fCanvas; // pointer back to canvas imp
278public:
279 TRootContainer(TRootCanvas *c, Window_t id, const TGWindow *parent);
280
281 Bool_t HandleButton(Event_t *ev) override;
288 { return fCanvas->HandleContainerKey(ev); }
290 { return fCanvas->HandleContainerMotion(ev); }
292 { return fCanvas->HandleContainerExpose(ev); }
294 { return fCanvas->HandleContainerCrossing(ev); }
295 void SavePrimitive(std::ostream &out, Option_t * = "") override;
296 void SetEditable(Bool_t) override { }
297};
298
299////////////////////////////////////////////////////////////////////////////////
300/// Create a canvas container.
301
316
317////////////////////////////////////////////////////////////////////////////////
318/// Directly handle scroll mouse buttons (4 and 5), only pass buttons
319/// 1, 2 and 3 on to the TCanvas.
320
322{
324 UInt_t page = vp->GetHeight()/4;
325 Int_t newpos;
326
327 gVirtualX->SetInputFocus(GetMainFrame()->GetId());
328
329 if (event->fCode == kButton4) {
330 //scroll up
331 newpos = fCanvas->fCanvasWindow->GetVsbPosition() - page;
332 if (newpos < 0) newpos = 0;
334// return kTRUE;
335 }
336 if (event->fCode == kButton5) {
337 // scroll down
338 newpos = fCanvas->fCanvasWindow->GetVsbPosition() + page;
340// return kTRUE;
341 }
343}
344
345
346////////////////////////////////////////////////////////////////////////////////
347/// Create a basic ROOT canvas.
348
359
360////////////////////////////////////////////////////////////////////////////////
361/// Create a basic ROOT canvas.
362
374
375////////////////////////////////////////////////////////////////////////////////
376/// Create the actual canvas.
377
379{
380 fButton = 0;
381 fAutoFit = kTRUE; // check also menu entry
382 fEditor = 0;
384
385 // Create menus
394
395 static Int_t img = 0;
396
397 if (!img) {
400 TImage* itmp = TImage::Create();
401 img = itmp ? 1 : -1;
402 if (itmp) {
403 delete itmp;
404 itmp=NULL;
405 }
406 gErrorIgnoreLevel = sav;
407 }
408 if (img > 0) {
412 }
413
416
418 fFileMenu->AddEntry("&New Canvas", kFileNewCanvas);
419 fFileMenu->AddEntry("&Open...", kFileOpen);
420 fFileMenu->AddEntry("&Close Canvas", kFileCloseCanvas);
423 fFileMenu->AddEntry("Save &As...", kFileSaveAs);
425 fFileMenu->AddEntry("&Print...", kFilePrint);
427 fFileMenu->AddEntry("&Quit ROOT", kFileQuit);
428
432
434 fEditMenu->AddEntry("&Style...", kEditStyle);
436 fEditMenu->AddEntry("Cu&t", kEditCut);
437 fEditMenu->AddEntry("&Copy", kEditCopy);
438 fEditMenu->AddEntry("&Paste", kEditPaste);
442 fEditMenu->AddEntry("&Undo", kEditUndo);
443 fEditMenu->AddEntry("&Redo", kEditRedo);
444
450
454
456 fViewMenu->AddEntry("&Editor", kViewEditor);
457 fViewMenu->AddEntry("&Toolbar", kViewToolbar);
458 fViewMenu->AddEntry("Event &Statusbar", kViewEventStatus);
459 fViewMenu->AddEntry("T&oolTip Info", kViewToolTips);
461 fViewMenu->AddEntry("&Colors", kViewColors);
462 fViewMenu->AddEntry("&Fonts", kViewFonts);
463 fViewMenu->AddEntry("&Markers", kViewMarkers);
465 fViewMenu->AddEntry("&Iconify", kViewIconify);
467 fViewMenu->AddPopup("&View With", fViewWithMenu);
468
470
472 fOptionMenu->AddEntry("&Auto Resize Canvas", kOptionAutoResize);
473 fOptionMenu->AddEntry("&Resize Canvas", kOptionResizeCanvas);
474 fOptionMenu->AddEntry("&Move Opaque", kOptionMoveOpaque);
475 fOptionMenu->AddEntry("Resize &Opaque", kOptionResizeOpaque);
477 fOptionMenu->AddEntry("&Interrupt", kOptionInterrupt);
478 fOptionMenu->AddEntry("R&efresh", kOptionRefresh);
480 fOptionMenu->AddEntry("&Pad Auto Exec", kOptionAutoExec);
482 fOptionMenu->AddEntry("&Statistics", kOptionStatistics);
483 fOptionMenu->AddEntry("Histogram &Title", kOptionHistTitle);
484 fOptionMenu->AddEntry("&Fit Parameters", kOptionFitParams);
485 fOptionMenu->AddEntry("Can Edit &Histograms", kOptionCanEdit);
486
487 // Opaque options initialized in InitWindow()
489 if (gStyle->GetOptStat())
491 if (gStyle->GetOptTitle())
493 if (gStyle->GetOptFit())
495 if (gROOT->GetEditHistograms())
497
499 fToolsMenu->AddEntry("&Inspect ROOT", kInspectRoot);
500 fToolsMenu->AddEntry("&Class Tree", kClassesTree);
501 fToolsMenu->AddEntry("&Fit Panel", kFitPanel);
502 fToolsMenu->AddEntry("&Start Browser", kToolsBrowser);
503 fToolsMenu->AddEntry("&Gui Builder", kToolsBuilder);
504 fToolsMenu->AddEntry("&Event Recorder", kToolsRecorder);
505
507 fHelpMenu->AddLabel("Basic Help On...");
509 fHelpMenu->AddEntry("&Canvas", kHelpOnCanvas);
510 fHelpMenu->AddEntry("&Menus", kHelpOnMenus);
511 fHelpMenu->AddEntry("&Graphics Editor", kHelpOnGraphicsEd);
512 fHelpMenu->AddEntry("&Browser", kHelpOnBrowser);
513 fHelpMenu->AddEntry("&Objects", kHelpOnObjects);
514 fHelpMenu->AddEntry("&PostScript", kHelpOnPS);
516 fHelpMenu->AddEntry("&About ROOT...", kHelpAbout);
517
518 // This main frame will process the menu commands
519 fFileMenu->Associate(this);
521 fEditMenu->Associate(this);
523 fViewMenu->Associate(this);
525 fViewWithMenu->Connect("PoppedUp()", "TRootCanvas", this, "UpdateViewWithMenu()");
526 fOptionMenu->Associate(this);
527 fToolsMenu->Associate(this);
528 fHelpMenu->Associate(this);
529
530 // Create menubar layout hints
534
535 // Create menubar
536 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
543
545
549
550 // Create toolbar dock
551 fToolDock = new TGDockableFrame(this);
555
556 // will allocate it later
557 fToolBar = 0;
558 fVertical1 = 0;
559 fVertical2 = 0;
562
566
567 fMainFrame = new TGCompositeFrame(this, GetWidth() + 4, GetHeight() + 4,
570
571 // Create editor frame that will host the pad editor
575
576 // Create canvas and canvas container that will host the ROOT graphics
579
580 fCanvasID = -1;
581
582 if (fCanvas->UseGL()) {
584 //first, initialize GL (if not yet)
585 if (!gGLManager) {
586 TString x = "win32";
587 if (gVirtualX->InheritsFrom("TGX11"))
588 x = "x11";
589 else if (gVirtualX->InheritsFrom("TGCocoa"))
590 x = "osx";
591
592 TPluginHandler *ph = gROOT->GetPluginManager()->FindHandler("TGLManager", x);
593
594 if (ph && ph->LoadPlugin() != -1) {
595 if (!ph->ExecPlugin(0))
596 Error("CreateCanvas", "GL manager plugin failed");
597 }
598 }
599
600 if (gGLManager) {
602 if (fCanvasID != -1) {
603 //Create gl context.
604 const Int_t glCtx = gGLManager->CreateGLContext(fCanvasID);
605 if (glCtx != -1) {
607 fCanvas->SetGLDevice(glCtx);//Now, fCanvas is responsible for context deletion!
608 } else
609 Error("CreateCanvas", "GL context creation failed.");
610 } else
611 Error("CreateCanvas", "GL window creation failed\n");
612 }
613 }
614
615 if (fCanvasID == -1)
617
618 Window_t win = gVirtualX->GetWindowID(fCanvasID);
622
625
626 // create the tooltip with a timeout of 250 ms
628
629 fCanvas->Connect("ProcessedEvent(Int_t, Int_t, Int_t, TObject*)",
630 "TRootCanvas", this,
631 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
632
633 // Create status bar
634 int parts[] = { 33, 10, 10, 47 };
635 fStatusBar = new TGStatusBar(this, 10, 10);
636 fStatusBar->SetParts(parts, 4);
637
639
641
642 // Misc
645 fIconPic = SetIconPixmap("macro_s.xpm");
646 SetClassHints("ROOT", "Canvas");
647
650
651 // by default status bar, tool bar and pad editor are hidden
656
659
660 // we need to use GetDefaultSize() to initialize the layout algorithm...
662
663 gVirtualX->SetDNDAware(fId, fDNDTypeList);
665}
666
667////////////////////////////////////////////////////////////////////////////////
668/// Delete ROOT basic canvas. Order is significant. Delete in reverse
669/// order of creation.
670
672{
673 delete fToolTip;
674 if (fIconPic) gClient->FreePicture(fIconPic);
675 if (fEditor && !fEmbedded) delete fEditor;
676 if (fToolBar) {
677 Disconnect(fToolDock, "Docked()", this, "AdjustSize()");
678 Disconnect(fToolDock, "Undocked()", this, "AdjustSize()");
679 fToolBar->Cleanup();
680 delete fToolBar;
681 }
682
683 if (!MustCleanup()) {
684 delete fStatusBar;
685 delete fStatusBarLayout;
686 delete fCanvasContainer;
687 delete fCanvasWindow;
688
689 delete fEditorFrame;
690 delete fEditorLayout;
691 delete fMainFrame;
692 delete fMainFrameLayout;
693 delete fToolBarSep;
694 delete fToolDock;
695 delete fToolBarLayout;
696 delete fHorizontal1;
697 delete fHorizontal1Layout;
698
699 delete fMenuBar;
700 delete fMenuBarLayout;
701 delete fMenuBarItemLayout;
702 delete fMenuBarHelpLayout;
703 delete fCanvasLayout;
704 delete fDockLayout;
705 }
706
707 delete fFileMenu;
708 delete fFileSaveMenu;
709 delete fEditMenu;
710 delete fEditClearMenu;
711 delete fViewMenu;
712 delete fViewWithMenu;
713 delete fOptionMenu;
714 delete fToolsMenu;
715 delete fHelpMenu;
716}
717
718////////////////////////////////////////////////////////////////////////////////
719/// Called via TCanvasImp interface by TCanvas.
720
722{
724 if(gged && gged->GetCanvas() == fCanvas) {
725 if (fEmbedded) {
726 ((TGedEditor *)gged)->SetModel(0, 0, kButton1Down);
727 ((TGedEditor *)gged)->SetCanvas(0);
728 }
729 else gged->Hide();
730 }
731
732 if (fCanvasID != -1) {
733 gVirtualX->SelectWindow(fCanvasID);
734 gVirtualX->CloseWindow();
735 fCanvasID = -1;
736 }
737}
738
739////////////////////////////////////////////////////////////////////////////////
740/// Really delete the canvas and this GUI.
741
743{
745 if(gged && gged->GetCanvas() == fCanvas) {
746 if (fEmbedded) {
747 ((TGedEditor *)gged)->SetModel(0, 0, kButton1Down);
748 ((TGedEditor *)gged)->SetCanvas(0);
749 }
750 else gged->Hide();
751 }
752
753 fToolTip->Hide();
754 Disconnect(fCanvas, "ProcessedEvent(Int_t, Int_t, Int_t, TObject*)",
755 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
756
758 fCanvas->Clear();
759 fCanvas->SetName("");
760 if (gPad && gPad->GetCanvas() == fCanvas)
761 gPad = nullptr;
762 delete this;
763}
764
765////////////////////////////////////////////////////////////////////////////////
766/// In case window is closed via WM we get here.
767
772
773////////////////////////////////////////////////////////////////////////////////
774/// Return width of canvas container.
775
780
781////////////////////////////////////////////////////////////////////////////////
782/// Return height of canvas container.
783
788
789////////////////////////////////////////////////////////////////////////////////
790/// Gets the size and position of the window containing the canvas. This
791/// size includes the menubar and borders.
792
794{
795 gVirtualX->GetWindowSize(fId, x, y, w, h);
796
797 Window_t childdum;
798 gVirtualX->TranslateCoordinates(fId, gClient->GetDefaultRoot()->GetId(),
799 0, 0, x, y, childdum);
800 if (!fCanvas->GetShowEditor()) return 0;
801 return fEditorFrame->GetWidth();
802}
803
804////////////////////////////////////////////////////////////////////////////////
805/// Set text in status bar.
806
807void TRootCanvas::SetStatusText(const char *txt, Int_t partidx)
808{
809 fStatusBar->SetText(txt, partidx);
810}
811
812////////////////////////////////////////////////////////////////////////////////
813/// Handle menu and other command generated by the user.
814
816{
817 TRootHelpDialog *hd;
818 TList *lc;
819
820 switch (GET_MSG(msg)) {
821
822 case kC_COMMAND:
823
824 switch (GET_SUBMSG(msg)) {
825
826 case kCM_BUTTON:
827 case kCM_MENU:
828
829 switch (parm1) {
830 // Handle toolbar items...
831 case kToolModify:
832 gROOT->SetEditorMode();
833 break;
834 case kToolArc:
835 gROOT->SetEditorMode("Arc");
836 break;
837 case kToolLine:
838 gROOT->SetEditorMode("Line");
839 break;
840 case kToolArrow:
841 gROOT->SetEditorMode("Arrow");
842 break;
843 case kToolDiamond:
844 gROOT->SetEditorMode("Diamond");
845 break;
846 case kToolEllipse:
847 gROOT->SetEditorMode("Ellipse");
848 break;
849 case kToolPad:
850 gROOT->SetEditorMode("Pad");
851 break;
852 case kToolPave:
853 gROOT->SetEditorMode("Pave");
854 break;
855 case kToolPLabel:
856 gROOT->SetEditorMode("PaveLabel");
857 break;
858 case kToolPText:
859 gROOT->SetEditorMode("PaveText");
860 break;
861 case kToolPsText:
862 gROOT->SetEditorMode("PavesText");
863 break;
864 case kToolGraph:
865 gROOT->SetEditorMode("PolyLine");
866 break;
867 case kToolCurlyLine:
868 gROOT->SetEditorMode("CurlyLine");
869 break;
870 case kToolCurlyArc:
871 gROOT->SetEditorMode("CurlyArc");
872 break;
873 case kToolLatex:
874 gROOT->SetEditorMode("Text");
875 break;
876 case kToolMarker:
877 gROOT->SetEditorMode("Marker");
878 break;
879 case kToolCutG:
880 gROOT->SetEditorMode("CutG");
881 break;
882
883 // Handle File menu items...
884 case kFileNewCanvas:
885 gROOT->MakeDefCanvas();
886 break;
887 case kFileOpen:
888 {
889 static TString dir(".");
890 TGFileInfo fi;
892 fi.SetIniDir(dir);
893 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDOpen,&fi);
894 if (!fi.fFilename) return kTRUE;
895 dir = fi.fIniDir;
896 TFile::Open(fi.fFilename, "update");
897 TIter next(gROOT->GetListOfBrowsers());
898 TBrowser *b;
899 while ((b = (TBrowser *)next())) {
900 TRootBrowser *rb = dynamic_cast<TRootBrowser *>(b->GetBrowserImp());
901 if (rb) {
902 TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(rb->GetActBrowser());
903 if (fb)
904 fb->Selected(0);
905 }
906 }
907 gROOT->RefreshBrowsers();
908 }
909 break;
910 case kFileSaveAs:
911 {
912 TString workdir = gSystem->WorkingDirectory();
913 static TString dir(".");
914 static Int_t typeidx = 0;
915 static Bool_t overwr = kFALSE;
916 TGFileInfo fi;
917 TString defaultType = gEnv->GetValue("Canvas.SaveAsDefaultType", ".pdf");
918 if (typeidx == 0) {
919 for (int i=1;gSaveAsTypes[i];i+=2) {
920 TString ftype = gSaveAsTypes[i];
921 if (ftype.EndsWith(defaultType.Data())) {
922 typeidx = i-1;
923 break;
924 }
925 }
926 }
928 fi.SetIniDir(dir);
929 fi.fFileTypeIdx = typeidx;
930 fi.fOverwrite = overwr;
931 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDSave, &fi);
932 gSystem->ChangeDirectory(workdir.Data());
933 if (!fi.fFilename) return kTRUE;
934 Bool_t appendedType = kFALSE;
935 TString fn = fi.fFilename;
936 TString ft = fi.fFileTypes[fi.fFileTypeIdx+1];
937 // clang-format off
938 dir = fi.fIniDir;
939 typeidx = fi.fFileTypeIdx;
940 overwr = fi.fOverwrite;
941again:
942 if (fn.EndsWith(".root") ||
943 fn.EndsWith(".ps") ||
944 fn.EndsWith(".eps") ||
945 fn.EndsWith(".pdf") ||
946 fn.EndsWith(".html") ||
947 fn.EndsWith(".svg") ||
948 fn.EndsWith(".tex") ||
949 fn.EndsWith(".gif") ||
950 fn.EndsWith(".bmp") ||
951 fn.EndsWith(".xml") ||
952 fn.EndsWith(".xpm") ||
953 fn.EndsWith(".jpg") ||
954 fn.EndsWith(".png") ||
955 fn.EndsWith(".xcf") ||
956 fn.EndsWith(".tiff")) {
957 fCanvas->SaveAs(fn);
958 } else if (fn.EndsWith(".C"))
959 fCanvas->SaveSource(fn);
960 else {
961 if (!appendedType) {
962 if (ft.Index(".") != kNPOS) {
963 fn += ft(ft.Index("."), ft.Length());
964 appendedType = kTRUE;
965 goto again;
966 }
967 }
968 Warning("ProcessMessage", "file %s cannot be saved with this extension", fi.fFilename);
969 }
970 for (int i = 1; gSaveAsTypes[i]; i += 2) {
971 TString ftype = gSaveAsTypes[i];
972 ftype.ReplaceAll("*.", ".");
973 if (fn.EndsWith(ftype.Data())) {
974 typeidx = i - 1;
975 break;
976 }
977 }
978 }
979 break;
980 case kFileSaveAsRoot:
981 fCanvas->SaveAs(".root");
982 break;
983 case kFileSaveAsC:
985 break;
986 case kFileSaveAsPS:
987 fCanvas->SaveAs();
988 break;
989 case kFileSaveAsEPS:
990 fCanvas->SaveAs(".eps");
991 break;
992 case kFileSaveAsPDF:
993 fCanvas->SaveAs(".pdf");
994 break;
995 case kFileSaveAsHTML:
996 fCanvas->SaveAs(".html");
997 break;
998 case kFileSaveAsSVG:
999 fCanvas->SaveAs(".svg");
1000 break;
1001 case kFileSaveAsGIF:
1002 fCanvas->SaveAs(".gif");
1003 break;
1004 case kFileSaveAsJPG:
1005 fCanvas->SaveAs(".jpg");
1006 break;
1007 case kFileSaveAsPNG:
1008 fCanvas->SaveAs(".png");
1009 break;
1010 case kFileSaveAsBMP:
1011 fCanvas->SaveAs(".bmp");
1012 break;
1013 case kFileSaveAsTEX:
1014 fCanvas->SaveAs(".tex");
1015 break;
1016 case kFilePrint:
1017 PrintCanvas();
1018 break;
1019 case kFileCloseCanvas:
1021 break;
1022 case kFileQuit:
1023 if (!gApplication->ReturnFromRun()) {
1027 }
1030 if (TClass::GetClass("TStyleManager", kFALSE, kTRUE))
1031 gROOT->ProcessLine("TStyleManager::Terminate()");
1033 break;
1034
1035 // Handle Edit menu items...
1036 case kEditStyle:
1037 if (!TClass::GetClass("TStyleManager"))
1038 gSystem->Load("libGed");
1039 gROOT->ProcessLine("TStyleManager::Show()");
1040 break;
1041 case kEditCut:
1042 // still noop
1043 break;
1044 case kEditCopy:
1045 // still noop
1046 break;
1047 case kEditPaste:
1048 // still noop
1049 break;
1050 case kEditUndo:
1051 // noop
1052 break;
1053 case kEditRedo:
1054 // noop
1055 break;
1056 case kEditClearPad:
1057 gPad->Clear();
1058 gPad->Modified();
1059 gPad->Update();
1060 break;
1061 case kEditClearCanvas:
1062 fCanvas->Clear();
1063 fCanvas->Modified();
1064 fCanvas->Update();
1065 break;
1066
1067 // Handle View menu items...
1068 case kViewEditor:
1070 break;
1071 case kViewToolbar:
1073 break;
1074 case kViewEventStatus:
1076 break;
1077 case kViewToolTips:
1079 break;
1080 case kViewColors:
1081 {
1082 TVirtualPad *padsav = gPad->GetCanvas();
1083 //This was the code with the old color table
1084 // TCanvas *m = new TCanvas("colors","Color Table");
1085 // TPad::DrawColorTable();
1086 // m->Update();
1087 TColorWheel *wheel = new TColorWheel();
1088 wheel->Draw();
1089
1090 //tp: with Cocoa, window is visible (and repainted)
1091 //before wheel->Draw() was called and you can see "empty"
1092 //canvas.
1093 gPad->Update();
1094 //
1095 if (padsav) padsav->cd();
1096 }
1097 break;
1098 case kViewFonts:
1099 // noop
1100 break;
1101 case kViewMarkers:
1102 {
1103 TVirtualPad *padsav = gPad ? gPad->GetCanvas() : nullptr;
1104 TCanvas *m = new TCanvas("markers","Marker Types",600,200);
1106 m->Update();
1107 if (padsav) padsav->cd();
1108 }
1109 break;
1110 case kViewIconify:
1111 Iconify();
1112 break;
1113 case kViewX3D: {
1114 TVirtualPad *pad = gPad ? gPad : (fCanvas ? fCanvas->GetSelectedPad() : nullptr);
1115 if (!pad)
1116 pad = fCanvas;
1117 if (!PadHasGeometryContent(pad))
1118 pad->GetViewer3D("x3d");
1119 break;
1120 }
1121 case kViewOpenGL:
1122 gPad->GetViewer3D("ogl");
1123 break;
1124
1125 // Handle Option menu items...
1126 case kOptionAutoExec:
1128 if (fCanvas->GetAutoExec()) {
1130 } else {
1132 }
1133 break;
1134 case kOptionAutoResize:
1135 {
1137 int opt = fCanvasContainer->GetOptions();
1138 if (fAutoFit) {
1139 opt &= ~kFixedSize;
1141 } else {
1142 opt |= kFixedSize;
1144 }
1146 // in case of autofit this will generate a configure
1147 // event for the container and this will force the
1148 // update of the TCanvas
1149 //Layout();
1150 }
1151 Layout();
1152 break;
1154 FitCanvas();
1155 break;
1156 case kOptionMoveOpaque:
1157 if (fCanvas->OpaqueMoving()) {
1158 fCanvas->MoveOpaque(0);
1160 } else {
1161 fCanvas->MoveOpaque(1);
1163 }
1164 break;
1166 if (fCanvas->OpaqueResizing()) {
1169 } else {
1172 }
1173 break;
1174 case kOptionInterrupt:
1175 gROOT->SetInterrupt();
1176 break;
1177 case kOptionRefresh:
1178 fCanvas->Paint();
1179 fCanvas->Update();
1180 break;
1181 case kOptionStatistics:
1182 if (gStyle->GetOptStat()) {
1183 gStyle->SetOptStat(0);
1184 delete gPad->FindObject("stats");
1186 } else {
1187 gStyle->SetOptStat(1);
1189 }
1190 gPad->Modified();
1191 fCanvas->Update();
1192 break;
1193 case kOptionHistTitle:
1194 if (gStyle->GetOptTitle()) {
1195 gStyle->SetOptTitle(0);
1196 delete gPad->FindObject("title");
1198 } else {
1199 gStyle->SetOptTitle(1);
1201 }
1202 gPad->Modified();
1203 fCanvas->Update();
1204 break;
1205 case kOptionFitParams:
1206 if (gStyle->GetOptFit()) {
1207 gStyle->SetOptFit(0);
1209 } else {
1210 gStyle->SetOptFit(1);
1212 }
1213 gPad->Modified();
1214 fCanvas->Update();
1215 break;
1216 case kOptionCanEdit:
1217 if (gROOT->GetEditHistograms()) {
1218 gROOT->SetEditHistograms(kFALSE);
1220 } else {
1221 gROOT->SetEditHistograms(kTRUE);
1223 }
1224 break;
1225
1226 // Handle Tools menu items...
1227 case kInspectRoot:
1228 fCanvas->cd();
1229 gROOT->Inspect();
1230 fCanvas->Update();
1231 break;
1232 case kToolsBrowser:
1233 new TBrowser("browser");
1234 break;
1235 case kToolsBuilder:
1237 break;
1238 case kToolsRecorder:
1239 gROOT->ProcessLine("new TGRecorder()");
1240 break;
1241
1242 // Handle Tools menu items...
1243 case kClassesTree:
1244 {
1245 TString cdef;
1246 lc = (TList*)gROOT->GetListOfCanvases();
1247 if (lc->FindObject("ClassTree")) {
1248 cdef = TString::Format("ClassTree_%d", lc->GetSize()+1);
1249 } else {
1250 cdef = "ClassTree";
1251 }
1252 new TClassTree(cdef.Data(), "TObject");
1253 fCanvas->Update();
1254 }
1255 break;
1256
1257 case kFitPanel:
1258 {
1259 // use plugin manager to create instance of TFitEditor
1260 TPluginHandler *handler = gROOT->GetPluginManager()->FindHandler("TFitEditor");
1261 if (handler && handler->LoadPlugin() != -1) {
1262 if (handler->ExecPlugin(2, fCanvas, 0) == 0)
1263 Error("FitPanel", "Unable to crate the FitPanel");
1264 }
1265 else
1266 Error("FitPanel", "Unable to find the FitPanel plug-in");
1267 }
1268 break;
1269
1270 // Handle Help menu items...
1271 case kHelpAbout:
1272 {
1273#ifdef WIN32
1275#else
1276
1277 char str[32];
1278 snprintf(str, 32, "About ROOT %s...", gROOT->GetVersion());
1279 hd = new TRootHelpDialog(this, str, 600, 400);
1280 hd->SetText(gHelpAbout);
1281 hd->Popup();
1282#endif
1283 }
1284 break;
1285 case kHelpOnCanvas:
1286 hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
1287 hd->SetText(gHelpCanvas);
1288 hd->Popup();
1289 break;
1290 case kHelpOnMenus:
1291 hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
1293 hd->Popup();
1294 break;
1295 case kHelpOnGraphicsEd:
1296 hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
1298 hd->Popup();
1299 break;
1300 case kHelpOnBrowser:
1301 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
1302 hd->SetText(gHelpBrowser);
1303 hd->Popup();
1304 break;
1305 case kHelpOnObjects:
1306 hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
1307 hd->SetText(gHelpObjects);
1308 hd->Popup();
1309 break;
1310 case kHelpOnPS:
1311 hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
1313 hd->Popup();
1314 break;
1315 // clang-format on
1316 }
1317 default:
1318 break;
1319 }
1320 default:
1321 break;
1322 }
1323 return kTRUE;
1324}
1325
1326////////////////////////////////////////////////////////////////////////////////
1327/// Called by TCanvas ctor to get window indetifier.
1328
1338
1339////////////////////////////////////////////////////////////////////////////////
1340/// Set size of canvas container. Units in pixels.
1341/// If w==0 and h==0, set autofit mode
1342
1344{
1345 // turn off autofit, we want to stay at the given size
1346 int opt = fCanvasContainer->GetOptions();
1347 if (!w && !h) {
1348 fAutoFit = kTRUE;
1350 opt &= ~kFixedSize; // turn off fixed size mode
1351 } else {
1352 fAutoFit = kFALSE;
1354 opt |= kFixedSize; // turn on fixed size mode
1355 }
1359 Layout(); // force layout (will update container to given size)
1360 fCanvas->Resize();
1361 fCanvas->Update();
1362}
1363
1364////////////////////////////////////////////////////////////////////////////////
1365/// Set cursor for the canvas
1366
1368{
1369 if (fCanvasID != -1)
1370 gVirtualX->SetCursor(fCanvasID, cursor);
1371}
1372
1373////////////////////////////////////////////////////////////////////////////////
1374/// Set canvas position (units in pixels).
1375
1380
1381////////////////////////////////////////////////////////////////////////////////
1382/// Set size of canvas (units in pixels).
1383
1385{
1386 Resize(w, h);
1387
1388 // Make sure the change of size is really done.
1389 gVirtualX->Update(1);
1390 if (!gThreadXAR) {
1391 gSystem->Sleep(100);
1393 gSystem->Sleep(10);
1395 }
1396}
1397
1398////////////////////////////////////////////////////////////////////////////////
1399/// Put canvas window on top of the window stack.
1400
1402{
1403 gVirtualX->RaiseWindow(GetId());
1404}
1405
1406////////////////////////////////////////////////////////////////////////////////
1407/// Change title on window.
1408
1409void TRootCanvas::SetWindowTitle(const char *title)
1410{
1411 SetWindowName(title);
1412 SetIconName(title);
1413 fToolDock->SetWindowName(TString::Format("ToolBar: %s", title));
1414}
1415
1416////////////////////////////////////////////////////////////////////////////////
1417/// Fit canvas container to current window size.
1418
1420{
1421 if (!fAutoFit) {
1422 int opt = fCanvasContainer->GetOptions();
1423 int oopt = opt;
1424 opt &= ~kFixedSize; // turn off fixed size mode
1426 Layout(); // force layout
1427 fCanvas->Resize();
1428 fCanvas->Update();
1430 }
1431}
1432
1433////////////////////////////////////////////////////////////////////////////////
1434/// Print the canvas.
1435
1437{
1438 Int_t ret = 0;
1439 Bool_t pname = kTRUE;
1440 char *printer, *printCmd;
1441 static TString sprinter, sprintCmd;
1442
1443 if (sprinter == "")
1444 printer = StrDup(gEnv->GetValue("Print.Printer", ""));
1445 else
1446 printer = StrDup(sprinter);
1447 if (sprintCmd == "")
1448#ifndef WIN32
1449 printCmd = StrDup(gEnv->GetValue("Print.Command", ""));
1450#else
1451 printCmd = StrDup(gEnv->GetValue("Print.Command", "start AcroRd32.exe /p"));
1452#endif
1453 else
1454 printCmd = StrDup(sprintCmd);
1455
1456 new TGPrintDialog(fClient->GetDefaultRoot(), this, 400, 150,
1457 &printer, &printCmd, &ret);
1458 if (ret) {
1459 sprinter = printer;
1460 sprintCmd = printCmd;
1461
1462 if (sprinter == "")
1463 pname = kFALSE;
1464
1465 TString fn = "rootprint";
1466 FILE *f = gSystem->TempFileName(fn, gEnv->GetValue("Print.Directory", gSystem->TempDirectory()));
1467 if (f) fclose(f);
1468 fn += TString::Format(".%s",gEnv->GetValue("Print.FileType", "pdf"));
1469 fCanvas->Print(fn);
1470
1471 TString cmd = sprintCmd;
1472 if (cmd.Contains("%p"))
1473 cmd.ReplaceAll("%p", sprinter);
1474 else if (pname) {
1475 cmd += " "; cmd += sprinter; cmd += " ";
1476 }
1477
1478 if (cmd.Contains("%f"))
1479 cmd.ReplaceAll("%f", fn);
1480 else {
1481 cmd += " "; cmd += fn; cmd += " ";
1482 }
1483
1484 gSystem->Exec(cmd);
1485#ifndef WIN32
1486 gSystem->Unlink(fn);
1487#endif
1488 }
1489 delete [] printer;
1490 delete [] printCmd;
1491}
1492
1493////////////////////////////////////////////////////////////////////////////////
1494/// Display a tooltip with infos about the primitive below the cursor.
1495
1497{
1498 fToolTip->Hide();
1499 if (!fCanvas->GetShowToolTips() || selected == 0 ||
1500 event != kMouseMotion || fButton != 0)
1501 return;
1502 TString tipInfo;
1503 TString objInfo = selected->GetObjectInfo(px, py);
1504 if (objInfo.BeginsWith("-")) {
1505 // if the string begins with '-', display only the object info
1506 objInfo.Remove(TString::kLeading, '-');
1507 tipInfo = objInfo;
1508 }
1509 else {
1510 const char *title = selected->GetTitle();
1511 tipInfo += TString::Format("%s::%s", selected->ClassName(),
1512 selected->GetName());
1513 if (title && strlen(title))
1514 tipInfo += TString::Format("\n%s", selected->GetTitle());
1515 tipInfo += TString::Format("\n%d, %d", px, py);
1516 if (!objInfo.IsNull())
1517 tipInfo += TString::Format("\n%s", objInfo.Data());
1518 }
1519 fToolTip->SetText(tipInfo.Data());
1520 fToolTip->SetPosition(px+15, py+15);
1521 fToolTip->Reset();
1522}
1523
1524////////////////////////////////////////////////////////////////////////////////
1525/// Show or hide menubar.
1526
1528{
1529 if (show) ShowFrame(fMenuBar);
1530 else HideFrame(fMenuBar);
1531}
1532
1533////////////////////////////////////////////////////////////////////////////////
1534/// Show or hide statusbar.
1535
1537{
1540
1541 UInt_t h = GetHeight();
1542 UInt_t sh = fStatusBar->GetHeight()+2;
1543
1544 if (show) {
1547 if (dh - ch >= sh) h = h + sh;
1548 else h = ch;
1549 } else {
1552 if (dh - ch < sh) h = ch;
1553 else h = h - sh;
1554 }
1555 Resize(GetWidth(), h);
1556}
1557
1558////////////////////////////////////////////////////////////////////////////////
1559/// Show or hide side frame.
1560
1562{
1564
1565 UInt_t w = GetWidth();
1567 UInt_t h = GetHeight();
1569
1570 auto lambda_show = [&, this]() {
1571 if (show) {
1572 if (!fEditor)
1573 CreateEditor();
1575 if (gged && gged->GetCanvas() == fCanvas) {
1576 gged->Hide();
1577 }
1580 h += s;
1581 }
1583 fEditor->Show();
1585 w += e;
1586 } else {
1589 h -= s;
1590 }
1591 if (fEditor)
1592 fEditor->Hide();
1595 w -= e;
1596 }
1597 };
1598
1599 if (fParent && fParent != fClient->GetDefaultRoot()) {
1602 if (main && main->InheritsFrom("TRootBrowser")) {
1603 TRootBrowser *browser = (TRootBrowser *)main;
1604 if (!fEmbedded)
1605 browser->GetTabRight()->Connect("Selected(Int_t)", "TRootCanvas",
1606 this, "Activated(Int_t)");
1607 fEmbedded = kTRUE;
1608 if (show && (!fEditor || !((TGedEditor *)fEditor)->IsMapped())) {
1609 if (!browser->GetTabLeft()->GetTabTab("Pad Editor")) {
1610 if (browser->GetActFrame()) { //already in edit mode
1611 TTimer::SingleShot(200, "TRootCanvas", this, "ShowEditor(=kTRUE)");
1612 } else {
1614 if (!fEditor)
1616 else {
1617 ((TGedEditor *)fEditor)->ReparentWindow(fClient->GetRoot());
1618 ((TGedEditor *)fEditor)->MapWindow();
1619 }
1620 browser->StopEmbedding("Pad Editor");
1621 if (fEditor) {
1623 gROOT->GetListOfCleanups()->Remove((TGedEditor *)fEditor);
1624 ((TGedEditor *)fEditor)->SetCanvas(fCanvas);
1625 ((TGedEditor *)fEditor)->SetModel(fCanvas, fCanvas, kButton1Down);
1626 }
1627 }
1628 }
1629 else
1631 }
1632 if (show) browser->GetTabLeft()->SetTab("Pad Editor");
1633 } else {
1634 lambda_show();
1635 main->Layout();
1636 }
1637 }
1638 else {
1639 lambda_show();
1640 Resize(w, h);
1641 }
1642}
1643
1644////////////////////////////////////////////////////////////////////////////////
1645/// Create embedded editor.
1646
1648{
1651 gPad = Canvas();
1652 // next two lines are related to the old editor
1653 Int_t show = gEnv->GetValue("Canvas.ShowEditor", 0);
1654 gEnv->SetValue("Canvas.ShowEditor","true");
1659
1660 // next line is related to the old editor
1661 if (show == 0) gEnv->SetValue("Canvas.ShowEditor","false");
1662}
1663
1664////////////////////////////////////////////////////////////////////////////////
1665/// Show or hide toolbar.
1666
1668{
1669 if (show && !fToolBar) {
1670
1673
1674 Int_t spacing = 6, i;
1675 for (i = 0; gToolBarData[i].fPixmap; i++) {
1676 if (strlen(gToolBarData[i].fPixmap) == 0) {
1677 spacing = 6;
1678 continue;
1679 }
1680 fToolBar->AddButton(this, &gToolBarData[i], spacing);
1681 spacing = 0;
1682 }
1689
1690 spacing = 6;
1691 for (i = 0; gToolBarData1[i].fPixmap; i++) {
1692 if (strlen(gToolBarData1[i].fPixmap) == 0) {
1693 spacing = 6;
1694 continue;
1695 }
1696 fToolBar->AddButton(this, &gToolBarData1[i], spacing);
1697 spacing = 0;
1698 }
1700 fToolDock->Layout();
1702 fToolDock->Connect("Docked()", "TRootCanvas", this, "AdjustSize()");
1703 fToolDock->Connect("Undocked()", "TRootCanvas", this, "AdjustSize()");
1704 }
1705
1706 if (!fToolBar) return;
1707
1708 UInt_t h = GetHeight();
1710 UInt_t dh = fToolBar->GetHeight();
1711
1712 if (show) {
1716 h = h + sh;
1717 }
1720 h = h + dh + sh;
1721 } else {
1722 if (fToolDock->IsUndocked()) {
1724 h = h + 2*sh;
1725 } else h = h - dh;
1726
1730 h = h - sh;
1731 }
1733 h = h - sh;
1735 }
1736 Resize(GetWidth(), h);
1737}
1738
1739////////////////////////////////////////////////////////////////////////////////
1740/// Enable or disable tooltip info.
1741
1743{
1744 if (show)
1746 else
1748}
1749
1750////////////////////////////////////////////////////////////////////////////////
1751/// Returns kTRUE if the editor is shown.
1752
1757
1758////////////////////////////////////////////////////////////////////////////////
1759/// Returns kTRUE if the menu bar is shown.
1760
1762{
1763 return (fMenuBar) && fMenuBar->IsMapped();
1764}
1765
1766////////////////////////////////////////////////////////////////////////////////
1767/// Returns kTRUE if the status bar is shown.
1768
1770{
1771 return (fStatusBar) && fStatusBar->IsMapped();
1772}
1773
1774////////////////////////////////////////////////////////////////////////////////
1775/// Returns kTRUE if the tool bar is shown.
1776
1778{
1779 return (fToolBar) && fToolBar->IsMapped();
1780}
1781
1782////////////////////////////////////////////////////////////////////////////////
1783/// Returns kTRUE if the tooltips are enabled.
1784
1786{
1787 return (fCanvas) && fCanvas->GetShowToolTips();
1788}
1789
1790////////////////////////////////////////////////////////////////////////////////
1791/// Keep the same canvas size while docking/undocking toolbar.
1792
1794{
1795 UInt_t h = GetHeight();
1796 UInt_t dh = fToolBar->GetHeight();
1798
1799 if (fToolDock->IsUndocked()) {
1802 h = h - sh;
1803 }
1805 h = h - dh - sh;
1806 } else {
1809 h = h + sh;
1810 }
1812 h = h + dh + sh;
1813 }
1814 Resize(GetWidth(), h);
1815}
1816
1817////////////////////////////////////////////////////////////////////////////////
1818/// Handle mouse button events in the canvas container.
1819
1821{
1822 Int_t button = event->fCode;
1823 Int_t x = event->fX;
1824 Int_t y = event->fY;
1825
1826 if (event->fType == kButtonPress) {
1827 if (fToolTip && fCanvas->GetShowToolTips()) {
1828 fToolTip->Hide();
1829 // do not sync GL canvas - avoid flicking
1830 if (!fCanvas->UseGL() && (fCanvasID != -1)) {
1831 gVirtualX->UpdateWindowW(gVirtualX->GetWindowContext(fCanvasID), 0);
1833 }
1834 }
1835 fButton = button;
1836 if (button == kButton1) {
1837 if (event->fState & kKeyShiftMask)
1839 else
1841 }
1842 if (button == kButton2)
1844 if (button == kButton3) {
1846 fButton = 0; // button up is consumed by TContextMenu
1847 }
1848
1849 } else if (event->fType == kButtonRelease) {
1850 if (button == kButton4)
1852 if (button == kButton5)
1854 if (button == kButton1)
1856 if (button == kButton2)
1858 if (button == kButton3)
1860
1861 fButton = 0;
1862 }
1863
1864 return kTRUE;
1865}
1866
1867////////////////////////////////////////////////////////////////////////////////
1868/// Handle mouse button double click events in the canvas container.
1869
1871{
1872 Int_t button = event->fCode;
1873 Int_t x = event->fX;
1874 Int_t y = event->fY;
1875
1876 if (button == kButton1)
1878 if (button == kButton2)
1880 if (button == kButton3)
1882
1883 return kTRUE;
1884}
1885
1886////////////////////////////////////////////////////////////////////////////////
1887/// Handle configure (i.e. resize) event.
1888
1890{
1891 if (fAutoFit) {
1892 fCanvas->Resize();
1893 fCanvas->Update();
1894 }
1895
1897 // get menu height
1898 static Int_t dh = 0;
1899 if (!dh)
1902 fCanvas->GetAspectRatio()) + dh;
1904 }
1905 return kTRUE;
1906}
1907
1908////////////////////////////////////////////////////////////////////////////////
1909/// Handle keyboard events in the canvas container.
1910
1912{
1913 static EGEventType previous_event = kOtherEvent;
1914 static UInt_t previous_keysym = 0;
1915
1916 if (event->fType == kGKeyPress) {
1917 fButton = event->fCode;
1918 UInt_t keysym;
1919 char str[2];
1920 gVirtualX->LookupString(event, str, sizeof(str), keysym);
1921
1922 if (str[0] == kESC){ // ESC sets the escape flag
1923 gROOT->SetEscape();
1926 gPad->Modified();
1927 return kTRUE;
1928 }
1929 if (str[0] == 3) // ctrl-c sets the interrupt flag
1930 gROOT->SetInterrupt();
1931
1932 // handle arrow keys
1933 if (keysym > 0x1011 && keysym < 0x1016) {
1934 Window_t dum1, dum2, wid;
1935 UInt_t mask = 0;
1936 Int_t mx, my, tx, ty;
1937 wid = gVirtualX->GetDefaultRootWindow();
1938 gVirtualX->QueryPointer(wid, dum1, dum2, mx, my, mx, my, mask);
1939 gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(),
1941 mx, my, tx, ty, dum1);
1943 // handle case where we got consecutive same keypressed events coming
1944 // from auto-repeat on Windows (as it fires only successive keydown events)
1945 if ((previous_keysym == keysym) && (previous_event == kGKeyPress)) {
1946 switch (keysym) {
1947 case 0x1012: // left
1948 gVirtualX->Warp(--mx, my, wid); --tx;
1949 break;
1950 case 0x1013: // up
1951 gVirtualX->Warp(mx, --my, wid); --ty;
1952 break;
1953 case 0x1014: // right
1954 gVirtualX->Warp(++mx, my, wid); ++tx;
1955 break;
1956 case 0x1015: // down
1957 gVirtualX->Warp(mx, ++my, wid); ++ty;
1958 break;
1959 default:
1960 break;
1961 }
1963 }
1964 previous_keysym = keysym;
1965 }
1966 else {
1967 fCanvas->HandleInput(kKeyPress, str[0], keysym);
1968 }
1969 } else if (event->fType == kKeyRelease) {
1970 UInt_t keysym;
1971 char str[2];
1972 gVirtualX->LookupString(event, str, sizeof(str), keysym);
1973
1974 if (keysym > 0x1011 && keysym < 0x1016) {
1975 Window_t dum1, dum2, wid;
1976 UInt_t mask = 0;
1977 Int_t mx, my, tx, ty;
1978 wid = gVirtualX->GetDefaultRootWindow();
1979 gVirtualX->QueryPointer(wid, dum1, dum2, mx, my, mx, my, mask);
1980 switch (keysym) {
1981 case 0x1012: // left
1982 gVirtualX->Warp(--mx, my, wid);
1983 break;
1984 case 0x1013: // up
1985 gVirtualX->Warp(mx, --my, wid);
1986 break;
1987 case 0x1014: // right
1988 gVirtualX->Warp(++mx, my, wid);
1989 break;
1990 case 0x1015: // down
1991 gVirtualX->Warp(mx, ++my, wid);
1992 break;
1993 default:
1994 break;
1995 }
1996 gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(),
1998 mx, my, tx, ty, dum1);
2000 previous_keysym = keysym;
2001 }
2002 fButton = 0;
2003 }
2004 previous_event = event->fType;
2005 return kTRUE;
2006}
2007
2008////////////////////////////////////////////////////////////////////////////////
2009/// Handle mouse motion event in the canvas container.
2010
2012{
2013 Int_t x = event->fX;
2014 Int_t y = event->fY;
2015
2016 if (fButton == 0)
2018 if (fButton == kButton1) {
2019 if (event->fState & kKeyShiftMask)
2021 else
2023 }
2024 if (fButton == kButton2)
2026
2027 return kTRUE;
2028}
2029
2030////////////////////////////////////////////////////////////////////////////////
2031/// Handle expose events.
2032
2034{
2035 if (event->fCount == 0) {
2036 fCanvas->Flush();
2037 }
2038
2039 return kTRUE;
2040}
2041
2042////////////////////////////////////////////////////////////////////////////////
2043/// Handle enter/leave events. Only leave is activated at the moment.
2044
2046{
2047 Int_t x = event->fX;
2048 Int_t y = event->fY;
2049
2050 // pointer grabs create also an enter and leave event but with fCode
2051 // either kNotifyGrab or kNotifyUngrab, don't propagate these events
2052 if (event->fType == kLeaveNotify && event->fCode == kNotifyNormal)
2054
2055 if (event->fType == kEnterNotify && event->fCode == kNotifyNormal)
2057
2058 return kTRUE;
2059}
2060
2061////////////////////////////////////////////////////////////////////////////////
2062/// Handle drop events.
2063
2065{
2066 static Atom_t rootObj = gVirtualX->InternAtom("application/root", kFALSE);
2067 static Atom_t uriObj = gVirtualX->InternAtom("text/uri-list", kFALSE);
2068
2069 if (data->fDataType == rootObj) {
2070 TBufferFile buf(TBuffer::kRead, data->fDataLength, (void *)data->fData);
2071 buf.SetReadMode();
2073 if (!obj) return kTRUE;
2074 gPad->Clear();
2075 if (obj->InheritsFrom("TKey")) {
2076 TObject *object = (TObject *)gROOT->ProcessLine(TString::Format("((TKey *)0x%zx)->ReadObj();", (size_t)obj));
2077 if (!object) return kTRUE;
2078 if (object->InheritsFrom("TGraph"))
2079 object->Draw("ALP");
2080 else if (object->InheritsFrom("TImage"))
2081 object->Draw("x");
2082 else if (object->IsA()->GetMethodAllAny("Draw"))
2083 object->Draw();
2084 }
2085 else if (obj->InheritsFrom("TGraph"))
2086 obj->Draw("ALP");
2087 else if (obj->IsA()->GetMethodAllAny("Draw"))
2088 obj->Draw();
2089 gPad->Modified();
2090 gPad->Update();
2091 return kTRUE;
2092 }
2093 else if (data->fDataType == uriObj) {
2094 TString sfname((char *)data->fData);
2095 if (sfname.Length() > 7) {
2096 sfname.ReplaceAll("\r\n", "");
2097 TUrl uri(sfname.Data());
2098 if (sfname.EndsWith(".bmp") ||
2099 sfname.EndsWith(".gif") ||
2100 sfname.EndsWith(".jpg") ||
2101 sfname.EndsWith(".png") ||
2102 sfname.EndsWith(".ps") ||
2103 sfname.EndsWith(".eps") ||
2104 sfname.EndsWith(".pdf") ||
2105 sfname.EndsWith(".tiff") ||
2106 sfname.EndsWith(".xpm")) {
2107 TImage *img = TImage::Open(uri.GetFile());
2108 if (img) {
2109 img->Draw("x");
2110 img->SetEditable(kTRUE);
2111 }
2112 }
2113 gPad->Modified();
2114 gPad->Update();
2115 }
2116 }
2117 return kFALSE;
2118}
2119
2120////////////////////////////////////////////////////////////////////////////////
2121/// Handle dragging position events.
2122
2124 Int_t /*xroot*/, Int_t /*yroot*/)
2125{
2126 TPad *pad = fCanvas->Pick(x, y, 0);
2127 if (pad) {
2128 pad->cd();
2129 gROOT->SetSelectedPad(pad);
2130 // make sure the pad is highlighted (on Windows)
2131 pad->Update();
2132 }
2133 return action;
2134}
2135
2136////////////////////////////////////////////////////////////////////////////////
2137/// Handle drag enter events.
2138
2140{
2141 static Atom_t rootObj = gVirtualX->InternAtom("application/root", kFALSE);
2142 static Atom_t uriObj = gVirtualX->InternAtom("text/uri-list", kFALSE);
2143 Atom_t ret = kNone;
2144 for (int i = 0; typelist[i] != kNone; ++i) {
2145 if (typelist[i] == rootObj)
2146 ret = rootObj;
2147 if (typelist[i] == uriObj)
2148 ret = uriObj;
2149 }
2150 return ret;
2151}
2152
2153////////////////////////////////////////////////////////////////////////////////
2154/// Handle drag leave events.
2155
2157{
2158 return kTRUE;
2159}
2160
2161////////////////////////////////////////////////////////////////////////////////
2162/// Slot handling tab switching in the browser, to properly set the canvas
2163/// and the model to the editor.
2164
2166{
2167 if (fEmbedded) {
2168 TGTab *sender = (TGTab *)gTQSender;
2169 if (sender) {
2170 TGCompositeFrame *cont = sender->GetTabContainer(id);
2171 if (cont == fParent) {
2172 if (!fEditor)
2174 if (fEditor && ((TGedEditor *)fEditor)->IsMapped()) {
2175 ((TGedEditor *)fEditor)->SetCanvas(fCanvas);
2176 ((TGedEditor *)fEditor)->SetModel(fCanvas, fCanvas, kButton1Down);
2177 }
2178 }
2179 }
2180 }
2181}
2182
2183////////////////////////////////////////////////////////////////////////////////
2184/// Update the "View With" submenu based on the currently selected pad content.
2185
2187{
2188 TVirtualPad *pad = fCanvas ? fCanvas->GetSelectedPad() : nullptr;
2189 if (!pad)
2190 pad = fCanvas;
2191
2192 if (PadHasGeometryContent(pad))
2194 else
2196}
2197
2198////////////////////////////////////////////////////////////////////////////////
2199/// Save a canvas container as a C++ statement(s) on output stream out.
2200
2201void TRootContainer::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
2202{
2203 out << "\n // canvas container\n";
2204 out << " Int_t canvasID = gVirtualX->InitWindow((ULongptr_t)" << GetParent()->GetParent()->GetName()
2205 << "->GetId());\n";
2206 out << " Window_t winC = gVirtualX->GetWindowID(canvasID);\n";
2207 out << " TGCompositeFrame *" << GetName() << " = new TGCompositeFrame(gClient, winC, " << GetParent()->GetName()
2208 << ");\n";
2209}
EEventType
Definition Buttons.h:15
@ kMouseMotion
Definition Buttons.h:23
@ kWheelUp
Definition Buttons.h:18
@ 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
@ kButton1Shift
Definition Buttons.h:18
@ kButton1Motion
Definition Buttons.h:20
@ kButton1Up
Definition Buttons.h:19
@ kWheelDown
Definition Buttons.h:18
@ 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
Handle_t Atom_t
WM token.
Definition GuiTypes.h:38
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
ECursor
Definition GuiTypes.h:373
const Mask_t kButtonPressMask
Definition GuiTypes.h:162
@ kNotifyNormal
Definition GuiTypes.h:220
const Mask_t kExposureMask
Definition GuiTypes.h:166
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
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
@ kFixedWidth
Definition GuiTypes.h:388
@ kHorizontalFrame
Definition GuiTypes.h:383
@ kFixedSize
Definition GuiTypes.h:391
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
@ 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
R__EXTERN const char gHelpObjects[]
Definition HelpText.h:26
R__EXTERN const char gHelpPullDownMenus[]
Definition HelpText.h:24
R__EXTERN const char gHelpAbout[]
Definition HelpText.h:17
R__EXTERN const char gHelpGraphicsEditor[]
Definition HelpText.h:23
R__EXTERN const char gHelpCanvas[]
Definition HelpText.h:25
R__EXTERN const char gHelpBrowser[]
Definition HelpText.h:18
R__EXTERN const char gHelpPostscript[]
Definition HelpText.h:21
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
cudaEvent_t event
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:90
unsigned long ULongptr_t
Unsigned integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:91
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
Definition RtypesCore.h:132
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
R__EXTERN TApplication * gApplication
R__EXTERN TEnv * gEnv
Definition TEnv.h:126
constexpr Int_t kFatal
Definition TError.h:50
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
Int_t gErrorIgnoreLevel
errors with level below this value will be ignored. Default is kUnset.
Definition TError.cxx:33
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
#define gClient
Definition TGClient.h:157
@ kFDOpen
@ kFDSave
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
winID h TVirtualViewer3D TVirtualGLPainter p
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 void SetIconPixmap
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t cursor
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 win
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetWMPosition
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 width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
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:142
R__EXTERN void * gTQSender
Definition TQObject.h:46
#define gROOT
Definition TROOT.h:417
@ kFilePrint
@ kHelpOnCanvas
@ kFileSaveAs
@ kFileQuit
@ kHelpOnGraphicsEd
@ kFileNewCanvas
@ kHelpOnObjects
@ kHelpOnBrowser
@ kHelpOnMenus
@ kHelpOnPS
@ kHelpAbout
@ kFileOpen
static ToolBarData_t gToolBarData[]
static const char * gOpenTypes[]
ERootCanvasCommands
@ kOptionInterrupt
@ kToolLatex
@ kFitPanel
@ kToolsBuilder
@ kToolPLabel
@ kEditStyle
@ kOptionCanEdit
@ kOptionResizeOpaque
@ kEditClearCanvas
@ kToolPad
@ kFilePrint
@ kViewOpenGL
@ kEditRedo
@ kHelpOnCanvas
@ kToolDiamond
@ kToolCurlyLine
@ kViewFonts
@ kToolLine
@ kFileSaveAsPDF
@ kViewIconify
@ kFileCloseCanvas
@ kViewX3D
@ kFileSaveAs
@ kToolEllipse
@ kToolPsText
@ kToolModify
@ kFileSaveAsGIF
@ kFileQuit
@ kToolArrow
@ kToolArc
@ kToolsRecorder
@ kToolsBrowser
@ kOptionResizeCanvas
@ kToolPave
@ kHelpOnGraphicsEd
@ kFileNewCanvas
@ kOptionFitParams
@ kOptionRefresh
@ kHelpOnObjects
@ kEditCopy
@ kFileSaveAsEPS
@ kInspectRoot
@ kViewToolTips
@ kOptionMoveOpaque
@ kViewEditor
@ kHelpOnBrowser
@ kClassesTree
@ kToolPText
@ kViewToolbar
@ kOptionAutoExec
@ kHelpOnMenus
@ kEditUndo
@ kHelpOnPS
@ kFileSaveAsPNG
@ kViewMarkers
@ kEditClearPad
@ kToolCurlyArc
@ kEditCut
@ kFileSaveAsC
@ kViewColors
@ kToolGraph
@ kViewEventStatus
@ kFileSaveAsBMP
@ kFileSaveAsPS
@ kOptionStatistics
@ kFileSaveAsJPG
@ kOptionHistTitle
@ kFileSaveAsSVG
@ kFileSaveAsHTML
@ kFileSaveAsTEX
@ kHelpAbout
@ kToolCutG
@ kToolMarker
@ kFileSaveAsRoot
@ kFileOpen
@ kEditPaste
@ kOptionAutoResize
static const char * gSaveAsTypes[]
static ToolBarData_t gToolBarData1[]
static ToolBarData_t gToolBarData[]
static const char * gOpenTypes[]
char * StrDup(const char *str)
Duplicate the string str.
Definition TString.cxx:2639
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
R__EXTERN TSystem * gSystem
Definition TSystem.h:582
#define gGLManager
Definition TVirtualGL.h:158
#define gPad
R__EXTERN Int_t(* gThreadXAR)(const char *xact, Int_t nb, void **ar, Int_t *iret)
#define gVirtualX
Definition TVirtualX.h:379
Int_t GET_MSG(Long_t val)
@ kCM_MENU
@ kC_COMMAND
@ kCM_BUTTON
Int_t GET_SUBMSG(Long_t val)
Bool_t ReturnFromRun() const
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
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
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area).
Definition TCanvasImp.h:31
TCanvas * Canvas() const
Definition TCanvasImp.h:59
TCanvas * fCanvas
Definition TCanvasImp.h:35
friend class TCanvas
Definition TCanvasImp.h:32
The Canvas class.
Definition TCanvas.h:23
UInt_t GetWindowHeight() const
Definition TCanvas.h:167
virtual void ToggleAutoExec()
Toggle pad auto execution of list of TExecs.
Definition TCanvas.cxx:2451
virtual void ToggleToolTips()
Toggle tooltip display.
Definition TCanvas.cxx:2493
void Clear(Option_t *option="") override
Remove all primitives from the canvas.
Definition TCanvas.cxx:751
virtual void ToggleEventStatus()
Toggle event statusbar.
Definition TCanvas.cxx:2460
void SetSupportGL(Bool_t support)
Definition TCanvas.h:236
TPad * Pick(Int_t px, Int_t py, TObjLink *&pickobj) override
Search for an object at pixel position px,py.
Definition TCanvas.h:190
virtual void Resize(Option_t *option="")
Recompute canvas parameters following a X11 Resize.
Definition TCanvas.cxx:1689
void SaveSource(const char *filename="", Option_t *option="")
Save primitives in this canvas as a C++ macro file.
Definition TCanvas.cxx:1835
void SetCanvasImp(TCanvasImp *i)
Set canvas implementation If web-based implementation provided, some internal fields also initialized...
Definition TCanvas.cxx:2184
virtual void HandleInput(EEventType button, Int_t x, Int_t y)
Handle Input Events.
Definition TCanvas.cxx:1242
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
Definition TCanvas.cxx:733
Bool_t GetShowEditor() const
Definition TCanvas.h:155
Bool_t GetAutoExec() const
Definition TCanvas.h:157
virtual void ToggleEditor()
Toggle editor.
Definition TCanvas.cxx:2482
TVirtualPad * GetSelectedPad() const override
Definition TCanvas.h:151
Bool_t GetShowToolTips() const
Definition TCanvas.h:156
void SetName(const char *name="") override
Set canvas name.
Definition TCanvas.cxx:2046
void Paint(Option_t *option="") override
Paint canvas.
Definition TCanvas.cxx:1564
void Update() override
Update canvas pad buffers.
Definition TCanvas.cxx:2520
Bool_t OpaqueMoving() const override
Definition TCanvas.h:187
void Flush()
Flush canvas buffers.
Definition TCanvas.cxx:1155
void MoveOpaque(Int_t set=1)
Set option to move objects/pads in a canvas.
Definition TCanvas.cxx:1556
Bool_t UseGL() const
Definition TCanvas.h:235
void ResizeOpaque(Int_t set=1)
Set option to resize objects/pads in a canvas.
Definition TCanvas.cxx:1782
virtual void ToggleToolBar()
Toggle toolbar.
Definition TCanvas.cxx:2471
Bool_t OpaqueResizing() const override
Definition TCanvas.h:188
Draw inheritance tree and their relations for a list of classes.
Definition TClassTree.h:22
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
TMethod * GetMethodAllAny(const char *method)
Return pointer to method without looking at parameters.
Definition TClass.cxx:4505
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2999
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Draw the ROOT Color Wheel.
Definition TColorWheel.h:23
void Draw(Option_t *option="") override
Paint the color wheel.
Drag and drop data container.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:511
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
Definition TEnv.cxx:752
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition TFile.cxx:3802
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
virtual void SetVsbPosition(Int_t newPos)
Set position of vertical scrollbar.
virtual Int_t GetVsbPosition() const
Get position of vertical scrollbar.
TGViewPort * GetViewPort() const
Definition TGCanvas.h:217
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:234
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
UInt_t GetDisplayHeight() const
Get display height.
Definition TGClient.cxx:275
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:318
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1110
Int_t MustCleanup() const override
Definition TGFrame.h:362
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1157
TGCompositeFrame(const TGCompositeFrame &)=delete
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1250
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1197
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1065
void SetEditable(Bool_t on=kTRUE) override
Switch ON/OFF edit mode.
Definition TGFrame.cxx:941
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1015
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1036
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1183
A frame with handles that allow it to be undocked (i.e.
void DockContainer(Int_t del=kTRUE)
Dock container back to TGDockableFrame.
void AddFrame(TGFrame *f, TGLayoutHints *hints) override
Add frame to dockable frame container. Frame and hints are NOT adopted.
void SetWindowName(const char *name) override
Set window name so it appear as title of the undock window.
void EnableHide(Bool_t onoff)
Enable hiding.
Bool_t IsUndocked() const
System file browser, used as TRootBrowser plug-in.
void Selected(char *)
A ROOT File has been selected in TGFileBrowser.
This class creates a file selection dialog.
char * fFilename
selected file name
Int_t fFileTypeIdx
selected file type, index in fFileTypes
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
Bool_t fOverwrite
if true overwrite the file with existing name on save
void SetIniDir(const char *inidir)
Set directory name.
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:332
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition TGFrame.cxx:622
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition TGFrame.cxx:436
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:598
void Move(Int_t x, Int_t y) override
Move frame.
Definition TGFrame.cxx:586
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:269
virtual UInt_t GetOptions() const
Definition TGFrame.h:199
UInt_t GetHeight() const
Definition TGFrame.h:227
virtual void SetWidth(UInt_t w)
Definition TGFrame.h:248
void SetDNDTarget(Bool_t onoff)
Definition TGFrame.h:272
UInt_t GetWidth() const
Definition TGFrame.h:226
virtual void SetHeight(UInt_t h)
Definition TGFrame.h:249
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:399
Atom_t * fDNDTypeList
handles DND types
Definition TGFrame.h:415
virtual void SendCloseMessage()
Send close message to self.
Definition TGFrame.cxx:1739
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1853
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1796
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1783
const char * GetWindowName() const
Definition TGFrame.h:478
The TGMenu.h header contains all different menu classes.
Definition TGMenu.h:282
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=nullptr)
Add popup menu to menu bar.
Definition TGMenu.cxx:414
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Handle_t GetId() const
Definition TGObject.h:41
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
This class creates a popup menu object.
Definition TGMenu.h:110
virtual void AddLabel(TGHotString *s, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu label to the menu.
Definition TGMenu.cxx:1092
virtual Bool_t IsEntryChecked(Int_t id)
Return true if menu item is checked.
Definition TGMenu.cxx:1842
virtual void AddPopup(TGHotString *s, TGPopupMenu *popup, TGMenuEntry *before=nullptr, const TGPicture *p=nullptr)
Add a (cascading) popup menu to a popup menu.
Definition TGMenu.cxx:1149
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition TGMenu.cxx:1779
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition TGMenu.cxx:1721
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition TGMenu.cxx:1702
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition TGMenu.cxx:1804
virtual void Associate(const TGWindow *w)
Definition TGMenu.h:206
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1057
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=nullptr, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu entry.
Definition TGMenu.cxx:987
Provides a StatusBar widget.
Definition TGStatusBar.h:21
virtual void SetText(TGString *text, Int_t partidx=0)
Set text in partition partidx in status bar.
virtual void SetParts(Int_t npart)
Divide the status bar in npart equal sized parts.
A tab widget contains a set of composite frames each with a little tab with a name (like a set of fol...
Definition TGTab.h:46
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
Definition TGTab.cxx:660
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
Definition TGTab.cxx:555
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
Definition TGTab.cxx:611
A toolbar is a composite frame that contains TGPictureButtons.
Definition TGToolBar.h:33
virtual TGButton * AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing=0)
Add button to toolbar.
Definition TGToolBar.cxx:91
void Cleanup() override
Cleanup and delete all objects contained in this composite frame.
A tooltip can be a one or multiple lines help text that is displayed in a window when the mouse curso...
Definition TGToolTip.h:24
void Hide()
Hide tool tip window.
void SetPosition(Int_t x, Int_t y)
Set popup position within specified frame (as specified in the ctor).
void SetText(const char *new_text)
Set new tool tip text.
void Reset()
Reset tool tip popup delay timer.
A vertical 3D line is a line that can be used to separate groups of widgets.
Definition TG3DLine.h:33
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:150
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
@ kEditEnable
allow edit of this window
Definition TGWindow.h:56
@ kEditDisable
disable edit of this window
Definition TGWindow.h:57
const TGWindow * GetParent() const
Definition TGWindow.h:83
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition TGWindow.cxx:293
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
static TGuiBuilder * Instance()
return an instance of TGuiBuilder object
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
static TImage * Create()
Create an image.
Definition TImage.cxx:34
A doubly linked list.
Definition TList.h:38
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
Definition TList.cxx:708
static void DisplayMarkerTypes()
Display the table of markers with their numbers.
Definition TMarker.cxx:100
Mother of all ROOT objects.
Definition TObject.h:42
virtual void Inspect() const
Dump contents of this object in a graphics canvas.
Definition TObject.cxx:569
static TClass * Class()
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:548
virtual TClass * IsA() const
Definition TObject.h:248
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:292
The most important graphics class in the ROOT system.
Definition TPad.h:32
Double_t GetAspectRatio() const override
Definition TPad.h:235
void Update() override
Update pad.
Definition TPad.cxx:2812
void Modified(Bool_t flag=true) override
Mark pad modified Will be repainted when TCanvas::Update() will be called next time.
Definition TPad.cxx:7340
Bool_t HasFixedAspectRatio() const override
Definition TPad.h:281
virtual void SetGLDevice(Int_t dev)
Definition TPad.h:382
void SaveAs(const char *filename="", Option_t *option="") const override
Save the pad content in a file.
Definition TPad.cxx:5794
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition TPad.cxx:757
void Print(const char *filename="") const override
This method is equivalent to SaveAs("filename"). See TPad::SaveAs for details.
Definition TPad.cxx:4787
Longptr_t ExecPlugin(int nargs)
Int_t LoadPlugin()
Load the plugin library for this handler.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:865
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
This class creates a ROOT object browser, constituted by three main tabs.
TGTab * GetTabLeft() const
void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1) override
Start embedding external frame in the tab "pos" and tab element "subpos".
void StopEmbedding(const char *name=nullptr) override
TBrowserImp * GetActBrowser() const
TGFrame * GetActFrame() const
TGTab * GetTabRight() const
This class creates a main window with menubar, scrollbars and a drawing area.
Definition TRootCanvas.h:34
TGToolBar * fToolBar
icon button toolbar
Definition TRootCanvas.h:62
UInt_t GetCwidth() const
Return width of canvas container.
void AdjustSize()
Keep the same canvas size while docking/undocking toolbar.
Bool_t fAutoFit
when true canvas container keeps same size as canvas
Definition TRootCanvas.h:79
TGPopupMenu * fEditMenu
edit menu
Definition TRootCanvas.h:44
friend class TRootContainer
Definition TRootCanvas.h:36
void CreateEditor()
Create embedded editor.
Bool_t HasEditor() const override
Returns kTRUE if the editor is shown.
Bool_t HandleContainerKey(Event_t *ev)
Handle keyboard events in the canvas container.
UInt_t GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Gets the size and position of the window containing the canvas.
void Close() override
Called via TCanvasImp interface by TCanvas.
Bool_t HandleDNDDrop(TDNDData *data) override
Handle drop events.
void Iconify() override
void SetStatusText(const char *txt=nullptr, Int_t partidx=0) override
Set text in status bar.
TGLayoutHints * fMainFrameLayout
layout for main frame
Definition TRootCanvas.h:64
Bool_t HandleContainerButton(Event_t *ev)
Handle mouse button events in the canvas container.
Bool_t HandleContainerCrossing(Event_t *ev)
Handle enter/leave events. Only leave is activated at the moment.
UInt_t GetCheight() const
Return height of canvas container.
TGDockableFrame * fToolDock
dockable frame holding the toolbar
Definition TRootCanvas.h:71
void RaiseWindow() override
Put canvas window on top of the window stack.
void ShowEditor(Bool_t show=kTRUE) override
Show or hide side frame.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Handle menu and other command generated by the user.
void ReallyDelete() override
Really delete the canvas and this GUI.
void ShowMenuBar(Bool_t show=kTRUE) override
Show or hide menubar.
Atom_t HandleDNDEnter(Atom_t *typelist) override
Handle drag enter events.
void ShowStatusBar(Bool_t show=kTRUE) override
Show or hide statusbar.
TGHorizontal3DLine * fHorizontal1
toolbar separator
Definition TRootCanvas.h:67
TGLayoutHints * fEditorLayout
layout for editor frame
Definition TRootCanvas.h:59
TGPopupMenu * fToolsMenu
tools menu
Definition TRootCanvas.h:49
TGLayoutHints * fMenuBarItemLayout
layout hints for menu in menubar
Definition TRootCanvas.h:52
Int_t fCanvasID
index in fWindows array of TGX11
Definition TRootCanvas.h:78
const TGPicture * fIconPic
icon picture
Definition TRootCanvas.h:73
void SetCanvasSize(UInt_t w, UInt_t h) override
Set size of canvas container.
void SetWindowSize(UInt_t w, UInt_t h) override
Set size of canvas (units in pixels).
void PrintCanvas()
Print the canvas.
TRootCanvas(const TRootCanvas &)=delete
void ShowToolBar(Bool_t show=kTRUE) override
Show or hide toolbar.
Bool_t HasToolBar() const override
Returns kTRUE if the tool bar is shown.
void Activated(Int_t id)
Slot handling tab switching in the browser, to properly set the canvas and the model to the editor.
TGHorizontal3DLine * fToolBarSep
toolbar separator
Definition TRootCanvas.h:63
TGPopupMenu * fViewWithMenu
view with... cascade submenu
Definition TRootCanvas.h:47
TGPopupMenu * fEditClearMenu
clear cascade submenu
Definition TRootCanvas.h:45
void ShowToolTips(Bool_t show=kTRUE) override
Enable or disable tooltip info.
Bool_t HasToolTips() const override
Returns kTRUE if the tooltips are enabled.
TRootContainer * fCanvasContainer
container in canvas widget
Definition TRootCanvas.h:40
Bool_t fEmbedded
true if embedded in any other frame (e.g. in the browser)
Definition TRootCanvas.h:77
Bool_t HandleContainerDoubleClick(Event_t *ev)
Handle mouse button double click events in the canvas container.
TGLayoutHints * fHorizontal1Layout
layout hints for separator
Definition TRootCanvas.h:70
TGVertical3DLine * fVertical2
toolbar vertical separator
Definition TRootCanvas.h:66
TGLayoutHints * fMenuBarLayout
menubar layout hints
Definition TRootCanvas.h:51
void FitCanvas()
Fit canvas container to current window size.
Bool_t HandleContainerMotion(Event_t *ev)
Handle mouse motion event in the canvas container.
TGCanvas * fCanvasWindow
canvas widget
Definition TRootCanvas.h:39
TGLayoutHints * fMenuBarHelpLayout
layout hint for help menu in menubar
Definition TRootCanvas.h:53
TGPopupMenu * fViewMenu
view menu
Definition TRootCanvas.h:46
TGStatusBar * fStatusBar
statusbar widget
Definition TRootCanvas.h:55
TGPopupMenu * fOptionMenu
option menu
Definition TRootCanvas.h:48
TGLayoutHints * fDockLayout
layout hints for dockable frame widget
Definition TRootCanvas.h:72
TGPopupMenu * fHelpMenu
help menu
Definition TRootCanvas.h:50
void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Display a tooltip with infos about the primitive below the cursor.
void CreateCanvas(const char *name)
Create the actual canvas.
TGLayoutHints * fVertical1Layout
layout hints for separator
Definition TRootCanvas.h:68
Bool_t HasStatusBar() const override
Returns kTRUE if the status bar is shown.
void SetCursor(ECursor cursor) override
Set cursor for the canvas.
Bool_t HandleContainerConfigure(Event_t *ev)
Handle configure (i.e. resize) event.
Bool_t HasMenuBar() const override
Returns kTRUE if the menu bar is shown.
TGCompositeFrame * fMainFrame
main frame containing canvas and side frame
Definition TRootCanvas.h:60
Int_t InitWindow() override
Called by TCanvas ctor to get window indetifier.
void UpdateViewWithMenu()
Update the "View With" submenu based on the currently selected pad content.
TGLayoutHints * fVertical2Layout
layout hints for separator
Definition TRootCanvas.h:69
TVirtualPadEditor * fEditor
pointer to currently loaded pad editor
Definition TRootCanvas.h:76
TGMenuBar * fMenuBar
menubar
Definition TRootCanvas.h:41
void SetWindowPosition(Int_t x, Int_t y) override
Set canvas position (units in pixels).
Bool_t HandleContainerExpose(Event_t *ev)
Handle expose events.
TGLayoutHints * fCanvasLayout
layout for canvas widget
Definition TRootCanvas.h:54
TGLayoutHints * fToolBarLayout
layout for toolbar widget
Definition TRootCanvas.h:61
Bool_t HandleDNDLeave() override
Handle drag leave events.
TGCompositeFrame * fEditorFrame
side frame for current pad editor
Definition TRootCanvas.h:58
~TRootCanvas() override
Delete ROOT basic canvas.
TGToolTip * fToolTip
tooltip for object info
Definition TRootCanvas.h:74
TGPopupMenu * fFileMenu
file menu
Definition TRootCanvas.h:42
TGPopupMenu * fFileSaveMenu
save cascade submenu
Definition TRootCanvas.h:43
Atom_t HandleDNDPosition(Int_t x, Int_t y, Atom_t action, Int_t xroot, Int_t yroot) override
Handle dragging position events.
void SetWindowTitle(const char *newTitle) override
Change title on window.
void CloseWindow() override
In case window is closed via WM we get here.
Int_t fButton
currently pressed button
Definition TRootCanvas.h:80
TGLayoutHints * fStatusBarLayout
layout hints for statusbar
Definition TRootCanvas.h:56
TGVertical3DLine * fVertical1
toolbar vertical separator
Definition TRootCanvas.h:65
Bool_t HandleCrossing(Event_t *ev) override
void SetEditable(Bool_t) override
Switch ON/OFF edit mode.
Bool_t HandleDoubleClick(Event_t *ev) override
TRootContainer(TRootCanvas *c, Window_t id, const TGWindow *parent)
Create a canvas container.
Bool_t HandleMotion(Event_t *ev) override
Bool_t HandleKey(Event_t *ev) override
Bool_t HandleConfigureNotify(Event_t *ev) override
This event is generated when the frame is resized.
Bool_t HandleExpose(Event_t *ev) override
void SavePrimitive(std::ostream &out, Option_t *="") override
Save a canvas container as a C++ statement(s) on output stream out.
TRootCanvas * fCanvas
Bool_t HandleButton(Event_t *ev) override
Directly handle scroll mouse buttons (4 and 5), only pass buttons 1, 2 and 3 on to the TCanvas.
A TRootHelpDialog is used to display help text (or any text in a dialog window).
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
void Popup()
Show help dialog.
Basic string class.
Definition TString.h:137
Ssiz_t Length() const
Definition TString.h:426
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2325
const char * Data() const
Definition TString.h:385
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:714
@ kLeading
Definition TString.h:283
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:633
Bool_t IsNull() const
Definition TString.h:423
TString & Remove(Ssiz_t pos)
Definition TString.h:695
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:2460
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:642
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:661
Int_t GetOptStat() const
Definition TStyle.h:247
void SetOptTitle(Int_t tit=1)
Definition TStyle.h:338
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition TStyle.cxx:1641
Int_t GetOptTitle() const
Definition TStyle.h:248
Int_t GetOptFit() const
Definition TStyle.h:246
void SetOptFit(Int_t fit=1)
The type of information about fit parameters printed in the histogram statistics box can be selected ...
Definition TStyle.cxx:1594
virtual FILE * TempFileName(TString &base, const char *dir=nullptr, const char *suffix=nullptr)
Create a secure temporary file by appending a unique 6 letter string to base.
Definition TSystem.cxx:1521
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition TSystem.cxx:656
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition TSystem.cxx:1879
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition TSystem.cxx:877
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition TSystem.cxx:440
virtual const char * WorkingDirectory()
Return working directory.
Definition TSystem.cxx:886
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:419
virtual int Unlink(const char *name)
Unlink, i.e.
Definition TSystem.cxx:1403
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
Definition TSystem.cxx:1504
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
Definition TTimer.cxx:261
This class represents a WWW compatible URL.
Definition TUrl.h:33
const char * GetFile() const
Definition TUrl.h:69
Abstract base class used by ROOT graphics editor.
virtual TCanvas * GetCanvas() const =0
static TVirtualPadEditor * LoadEditor()
Static function returning a pointer to a new pad editor.
virtual void Hide()
static TVirtualPadEditor * GetPadEditor(Bool_t load=kTRUE)
Returns the pad editor dialog. Static method.
virtual void SetGlobal(Bool_t)
virtual void Show()
static void Terminate()
Close the global pad editor. Static method.
small helper class to store/restore gPad context in TPad methods
Definition TVirtualPad.h:63
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:53
virtual TList * GetListOfPrimitives() const =0
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
virtual TVirtualViewer3D * GetViewer3D(Option_t *type="")=0
static TClass * Class()
virtual TCanvas * GetCanvas() const =0
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
int main()
Definition main.cpp:18
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Definition TMath.h:706
Event structure.
Definition GuiTypes.h:175
const char * fPixmap
Definition TGToolBar.h:24
TMarker m
Definition textangle.C:8