Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TRootBrowser.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Bertrand Bellenot 26/09/2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, 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 TRootBrowser
14 \ingroup guiwidgets
15
16This class creates a ROOT object browser, constituted by three main tabs.
17
18All tabs can 'swallow' frames, thanks to the new method:
19 ExecPlugin(const char *name = 0, const char *fname = 0,
20 const char *cmd = 0, Int_t pos = kRight,
21 Int_t subpos = -1)
22allowing to select plugins (can be a macro or a command)
23to be executed, and where to embed the frame created by
24the plugin (tab and tab element).
25
26### Examples:
27
28#### create a new browser:
29```
30TBrowser b;
31```
32
33#### create a new TCanvas in a new top right tab element:
34```
35b.ExecPlugin("Canvas", 0, "new TCanvas()");
36```
37#### create a new top right tab element embedding the TGMainFrame created by the macro 'myMacro.C':
38```
39b.ExecPlugin("MyPlugin", "myMacro.C");
40```
41
42#### create a new bottom tab element embedding the TGMainFrame created by the macro 'myMacro.C':
43```
44b.ExecPlugin("MyPlugin", "myMacro.C", 0, TRootBrowser::kBottom);
45```
46
47this browser implementation can be selected via the env
48`Browser.Name` in `.rootrc`, (TRootBrowser or TRootBrowserLite)
49the default being TRootBrowserLite
50a list of options (plugins) for the new TRootBrowser is also
51specified via the env 'Browser.Options' in .rootrc, the default
52being: FECI
53
54Here is the list of available options:
55 - F: File browser
56 - E: Text Editor
57 - H: HTML browser C: Canvas I: I/O redirection
58 - G: GL viewer
59
60*/
61
62#include <ROOT/RNTuple.hxx>
64
65#include "TROOT.h"
66#include "TSystem.h"
67#include "TApplication.h"
68#include "TBrowser.h"
69#include "TClass.h"
70#include "TGClient.h"
71#include "TGFrame.h"
72#include "TGTab.h"
73#include "TGMenu.h"
74#include "TGLayout.h"
75#include "TGSplitter.h"
76#include "TGStatusBar.h"
77#include "Varargs.h"
78#include "TInterpreter.h"
79#include "TGFileDialog.h"
80#include "TObjString.h"
81#include "TVirtualPad.h"
82#include "TEnv.h"
83#include <KeySymbols.h>
84
85#include "RConfigure.h"
86
87#include "TRootBrowser.h"
88#include "TGFileBrowser.h"
89#include "TGInputDialog.h"
90#include "TRootHelpDialog.h"
91#include "TVirtualPadEditor.h"
92#include "HelpText.h"
93#include "Getline.h"
94#include "TVirtualX.h"
95#include "strlcpy.h"
96
97#include <cstdio>
98
99#ifdef WIN32
100#include <TWin32SplashThread.h>
101#endif
102
103static const char *gOpenFileTypes[] = {
104 "ROOT files", "*.root",
105 "All files", "*",
106 0, 0
107};
108
109static const char *gPluginFileTypes[] = {
110 "ROOT files", "*.C",
111 "All files", "*",
112 0, 0
113};
114
115
116
117////////////////////////////////////////////////////////////////////////////////
118/// Create browser with a specified width and height.
119
122 TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
123{
125 fActBrowser = 0;
126 fIconPic = 0;
129 if (initshow) {
130 InitPlugins(opt);
131 MapWindow();
132 }
133 TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
134 "TRootBrowser", this,
135 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
136 gVirtualX->SetInputFocus(GetId());
137}
138
139////////////////////////////////////////////////////////////////////////////////
140/// Create browser with a specified width and height and at position x, y.
141
145 TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
146{
148 fActBrowser = 0;
149 fIconPic = 0;
152 SetWMPosition(x, y);
153 if (initshow) {
154 InitPlugins(opt);
155 MapWindow();
156 }
157 TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
158 "TRootBrowser", this,
159 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
160 gVirtualX->SetInputFocus(GetId());
161}
162
163
164////////////////////////////////////////////////////////////////////////////////
165
167{
168 static bool hasRNTupleBrowsing __attribute__((unused)) = []() {
170 return true;
171 }();
172
173 // Create the actual interface.
174
175 fVf = new TGVerticalFrame(this, 100, 100);
176
178 fLH1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
179 fLH2 = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 1);
185
186 // Menubar Frame
187 fTopMenuFrame = new TGHorizontalFrame(fVf, 100, 20);
188
191 fMenuFile = new TGPopupMenu(gClient->GetDefaultRoot());
192 fMenuFile->AddEntry("&Browse...\tCtrl+B", kBrowse);
193 fMenuFile->AddEntry("&Open...\tCtrl+O", kOpenFile);
195
197 fMenuHelp->AddEntry("&About ROOT...", kHelpAbout);
199 fMenuHelp->AddEntry("Help On Browser...", kHelpOnBrowser);
200 fMenuHelp->AddEntry("Help On Canvas...", kHelpOnCanvas);
201 fMenuHelp->AddEntry("Help On Menus...", kHelpOnMenus);
202 fMenuHelp->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
203 fMenuHelp->AddEntry("Help On Objects...", kHelpOnObjects);
204 fMenuHelp->AddEntry("Help On PostScript...", kHelpOnPS);
205 fMenuHelp->AddEntry("Help On Remote Session...", kHelpOnRemote);
206 fMenuFile->AddPopup("Browser Help...", fMenuHelp);
207
209 fMenuFile->AddEntry("&Clone\tCtrl+N", kClone);
211 fMenuFile->AddEntry("New &Editor\tCtrl+E", kNewEditor);
212 fMenuFile->AddEntry("New &Canvas\tCtrl+C", kNewCanvas);
216 fMenuExecPlugin->AddEntry("&Command...", kExecPluginCmd);
217 fMenuFile->AddPopup("Execute &Plugin...", fMenuExecPlugin);
219 fMenuFile->AddEntry("Close &Tab\tCtrl+T", kCloseTab);
220 fMenuFile->AddEntry("Close &Window\tCtrl+W", kCloseWindow);
222 fMenuFile->AddEntry("&Quit Root\tCtrl+Q", kQuitRoot);
223 fMenuBar->AddPopup("&Browser", fMenuFile, fLH1);
224 fMenuFile->Connect("Activated(Int_t)", "TRootBrowser", this,
225 "HandleMenu(Int_t)");
228
231
234
235 // Toolbar Frame
239
240 fHf = new TGHorizontalFrame(fVf, 100, 100);
241 // Tabs & co...
242#if defined(R__HAS_COCOA)
243 fV1 = new TGVerticalFrame(fHf, 252, 100, kFixedWidth);
244#else
245 fV1 = new TGVerticalFrame(fHf, 250, 100, kFixedWidth);
246#endif
247 fV2 = new TGVerticalFrame(fHf, 600, 100);
248 fH1 = new TGHorizontalFrame(fV2, 100, 100);
249 fH2 = new TGHorizontalFrame(fV2, 100, 100, kFixedHeight);
250
251 // Left tab
252 fTabLeft = new TGTab(fV1,100,100);
253 //fTabLeft->AddTab("Tab 1");
256
257 // Vertical splitter
258 fVSplitter = new TGVSplitter(fHf, 4, 4);
260 fHf->AddFrame(fV1, fLH7);
262
263 // Right tab
264 fTabRight = new TGTab(fH1, 500, 100);
265 //fTabRight->AddTab("Tab 1");
268 fTabRight->Connect("Selected(Int_t)", "TRootBrowser", this, "DoTab(Int_t)");
269 fTabRight->Connect("CloseTab(Int_t)", "TRootBrowser", this, "CloseTab(Int_t)");
270 fV2->AddFrame(fH1, fLH4);
271
272 // Horizontal splitter
273 fHSplitter = new TGHSplitter(fV2, 4, 4);
275
276 // Bottom tab
277 fTabBottom = new TGTab(fH2, 100, 100);
278 //fTabBottom->AddTab("Tab 1");
280 fV2->AddFrame(fH2, fLH3);
281
283 fHf->AddFrame(fV2, fLH5);
284 fVf->AddFrame(fHf, fLH5);
285 AddFrame(fVf, fLH5);
286
287 // status bar
288 fStatusBar = new TGStatusBar(this, 400, 20);
289 int parts[] = { 33, 10, 10, 47 };
292
293 fNbInitPlugins = 0;
294 fEditFrame = 0;
295 fEditTab = 0;
296 fEditPos = -1;
297 fEditSubPos= -1;
298 fNbTab[0] = fNbTab[1] = fNbTab[2] = 0;
299 fCrTab[0] = fCrTab[1] = fCrTab[2] = -1;
300
301 // Set a name to the main frame
304 fIconPic = SetIconPixmap("rootdb_s.xpm");
305 SetClassHints("ROOT", "Browser");
306
307 if (!strcmp(gROOT->GetDefCanvasName(), "c1"))
308 gROOT->SetDefCanvasName("Canvas_1");
309
310 SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
314
316}
317
318////////////////////////////////////////////////////////////////////////////////
319/// Clean up all widgets, frames and layouthints that were used
320
322{
323 if (fIconPic) gClient->FreePicture(fIconPic);
324 delete fLH0;
325 delete fLH1;
326 delete fLH2;
327 delete fLH3;
328 delete fLH4;
329 delete fLH5;
330 delete fLH6;
331 delete fLH7;
332 delete fMenuHelp;
333 delete fMenuExecPlugin;
334 delete fMenuFile;
335 delete fMenuBar;
336 delete fMenuFrame;
337 delete fPreMenuFrame;
338 delete fTopMenuFrame;
339 delete fToolbarFrame;
340 delete fVSplitter;
341 delete fHSplitter;
342 delete fTabLeft;
343 delete fTabRight;
344 delete fTabBottom;
345 delete fH1;
346 delete fH2;
347 delete fV1;
348 delete fV2;
349 delete fHf;
350 delete fStatusBar;
351 delete fVf;
352}
353
354////////////////////////////////////////////////////////////////////////////////
355/// Add items to the actual browser. This function has to be called
356/// by the Browse() member function of objects when they are
357/// called by a browser. If check < 0 (default) no check box is drawn,
358/// if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
359
360void TRootBrowser::Add(TObject *obj, const char *name, Int_t check)
361{
362 if (obj->InheritsFrom("TObjectSpy"))
363 return;
364 if (fActBrowser)
365 fActBrowser->Add(obj, name, check);
366}
367
368////////////////////////////////////////////////////////////////////////////////
369/// Browse object. This, in turn, will trigger the calling of
370/// TRootBrowser::Add() which will fill the IconBox and the tree.
371/// Emits signal "BrowseObj(TObject*)".
372
374{
375 if (fActBrowser)
377 Emit("BrowseObj(TObject*)", (Longptr_t)obj);
378}
379
380////////////////////////////////////////////////////////////////////////////////
381/// Clone the browser. A new Browser will be created, with the same
382/// plugins executed in the current one.
383
385{
386 Int_t loop = 1;
388 TBrowser *b = new TBrowser();
389 TIter next(&fPlugins);
390 while ((plugin = (TBrowserPlugin *)next())) {
391 if (loop > fNbInitPlugins)
392 b->ExecPlugin(plugin->GetName(), "", plugin->fCommand.Data(), plugin->fTab,
393 plugin->fSubTab);
394 ++loop;
395 }
396}
397
398////////////////////////////////////////////////////////////////////////////////
399/// Remove tab element id from right tab.
400
402{
403 RemoveTab(kRight, id);
404}
405
406////////////////////////////////////////////////////////////////////////////////
407/// Properly close the mainframes embedded in the different tabs
408
410{
413 Int_t i;
414 TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
415 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
416 Disconnect(fMenuFile, "Activated(Int_t)", this, "HandleMenu(Int_t)");
417 Disconnect(fTabRight, "Selected(Int_t)", this, "DoTab(Int_t)");
418 if (fPlugins.IsEmpty()) return;
419 fActBrowser = 0;
420 for (i=0;i<fTabLeft->GetNumberOfTabs();i++) {
422 if (!container) continue;
423 el = (TGFrameElement *)container->GetList()->First();
424 if (el && el->fFrame) {
425 el->fFrame->SetFrameElement(0);
426 if (el->fFrame->InheritsFrom("TVirtualPadEditor")) {
428 }
429 else if (el->fFrame->InheritsFrom("TGMainFrame")) {
430 el->fFrame->UnmapWindow();
431 ((TGMainFrame *)el->fFrame)->CloseWindow();
433 }
434 else
435 delete el->fFrame;
436 el->fFrame = 0;
437 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
438 (el->fLayout->References() > 0)) {
439 el->fLayout->RemoveReference();
440 if (!el->fLayout->References()) {
441 delete el->fLayout;
442 }
443 }
444 container->GetList()->Remove(el);
445 delete el;
446 }
447 }
448 for (i=0;i<fTabRight->GetNumberOfTabs();i++) {
450 if (!container) continue;
451 el = (TGFrameElement *)container->GetList()->First();
452 if (el && el->fFrame) {
453 el->fFrame->SetFrameElement(0);
454 if (el->fFrame->InheritsFrom("TGMainFrame")) {
455 el->fFrame->UnmapWindow();
456 Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
457 if (sleep)
458 gSystem->Sleep(150);
459 ((TGMainFrame *)el->fFrame)->CloseWindow();
460 if (sleep)
461 gSystem->Sleep(150);
463 }
464 else
465 delete el->fFrame;
466 el->fFrame = 0;
467 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
468 (el->fLayout->References() > 0)) {
469 el->fLayout->RemoveReference();
470 if (!el->fLayout->References()) {
471 delete el->fLayout;
472 }
473 }
474 container->GetList()->Remove(el);
475 delete el;
476 }
477 }
478 for (i=0;i<fTabBottom->GetNumberOfTabs();i++) {
480 if (!container) continue;
481 el = (TGFrameElement *)container->GetList()->First();
482 if (el && el->fFrame) {
483 el->fFrame->SetFrameElement(0);
484 if (el->fFrame->InheritsFrom("TGMainFrame")) {
485 el->fFrame->UnmapWindow();
486 ((TGMainFrame *)el->fFrame)->CloseWindow();
487 gSystem->Sleep(150);
489 }
490 else
491 delete el->fFrame;
492 el->fFrame = 0;
493 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
494 (el->fLayout->References() > 0)) {
495 el->fLayout->RemoveReference();
496 if (!el->fLayout->References()) {
497 delete el->fLayout;
498 }
499 }
500 container->GetList()->Remove(el);
501 delete el;
502 }
503 }
505 Emit("CloseWindow()");
506}
507
508////////////////////////////////////////////////////////////////////////////////
509/// Called when window is closed via the window manager.
510
512{
513 TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
514 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
515 CloseTabs();
516 DeleteWindow();
517}
518
519////////////////////////////////////////////////////////////////////////////////
520/// Handle Tab navigation.
521
523{
525 if ((sender) && (sender == fTabRight)) {
526 SwitchMenus(sender->GetTabContainer(id));
527 }
528}
529
530////////////////////////////////////////////////////////////////////////////////
531/// Display a tooltip with infos about the primitive below the cursor.
532
534{
535 const Int_t kTMAX=256;
536 static char atext[kTMAX];
537 if (selected == 0 || event == kMouseLeave) {
538 SetStatusText("", 0);
539 SetStatusText("", 1);
540 SetStatusText("", 2);
541 SetStatusText("", 3);
542 return;
543 }
544 SetStatusText(selected->GetTitle(), 0);
545 SetStatusText(selected->GetName(), 1);
546 if (event == kKeyPress)
547 snprintf(atext, kTMAX, "%c", (char) px);
548 else
549 snprintf(atext, kTMAX, "%d,%d", px, py);
551 SetStatusText(selected->GetObjectInfo(px,py), 3);
552}
553
554////////////////////////////////////////////////////////////////////////////////
555/// Execute a macro and embed the created frame in the tab "pos"
556/// and tab element "subpos".
557
559 const char *cmd, Int_t pos, Int_t subpos)
560{
561 Longptr_t retval = 0;
564 if (cmd && strlen(cmd)) {
565 command = cmd;
566 if (name) pname = name;
567 else pname = TString::Format("Plugin %d", fPlugins.GetSize());
568 p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
569 }
570 else if (fname && strlen(fname)) {
572 Ssiz_t t = pname.Last('.');
573 if (t > 0) pname.Remove(t);
574 command.Form("gROOT->Macro(\"%s\");", gSystem->UnixPathName(fname));
575 p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
576 }
577 else return 0;
578
579 Bool_t new_canvas = command.Contains("new TCanvas");
580 Bool_t is_web_canvas = strcmp(gEnv->GetValue("Canvas.Name", ""), "TWebCanvas") == 0;
581
583 return gROOT->ProcessLine(command.Data());
584
586 gEnv->SetValue("Canvas.Name", "TRootCanvas");
587
589 fPlugins.Add(p);
590 retval = gROOT->ProcessLine(command.Data());
591 if (new_canvas) {
592 pname = gPad->GetName();
593 p->SetName(pname.Data());
594 if (is_web_canvas)
595 gEnv->SetValue("Canvas.Name", "TWebCanvas");
596 }
597 SetTabTitle(pname.Data(), pos, subpos);
599 return retval;
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Returns drawing option.
604
606{
607 if (fActBrowser)
608 return fActBrowser->GetDrawOption();
609 return 0;
610}
611
612////////////////////////////////////////////////////////////////////////////////
613/// Returns the TGTab at position pos.
614
616{
617 switch (pos) {
618 case kLeft: return fTabLeft;
619 case kRight: return fTabRight;
620 case kBottom: return fTabBottom;
621 default: return 0;
622 }
623}
624
625////////////////////////////////////////////////////////////////////////////////
626/// Handle keyboard events.
627
629{
630 char input[10];
632
633 if (event->fType == kGKeyPress) {
634 gVirtualX->LookupString(event, input, sizeof(input), keysym);
635
636 if (!event->fState && (EKeySym)keysym == kKey_F5) {
637 Refresh(kTRUE);
638 return kTRUE;
639 }
640 switch ((EKeySym)keysym) { // ignore these keys
641 case kKey_Shift:
642 case kKey_Control:
643 case kKey_Meta:
644 case kKey_Alt:
645 case kKey_CapsLock:
646 case kKey_NumLock:
647 case kKey_ScrollLock:
648 return kTRUE;
649 default:
650 break;
651 }
652 if (event->fState & kKeyControlMask) { // Cntrl key modifier pressed
653 switch ((EKeySym)keysym & ~0x20) { // treat upper and lower the same
654 case kKey_B:
656 return kTRUE;
657 case kKey_O:
659 return kTRUE;
660 case kKey_E:
662 return kTRUE;
663 case kKey_C:
665 return kTRUE;
666 case kKey_H:
668 return kTRUE;
669 case kKey_N:
671 return kTRUE;
672 case kKey_T:
674 return kTRUE;
675 case kKey_W:
677 return kTRUE;
678 case kKey_Q:
680 return kTRUE;
681 default:
682 break;
683 }
684 }
685 }
687}
688
689////////////////////////////////////////////////////////////////////////////////
690/// Handle menu entries events.
691
693{
695 TString cmd;
696 static Int_t eNr = 1;
698 if (sender != fMenuFile)
699 return;
700 switch (id) {
701 case kBrowse:
702 new TBrowser();
703 break;
704 case kOpenFile:
705 {
707 static TString dir(".");
709 fi.fFileTypes = gOpenFileTypes;
710 fi.SetIniDir(dir);
711 new TGFileDialog(gClient->GetDefaultRoot(), this,
712 kFDOpen,&fi);
713 dir = fi.fIniDir;
714 if (fi.fMultipleSelection && fi.fFileNamesList) {
715 TObjString *el;
716 TIter next(fi.fFileNamesList);
717 while ((el = (TObjString *) next())) {
718 gROOT->ProcessLine(Form("new TFile(\"%s\");",
719 gSystem->UnixPathName(el->GetString())));
720 }
721 newfile = kTRUE;
722 }
723 else if (fi.fFilename) {
724 gROOT->ProcessLine(Form("new TFile(\"%s\");",
725 gSystem->UnixPathName(fi.fFilename)));
726 newfile = kTRUE;
727 }
728 if (fActBrowser && newfile) {
729 TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(fActBrowser);
730 if (fb) fb->Selected(0);
731 }
732 }
733 break;
734 // Handle Help menu items...
735 case kHelpAbout:
736 {
737#ifdef WIN32
739#else
740 char str[32];
741 snprintf(str, 32, "About ROOT %s...", gROOT->GetVersion());
742 hd = new TRootHelpDialog(this, str, 600, 400);
743 hd->SetText(gHelpAbout);
744 hd->Popup();
745#endif
746 }
747 break;
748 case kHelpOnCanvas:
749 hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
750 hd->SetText(gHelpCanvas);
751 hd->Popup();
752 break;
753 case kHelpOnMenus:
754 hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
755 hd->SetText(gHelpPullDownMenus);
756 hd->Popup();
757 break;
759 hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
760 hd->SetText(gHelpGraphicsEditor);
761 hd->Popup();
762 break;
763 case kHelpOnBrowser:
764 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
765 hd->SetText(gHelpBrowser);
766 hd->Popup();
767 break;
768 case kHelpOnObjects:
769 hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
770 hd->SetText(gHelpObjects);
771 hd->Popup();
772 break;
773 case kHelpOnPS:
774 hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
775 hd->SetText(gHelpPostscript);
776 hd->Popup();
777 break;
778 case kHelpOnRemote:
779 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
780 hd->SetText(gHelpRemote);
781 hd->Popup();
782 break;
783 case kClone:
784 CloneBrowser();
785 break;
786 case kNewEditor:
787 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot())");
788 ++eNr;
789 ExecPlugin(Form("Editor %d", eNr), "", cmd.Data(), 1);
790 break;
791 case kNewCanvas:
792 ExecPlugin("", "", "new TCanvas()", 1);
793 break;
794 case kExecPluginMacro:
795 {
796 static TString dir(".");
798 fi.fFileTypes = gPluginFileTypes;
799 fi.SetIniDir(dir);
800 new TGFileDialog(gClient->GetDefaultRoot(), this,
801 kFDOpen,&fi);
802 dir = fi.fIniDir;
803 if (fi.fFilename) {
804 ExecPlugin(0, fi.fFilename, 0, kRight);
805 }
806 }
807 break;
808 case kExecPluginCmd:
809 {
810 char command[1024];
811 strlcpy(command, "new TGLSAViewer(gClient->GetRoot(), 0);",
812 sizeof(command));
813 new TGInputDialog(gClient->GetRoot(), this,
814 "Enter plugin command line:",
816 if (strcmp(command, "")) {
817 ExecPlugin("User", 0, command, kRight);
818 }
819 }
820 break;
821 case kCloseTab:
823 break;
824 case kCloseWindow:
825 CloseWindow();
826 break;
827 case kQuitRoot:
828 CloseWindow();
830 break;
831 default:
832 break;
833 }
834}
835
836////////////////////////////////////////////////////////////////////////////////
837/// Initialize default plugins. Could be also of the form:
838/// StartEmbedding(0);
839/// TPluginHandler *ph;
840/// ph = gROOT->GetPluginManager()->FindHandler("TGClassBrowser");
841/// if (ph && ph->LoadPlugin() != -1) {
842/// ph->ExecPlugin(3, gClient->GetRoot(), 200, 500);
843/// }
844/// StopEmbedding();
845
847{
848 TString cmd;
849
850 if ((opt == 0) || (!opt[0]))
851 return;
852 // --- Left vertical area
853
854 // File Browser plugin
855 if (strchr(opt, 'F')) {
856 cmd.Form("new TGFileBrowser(gClient->GetRoot(), (TBrowser *)0x%zx, 200, 500);", (size_t)fBrowser);
857 ExecPlugin("Files", 0, cmd.Data(), 0);
859 }
860
861 // --- Right main area
862
863 Int_t i, len = strlen(opt);
864 for (i=0; i<len; ++i) {
865 // Editor plugin...
866 if (opt[i] == 'E') {
867 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot());");
868 ExecPlugin("Editor 1", 0, cmd.Data(), 1);
870 }
871
872 // Canvas plugin...
873 if (opt[i] == 'C') {
874 cmd.Form("new TCanvas();");
875 ExecPlugin("c1", 0, cmd.Data(), 1);
877 }
878
879 // GLViewer plugin...
880 if (opt[i] == 'G') {
881 cmd.Form("new TGLSAViewer(gClient->GetRoot(), 0);");
882 ExecPlugin("OpenGL", 0, cmd.Data(), 1);
884 }
885
886 }
887 // --- Right bottom area
888
889 // Command plugin...
890 if (strchr(opt, 'I')) {
891 cmd.Form("new TGCommandPlugin(gClient->GetRoot(), 700, 300);");
892 ExecPlugin("Command", 0, cmd.Data(), 2);
894 }
895
896 // --- Select first tab everywhere
897 SetTab(0, 0);
898 SetTab(1, 0);
899 SetTab(2, 0);
900}
901
902////////////////////////////////////////////////////////////////////////////////
903/// Check if the GUI factory is set to use the Web GUI.
904
906{
907 TString factory = gEnv->GetValue("Gui.Factory", "native");
908 return (factory.Contains("web", TString::kIgnoreCase));
909}
910
911////////////////////////////////////////////////////////////////////////////////
912/// Really delete the browser and the this GUI.
913
915{
917 delete this;
918}
919
920////////////////////////////////////////////////////////////////////////////////
921/// Recursively remove object from browser.
922
928
929////////////////////////////////////////////////////////////////////////////////
930/// Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
931
933{
934 TGMenuEntry *entry = 0;
935 TIter next(popup->GetListOfEntries());
936 while ((entry = (TGMenuEntry *)next())) {
937 if (entry->GetPopup()) {
938 RecursiveReparent(entry->GetPopup());
939 }
940 }
941 popup->ReparentWindow(gClient->GetDefaultRoot());
942}
943
944////////////////////////////////////////////////////////////////////////////////
945/// Refresh the actual browser contents.
946
952
953////////////////////////////////////////////////////////////////////////////////
954/// Remove tab element "subpos" from tab "pos".
955
957{
958 TGTab *edit = 0;
959 switch (pos) {
960 case kLeft: // left
961 edit = fTabLeft;
962 break;
963 case kRight: // right
964 edit = fTabRight;
966 fMenuFrame->GetList()->Remove(fActMenuBar);
967 fActMenuBar = 0;
968 break;
969 case kBottom: // bottom
971 break;
972 }
973 if (!edit || !edit->GetTabTab(subpos))
974 return;
975 const char *tabName = edit->GetTabTab(subpos)->GetString();
976 TObject *obj = 0;
977 if ((obj = fPlugins.FindObject(tabName))) {
978 fPlugins.Remove(obj);
979 }
980 TGFrameElement *el = 0;
981 if (edit->GetTabContainer(subpos))
982 el = (TGFrameElement *)edit->GetTabContainer(subpos)->GetList()->First();
983 if (el && el->fFrame) {
984 el->fFrame->Disconnect("ProcessedConfigure(Event_t*)");
985 el->fFrame->SetFrameElement(0);
986 if (el->fFrame->InheritsFrom("TGMainFrame")) {
987 Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
988 ((TGMainFrame *)el->fFrame)->CloseWindow();
989 if (sleep)
990 gSystem->Sleep(150);
992 }
993 else
994 delete el->fFrame;
995 el->fFrame = 0;
996 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
997 (el->fLayout->References() > 0)) {
998 el->fLayout->RemoveReference();
999 if (!el->fLayout->References()) {
1000 delete el->fLayout;
1001 }
1002 }
1003 edit->GetTabContainer(subpos)->GetList()->Remove(el);
1004 delete el;
1005 }
1006 fNbTab[pos]--;
1007 edit->RemoveTab(subpos);
1008 SwitchMenus(edit->GetTabContainer(edit->GetCurrent()));
1009}
1010
1011////////////////////////////////////////////////////////////////////////////////
1012/// Switch to Tab "subpos" in TGTab "pos".
1013
1015{
1016 TGTab *tab = GetTab(pos);
1017 if (subpos == -1)
1018 subpos = fCrTab[pos];
1019
1020 if (tab && tab->SetTab(subpos, kFALSE)) { // Block signal emit
1021 if (pos == kRight)
1022 SwitchMenus(tab->GetTabContainer(subpos));
1023 tab->Layout();
1024 }
1025}
1026
1027////////////////////////////////////////////////////////////////////////////////
1028/// Set text "title" of Tab "subpos" in TGTab "pos".
1029
1030void TRootBrowser::SetTabTitle(const char *title, Int_t pos, Int_t subpos)
1031{
1032 TBrowserPlugin *p = 0;
1033 TGTab *edit = GetTab(pos);
1034 if (!edit) return;
1035 if (subpos == -1)
1036 subpos = fCrTab[pos];
1037
1038 TGTabElement *el = edit->GetTabTab(subpos);
1039 if (el) {
1040 el->SetText(new TGString(title));
1041 edit->Layout();
1042 if ((p = (TBrowserPlugin *)fPlugins.FindObject(title)))
1043 p->SetName(title);
1044 }
1045}
1046
1047////////////////////////////////////////////////////////////////////////////////
1048/// Set text in column col in status bar.
1049
1051{
1053}
1054
1055////////////////////////////////////////////////////////////////////////////////
1056/// Show the selected frame's menu and hide previous one.
1057
1059{
1060 TGFrameElement *el = 0;
1061 // temporary solution until I find a proper way to handle
1062 // these bloody menus...
1063 fBindList->Delete();
1065 while ((el = (TGFrameElement *) nextm())) {
1066 TGMenuTitle *t = (TGMenuTitle *) el->fFrame;
1067 Int_t code = t->GetHotKeyCode();
1076 }
1079 menu->Layout();
1080 fMenuFrame->Layout();
1081 fActMenuBar = menu;
1082}
1083
1084////////////////////////////////////////////////////////////////////////////////
1085/// Start embedding external frame in the tab "pos" and tab element "subpos".
1086
1088{
1089 fEditTab = GetTab(pos);
1090 if (!fEditTab) return;
1091 fEditPos = pos;
1093
1094 if (fEditFrame == 0) {
1095 if (subpos == -1) {
1096 fCrTab[pos] = fNbTab[pos]++;
1097 fEditFrame = fEditTab->AddTab(Form("Tab %d",fNbTab[pos]));
1101 if(tabel) {
1102 tabel->MapWindow();
1103 if (fShowCloseTab && (pos == 1))
1104 tabel->ShowClose();
1105 }
1107 fEditTab->Layout();
1108 }
1109 else {
1110 fCrTab[pos] = subpos;
1113 }
1115 }
1116}
1117
1118////////////////////////////////////////////////////////////////////////////////
1119/// Stop embedding external frame in the current editable frame.
1120
1122{
1123 if (fEditFrame != 0) {
1126 if (el && el->fFrame) {
1127 // let be notified when the inside frame gets resized, and tell its
1128 // container to recompute its layout
1129 el->fFrame->Connect("ProcessedConfigure(Event_t*)", "TGCompositeFrame",
1130 fEditFrame, "Layout()");
1131 }
1132 if (layout) {
1133 el = (TGFrameElement*) fEditFrame->GetList()->Last();
1134 // !!!! MT what to do with the old layout? Leak it for now ...
1135 if (el) el->fLayout = layout;
1136 }
1137 fEditFrame->Layout();
1138 if (fEditTab == fTabRight)
1140 }
1141 if (name && strlen(name)) {
1143 }
1145 fEditFrame = fEditTab = 0;
1146 fEditPos = fEditSubPos = -1;
1147}
1148
1149////////////////////////////////////////////////////////////////////////////////
1150/// Move the menu from original frame to our TGMenuFrame, or display the
1151/// menu associated to the current tab.
1152
1154{
1155 if (from == 0)
1156 return;
1157 TGFrameElement *fe = (TGFrameElement *)from->GetList()->First();
1158 if (!fe) {
1159 if (fActMenuBar != fMenuBar)
1161 return;
1162 }
1164 TGFrameElement *el = 0;
1165 if (embed && embed->GetList()) {
1166 TIter next(embed->GetList());
1167 while ((el = (TGFrameElement *)next())) {
1168 if (el->fFrame->InheritsFrom("TGMenuBar")) {
1169 TGMenuBar *menu = (TGMenuBar *)el->fFrame;
1170 if (fActMenuBar == menu)
1171 return;
1174 while ((nw = (TGFrameElement *) nel())) {
1175 if (nw->fFrame == menu) {
1176 ShowMenu(menu);
1177 return;
1178 }
1179 }
1180 ((TGCompositeFrame *)menu->GetParent())->HideFrame(menu);
1181 ((TGCompositeFrame *)menu->GetParent())->SetCleanup(kNoCleanup);
1182 menu->ReparentWindow(fMenuFrame);
1185 TIter mnext(menu->GetList());
1186 while ((mel = (TGFrameElement *) mnext())) {
1187 TGMenuTitle *t = (TGMenuTitle *) mel->fFrame;
1188 TGPopupMenu *popup = menu->GetPopup(t->GetName());
1189 if (popup) {
1191 if (popup->GetEntry("Close Canvas")) {
1192 TGMenuEntry *exit = popup->GetEntry("Close Canvas");
1193 popup->HideEntry(exit->GetEntryId());
1194 }
1195 if (popup->GetEntry("Close Viewer")) {
1196 TGMenuEntry *exit = popup->GetEntry("Close Viewer");
1197 popup->HideEntry(exit->GetEntryId());
1198 }
1199 if (popup->GetEntry("Quit ROOT")) {
1200 TGMenuEntry *exit = popup->GetEntry("Quit ROOT");
1201 popup->HideEntry(exit->GetEntryId());
1202 }
1203 if (popup->GetEntry("Exit")) {
1204 TGMenuEntry *exit = popup->GetEntry("Exit");
1205 popup->HideEntry(exit->GetEntryId());
1206 }
1207 }
1208 }
1209 ShowMenu(menu);
1210 return;
1211 }
1212 }
1213 }
1214 if (fActMenuBar != fMenuBar)
1216}
1217
1218////////////////////////////////////////////////////////////////////////////////
1219/// Emits signal when double clicking on icon.
1220
1222{
1223 Emit("DoubleClicked(TObject*)", (Longptr_t)obj);
1224}
1225
1226////////////////////////////////////////////////////////////////////////////////
1227/// Emits signal when double clicking on icon.
1228
1230{
1231 Longptr_t args[2];
1232
1233 args[0] = (Longptr_t)obj;
1234 args[1] = checked;
1235
1236 Emit("Checked(TObject*,Bool_t)", args);
1237}
1238
1239////////////////////////////////////////////////////////////////////////////////
1240/// Emits signal "ExecuteDefaultAction(TObject*)".
1241
1243{
1244 Emit("ExecuteDefaultAction(TObject*)", (Longptr_t)obj);
1245}
1246
1247
1248////////////////////////////////////////////////////////////////////////////////
1249/// static constructor returning TBrowserImp,
1250/// as needed by the plugin mechanism.
1251
1254 Option_t *opt)
1255{
1256 TRootBrowser *browser = new TRootBrowser(b, title, width, height, opt);
1257 return (TBrowserImp *)browser;
1258}
1259
1260////////////////////////////////////////////////////////////////////////////////
1261/// static constructor returning TBrowserImp,
1262/// as needed by the plugin mechanism.
1263
1266 Option_t *opt)
1267{
1268 TRootBrowser *browser = new TRootBrowser(b, title, x, y, width, height, opt);
1269 return (TBrowserImp *)browser;
1270}
@ kKeyPress
Definition Buttons.h:20
@ kMouseLeave
Definition Buttons.h:23
@ kGKeyPress
Definition GuiTypes.h:61
const Mask_t kKeyLockMask
Definition GuiTypes.h:197
const Mask_t kKeyMod1Mask
typically the Alt key
Definition GuiTypes.h:199
const Mask_t kKeyReleaseMask
Definition GuiTypes.h:161
const Mask_t kKeyPressMask
Definition GuiTypes.h:160
const Mask_t kKeyShiftMask
Definition GuiTypes.h:196
@ kRaisedFrame
Definition GuiTypes.h:385
@ kFixedWidth
Definition GuiTypes.h:388
@ kHorizontalFrame
Definition GuiTypes.h:383
@ kFixedHeight
Definition GuiTypes.h:390
const Mask_t kKeyControlMask
Definition GuiTypes.h:198
const Mask_t kKeyMod2Mask
typically mod on numeric keys
Definition GuiTypes.h:200
R__EXTERN const char gHelpObjects[]
Definition HelpText.h:26
R__EXTERN const char gHelpPullDownMenus[]
Definition HelpText.h:24
R__EXTERN const char gHelpRemote[]
Definition HelpText.h:28
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
EKeySym
Definition KeySymbols.h:25
@ kKey_W
Definition KeySymbols.h:148
@ kKey_Q
Definition KeySymbols.h:142
@ kKey_Meta
Definition KeySymbols.h:51
@ kKey_B
Definition KeySymbols.h:127
@ kKey_N
Definition KeySymbols.h:139
@ kKey_CapsLock
Definition KeySymbols.h:53
@ kKey_F5
Definition KeySymbols.h:61
@ kKey_Alt
Definition KeySymbols.h:52
@ kKey_C
Definition KeySymbols.h:128
@ kKey_ScrollLock
Definition KeySymbols.h:55
@ kKey_O
Definition KeySymbols.h:140
@ kKey_Shift
Definition KeySymbols.h:49
@ kKey_E
Definition KeySymbols.h:130
@ kKey_T
Definition KeySymbols.h:145
@ kKey_Control
Definition KeySymbols.h:50
@ kKey_H
Definition KeySymbols.h:133
@ kKey_NumLock
Definition KeySymbols.h:54
#define b(i)
Definition RSha256.hxx:100
cudaEvent_t event
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:90
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
R__EXTERN TApplication * gApplication
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TEnv * gEnv
Definition TEnv.h:126
#define gClient
Definition TGClient.h:157
@ kFDOpen
@ kNoCleanup
Definition TGFrame.h:40
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsNormal
Definition TGLayout.h:32
@ 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 input
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 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 len
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 SetWMSizeHints
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
char name[80]
Definition TGX11.cxx:142
R__EXTERN C unsigned int sleep(unsigned int seconds)
R__EXTERN void * gTQSender
Definition TQObject.h:46
#define gROOT
Definition TROOT.h:417
static const char * gPluginFileTypes[]
static const char * gOpenFileTypes[]
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2570
R__EXTERN TSystem * gSystem
Definition TSystem.h:582
#define gPad
#define gVirtualX
Definition TVirtualX.h:379
static TClass * Class()
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
ABC describing GUI independent browser implementation protocol.
Definition TBrowserImp.h:29
virtual Option_t * GetDrawOption() const
Definition TBrowserImp.h:57
virtual void BrowseObj(TObject *)
Definition TBrowserImp.h:48
virtual void RecursiveRemove(TObject *)
Definition TBrowserImp.h:53
virtual void Refresh(Bool_t=kFALSE)
Definition TBrowserImp.h:54
virtual void Add(TObject *, const char *, Int_t)
Definition TBrowserImp.h:44
TBrowser * fBrowser
TBrowser associated with this implementation.
Definition TBrowserImp.h:32
Helper class used to manage plugins (command or macro to be executed).
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
void SetBrowserImp(TBrowserImp *i)
Definition TBrowser.h:96
virtual Bool_t IsEmpty() const
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
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
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
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
virtual TList * GetList() const
Definition TGFrame.h:312
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1157
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
static TGLayoutHints * fgDefaultHints
Definition TGFrame.h:299
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1183
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.
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
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:598
void MapWindow() override
map window
Definition TGFrame.h:206
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:269
void SetFrame(TGFrame *frame, Bool_t above) override
Set frame to be resized.
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
Input Dialog Widget.
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
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1853
TList * fBindList
list with key bindings
Definition TGFrame.h:416
virtual Bool_t BindKey(const TGWindow *w, Int_t keycode, Int_t modifier) const
Bind key to a window.
Definition TGFrame.cxx:1632
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
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
Definition TGFrame.cxx:1601
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
This class contains all information about a menu entry.
Definition TGMenu.h:57
This class creates a menu title.
Definition TGMenu.h:234
const char * GetName() const override
Returns name of object.
Definition TGMenu.h:274
Int_t GetHotKeyCode() const
Definition TGMenu.h:272
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Handle_t GetId() const
Definition TGObject.h:41
This class creates a popup menu object.
Definition TGMenu.h:110
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 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
virtual void Activated(Int_t id)
Definition TGMenu.h:219
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.
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
Service classes of the tab widget.
Definition TGTab.h:117
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
Int_t GetNumberOfTabs() const
Return number of tabs.
Definition TGTab.cxx:706
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
Int_t GetCurrent() const
Definition TGTab.h:90
virtual void Selected(Int_t id)
Definition TGTab.h:109
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
Definition TGTab.cxx:611
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
Definition TGTab.cxx:373
void SetFrame(TGFrame *frame, Bool_t left) override
Set frame to be resized.
A composite frame that layout their children in vertical way.
Definition TGFrame.h:376
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
Definition TList.cxx:708
void Add(TObject *obj) override
Definition TList.h:81
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:952
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:600
Collectable string class.
Definition TObjString.h:28
Mother of all ROOT objects.
Definition TObject.h:42
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:547
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
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.
TGPopupMenu * fMenuExecPlugin
"Exec Plugin" popup menu
TGHorizontalFrame * fMenuFrame
Shared menu frame.
TGTab * GetTab(Int_t pos) const
Returns the TGTab at position pos.
TGLayoutHints * fLH4
void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1) override
Start embedding external frame in the tab "pos" and tab element "subpos".
Bool_t fShowCloseTab
kTRUE to show close icon on tab elements
void SetTabTitle(const char *title, Int_t pos=kRight, Int_t subpos=-1)
Set text "title" of Tab "subpos" in TGTab "pos".
TGPopupMenu * fMenuHelp
"Browser Help" popup menu
Int_t fCrTab[3]
Actual (active) tab elements (for each Tab)
void ExecuteDefaultAction(TObject *obj) override
Emits signal "ExecuteDefaultAction(TObject*)".
TRootBrowser(const TRootBrowser &)=delete
Longptr_t ExecPlugin(const char *name=nullptr, const char *fname=nullptr, const char *cmd=nullptr, Int_t pos=kRight, Int_t subpos=-1) override
Execute a macro and embed the created frame in the tab "pos" and tab element "subpos".
TGHorizontalFrame * fH2
Horizontal frame.
Int_t fNbTab[3]
Number of tab elements (for each Tab)
TGStatusBar * fStatusBar
Status bar.
Bool_t IsWebGUI()
Check if the GUI factory is set to use the Web GUI.
TGVerticalFrame * fVf
Vertical frame.
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
TGLayoutHints * fLH6
TGHSplitter * fHSplitter
Horizontal splitter.
TBrowserImp * fActBrowser
Actual (active) browser imp.
TGCompositeFrame * fEditFrame
Frame in "Edit" mode.
virtual void CloseTab(Int_t id)
Remove tab element id from right tab.
static TBrowserImp * NewBrowser(TBrowser *b=nullptr, const char *title="ROOT Browser", UInt_t width=800, UInt_t height=500, Option_t *opt="")
static constructor returning TBrowserImp, as needed by the plugin mechanism.
TGCompositeFrame * fActMenuBar
Actual (active) menu bar.
Int_t fEditPos
Id of tab in "Edit" mode.
TGLayoutHints * fLH1
void ReallyDelete() override
Really delete the browser and the this GUI.
void StopEmbedding(const char *name=nullptr) override
const TGPicture * fIconPic
icon picture
Int_t fEditSubPos
Id of subtab in "Edit" mode.
TGTab * fEditTab
Tab in "Edit" mode.
TGLayoutHints * fLH2
TGVerticalFrame * fV1
Vertical frame.
void DoTab(Int_t id)
Handle Tab navigation.
TGLayoutHints * fLH0
void RecursiveRemove(TObject *obj) override
Recursively remove object from browser.
void CreateBrowser(const char *name)
TGHorizontalFrame * fPreMenuFrame
First (owned) menu frame.
TGLayoutHints * fLH5
void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Display a tooltip with infos about the primitive below the cursor.
~TRootBrowser() override
Clean up all widgets, frames and layouthints that were used.
TList fPlugins
List of plugins.
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
void SetTab(Int_t pos=kRight, Int_t subpos=-1)
Switch to Tab "subpos" in TGTab "pos".
void CloneBrowser()
Clone the browser.
TGTab * fTabRight
Right Tab.
void HandleMenu(Int_t id)
Handle menu entries events.
TGVSplitter * fVSplitter
Vertical splitter.
TGHorizontalFrame * fHf
Horizontal frame.
void RemoveTab(Int_t pos, Int_t subpos)
Remove tab element "subpos" from tab "pos".
TGTab * fTabBottom
Bottom Tab.
void Refresh(Bool_t force=kFALSE) override
Refresh the actual browser contents.
TGPopupMenu * fMenuFile
"File" popup menu
void SwitchMenus(TGCompositeFrame *from)
Move the menu from original frame to our TGMenuFrame, or display the menu associated to the current t...
void BrowseObj(TObject *obj) override
Browse object.
TGLayoutHints * fLH7
Layout hints, part 2.
virtual void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
void ShowMenu(TGCompositeFrame *menu)
Show the selected frame's menu and hide previous one.
void SetStatusText(const char *txt, Int_t col) override
Set text in column col in status bar.
void CloseWindow() override
Called when window is closed via the window manager.
TGTab * fTabLeft
Left Tab.
void Add(TObject *obj, const char *name=nullptr, Int_t check=-1) override
Add items to the actual browser.
TGHorizontalFrame * fTopMenuFrame
Top menu frame.
TGLayoutHints * fLH3
Layout hints, part 1.
TGMenuBar * fMenuBar
Main (owned) menu bar.
Int_t fNbInitPlugins
Number of initial plugins (from .rootrc)
void InitPlugins(Option_t *opt="")
Initialize default plugins.
TGVerticalFrame * fV2
Vertical frame.
void RecursiveReparent(TGPopupMenu *popup)
Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
void CloseTabs() override
Properly close the mainframes embedded in the different tabs.
Option_t * GetDrawOption() const override
Returns drawing option.
TGHorizontalFrame * fH1
Horizontal frame.
TGHorizontalFrame * fToolbarFrame
Toolbar frame.
A TRootHelpDialog is used to display help text (or any text in a dialog window).
Basic string class.
Definition TString.h:137
@ kIgnoreCase
Definition TString.h:284
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:2459
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:642
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1077
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition TSystem.cxx:948
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition TSystem.cxx:439
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:418
static void Terminate()
Close the global pad editor. Static method.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
void BrowseRNTuple(const void *ntuple, TBrowser *b)
Event structure.
Definition GuiTypes.h:175