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