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);
212 fMenuFile->AddEntry("New &HTML\tCtrl+H", kNewHtml);
216 fMenuExecPlugin->AddEntry("&Command...", kExecPluginCmd);
217 fMenuFile->AddPopup("Execute &Plugin...", fMenuExecPlugin);
219 fMenuFile->AddEntry("Close &Tab\tCtrl+T", kCloseTab);
220 fMenuFile->AddEntry("Close &Window\tCtrl+W", kCloseWindow);
222 fMenuFile->AddEntry("&Quit Root\tCtrl+Q", kQuitRoot);
223 fMenuBar->AddPopup("&Browser", fMenuFile, fLH1);
224 fMenuFile->Connect("Activated(Int_t)", "TRootBrowser", this,
225 "HandleMenu(Int_t)");
228
229 if (!TClass::GetClass("TGHtmlBrowser"))
231
234
237
238 // Toolbar Frame
242
243 fHf = new TGHorizontalFrame(fVf, 100, 100);
244 // Tabs & co...
245#if defined(R__HAS_COCOA)
246 fV1 = new TGVerticalFrame(fHf, 252, 100, kFixedWidth);
247#else
248 fV1 = new TGVerticalFrame(fHf, 250, 100, kFixedWidth);
249#endif
250 fV2 = new TGVerticalFrame(fHf, 600, 100);
251 fH1 = new TGHorizontalFrame(fV2, 100, 100);
252 fH2 = new TGHorizontalFrame(fV2, 100, 100, kFixedHeight);
253
254 // Left tab
255 fTabLeft = new TGTab(fV1,100,100);
256 //fTabLeft->AddTab("Tab 1");
259
260 // Vertical splitter
261 fVSplitter = new TGVSplitter(fHf, 4, 4);
263 fHf->AddFrame(fV1, fLH7);
265
266 // Right tab
267 fTabRight = new TGTab(fH1, 500, 100);
268 //fTabRight->AddTab("Tab 1");
271 fTabRight->Connect("Selected(Int_t)", "TRootBrowser", this, "DoTab(Int_t)");
272 fTabRight->Connect("CloseTab(Int_t)", "TRootBrowser", this, "CloseTab(Int_t)");
273 fV2->AddFrame(fH1, fLH4);
274
275 // Horizontal splitter
276 fHSplitter = new TGHSplitter(fV2, 4, 4);
278
279 // Bottom tab
280 fTabBottom = new TGTab(fH2, 100, 100);
281 //fTabBottom->AddTab("Tab 1");
283 fV2->AddFrame(fH2, fLH3);
284
286 fHf->AddFrame(fV2, fLH5);
287 fVf->AddFrame(fHf, fLH5);
288 AddFrame(fVf, fLH5);
289
290 // status bar
291 fStatusBar = new TGStatusBar(this, 400, 20);
292 int parts[] = { 33, 10, 10, 47 };
295
296 fNbInitPlugins = 0;
297 fEditFrame = 0;
298 fEditTab = 0;
299 fEditPos = -1;
300 fEditSubPos= -1;
301 fNbTab[0] = fNbTab[1] = fNbTab[2] = 0;
302 fCrTab[0] = fCrTab[1] = fCrTab[2] = -1;
303
304 // Set a name to the main frame
307 fIconPic = SetIconPixmap("rootdb_s.xpm");
308 SetClassHints("ROOT", "Browser");
309
310 if (!strcmp(gROOT->GetDefCanvasName(), "c1"))
311 gROOT->SetDefCanvasName("Canvas_1");
312
313 SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
317
319}
320
321////////////////////////////////////////////////////////////////////////////////
322/// Clean up all widgets, frames and layouthints that were used
323
325{
326 if (fIconPic) gClient->FreePicture(fIconPic);
327 delete fLH0;
328 delete fLH1;
329 delete fLH2;
330 delete fLH3;
331 delete fLH4;
332 delete fLH5;
333 delete fLH6;
334 delete fLH7;
335 delete fMenuHelp;
336 delete fMenuExecPlugin;
337 delete fMenuFile;
338 delete fMenuBar;
339 delete fMenuFrame;
340 delete fPreMenuFrame;
341 delete fTopMenuFrame;
342 delete fToolbarFrame;
343 delete fVSplitter;
344 delete fHSplitter;
345 delete fTabLeft;
346 delete fTabRight;
347 delete fTabBottom;
348 delete fH1;
349 delete fH2;
350 delete fV1;
351 delete fV2;
352 delete fHf;
353 delete fStatusBar;
354 delete fVf;
355}
356
357////////////////////////////////////////////////////////////////////////////////
358/// Add items to the actual browser. This function has to be called
359/// by the Browse() member function of objects when they are
360/// called by a browser. If check < 0 (default) no check box is drawn,
361/// if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
362
363void TRootBrowser::Add(TObject *obj, const char *name, Int_t check)
364{
365 if (obj->InheritsFrom("TObjectSpy"))
366 return;
367 if (fActBrowser)
368 fActBrowser->Add(obj, name, check);
369}
370
371////////////////////////////////////////////////////////////////////////////////
372/// Browse object. This, in turn, will trigger the calling of
373/// TRootBrowser::Add() which will fill the IconBox and the tree.
374/// Emits signal "BrowseObj(TObject*)".
375
377{
378 if (fActBrowser)
380 Emit("BrowseObj(TObject*)", (Longptr_t)obj);
381}
382
383////////////////////////////////////////////////////////////////////////////////
384/// Clone the browser. A new Browser will be created, with the same
385/// plugins executed in the current one.
386
388{
389 Int_t loop = 1;
391 TBrowser *b = new TBrowser();
392 TIter next(&fPlugins);
393 while ((plugin = (TBrowserPlugin *)next())) {
394 if (loop > fNbInitPlugins)
395 b->ExecPlugin(plugin->GetName(), "", plugin->fCommand.Data(), plugin->fTab,
396 plugin->fSubTab);
397 ++loop;
398 }
399}
400
401////////////////////////////////////////////////////////////////////////////////
402/// Remove tab element id from right tab.
403
405{
406 RemoveTab(kRight, id);
407}
408
409////////////////////////////////////////////////////////////////////////////////
410/// Properly close the mainframes embedded in the different tabs
411
413{
416 Int_t i;
417 TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
418 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
419 Disconnect(fMenuFile, "Activated(Int_t)", this, "HandleMenu(Int_t)");
420 Disconnect(fTabRight, "Selected(Int_t)", this, "DoTab(Int_t)");
421 if (fPlugins.IsEmpty()) return;
422 fActBrowser = 0;
423 for (i=0;i<fTabLeft->GetNumberOfTabs();i++) {
425 if (!container) continue;
426 el = (TGFrameElement *)container->GetList()->First();
427 if (el && el->fFrame) {
428 el->fFrame->SetFrameElement(0);
429 if (el->fFrame->InheritsFrom("TVirtualPadEditor")) {
431 }
432 else if (el->fFrame->InheritsFrom("TGMainFrame")) {
433 el->fFrame->UnmapWindow();
434 ((TGMainFrame *)el->fFrame)->CloseWindow();
436 }
437 else
438 delete el->fFrame;
439 el->fFrame = 0;
440 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
441 (el->fLayout->References() > 0)) {
442 el->fLayout->RemoveReference();
443 if (!el->fLayout->References()) {
444 delete el->fLayout;
445 }
446 }
447 container->GetList()->Remove(el);
448 delete el;
449 }
450 }
451 for (i=0;i<fTabRight->GetNumberOfTabs();i++) {
453 if (!container) continue;
454 el = (TGFrameElement *)container->GetList()->First();
455 if (el && el->fFrame) {
456 el->fFrame->SetFrameElement(0);
457 if (el->fFrame->InheritsFrom("TGMainFrame")) {
458 el->fFrame->UnmapWindow();
459 Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
460 if (sleep)
461 gSystem->Sleep(150);
462 ((TGMainFrame *)el->fFrame)->CloseWindow();
463 if (sleep)
464 gSystem->Sleep(150);
466 }
467 else
468 delete el->fFrame;
469 el->fFrame = 0;
470 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
471 (el->fLayout->References() > 0)) {
472 el->fLayout->RemoveReference();
473 if (!el->fLayout->References()) {
474 delete el->fLayout;
475 }
476 }
477 container->GetList()->Remove(el);
478 delete el;
479 }
480 }
481 for (i=0;i<fTabBottom->GetNumberOfTabs();i++) {
483 if (!container) continue;
484 el = (TGFrameElement *)container->GetList()->First();
485 if (el && el->fFrame) {
486 el->fFrame->SetFrameElement(0);
487 if (el->fFrame->InheritsFrom("TGMainFrame")) {
488 el->fFrame->UnmapWindow();
489 ((TGMainFrame *)el->fFrame)->CloseWindow();
490 gSystem->Sleep(150);
492 }
493 else
494 delete el->fFrame;
495 el->fFrame = 0;
496 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
497 (el->fLayout->References() > 0)) {
498 el->fLayout->RemoveReference();
499 if (!el->fLayout->References()) {
500 delete el->fLayout;
501 }
502 }
503 container->GetList()->Remove(el);
504 delete el;
505 }
506 }
508 Emit("CloseWindow()");
509}
510
511////////////////////////////////////////////////////////////////////////////////
512/// Called when window is closed via the window manager.
513
515{
516 TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
517 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
518 CloseTabs();
519 DeleteWindow();
520}
521
522////////////////////////////////////////////////////////////////////////////////
523/// Handle Tab navigation.
524
526{
528 if ((sender) && (sender == fTabRight)) {
529 SwitchMenus(sender->GetTabContainer(id));
530 }
531}
532
533////////////////////////////////////////////////////////////////////////////////
534/// Display a tooltip with infos about the primitive below the cursor.
535
536void TRootBrowser::EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
537{
538 const Int_t kTMAX=256;
539 static char atext[kTMAX];
540 if (selected == 0 || event == kMouseLeave) {
541 SetStatusText("", 0);
542 SetStatusText("", 1);
543 SetStatusText("", 2);
544 SetStatusText("", 3);
545 return;
546 }
547 SetStatusText(selected->GetTitle(), 0);
548 SetStatusText(selected->GetName(), 1);
549 if (event == kKeyPress)
550 snprintf(atext, kTMAX, "%c", (char) px);
551 else
552 snprintf(atext, kTMAX, "%d,%d", px, py);
554 SetStatusText(selected->GetObjectInfo(px,py), 3);
555}
556
557////////////////////////////////////////////////////////////////////////////////
558/// Execute a macro and embed the created frame in the tab "pos"
559/// and tab element "subpos".
560
562 const char *cmd, Int_t pos, Int_t subpos)
563{
564 Longptr_t retval = 0;
567 if (cmd && strlen(cmd)) {
568 command = cmd;
569 if (name) pname = name;
570 else pname = TString::Format("Plugin %d", fPlugins.GetSize());
571 p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
572 }
573 else if (fname && strlen(fname)) {
575 Ssiz_t t = pname.Last('.');
576 if (t > 0) pname.Remove(t);
577 command.Form("gROOT->Macro(\"%s\");", gSystem->UnixPathName(fname));
578 p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
579 }
580 else return 0;
581
582 Bool_t new_canvas = command.Contains("new TCanvas");
583 Bool_t is_web_canvas = strcmp(gEnv->GetValue("Canvas.Name", ""), "TWebCanvas") == 0;
584
586 return gROOT->ProcessLine(command.Data());
587
589 gEnv->SetValue("Canvas.Name", "TRootCanvas");
590
592 fPlugins.Add(p);
593 retval = gROOT->ProcessLine(command.Data());
594 if (new_canvas) {
595 pname = gPad->GetName();
596 p->SetName(pname.Data());
597 if (is_web_canvas)
598 gEnv->SetValue("Canvas.Name", "TWebCanvas");
599 }
600 SetTabTitle(pname.Data(), pos, subpos);
602 return retval;
603}
604
605////////////////////////////////////////////////////////////////////////////////
606/// Returns drawing option.
607
609{
610 if (fActBrowser)
611 return fActBrowser->GetDrawOption();
612 return 0;
613}
614
615////////////////////////////////////////////////////////////////////////////////
616/// Returns the TGTab at position pos.
617
619{
620 switch (pos) {
621 case kLeft: return fTabLeft;
622 case kRight: return fTabRight;
623 case kBottom: return fTabBottom;
624 default: return 0;
625 }
626}
627
628////////////////////////////////////////////////////////////////////////////////
629/// Handle keyboard events.
630
632{
633 char input[10];
635
636 if (event->fType == kGKeyPress) {
637 gVirtualX->LookupString(event, input, sizeof(input), keysym);
638
639 if (!event->fState && (EKeySym)keysym == kKey_F5) {
640 Refresh(kTRUE);
641 return kTRUE;
642 }
643 switch ((EKeySym)keysym) { // ignore these keys
644 case kKey_Shift:
645 case kKey_Control:
646 case kKey_Meta:
647 case kKey_Alt:
648 case kKey_CapsLock:
649 case kKey_NumLock:
650 case kKey_ScrollLock:
651 return kTRUE;
652 default:
653 break;
654 }
655 if (event->fState & kKeyControlMask) { // Cntrl key modifier pressed
656 switch ((EKeySym)keysym & ~0x20) { // treat upper and lower the same
657 case kKey_B:
659 return kTRUE;
660 case kKey_O:
662 return kTRUE;
663 case kKey_E:
665 return kTRUE;
666 case kKey_C:
668 return kTRUE;
669 case kKey_H:
671 return kTRUE;
672 case kKey_N:
674 return kTRUE;
675 case kKey_T:
677 return kTRUE;
678 case kKey_W:
680 return kTRUE;
681 case kKey_Q:
683 return kTRUE;
684 default:
685 break;
686 }
687 }
688 }
689 return TGMainFrame::HandleKey(event);
690}
691
692////////////////////////////////////////////////////////////////////////////////
693/// Handle menu entries events.
694
696{
698 TString cmd;
699 static Int_t eNr = 1;
701 if (sender != fMenuFile)
702 return;
703 switch (id) {
704 case kBrowse:
705 new TBrowser();
706 break;
707 case kOpenFile:
708 {
710 static TString dir(".");
712 fi.fFileTypes = gOpenFileTypes;
713 fi.SetIniDir(dir);
714 new TGFileDialog(gClient->GetDefaultRoot(), this,
715 kFDOpen,&fi);
716 dir = fi.fIniDir;
717 if (fi.fMultipleSelection && fi.fFileNamesList) {
718 TObjString *el;
719 TIter next(fi.fFileNamesList);
720 while ((el = (TObjString *) next())) {
721 gROOT->ProcessLine(Form("new TFile(\"%s\");",
722 gSystem->UnixPathName(el->GetString())));
723 }
724 newfile = kTRUE;
725 }
726 else if (fi.fFilename) {
727 gROOT->ProcessLine(Form("new TFile(\"%s\");",
728 gSystem->UnixPathName(fi.fFilename)));
729 newfile = kTRUE;
730 }
731 if (fActBrowser && newfile) {
732 TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(fActBrowser);
733 if (fb) fb->Selected(0);
734 }
735 }
736 break;
737 // Handle Help menu items...
738 case kHelpAbout:
739 {
740#ifdef WIN32
742#else
743 char str[32];
744 snprintf(str, 32, "About ROOT %s...", gROOT->GetVersion());
745 hd = new TRootHelpDialog(this, str, 600, 400);
746 hd->SetText(gHelpAbout);
747 hd->Popup();
748#endif
749 }
750 break;
751 case kHelpOnCanvas:
752 hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
753 hd->SetText(gHelpCanvas);
754 hd->Popup();
755 break;
756 case kHelpOnMenus:
757 hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
758 hd->SetText(gHelpPullDownMenus);
759 hd->Popup();
760 break;
762 hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
763 hd->SetText(gHelpGraphicsEditor);
764 hd->Popup();
765 break;
766 case kHelpOnBrowser:
767 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
768 hd->SetText(gHelpBrowser);
769 hd->Popup();
770 break;
771 case kHelpOnObjects:
772 hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
773 hd->SetText(gHelpObjects);
774 hd->Popup();
775 break;
776 case kHelpOnPS:
777 hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
778 hd->SetText(gHelpPostscript);
779 hd->Popup();
780 break;
781 case kHelpOnRemote:
782 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
783 hd->SetText(gHelpRemote);
784 hd->Popup();
785 break;
786 case kClone:
787 CloneBrowser();
788 break;
789 case kNewEditor:
790 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot())");
791 ++eNr;
792 ExecPlugin(Form("Editor %d", eNr), "", cmd.Data(), 1);
793 break;
794 case kNewCanvas:
795 ExecPlugin("", "", "new TCanvas()", 1);
796 break;
797 case kNewHtml:
798 cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot())",
799 gEnv->GetValue("Browser.StartUrl", "http://root.cern.ch"));
800 ExecPlugin("HTML", "", cmd.Data(), 1);
801 break;
802 case kExecPluginMacro:
803 {
804 static TString dir(".");
806 fi.fFileTypes = gPluginFileTypes;
807 fi.SetIniDir(dir);
808 new TGFileDialog(gClient->GetDefaultRoot(), this,
809 kFDOpen,&fi);
810 dir = fi.fIniDir;
811 if (fi.fFilename) {
812 ExecPlugin(0, fi.fFilename, 0, kRight);
813 }
814 }
815 break;
816 case kExecPluginCmd:
817 {
818 char command[1024];
819 strlcpy(command, "new TGLSAViewer(gClient->GetRoot(), 0);",
820 sizeof(command));
821 new TGInputDialog(gClient->GetRoot(), this,
822 "Enter plugin command line:",
824 if (strcmp(command, "")) {
825 ExecPlugin("User", 0, command, kRight);
826 }
827 }
828 break;
829 case kCloseTab:
831 break;
832 case kCloseWindow:
833 CloseWindow();
834 break;
835 case kQuitRoot:
836 CloseWindow();
838 break;
839 default:
840 break;
841 }
842}
843
844////////////////////////////////////////////////////////////////////////////////
845/// Initialize default plugins. Could be also of the form:
846/// StartEmbedding(0);
847/// TPluginHandler *ph;
848/// ph = gROOT->GetPluginManager()->FindHandler("TGClassBrowser");
849/// if (ph && ph->LoadPlugin() != -1) {
850/// ph->ExecPlugin(3, gClient->GetRoot(), 200, 500);
851/// }
852/// StopEmbedding();
853
855{
856 TString cmd;
857
858 if ((opt == 0) || (!opt[0]))
859 return;
860 // --- Left vertical area
861
862 // File Browser plugin
863 if (strchr(opt, 'F')) {
864 cmd.Form("new TGFileBrowser(gClient->GetRoot(), (TBrowser *)0x%zx, 200, 500);", (size_t)fBrowser);
865 ExecPlugin("Files", 0, cmd.Data(), 0);
867 }
868
869 // --- Right main area
870
871 Int_t i, len = strlen(opt);
872 for (i=0; i<len; ++i) {
873 // Editor plugin...
874 if (opt[i] == 'E') {
875 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot());");
876 ExecPlugin("Editor 1", 0, cmd.Data(), 1);
878 }
879
880 // HTML plugin...
881 if (opt[i] == 'H') {
882 if (gSystem->Load("libGuiHtml") >= 0) {
883 cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot());",
884 gEnv->GetValue("Browser.StartUrl",
885 "https://root.cern.ch/doc/master/classes.html"));
886 ExecPlugin("HTML", 0, cmd.Data(), 1);
888 }
889 }
890
891 // Canvas plugin...
892 if (opt[i] == 'C') {
893 cmd.Form("new TCanvas();");
894 ExecPlugin("c1", 0, cmd.Data(), 1);
896 }
897
898 // GLViewer plugin...
899 if (opt[i] == 'G') {
900 cmd.Form("new TGLSAViewer(gClient->GetRoot(), 0);");
901 ExecPlugin("OpenGL", 0, cmd.Data(), 1);
903 }
904
905 }
906 // --- Right bottom area
907
908 // Command plugin...
909 if (strchr(opt, 'I')) {
910 cmd.Form("new TGCommandPlugin(gClient->GetRoot(), 700, 300);");
911 ExecPlugin("Command", 0, cmd.Data(), 2);
913 }
914
915 // --- Select first tab everywhere
916 SetTab(0, 0);
917 SetTab(1, 0);
918 SetTab(2, 0);
919}
920
921////////////////////////////////////////////////////////////////////////////////
922/// Check if the GUI factory is set to use the Web GUI.
923
925{
926 TString factory = gEnv->GetValue("Gui.Factory", "native");
927 return (factory.Contains("web", TString::kIgnoreCase));
928}
929
930////////////////////////////////////////////////////////////////////////////////
931/// Really delete the browser and the this GUI.
932
934{
936 delete this;
937}
938
939////////////////////////////////////////////////////////////////////////////////
940/// Recursively remove object from browser.
941
947
948////////////////////////////////////////////////////////////////////////////////
949/// Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
950
952{
953 TGMenuEntry *entry = 0;
954 TIter next(popup->GetListOfEntries());
955 while ((entry = (TGMenuEntry *)next())) {
956 if (entry->GetPopup()) {
957 RecursiveReparent(entry->GetPopup());
958 }
959 }
960 popup->ReparentWindow(gClient->GetDefaultRoot());
961}
962
963////////////////////////////////////////////////////////////////////////////////
964/// Refresh the actual browser contents.
965
971
972////////////////////////////////////////////////////////////////////////////////
973/// Remove tab element "subpos" from tab "pos".
974
976{
977 TGTab *edit = 0;
978 switch (pos) {
979 case kLeft: // left
980 edit = fTabLeft;
981 break;
982 case kRight: // right
983 edit = fTabRight;
985 fMenuFrame->GetList()->Remove(fActMenuBar);
986 fActMenuBar = 0;
987 break;
988 case kBottom: // bottom
990 break;
991 }
992 if (!edit || !edit->GetTabTab(subpos))
993 return;
994 const char *tabName = edit->GetTabTab(subpos)->GetString();
995 TObject *obj = 0;
996 if ((obj = fPlugins.FindObject(tabName))) {
997 fPlugins.Remove(obj);
998 }
999 TGFrameElement *el = 0;
1000 if (edit->GetTabContainer(subpos))
1001 el = (TGFrameElement *)edit->GetTabContainer(subpos)->GetList()->First();
1002 if (el && el->fFrame) {
1003 el->fFrame->Disconnect("ProcessedConfigure(Event_t*)");
1004 el->fFrame->SetFrameElement(0);
1005 if (el->fFrame->InheritsFrom("TGMainFrame")) {
1006 Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
1007 ((TGMainFrame *)el->fFrame)->CloseWindow();
1008 if (sleep)
1009 gSystem->Sleep(150);
1011 }
1012 else
1013 delete el->fFrame;
1014 el->fFrame = 0;
1015 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
1016 (el->fLayout->References() > 0)) {
1017 el->fLayout->RemoveReference();
1018 if (!el->fLayout->References()) {
1019 delete el->fLayout;
1020 }
1021 }
1022 edit->GetTabContainer(subpos)->GetList()->Remove(el);
1023 delete el;
1024 }
1025 fNbTab[pos]--;
1026 edit->RemoveTab(subpos);
1027 SwitchMenus(edit->GetTabContainer(edit->GetCurrent()));
1028}
1029
1030////////////////////////////////////////////////////////////////////////////////
1031/// Switch to Tab "subpos" in TGTab "pos".
1032
1034{
1035 TGTab *tab = GetTab(pos);
1036 if (subpos == -1)
1037 subpos = fCrTab[pos];
1038
1039 if (tab && tab->SetTab(subpos, kFALSE)) { // Block signal emit
1040 if (pos == kRight)
1041 SwitchMenus(tab->GetTabContainer(subpos));
1042 tab->Layout();
1043 }
1044}
1045
1046////////////////////////////////////////////////////////////////////////////////
1047/// Set text "title" of Tab "subpos" in TGTab "pos".
1048
1049void TRootBrowser::SetTabTitle(const char *title, Int_t pos, Int_t subpos)
1050{
1051 TBrowserPlugin *p = 0;
1052 TGTab *edit = GetTab(pos);
1053 if (!edit) return;
1054 if (subpos == -1)
1055 subpos = fCrTab[pos];
1056
1057 TGTabElement *el = edit->GetTabTab(subpos);
1058 if (el) {
1059 el->SetText(new TGString(title));
1060 edit->Layout();
1061 if ((p = (TBrowserPlugin *)fPlugins.FindObject(title)))
1062 p->SetName(title);
1063 }
1064}
1065
1066////////////////////////////////////////////////////////////////////////////////
1067/// Set text in column col in status bar.
1068
1070{
1071 fStatusBar->SetText(txt, col);
1072}
1073
1074////////////////////////////////////////////////////////////////////////////////
1075/// Show the selected frame's menu and hide previous one.
1076
1078{
1079 TGFrameElement *el = 0;
1080 // temporary solution until I find a proper way to handle
1081 // these bloody menus...
1082 fBindList->Delete();
1084 while ((el = (TGFrameElement *) nextm())) {
1085 TGMenuTitle *t = (TGMenuTitle *) el->fFrame;
1086 Int_t code = t->GetHotKeyCode();
1095 }
1098 menu->Layout();
1099 fMenuFrame->Layout();
1100 fActMenuBar = menu;
1101}
1102
1103////////////////////////////////////////////////////////////////////////////////
1104/// Start embedding external frame in the tab "pos" and tab element "subpos".
1105
1107{
1108 fEditTab = GetTab(pos);
1109 if (!fEditTab) return;
1110 fEditPos = pos;
1112
1113 if (fEditFrame == 0) {
1114 if (subpos == -1) {
1115 fCrTab[pos] = fNbTab[pos]++;
1116 fEditFrame = fEditTab->AddTab(Form("Tab %d",fNbTab[pos]));
1120 if(tabel) {
1121 tabel->MapWindow();
1122 if (fShowCloseTab && (pos == 1))
1123 tabel->ShowClose();
1124 }
1126 fEditTab->Layout();
1127 }
1128 else {
1129 fCrTab[pos] = subpos;
1132 }
1134 }
1135}
1136
1137////////////////////////////////////////////////////////////////////////////////
1138/// Stop embedding external frame in the current editable frame.
1139
1141{
1142 if (fEditFrame != 0) {
1145 if (el && el->fFrame) {
1146 // let be notified when the inside frame gets resized, and tell its
1147 // container to recompute its layout
1148 el->fFrame->Connect("ProcessedConfigure(Event_t*)", "TGCompositeFrame",
1149 fEditFrame, "Layout()");
1150 }
1151 if (layout) {
1152 el = (TGFrameElement*) fEditFrame->GetList()->Last();
1153 // !!!! MT what to do with the old layout? Leak it for now ...
1154 if (el) el->fLayout = layout;
1155 }
1156 fEditFrame->Layout();
1157 if (fEditTab == fTabRight)
1159 }
1160 if (name && strlen(name)) {
1162 }
1164 fEditFrame = fEditTab = 0;
1165 fEditPos = fEditSubPos = -1;
1166}
1167
1168////////////////////////////////////////////////////////////////////////////////
1169/// Move the menu from original frame to our TGMenuFrame, or display the
1170/// menu associated to the current tab.
1171
1173{
1174 if (from == 0)
1175 return;
1176 TGFrameElement *fe = (TGFrameElement *)from->GetList()->First();
1177 if (!fe) {
1178 if (fActMenuBar != fMenuBar)
1180 return;
1181 }
1183 TGFrameElement *el = 0;
1184 if (embed && embed->GetList()) {
1185 TIter next(embed->GetList());
1186 while ((el = (TGFrameElement *)next())) {
1187 if (el->fFrame->InheritsFrom("TGMenuBar")) {
1188 TGMenuBar *menu = (TGMenuBar *)el->fFrame;
1189 if (fActMenuBar == menu)
1190 return;
1193 while ((nw = (TGFrameElement *) nel())) {
1194 if (nw->fFrame == menu) {
1195 ShowMenu(menu);
1196 return;
1197 }
1198 }
1199 ((TGCompositeFrame *)menu->GetParent())->HideFrame(menu);
1200 ((TGCompositeFrame *)menu->GetParent())->SetCleanup(kNoCleanup);
1201 menu->ReparentWindow(fMenuFrame);
1204 TIter mnext(menu->GetList());
1205 while ((mel = (TGFrameElement *) mnext())) {
1206 TGMenuTitle *t = (TGMenuTitle *) mel->fFrame;
1207 TGPopupMenu *popup = menu->GetPopup(t->GetName());
1208 if (popup) {
1210 if (popup->GetEntry("Close Canvas")) {
1211 TGMenuEntry *exit = popup->GetEntry("Close Canvas");
1212 popup->HideEntry(exit->GetEntryId());
1213 }
1214 if (popup->GetEntry("Close Viewer")) {
1215 TGMenuEntry *exit = popup->GetEntry("Close Viewer");
1216 popup->HideEntry(exit->GetEntryId());
1217 }
1218 if (popup->GetEntry("Quit ROOT")) {
1219 TGMenuEntry *exit = popup->GetEntry("Quit ROOT");
1220 popup->HideEntry(exit->GetEntryId());
1221 }
1222 if (popup->GetEntry("Exit")) {
1223 TGMenuEntry *exit = popup->GetEntry("Exit");
1224 popup->HideEntry(exit->GetEntryId());
1225 }
1226 }
1227 }
1228 ShowMenu(menu);
1229 return;
1230 }
1231 }
1232 }
1233 if (fActMenuBar != fMenuBar)
1235}
1236
1237////////////////////////////////////////////////////////////////////////////////
1238/// Emits signal when double clicking on icon.
1239
1241{
1242 Emit("DoubleClicked(TObject*)", (Longptr_t)obj);
1243}
1244
1245////////////////////////////////////////////////////////////////////////////////
1246/// Emits signal when double clicking on icon.
1247
1249{
1250 Longptr_t args[2];
1251
1252 args[0] = (Longptr_t)obj;
1253 args[1] = checked;
1254
1255 Emit("Checked(TObject*,Bool_t)", args);
1256}
1257
1258////////////////////////////////////////////////////////////////////////////////
1259/// Emits signal "ExecuteDefaultAction(TObject*)".
1260
1262{
1263 Emit("ExecuteDefaultAction(TObject*)", (Longptr_t)obj);
1264}
1265
1266
1267////////////////////////////////////////////////////////////////////////////////
1268/// static constructor returning TBrowserImp,
1269/// as needed by the plugin mechanism.
1270
1273 Option_t *opt)
1274{
1275 TRootBrowser *browser = new TRootBrowser(b, title, width, height, opt);
1276 return (TBrowserImp *)browser;
1277}
1278
1279////////////////////////////////////////////////////////////////////////////////
1280/// static constructor returning TBrowserImp,
1281/// as needed by the plugin mechanism.
1282
1285 Option_t *opt)
1286{
1287 TRootBrowser *browser = new TRootBrowser(b, title, x, y, width, height, opt);
1288 return (TBrowserImp *)browser;
1289}
@ kKeyPress
Definition Buttons.h:20
@ kMouseLeave
Definition Buttons.h:23
@ kGKeyPress
Definition GuiTypes.h:60
const Mask_t kKeyLockMask
Definition GuiTypes.h:196
const Mask_t kKeyMod1Mask
typically the Alt key
Definition GuiTypes.h:198
const Mask_t kKeyReleaseMask
Definition GuiTypes.h:160
const Mask_t kKeyPressMask
Definition GuiTypes.h:159
const Mask_t kKeyShiftMask
Definition GuiTypes.h:195
@ kRaisedFrame
Definition GuiTypes.h:384
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kFixedHeight
Definition GuiTypes.h:389
const Mask_t kKeyControlMask
Definition GuiTypes.h:197
const Mask_t kKeyMod2Mask
typically mod on numeric keys
Definition GuiTypes.h:199
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:170
#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:110
R__EXTERN C unsigned int sleep(unsigned int seconds)
R__EXTERN void * gTQSender
Definition TQObject.h:46
#define gROOT
Definition TROOT.h:411
static const char * gPluginFileTypes[]
static const char * gOpenFileTypes[]
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2495
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
#define gPad
#define gVirtualX
Definition TVirtualX.h:337
#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
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2973
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:490
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:735
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:1109
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:1156
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1249
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1196
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1064
void SetEditable(Bool_t on=kTRUE) override
Switch ON/OFF edit mode.
Definition TGFrame.cxx:940
static TGLayoutHints * fgDefaultHints
Definition TGFrame.h:299
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1182
System file browser, used as TRootBrowser plug-in.
void Selected(char *)
A ROOT File has been selected in TGHtmlBrowser.
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:331
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:621
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
void MapWindow() override
map window
Definition TGFrame.h:206
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:268
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:1850
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:1629
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1793
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1780
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
Definition TGFrame.cxx:1598
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 DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition TGMenu.cxx:1720
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:575
void Add(TObject *obj) override
Definition TList.h:81
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:819
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:467
Collectable string class.
Definition TObjString.h:28
Mother of all ROOT objects.
Definition TObject.h:41
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:543
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:2384
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:640
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition TSystem.cxx:1868
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1073
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition TSystem.cxx:944
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition TSystem.cxx:435
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:414
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:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
UInt_t fState
key or button mask
Definition GuiTypes.h:181