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 "TInterpreter.h"
78#include "TGFileDialog.h"
79#include "TObjString.h"
80#include "TVirtualPad.h"
81#include "TEnv.h"
82#include <KeySymbols.h>
83
84#include "RConfigure.h"
85
86#include "TRootBrowser.h"
87#include "TGFileBrowser.h"
88#include "TGInputDialog.h"
89#include "TRootHelpDialog.h"
90#include "TVirtualPadEditor.h"
91#include "HelpText.h"
92#include "Getline.h"
93#include "TVirtualX.h"
94#include "strlcpy.h"
95
96#include <cstdio>
97
98#include <cstdarg>
99
100#ifdef WIN32
101#include <TWin32SplashThread.h>
102#endif
103
104static const char *gOpenFileTypes[] = {
105 "ROOT files", "*.root",
106 "All files", "*",
107 0, 0
108};
109
110static const char *gPluginFileTypes[] = {
111 "ROOT files", "*.C",
112 "All files", "*",
113 0, 0
114};
115
116
117
118////////////////////////////////////////////////////////////////////////////////
119/// Create browser with a specified width and height.
120
123 TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
124{
126 fActBrowser = 0;
127 fIconPic = 0;
130 if (initshow) {
131 InitPlugins(opt);
132 MapWindow();
133 }
134 TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
135 "TRootBrowser", this,
136 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
137 gVirtualX->SetInputFocus(GetId());
138}
139
140////////////////////////////////////////////////////////////////////////////////
141/// Create browser with a specified width and height and at position x, y.
142
146 TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
147{
149 fActBrowser = 0;
150 fIconPic = 0;
153 SetWMPosition(x, y);
154 if (initshow) {
155 InitPlugins(opt);
156 MapWindow();
157 }
158 TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
159 "TRootBrowser", this,
160 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
161 gVirtualX->SetInputFocus(GetId());
162}
163
164
165////////////////////////////////////////////////////////////////////////////////
166
168{
169 static bool hasRNTupleBrowsing __attribute__((unused)) = []() {
171 return true;
172 }();
173
174 // Create the actual interface.
175
176 fVf = new TGVerticalFrame(this, 100, 100);
177
179 fLH1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
180 fLH2 = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 1);
186
187 // Menubar Frame
188 fTopMenuFrame = new TGHorizontalFrame(fVf, 100, 20);
189
192 fMenuFile = new TGPopupMenu(gClient->GetDefaultRoot());
193 fMenuFile->AddEntry("&Browse...\tCtrl+B", kBrowse);
194 fMenuFile->AddEntry("&Open...\tCtrl+O", kOpenFile);
196
198 fMenuHelp->AddEntry("&About ROOT...", kHelpAbout);
200 fMenuHelp->AddEntry("Help On Browser...", kHelpOnBrowser);
201 fMenuHelp->AddEntry("Help On Canvas...", kHelpOnCanvas);
202 fMenuHelp->AddEntry("Help On Menus...", kHelpOnMenus);
203 fMenuHelp->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
204 fMenuHelp->AddEntry("Help On Objects...", kHelpOnObjects);
205 fMenuHelp->AddEntry("Help On PostScript...", kHelpOnPS);
206 fMenuHelp->AddEntry("Help On Remote Session...", kHelpOnRemote);
207 fMenuFile->AddPopup("Browser Help...", fMenuHelp);
208
210 fMenuFile->AddEntry("&Clone\tCtrl+N", kClone);
212 fMenuFile->AddEntry("New &Editor\tCtrl+E", kNewEditor);
213 fMenuFile->AddEntry("New &Canvas\tCtrl+C", kNewCanvas);
217 fMenuExecPlugin->AddEntry("&Command...", kExecPluginCmd);
218 fMenuFile->AddPopup("Execute &Plugin...", fMenuExecPlugin);
220 fMenuFile->AddEntry("Close &Tab\tCtrl+T", kCloseTab);
221 fMenuFile->AddEntry("Close &Window\tCtrl+W", kCloseWindow);
223 fMenuFile->AddEntry("&Quit Root\tCtrl+Q", kQuitRoot);
224 fMenuBar->AddPopup("&Browser", fMenuFile, fLH1);
225 fMenuFile->Connect("Activated(Int_t)", "TRootBrowser", this,
226 "HandleMenu(Int_t)");
229
232
235
236 // Toolbar Frame
240
241 fHf = new TGHorizontalFrame(fVf, 100, 100);
242 // Tabs & co...
243#if defined(R__HAS_COCOA)
244 fV1 = new TGVerticalFrame(fHf, 252, 100, kFixedWidth);
245#else
246 fV1 = new TGVerticalFrame(fHf, 250, 100, kFixedWidth);
247#endif
248 fV2 = new TGVerticalFrame(fHf, 600, 100);
249 fH1 = new TGHorizontalFrame(fV2, 100, 100);
250 fH2 = new TGHorizontalFrame(fV2, 100, 100, kFixedHeight);
251
252 // Left tab
253 fTabLeft = new TGTab(fV1,100,100);
254 //fTabLeft->AddTab("Tab 1");
257
258 // Vertical splitter
259 fVSplitter = new TGVSplitter(fHf, 4, 4);
261 fHf->AddFrame(fV1, fLH7);
263
264 // Right tab
265 fTabRight = new TGTab(fH1, 500, 100);
266 //fTabRight->AddTab("Tab 1");
269 fTabRight->Connect("Selected(Int_t)", "TRootBrowser", this, "DoTab(Int_t)");
270 fTabRight->Connect("CloseTab(Int_t)", "TRootBrowser", this, "CloseTab(Int_t)");
271 fV2->AddFrame(fH1, fLH4);
272
273 // Horizontal splitter
274 fHSplitter = new TGHSplitter(fV2, 4, 4);
276
277 // Bottom tab
278 fTabBottom = new TGTab(fH2, 100, 100);
279 //fTabBottom->AddTab("Tab 1");
281 fV2->AddFrame(fH2, fLH3);
282
284 fHf->AddFrame(fV2, fLH5);
285 fVf->AddFrame(fHf, fLH5);
286 AddFrame(fVf, fLH5);
287
288 // status bar
289 fStatusBar = new TGStatusBar(this, 400, 20);
290 int parts[] = { 33, 10, 10, 47 };
293
294 fNbInitPlugins = 0;
295 fEditFrame = 0;
296 fEditTab = 0;
297 fEditPos = -1;
298 fEditSubPos= -1;
299 fNbTab[0] = fNbTab[1] = fNbTab[2] = 0;
300 fCrTab[0] = fCrTab[1] = fCrTab[2] = -1;
301
302 // Set a name to the main frame
305 fIconPic = SetIconPixmap("rootdb_s.xpm");
306 SetClassHints("ROOT", "Browser");
307
308 if (!strcmp(gROOT->GetDefCanvasName(), "c1"))
309 gROOT->SetDefCanvasName("Canvas_1");
310
311 SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
315
317}
318
319////////////////////////////////////////////////////////////////////////////////
320/// Clean up all widgets, frames and layouthints that were used
321
323{
324 if (fIconPic) gClient->FreePicture(fIconPic);
325 delete fLH0;
326 delete fLH1;
327 delete fLH2;
328 delete fLH3;
329 delete fLH4;
330 delete fLH5;
331 delete fLH6;
332 delete fLH7;
333 delete fMenuHelp;
334 delete fMenuExecPlugin;
335 delete fMenuFile;
336 delete fMenuBar;
337 delete fMenuFrame;
338 delete fPreMenuFrame;
339 delete fTopMenuFrame;
340 delete fToolbarFrame;
341 delete fVSplitter;
342 delete fHSplitter;
343 delete fTabLeft;
344 delete fTabRight;
345 delete fTabBottom;
346 delete fH1;
347 delete fH2;
348 delete fV1;
349 delete fV2;
350 delete fHf;
351 delete fStatusBar;
352 delete fVf;
353}
354
355////////////////////////////////////////////////////////////////////////////////
356/// Add items to the actual browser. This function has to be called
357/// by the Browse() member function of objects when they are
358/// called by a browser. If check < 0 (default) no check box is drawn,
359/// if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
360
361void TRootBrowser::Add(TObject *obj, const char *name, Int_t check)
362{
363 if (obj->InheritsFrom("TObjectSpy"))
364 return;
365 if (fActBrowser)
366 fActBrowser->Add(obj, name, check);
367}
368
369////////////////////////////////////////////////////////////////////////////////
370/// Browse object. This, in turn, will trigger the calling of
371/// TRootBrowser::Add() which will fill the IconBox and the tree.
372/// Emits signal "BrowseObj(TObject*)".
373
375{
376 if (fActBrowser)
378 Emit("BrowseObj(TObject*)", (Longptr_t)obj);
379}
380
381////////////////////////////////////////////////////////////////////////////////
382/// Clone the browser. A new Browser will be created, with the same
383/// plugins executed in the current one.
384
386{
387 Int_t loop = 1;
389 TBrowser *b = new TBrowser();
390 TIter next(&fPlugins);
391 while ((plugin = (TBrowserPlugin *)next())) {
392 if (loop > fNbInitPlugins)
393 b->ExecPlugin(plugin->GetName(), "", plugin->fCommand.Data(), plugin->fTab,
394 plugin->fSubTab);
395 ++loop;
396 }
397}
398
399////////////////////////////////////////////////////////////////////////////////
400/// Remove tab element id from right tab.
401
403{
404 RemoveTab(kRight, id);
405}
406
407////////////////////////////////////////////////////////////////////////////////
408/// Properly close the mainframes embedded in the different tabs
409
411{
414 Int_t i;
415 TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
416 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
417 Disconnect(fMenuFile, "Activated(Int_t)", this, "HandleMenu(Int_t)");
418 Disconnect(fTabRight, "Selected(Int_t)", this, "DoTab(Int_t)");
419 if (fPlugins.IsEmpty()) return;
420 fActBrowser = 0;
421 for (i=0;i<fTabLeft->GetNumberOfTabs();i++) {
423 if (!container) continue;
424 el = (TGFrameElement *)container->GetList()->First();
425 if (el && el->fFrame) {
426 el->fFrame->SetFrameElement(0);
427 if (el->fFrame->InheritsFrom("TVirtualPadEditor")) {
429 }
430 else if (el->fFrame->InheritsFrom("TGMainFrame")) {
431 el->fFrame->UnmapWindow();
432 ((TGMainFrame *)el->fFrame)->CloseWindow();
434 }
435 else
436 delete el->fFrame;
437 el->fFrame = 0;
438 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
439 (el->fLayout->References() > 0)) {
440 el->fLayout->RemoveReference();
441 if (!el->fLayout->References()) {
442 delete el->fLayout;
443 }
444 }
445 container->GetList()->Remove(el);
446 delete el;
447 }
448 }
449 for (i=0;i<fTabRight->GetNumberOfTabs();i++) {
451 if (!container) continue;
452 el = (TGFrameElement *)container->GetList()->First();
453 if (el && el->fFrame) {
454 el->fFrame->SetFrameElement(0);
455 if (el->fFrame->InheritsFrom("TGMainFrame")) {
456 el->fFrame->UnmapWindow();
457 Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
458 if (sleep)
459 gSystem->Sleep(150);
460 ((TGMainFrame *)el->fFrame)->CloseWindow();
461 if (sleep)
462 gSystem->Sleep(150);
464 }
465 else
466 delete el->fFrame;
467 el->fFrame = 0;
468 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
469 (el->fLayout->References() > 0)) {
470 el->fLayout->RemoveReference();
471 if (!el->fLayout->References()) {
472 delete el->fLayout;
473 }
474 }
475 container->GetList()->Remove(el);
476 delete el;
477 }
478 }
479 for (i=0;i<fTabBottom->GetNumberOfTabs();i++) {
481 if (!container) continue;
482 el = (TGFrameElement *)container->GetList()->First();
483 if (el && el->fFrame) {
484 el->fFrame->SetFrameElement(0);
485 if (el->fFrame->InheritsFrom("TGMainFrame")) {
486 el->fFrame->UnmapWindow();
487 ((TGMainFrame *)el->fFrame)->CloseWindow();
488 gSystem->Sleep(150);
490 }
491 else
492 delete el->fFrame;
493 el->fFrame = 0;
494 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
495 (el->fLayout->References() > 0)) {
496 el->fLayout->RemoveReference();
497 if (!el->fLayout->References()) {
498 delete el->fLayout;
499 }
500 }
501 container->GetList()->Remove(el);
502 delete el;
503 }
504 }
506 Emit("CloseWindow()");
507}
508
509////////////////////////////////////////////////////////////////////////////////
510/// Called when window is closed via the window manager.
511
513{
514 TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
515 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
516 CloseTabs();
517 DeleteWindow();
518}
519
520////////////////////////////////////////////////////////////////////////////////
521/// Handle Tab navigation.
522
524{
526 if ((sender) && (sender == fTabRight)) {
527 SwitchMenus(sender->GetTabContainer(id));
528 }
529}
530
531////////////////////////////////////////////////////////////////////////////////
532/// Display a tooltip with infos about the primitive below the cursor.
533
535{
536 const Int_t kTMAX=256;
537 static char atext[kTMAX];
538 if (selected == 0 || event == kMouseLeave) {
539 SetStatusText("", 0);
540 SetStatusText("", 1);
541 SetStatusText("", 2);
542 SetStatusText("", 3);
543 return;
544 }
545 SetStatusText(selected->GetTitle(), 0);
546 SetStatusText(selected->GetName(), 1);
547 if (event == kKeyPress)
548 snprintf(atext, kTMAX, "%c", (char) px);
549 else
550 snprintf(atext, kTMAX, "%d,%d", px, py);
552 SetStatusText(selected->GetObjectInfo(px,py), 3);
553}
554
555////////////////////////////////////////////////////////////////////////////////
556/// Execute a macro and embed the created frame in the tab "pos"
557/// and tab element "subpos".
558
560 const char *cmd, Int_t pos, Int_t subpos)
561{
562 Longptr_t retval = 0;
565 if (cmd && strlen(cmd)) {
566 command = cmd;
567 if (name) pname = name;
568 else pname = TString::Format("Plugin %d", fPlugins.GetSize());
569 p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
570 }
571 else if (fname && strlen(fname)) {
573 Ssiz_t t = pname.Last('.');
574 if (t > 0) pname.Remove(t);
575 command.Form("gROOT->Macro(\"%s\");", gSystem->UnixPathName(fname));
576 p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
577 }
578 else return 0;
579
580 Bool_t new_canvas = command.Contains("new TCanvas");
581 Bool_t is_web_canvas = strcmp(gEnv->GetValue("Canvas.Name", ""), "TWebCanvas") == 0;
582
584 return gROOT->ProcessLine(command.Data());
585
587 gEnv->SetValue("Canvas.Name", "TRootCanvas");
588
590 fPlugins.Add(p);
591 retval = gROOT->ProcessLine(command.Data());
592 if (new_canvas) {
593 pname = gPad->GetName();
594 p->SetName(pname.Data());
595 if (is_web_canvas)
596 gEnv->SetValue("Canvas.Name", "TWebCanvas");
597 }
598 SetTabTitle(pname.Data(), pos, subpos);
600 return retval;
601}
602
603////////////////////////////////////////////////////////////////////////////////
604/// Returns drawing option.
605
607{
608 if (fActBrowser)
609 return fActBrowser->GetDrawOption();
610 return 0;
611}
612
613////////////////////////////////////////////////////////////////////////////////
614/// Returns the TGTab at position pos.
615
617{
618 switch (pos) {
619 case kLeft: return fTabLeft;
620 case kRight: return fTabRight;
621 case kBottom: return fTabBottom;
622 default: return 0;
623 }
624}
625
626////////////////////////////////////////////////////////////////////////////////
627/// Handle keyboard events.
628
630{
631 char input[10];
633
634 if (event->fType == kGKeyPress) {
635 gVirtualX->LookupString(event, input, sizeof(input), keysym);
636
637 if (!event->fState && (EKeySym)keysym == kKey_F5) {
638 Refresh(kTRUE);
639 return kTRUE;
640 }
641 switch ((EKeySym)keysym) { // ignore these keys
642 case kKey_Shift:
643 case kKey_Control:
644 case kKey_Meta:
645 case kKey_Alt:
646 case kKey_CapsLock:
647 case kKey_NumLock:
648 case kKey_ScrollLock:
649 return kTRUE;
650 default:
651 break;
652 }
653 if (event->fState & kKeyControlMask) { // Cntrl key modifier pressed
654 switch ((EKeySym)keysym & ~0x20) { // treat upper and lower the same
655 case kKey_B:
657 return kTRUE;
658 case kKey_O:
660 return kTRUE;
661 case kKey_E:
663 return kTRUE;
664 case kKey_C:
666 return kTRUE;
667 case kKey_H:
669 return kTRUE;
670 case kKey_N:
672 return kTRUE;
673 case kKey_T:
675 return kTRUE;
676 case kKey_W:
678 return kTRUE;
679 case kKey_Q:
681 return kTRUE;
682 default:
683 break;
684 }
685 }
686 }
688}
689
690////////////////////////////////////////////////////////////////////////////////
691/// Handle menu entries events.
692
694{
696 TString cmd;
697 static Int_t eNr = 1;
699 if (sender != fMenuFile)
700 return;
701 switch (id) {
702 case kBrowse:
703 new TBrowser();
704 break;
705 case kOpenFile:
706 {
708 static TString dir(".");
710 fi.fFileTypes = gOpenFileTypes;
711 fi.SetIniDir(dir);
712 new TGFileDialog(gClient->GetDefaultRoot(), this,
713 kFDOpen,&fi);
714 dir = fi.fIniDir;
715 if (fi.fMultipleSelection && fi.fFileNamesList) {
716 TObjString *el;
717 TIter next(fi.fFileNamesList);
718 while ((el = (TObjString *) next())) {
719 gROOT->ProcessLine(Form("new TFile(\"%s\");",
720 gSystem->UnixPathName(el->GetString())));
721 }
722 newfile = kTRUE;
723 }
724 else if (fi.fFilename) {
725 gROOT->ProcessLine(Form("new TFile(\"%s\");",
726 gSystem->UnixPathName(fi.fFilename)));
727 newfile = kTRUE;
728 }
729 if (fActBrowser && newfile) {
730 TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(fActBrowser);
731 if (fb) fb->Selected(0);
732 }
733 }
734 break;
735 // Handle Help menu items...
736 case kHelpAbout:
737 {
738#ifdef WIN32
740#else
741 char str[32];
742 snprintf(str, 32, "About ROOT %s...", gROOT->GetVersion());
743 hd = new TRootHelpDialog(this, str, 600, 400);
744 hd->SetText(gHelpAbout);
745 hd->Popup();
746#endif
747 }
748 break;
749 case kHelpOnCanvas:
750 hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
751 hd->SetText(gHelpCanvas);
752 hd->Popup();
753 break;
754 case kHelpOnMenus:
755 hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
756 hd->SetText(gHelpPullDownMenus);
757 hd->Popup();
758 break;
760 hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
761 hd->SetText(gHelpGraphicsEditor);
762 hd->Popup();
763 break;
764 case kHelpOnBrowser:
765 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
766 hd->SetText(gHelpBrowser);
767 hd->Popup();
768 break;
769 case kHelpOnObjects:
770 hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
771 hd->SetText(gHelpObjects);
772 hd->Popup();
773 break;
774 case kHelpOnPS:
775 hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
776 hd->SetText(gHelpPostscript);
777 hd->Popup();
778 break;
779 case kHelpOnRemote:
780 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
781 hd->SetText(gHelpRemote);
782 hd->Popup();
783 break;
784 case kClone:
785 CloneBrowser();
786 break;
787 case kNewEditor:
788 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot())");
789 ++eNr;
790 ExecPlugin(Form("Editor %d", eNr), "", cmd.Data(), 1);
791 break;
792 case kNewCanvas:
793 ExecPlugin("", "", "new TCanvas()", 1);
794 break;
795 case kExecPluginMacro:
796 {
797 static TString dir(".");
799 fi.fFileTypes = gPluginFileTypes;
800 fi.SetIniDir(dir);
801 new TGFileDialog(gClient->GetDefaultRoot(), this,
802 kFDOpen,&fi);
803 dir = fi.fIniDir;
804 if (fi.fFilename) {
805 ExecPlugin(0, fi.fFilename, 0, kRight);
806 }
807 }
808 break;
809 case kExecPluginCmd:
810 {
811 char command[1024];
812 strlcpy(command, "new TGLSAViewer(gClient->GetRoot(), 0);",
813 sizeof(command));
814 new TGInputDialog(gClient->GetRoot(), this,
815 "Enter plugin command line:",
817 if (strcmp(command, "")) {
818 ExecPlugin("User", 0, command, kRight);
819 }
820 }
821 break;
822 case kCloseTab:
824 break;
825 case kCloseWindow:
826 CloseWindow();
827 break;
828 case kQuitRoot:
829 CloseWindow();
831 break;
832 default:
833 break;
834 }
835}
836
837////////////////////////////////////////////////////////////////////////////////
838/// Initialize default plugins. Could be also of the form:
839/// StartEmbedding(0);
840/// TPluginHandler *ph;
841/// ph = gROOT->GetPluginManager()->FindHandler("TGClassBrowser");
842/// if (ph && ph->LoadPlugin() != -1) {
843/// ph->ExecPlugin(3, gClient->GetRoot(), 200, 500);
844/// }
845/// StopEmbedding();
846
848{
849 TString cmd;
850
851 if ((opt == 0) || (!opt[0]))
852 return;
853 // --- Left vertical area
854
855 // File Browser plugin
856 if (strchr(opt, 'F')) {
857 cmd.Form("new TGFileBrowser(gClient->GetRoot(), (TBrowser *)0x%zx, 200, 500);", (size_t)fBrowser);
858 ExecPlugin("Files", 0, cmd.Data(), 0);
860 }
861
862 // --- Right main area
863
864 Int_t i, len = strlen(opt);
865 for (i=0; i<len; ++i) {
866 // Editor plugin...
867 if (opt[i] == 'E') {
868 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot());");
869 ExecPlugin("Editor 1", 0, cmd.Data(), 1);
871 }
872
873 // Canvas plugin...
874 if (opt[i] == 'C') {
875 cmd.Form("new TCanvas();");
876 ExecPlugin("c1", 0, cmd.Data(), 1);
878 }
879
880 // GLViewer plugin...
881 if (opt[i] == 'G') {
882 cmd.Form("new TGLSAViewer(gClient->GetRoot(), 0);");
883 ExecPlugin("OpenGL", 0, cmd.Data(), 1);
885 }
886
887 }
888 // --- Right bottom area
889
890 // Command plugin...
891 if (strchr(opt, 'I')) {
892 cmd.Form("new TGCommandPlugin(gClient->GetRoot(), 700, 300);");
893 ExecPlugin("Command", 0, cmd.Data(), 2);
895 }
896
897 // --- Select first tab everywhere
898 SetTab(0, 0);
899 SetTab(1, 0);
900 SetTab(2, 0);
901}
902
903////////////////////////////////////////////////////////////////////////////////
904/// Check if the GUI factory is set to use the Web GUI.
905
907{
908 TString factory = gEnv->GetValue("Gui.Factory", "native");
909 return (factory.Contains("web", TString::kIgnoreCase));
910}
911
912////////////////////////////////////////////////////////////////////////////////
913/// Really delete the browser and the this GUI.
914
916{
918 delete this;
919}
920
921////////////////////////////////////////////////////////////////////////////////
922/// Recursively remove object from browser.
923
929
930////////////////////////////////////////////////////////////////////////////////
931/// Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
932
934{
935 TGMenuEntry *entry = 0;
936 TIter next(popup->GetListOfEntries());
937 while ((entry = (TGMenuEntry *)next())) {
938 if (entry->GetPopup()) {
939 RecursiveReparent(entry->GetPopup());
940 }
941 }
942 popup->ReparentWindow(gClient->GetDefaultRoot());
943}
944
945////////////////////////////////////////////////////////////////////////////////
946/// Refresh the actual browser contents.
947
953
954////////////////////////////////////////////////////////////////////////////////
955/// Remove tab element "subpos" from tab "pos".
956
958{
959 TGTab *edit = 0;
960 switch (pos) {
961 case kLeft: // left
962 edit = fTabLeft;
963 break;
964 case kRight: // right
965 edit = fTabRight;
967 fMenuFrame->GetList()->Remove(fActMenuBar);
968 fActMenuBar = 0;
969 break;
970 case kBottom: // bottom
972 break;
973 }
974 if (!edit || !edit->GetTabTab(subpos))
975 return;
976 const char *tabName = edit->GetTabTab(subpos)->GetString();
977 TObject *obj = 0;
978 if ((obj = fPlugins.FindObject(tabName))) {
979 fPlugins.Remove(obj);
980 }
981 TGFrameElement *el = 0;
982 if (edit->GetTabContainer(subpos))
983 el = (TGFrameElement *)edit->GetTabContainer(subpos)->GetList()->First();
984 if (el && el->fFrame) {
985 el->fFrame->Disconnect("ProcessedConfigure(Event_t*)");
986 el->fFrame->SetFrameElement(0);
987 if (el->fFrame->InheritsFrom("TGMainFrame")) {
988 Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
989 ((TGMainFrame *)el->fFrame)->CloseWindow();
990 if (sleep)
991 gSystem->Sleep(150);
993 }
994 else
995 delete el->fFrame;
996 el->fFrame = 0;
997 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
998 (el->fLayout->References() > 0)) {
999 el->fLayout->RemoveReference();
1000 if (!el->fLayout->References()) {
1001 delete el->fLayout;
1002 }
1003 }
1004 edit->GetTabContainer(subpos)->GetList()->Remove(el);
1005 delete el;
1006 }
1007 fNbTab[pos]--;
1008 edit->RemoveTab(subpos);
1009 SwitchMenus(edit->GetTabContainer(edit->GetCurrent()));
1010}
1011
1012////////////////////////////////////////////////////////////////////////////////
1013/// Switch to Tab "subpos" in TGTab "pos".
1014
1016{
1017 TGTab *tab = GetTab(pos);
1018 if (subpos == -1)
1019 subpos = fCrTab[pos];
1020
1021 if (tab && tab->SetTab(subpos, kFALSE)) { // Block signal emit
1022 if (pos == kRight)
1023 SwitchMenus(tab->GetTabContainer(subpos));
1024 tab->Layout();
1025 }
1026}
1027
1028////////////////////////////////////////////////////////////////////////////////
1029/// Set text "title" of Tab "subpos" in TGTab "pos".
1030
1031void TRootBrowser::SetTabTitle(const char *title, Int_t pos, Int_t subpos)
1032{
1033 TBrowserPlugin *p = 0;
1034 TGTab *edit = GetTab(pos);
1035 if (!edit) return;
1036 if (subpos == -1)
1037 subpos = fCrTab[pos];
1038
1039 TGTabElement *el = edit->GetTabTab(subpos);
1040 if (el) {
1041 el->SetText(new TGString(title));
1042 edit->Layout();
1043 if ((p = (TBrowserPlugin *)fPlugins.FindObject(title)))
1044 p->SetName(title);
1045 }
1046}
1047
1048////////////////////////////////////////////////////////////////////////////////
1049/// Set text in column col in status bar.
1050
1052{
1054}
1055
1056////////////////////////////////////////////////////////////////////////////////
1057/// Show the selected frame's menu and hide previous one.
1058
1060{
1061 TGFrameElement *el = 0;
1062 // temporary solution until I find a proper way to handle
1063 // these bloody menus...
1064 fBindList->Delete();
1066 while ((el = (TGFrameElement *) nextm())) {
1067 TGMenuTitle *t = (TGMenuTitle *) el->fFrame;
1068 Int_t code = t->GetHotKeyCode();
1077 }
1080 menu->Layout();
1081 fMenuFrame->Layout();
1082 fActMenuBar = menu;
1083}
1084
1085////////////////////////////////////////////////////////////////////////////////
1086/// Start embedding external frame in the tab "pos" and tab element "subpos".
1087
1089{
1090 fEditTab = GetTab(pos);
1091 if (!fEditTab) return;
1092 fEditPos = pos;
1094
1095 if (fEditFrame == 0) {
1096 if (subpos == -1) {
1097 fCrTab[pos] = fNbTab[pos]++;
1098 fEditFrame = fEditTab->AddTab(Form("Tab %d",fNbTab[pos]));
1102 if(tabel) {
1103 tabel->MapWindow();
1104 if (fShowCloseTab && (pos == 1))
1105 tabel->ShowClose();
1106 }
1108 fEditTab->Layout();
1109 }
1110 else {
1111 fCrTab[pos] = subpos;
1114 }
1116 }
1117}
1118
1119////////////////////////////////////////////////////////////////////////////////
1120/// Stop embedding external frame in the current editable frame.
1121
1123{
1124 if (fEditFrame != 0) {
1127 if (el && el->fFrame) {
1128 // let be notified when the inside frame gets resized, and tell its
1129 // container to recompute its layout
1130 el->fFrame->Connect("ProcessedConfigure(Event_t*)", "TGCompositeFrame",
1131 fEditFrame, "Layout()");
1132 }
1133 if (layout) {
1134 el = (TGFrameElement*) fEditFrame->GetList()->Last();
1135 // !!!! MT what to do with the old layout? Leak it for now ...
1136 if (el) el->fLayout = layout;
1137 }
1138 fEditFrame->Layout();
1139 if (fEditTab == fTabRight)
1141 }
1142 if (name && strlen(name)) {
1144 }
1146 fEditFrame = fEditTab = 0;
1147 fEditPos = fEditSubPos = -1;
1148}
1149
1150////////////////////////////////////////////////////////////////////////////////
1151/// Move the menu from original frame to our TGMenuFrame, or display the
1152/// menu associated to the current tab.
1153
1155{
1156 if (from == 0)
1157 return;
1158 TGFrameElement *fe = (TGFrameElement *)from->GetList()->First();
1159 if (!fe) {
1160 if (fActMenuBar != fMenuBar)
1162 return;
1163 }
1165 TGFrameElement *el = 0;
1166 if (embed && embed->GetList()) {
1167 TIter next(embed->GetList());
1168 while ((el = (TGFrameElement *)next())) {
1169 if (el->fFrame->InheritsFrom("TGMenuBar")) {
1170 TGMenuBar *menu = (TGMenuBar *)el->fFrame;
1171 if (fActMenuBar == menu)
1172 return;
1175 while ((nw = (TGFrameElement *) nel())) {
1176 if (nw->fFrame == menu) {
1177 ShowMenu(menu);
1178 return;
1179 }
1180 }
1181 ((TGCompositeFrame *)menu->GetParent())->HideFrame(menu);
1182 ((TGCompositeFrame *)menu->GetParent())->SetCleanup(kNoCleanup);
1183 menu->ReparentWindow(fMenuFrame);
1186 TIter mnext(menu->GetList());
1187 while ((mel = (TGFrameElement *) mnext())) {
1188 TGMenuTitle *t = (TGMenuTitle *) mel->fFrame;
1189 TGPopupMenu *popup = menu->GetPopup(t->GetName());
1190 if (popup) {
1192 if (popup->GetEntry("Close Canvas")) {
1193 TGMenuEntry *exit = popup->GetEntry("Close Canvas");
1194 popup->HideEntry(exit->GetEntryId());
1195 }
1196 if (popup->GetEntry("Close Viewer")) {
1197 TGMenuEntry *exit = popup->GetEntry("Close Viewer");
1198 popup->HideEntry(exit->GetEntryId());
1199 }
1200 if (popup->GetEntry("Quit ROOT")) {
1201 TGMenuEntry *exit = popup->GetEntry("Quit ROOT");
1202 popup->HideEntry(exit->GetEntryId());
1203 }
1204 if (popup->GetEntry("Exit")) {
1205 TGMenuEntry *exit = popup->GetEntry("Exit");
1206 popup->HideEntry(exit->GetEntryId());
1207 }
1208 }
1209 }
1210 ShowMenu(menu);
1211 return;
1212 }
1213 }
1214 }
1215 if (fActMenuBar != fMenuBar)
1217}
1218
1219////////////////////////////////////////////////////////////////////////////////
1220/// Emits signal when double clicking on icon.
1221
1223{
1224 Emit("DoubleClicked(TObject*)", (Longptr_t)obj);
1225}
1226
1227////////////////////////////////////////////////////////////////////////////////
1228/// Emits signal when double clicking on icon.
1229
1231{
1232 Longptr_t args[2];
1233
1234 args[0] = (Longptr_t)obj;
1235 args[1] = checked;
1236
1237 Emit("Checked(TObject*,Bool_t)", args);
1238}
1239
1240////////////////////////////////////////////////////////////////////////////////
1241/// Emits signal "ExecuteDefaultAction(TObject*)".
1242
1244{
1245 Emit("ExecuteDefaultAction(TObject*)", (Longptr_t)obj);
1246}
1247
1248
1249////////////////////////////////////////////////////////////////////////////////
1250/// static constructor returning TBrowserImp,
1251/// as needed by the plugin mechanism.
1252
1255 Option_t *opt)
1256{
1257 TRootBrowser *browser = new TRootBrowser(b, title, width, height, opt);
1258 return (TBrowserImp *)browser;
1259}
1260
1261////////////////////////////////////////////////////////////////////////////////
1262/// static constructor returning TBrowserImp,
1263/// as needed by the plugin mechanism.
1264
1267 Option_t *opt)
1268{
1269 TRootBrowser *browser = new TRootBrowser(b, title, x, y, width, height, opt);
1270 return (TBrowserImp *)browser;
1271}
@ 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:2571
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:548
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:2460
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