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
116
117////////////////////////////////////////////////////////////////////////////////
118/// Create browser with a specified width and height.
119
122 TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
123{
125 fActBrowser = 0;
126 fIconPic = 0;
129 if (initshow) {
130 InitPlugins(opt);
131 MapWindow();
132 }
133 TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
134 "TRootBrowser", this,
135 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
136 gVirtualX->SetInputFocus(GetId());
137}
138
139////////////////////////////////////////////////////////////////////////////////
140/// Create browser with a specified width and height and at position x, y.
141
145 TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
146{
148 fActBrowser = 0;
149 fIconPic = 0;
152 SetWMPosition(x, y);
153 if (initshow) {
154 InitPlugins(opt);
155 MapWindow();
156 }
157 TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
158 "TRootBrowser", this,
159 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
160 gVirtualX->SetInputFocus(GetId());
161}
162
163
164////////////////////////////////////////////////////////////////////////////////
165
167{
168 static bool hasRNTupleBrowsing __attribute__((unused)) = []() {
170 return true;
171 }();
172
173 // Create the actual interface.
174
175 fVf = new TGVerticalFrame(this, 100, 100);
176
178 fLH1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
179 fLH2 = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 1);
185
186 // Menubar Frame
187 fTopMenuFrame = new TGHorizontalFrame(fVf, 100, 20);
188
191 fMenuFile = new TGPopupMenu(gClient->GetDefaultRoot());
192 fMenuFile->AddEntry("&Browse...\tCtrl+B", kBrowse);
193 fMenuFile->AddEntry("&Open...\tCtrl+O", kOpenFile);
195
197 fMenuHelp->AddEntry("&About ROOT...", kHelpAbout);
199 fMenuHelp->AddEntry("Help On Browser...", kHelpOnBrowser);
200 fMenuHelp->AddEntry("Help On Canvas...", kHelpOnCanvas);
201 fMenuHelp->AddEntry("Help On Menus...", kHelpOnMenus);
202 fMenuHelp->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
203 fMenuHelp->AddEntry("Help On Objects...", kHelpOnObjects);
204 fMenuHelp->AddEntry("Help On PostScript...", kHelpOnPS);
205 fMenuHelp->AddEntry("Help On Remote Session...", kHelpOnRemote);
206 fMenuFile->AddPopup("Browser Help...", fMenuHelp);
207
209 fMenuFile->AddEntry("&Clone\tCtrl+N", kClone);
211 fMenuFile->AddEntry("New &Editor\tCtrl+E", kNewEditor);
212 fMenuFile->AddEntry("New &Canvas\tCtrl+C", kNewCanvas);
213 fMenuFile->AddEntry("New &HTML\tCtrl+H", kNewHtml);
217 fMenuExecPlugin->AddEntry("&Command...", kExecPluginCmd);
218 fMenuFile->AddPopup("Execute &Plugin...", fMenuExecPlugin);
220 fMenuFile->AddEntry("Close &Tab\tCtrl+T", kCloseTab);
221 fMenuFile->AddEntry("Close &Window\tCtrl+W", kCloseWindow);
223 fMenuFile->AddEntry("&Quit Root\tCtrl+Q", kQuitRoot);
224 fMenuBar->AddPopup("&Browser", fMenuFile, fLH1);
225 fMenuFile->Connect("Activated(Int_t)", "TRootBrowser", this,
226 "HandleMenu(Int_t)");
229
230 if (!TClass::GetClass("TGHtmlBrowser"))
232
235
238
239 // Toolbar Frame
243
244 fHf = new TGHorizontalFrame(fVf, 100, 100);
245 // Tabs & co...
246#if defined(R__HAS_COCOA)
247 fV1 = new TGVerticalFrame(fHf, 252, 100, kFixedWidth);
248#else
249 fV1 = new TGVerticalFrame(fHf, 250, 100, kFixedWidth);
250#endif
251 fV2 = new TGVerticalFrame(fHf, 600, 100);
252 fH1 = new TGHorizontalFrame(fV2, 100, 100);
253 fH2 = new TGHorizontalFrame(fV2, 100, 100, kFixedHeight);
254
255 // Left tab
256 fTabLeft = new TGTab(fV1,100,100);
257 //fTabLeft->AddTab("Tab 1");
260
261 // Vertical splitter
262 fVSplitter = new TGVSplitter(fHf, 4, 4);
264 fHf->AddFrame(fV1, fLH7);
266
267 // Right tab
268 fTabRight = new TGTab(fH1, 500, 100);
269 //fTabRight->AddTab("Tab 1");
272 fTabRight->Connect("Selected(Int_t)", "TRootBrowser", this, "DoTab(Int_t)");
273 fTabRight->Connect("CloseTab(Int_t)", "TRootBrowser", this, "CloseTab(Int_t)");
274 fV2->AddFrame(fH1, fLH4);
275
276 // Horizontal splitter
277 fHSplitter = new TGHSplitter(fV2, 4, 4);
279
280 // Bottom tab
281 fTabBottom = new TGTab(fH2, 100, 100);
282 //fTabBottom->AddTab("Tab 1");
284 fV2->AddFrame(fH2, fLH3);
285
287 fHf->AddFrame(fV2, fLH5);
288 fVf->AddFrame(fHf, fLH5);
289 AddFrame(fVf, fLH5);
290
291 // status bar
292 fStatusBar = new TGStatusBar(this, 400, 20);
293 int parts[] = { 33, 10, 10, 47 };
296
297 fNbInitPlugins = 0;
298 fEditFrame = 0;
299 fEditTab = 0;
300 fEditPos = -1;
301 fEditSubPos= -1;
302 fNbTab[0] = fNbTab[1] = fNbTab[2] = 0;
303 fCrTab[0] = fCrTab[1] = fCrTab[2] = -1;
304
305 // Set a name to the main frame
308 fIconPic = SetIconPixmap("rootdb_s.xpm");
309 SetClassHints("ROOT", "Browser");
310
311 if (!strcmp(gROOT->GetDefCanvasName(), "c1"))
312 gROOT->SetDefCanvasName("Canvas_1");
313
314 SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
318
320}
321
322////////////////////////////////////////////////////////////////////////////////
323/// Clean up all widgets, frames and layouthints that were used
324
326{
327 if (fIconPic) gClient->FreePicture(fIconPic);
328 delete fLH0;
329 delete fLH1;
330 delete fLH2;
331 delete fLH3;
332 delete fLH4;
333 delete fLH5;
334 delete fLH6;
335 delete fLH7;
336 delete fMenuHelp;
337 delete fMenuExecPlugin;
338 delete fMenuFile;
339 delete fMenuBar;
340 delete fMenuFrame;
341 delete fPreMenuFrame;
342 delete fTopMenuFrame;
343 delete fToolbarFrame;
344 delete fVSplitter;
345 delete fHSplitter;
346 delete fTabLeft;
347 delete fTabRight;
348 delete fTabBottom;
349 delete fH1;
350 delete fH2;
351 delete fV1;
352 delete fV2;
353 delete fHf;
354 delete fStatusBar;
355 delete fVf;
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Add items to the actual browser. This function has to be called
360/// by the Browse() member function of objects when they are
361/// called by a browser. If check < 0 (default) no check box is drawn,
362/// if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
363
364void TRootBrowser::Add(TObject *obj, const char *name, Int_t check)
365{
366 if (obj->InheritsFrom("TObjectSpy"))
367 return;
368 if (fActBrowser)
369 fActBrowser->Add(obj, name, check);
370}
371
372////////////////////////////////////////////////////////////////////////////////
373/// Browse object. This, in turn, will trigger the calling of
374/// TRootBrowser::Add() which will fill the IconBox and the tree.
375/// Emits signal "BrowseObj(TObject*)".
376
378{
379 if (fActBrowser)
381 Emit("BrowseObj(TObject*)", (Longptr_t)obj);
382}
383
384////////////////////////////////////////////////////////////////////////////////
385/// Clone the browser. A new Browser will be created, with the same
386/// plugins executed in the current one.
387
389{
390 Int_t loop = 1;
392 TBrowser *b = new TBrowser();
393 TIter next(&fPlugins);
394 while ((plugin = (TBrowserPlugin *)next())) {
395 if (loop > fNbInitPlugins)
396 b->ExecPlugin(plugin->GetName(), "", plugin->fCommand.Data(), plugin->fTab,
397 plugin->fSubTab);
398 ++loop;
399 }
400}
401
402////////////////////////////////////////////////////////////////////////////////
403/// Remove tab element id from right tab.
404
406{
407 RemoveTab(kRight, id);
408}
409
410////////////////////////////////////////////////////////////////////////////////
411/// Properly close the mainframes embedded in the different tabs
412
414{
417 Int_t i;
418 TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
419 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
420 Disconnect(fMenuFile, "Activated(Int_t)", this, "HandleMenu(Int_t)");
421 Disconnect(fTabRight, "Selected(Int_t)", this, "DoTab(Int_t)");
422 if (fPlugins.IsEmpty()) return;
423 fActBrowser = 0;
424 for (i=0;i<fTabLeft->GetNumberOfTabs();i++) {
426 if (!container) continue;
427 el = (TGFrameElement *)container->GetList()->First();
428 if (el && el->fFrame) {
429 el->fFrame->SetFrameElement(0);
430 if (el->fFrame->InheritsFrom("TVirtualPadEditor")) {
432 }
433 else if (el->fFrame->InheritsFrom("TGMainFrame")) {
434 el->fFrame->UnmapWindow();
435 ((TGMainFrame *)el->fFrame)->CloseWindow();
437 }
438 else
439 delete el->fFrame;
440 el->fFrame = 0;
441 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
442 (el->fLayout->References() > 0)) {
443 el->fLayout->RemoveReference();
444 if (!el->fLayout->References()) {
445 delete el->fLayout;
446 }
447 }
448 container->GetList()->Remove(el);
449 delete el;
450 }
451 }
452 for (i=0;i<fTabRight->GetNumberOfTabs();i++) {
454 if (!container) continue;
455 el = (TGFrameElement *)container->GetList()->First();
456 if (el && el->fFrame) {
457 el->fFrame->SetFrameElement(0);
458 if (el->fFrame->InheritsFrom("TGMainFrame")) {
459 el->fFrame->UnmapWindow();
460 Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
461 if (sleep)
462 gSystem->Sleep(150);
463 ((TGMainFrame *)el->fFrame)->CloseWindow();
464 if (sleep)
465 gSystem->Sleep(150);
467 }
468 else
469 delete el->fFrame;
470 el->fFrame = 0;
471 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
472 (el->fLayout->References() > 0)) {
473 el->fLayout->RemoveReference();
474 if (!el->fLayout->References()) {
475 delete el->fLayout;
476 }
477 }
478 container->GetList()->Remove(el);
479 delete el;
480 }
481 }
482 for (i=0;i<fTabBottom->GetNumberOfTabs();i++) {
484 if (!container) continue;
485 el = (TGFrameElement *)container->GetList()->First();
486 if (el && el->fFrame) {
487 el->fFrame->SetFrameElement(0);
488 if (el->fFrame->InheritsFrom("TGMainFrame")) {
489 el->fFrame->UnmapWindow();
490 ((TGMainFrame *)el->fFrame)->CloseWindow();
491 gSystem->Sleep(150);
493 }
494 else
495 delete el->fFrame;
496 el->fFrame = 0;
497 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
498 (el->fLayout->References() > 0)) {
499 el->fLayout->RemoveReference();
500 if (!el->fLayout->References()) {
501 delete el->fLayout;
502 }
503 }
504 container->GetList()->Remove(el);
505 delete el;
506 }
507 }
509 Emit("CloseWindow()");
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Called when window is closed via the window manager.
514
516{
517 TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
518 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
519 CloseTabs();
520 DeleteWindow();
521}
522
523////////////////////////////////////////////////////////////////////////////////
524/// Handle Tab navigation.
525
527{
529 if ((sender) && (sender == fTabRight)) {
530 SwitchMenus(sender->GetTabContainer(id));
531 }
532}
533
534////////////////////////////////////////////////////////////////////////////////
535/// Display a tooltip with infos about the primitive below the cursor.
536
537void TRootBrowser::EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
538{
539 const Int_t kTMAX=256;
540 static char atext[kTMAX];
541 if (selected == 0 || event == kMouseLeave) {
542 SetStatusText("", 0);
543 SetStatusText("", 1);
544 SetStatusText("", 2);
545 SetStatusText("", 3);
546 return;
547 }
548 SetStatusText(selected->GetTitle(), 0);
549 SetStatusText(selected->GetName(), 1);
550 if (event == kKeyPress)
551 snprintf(atext, kTMAX, "%c", (char) px);
552 else
553 snprintf(atext, kTMAX, "%d,%d", px, py);
555 SetStatusText(selected->GetObjectInfo(px,py), 3);
556}
557
558////////////////////////////////////////////////////////////////////////////////
559/// Execute a macro and embed the created frame in the tab "pos"
560/// and tab element "subpos".
561
563 const char *cmd, Int_t pos, Int_t subpos)
564{
565 Longptr_t retval = 0;
568 if (cmd && strlen(cmd)) {
569 command = cmd;
570 if (name) pname = name;
571 else pname = TString::Format("Plugin %d", fPlugins.GetSize());
572 p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
573 }
574 else if (fname && strlen(fname)) {
576 Ssiz_t t = pname.Last('.');
577 if (t > 0) pname.Remove(t);
578 command.Form("gROOT->Macro(\"%s\");", gSystem->UnixPathName(fname));
579 p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
580 }
581 else return 0;
582
583 Bool_t new_canvas = command.Contains("new TCanvas");
584 Bool_t is_web_canvas = strcmp(gEnv->GetValue("Canvas.Name", ""), "TWebCanvas") == 0;
585
587 return gROOT->ProcessLine(command.Data());
588
590 gEnv->SetValue("Canvas.Name", "TRootCanvas");
591
593 fPlugins.Add(p);
594 retval = gROOT->ProcessLine(command.Data());
595 if (new_canvas) {
596 pname = gPad->GetName();
597 p->SetName(pname.Data());
598 if (is_web_canvas)
599 gEnv->SetValue("Canvas.Name", "TWebCanvas");
600 }
601 SetTabTitle(pname.Data(), pos, subpos);
603 return retval;
604}
605
606////////////////////////////////////////////////////////////////////////////////
607/// Returns drawing option.
608
610{
611 if (fActBrowser)
612 return fActBrowser->GetDrawOption();
613 return 0;
614}
615
616////////////////////////////////////////////////////////////////////////////////
617/// Returns the TGTab at position pos.
618
620{
621 switch (pos) {
622 case kLeft: return fTabLeft;
623 case kRight: return fTabRight;
624 case kBottom: return fTabBottom;
625 default: return 0;
626 }
627}
628
629////////////////////////////////////////////////////////////////////////////////
630/// Handle keyboard events.
631
633{
634 char input[10];
636
637 if (event->fType == kGKeyPress) {
638 gVirtualX->LookupString(event, input, sizeof(input), keysym);
639
640 if (!event->fState && (EKeySym)keysym == kKey_F5) {
641 Refresh(kTRUE);
642 return kTRUE;
643 }
644 switch ((EKeySym)keysym) { // ignore these keys
645 case kKey_Shift:
646 case kKey_Control:
647 case kKey_Meta:
648 case kKey_Alt:
649 case kKey_CapsLock:
650 case kKey_NumLock:
651 case kKey_ScrollLock:
652 return kTRUE;
653 default:
654 break;
655 }
656 if (event->fState & kKeyControlMask) { // Cntrl key modifier pressed
657 switch ((EKeySym)keysym & ~0x20) { // treat upper and lower the same
658 case kKey_B:
660 return kTRUE;
661 case kKey_O:
663 return kTRUE;
664 case kKey_E:
666 return kTRUE;
667 case kKey_C:
669 return kTRUE;
670 case kKey_H:
672 return kTRUE;
673 case kKey_N:
675 return kTRUE;
676 case kKey_T:
678 return kTRUE;
679 case kKey_W:
681 return kTRUE;
682 case kKey_Q:
684 return kTRUE;
685 default:
686 break;
687 }
688 }
689 }
690 return TGMainFrame::HandleKey(event);
691}
692
693////////////////////////////////////////////////////////////////////////////////
694/// Handle menu entries events.
695
697{
699 TString cmd;
700 static Int_t eNr = 1;
702 if (sender != fMenuFile)
703 return;
704 switch (id) {
705 case kBrowse:
706 new TBrowser();
707 break;
708 case kOpenFile:
709 {
711 static TString dir(".");
713 fi.fFileTypes = gOpenFileTypes;
714 fi.SetIniDir(dir);
715 new TGFileDialog(gClient->GetDefaultRoot(), this,
716 kFDOpen,&fi);
717 dir = fi.fIniDir;
718 if (fi.fMultipleSelection && fi.fFileNamesList) {
719 TObjString *el;
720 TIter next(fi.fFileNamesList);
721 while ((el = (TObjString *) next())) {
722 gROOT->ProcessLine(Form("new TFile(\"%s\");",
723 gSystem->UnixPathName(el->GetString())));
724 }
725 newfile = kTRUE;
726 }
727 else if (fi.fFilename) {
728 gROOT->ProcessLine(Form("new TFile(\"%s\");",
729 gSystem->UnixPathName(fi.fFilename)));
730 newfile = kTRUE;
731 }
732 if (fActBrowser && newfile) {
733 TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(fActBrowser);
734 if (fb) fb->Selected(0);
735 }
736 }
737 break;
738 // Handle Help menu items...
739 case kHelpAbout:
740 {
741#ifdef WIN32
743#else
744 char str[32];
745 snprintf(str, 32, "About ROOT %s...", gROOT->GetVersion());
746 hd = new TRootHelpDialog(this, str, 600, 400);
747 hd->SetText(gHelpAbout);
748 hd->Popup();
749#endif
750 }
751 break;
752 case kHelpOnCanvas:
753 hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
754 hd->SetText(gHelpCanvas);
755 hd->Popup();
756 break;
757 case kHelpOnMenus:
758 hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
759 hd->SetText(gHelpPullDownMenus);
760 hd->Popup();
761 break;
763 hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
764 hd->SetText(gHelpGraphicsEditor);
765 hd->Popup();
766 break;
767 case kHelpOnBrowser:
768 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
769 hd->SetText(gHelpBrowser);
770 hd->Popup();
771 break;
772 case kHelpOnObjects:
773 hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
774 hd->SetText(gHelpObjects);
775 hd->Popup();
776 break;
777 case kHelpOnPS:
778 hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
779 hd->SetText(gHelpPostscript);
780 hd->Popup();
781 break;
782 case kHelpOnRemote:
783 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
784 hd->SetText(gHelpRemote);
785 hd->Popup();
786 break;
787 case kClone:
788 CloneBrowser();
789 break;
790 case kNewEditor:
791 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot())");
792 ++eNr;
793 ExecPlugin(Form("Editor %d", eNr), "", cmd.Data(), 1);
794 break;
795 case kNewCanvas:
796 ExecPlugin("", "", "new TCanvas()", 1);
797 break;
798 case kNewHtml:
799 cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot())",
800 gEnv->GetValue("Browser.StartUrl", "http://root.cern.ch"));
801 ExecPlugin("HTML", "", cmd.Data(), 1);
802 break;
803 case kExecPluginMacro:
804 {
805 static TString dir(".");
807 fi.fFileTypes = gPluginFileTypes;
808 fi.SetIniDir(dir);
809 new TGFileDialog(gClient->GetDefaultRoot(), this,
810 kFDOpen,&fi);
811 dir = fi.fIniDir;
812 if (fi.fFilename) {
813 ExecPlugin(0, fi.fFilename, 0, kRight);
814 }
815 }
816 break;
817 case kExecPluginCmd:
818 {
819 char command[1024];
820 strlcpy(command, "new TGLSAViewer(gClient->GetRoot(), 0);",
821 sizeof(command));
822 new TGInputDialog(gClient->GetRoot(), this,
823 "Enter plugin command line:",
825 if (strcmp(command, "")) {
826 ExecPlugin("User", 0, command, kRight);
827 }
828 }
829 break;
830 case kCloseTab:
832 break;
833 case kCloseWindow:
834 CloseWindow();
835 break;
836 case kQuitRoot:
837 CloseWindow();
839 break;
840 default:
841 break;
842 }
843}
844
845////////////////////////////////////////////////////////////////////////////////
846/// Initialize default plugins. Could be also of the form:
847/// StartEmbedding(0);
848/// TPluginHandler *ph;
849/// ph = gROOT->GetPluginManager()->FindHandler("TGClassBrowser");
850/// if (ph && ph->LoadPlugin() != -1) {
851/// ph->ExecPlugin(3, gClient->GetRoot(), 200, 500);
852/// }
853/// StopEmbedding();
854
856{
857 TString cmd;
858
859 if ((opt == 0) || (!opt[0]))
860 return;
861 // --- Left vertical area
862
863 // File Browser plugin
864 if (strchr(opt, 'F')) {
865 cmd.Form("new TGFileBrowser(gClient->GetRoot(), (TBrowser *)0x%zx, 200, 500);", (size_t)fBrowser);
866 ExecPlugin("Files", 0, cmd.Data(), 0);
868 }
869
870 // --- Right main area
871
872 Int_t i, len = strlen(opt);
873 for (i=0; i<len; ++i) {
874 // Editor plugin...
875 if (opt[i] == 'E') {
876 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot());");
877 ExecPlugin("Editor 1", 0, cmd.Data(), 1);
879 }
880
881 // HTML plugin...
882 if (opt[i] == 'H') {
883 if (gSystem->Load("libGuiHtml") >= 0) {
884 cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot());",
885 gEnv->GetValue("Browser.StartUrl",
886 "https://root.cern.ch/doc/master/classes.html"));
887 ExecPlugin("HTML", 0, cmd.Data(), 1);
889 }
890 }
891
892 // Canvas plugin...
893 if (opt[i] == 'C') {
894 cmd.Form("new TCanvas();");
895 ExecPlugin("c1", 0, cmd.Data(), 1);
897 }
898
899 // GLViewer plugin...
900 if (opt[i] == 'G') {
901 cmd.Form("new TGLSAViewer(gClient->GetRoot(), 0);");
902 ExecPlugin("OpenGL", 0, cmd.Data(), 1);
904 }
905
906 }
907 // --- Right bottom area
908
909 // Command plugin...
910 if (strchr(opt, 'I')) {
911 cmd.Form("new TGCommandPlugin(gClient->GetRoot(), 700, 300);");
912 ExecPlugin("Command", 0, cmd.Data(), 2);
914 }
915
916 // --- Select first tab everywhere
917 SetTab(0, 0);
918 SetTab(1, 0);
919 SetTab(2, 0);
920}
921
922////////////////////////////////////////////////////////////////////////////////
923/// Check if the GUI factory is set to use the Web GUI.
924
926{
927 TString factory = gEnv->GetValue("Gui.Factory", "native");
928 return (factory.Contains("web", TString::kIgnoreCase));
929}
930
931////////////////////////////////////////////////////////////////////////////////
932/// Really delete the browser and the this GUI.
933
935{
937 delete this;
938}
939
940////////////////////////////////////////////////////////////////////////////////
941/// Recursively remove object from browser.
942
948
949////////////////////////////////////////////////////////////////////////////////
950/// Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
951
953{
954 TGMenuEntry *entry = 0;
955 TIter next(popup->GetListOfEntries());
956 while ((entry = (TGMenuEntry *)next())) {
957 if (entry->GetPopup()) {
958 RecursiveReparent(entry->GetPopup());
959 }
960 }
961 popup->ReparentWindow(gClient->GetDefaultRoot());
962}
963
964////////////////////////////////////////////////////////////////////////////////
965/// Refresh the actual browser contents.
966
972
973////////////////////////////////////////////////////////////////////////////////
974/// Remove tab element "subpos" from tab "pos".
975
977{
978 TGTab *edit = 0;
979 switch (pos) {
980 case kLeft: // left
981 edit = fTabLeft;
982 break;
983 case kRight: // right
984 edit = fTabRight;
986 fMenuFrame->GetList()->Remove(fActMenuBar);
987 fActMenuBar = 0;
988 break;
989 case kBottom: // bottom
991 break;
992 }
993 if (!edit || !edit->GetTabTab(subpos))
994 return;
995 const char *tabName = edit->GetTabTab(subpos)->GetString();
996 TObject *obj = 0;
997 if ((obj = fPlugins.FindObject(tabName))) {
998 fPlugins.Remove(obj);
999 }
1000 TGFrameElement *el = 0;
1001 if (edit->GetTabContainer(subpos))
1002 el = (TGFrameElement *)edit->GetTabContainer(subpos)->GetList()->First();
1003 if (el && el->fFrame) {
1004 el->fFrame->Disconnect("ProcessedConfigure(Event_t*)");
1005 el->fFrame->SetFrameElement(0);
1006 if (el->fFrame->InheritsFrom("TGMainFrame")) {
1007 Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
1008 ((TGMainFrame *)el->fFrame)->CloseWindow();
1009 if (sleep)
1010 gSystem->Sleep(150);
1012 }
1013 else
1014 delete el->fFrame;
1015 el->fFrame = 0;
1016 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
1017 (el->fLayout->References() > 0)) {
1018 el->fLayout->RemoveReference();
1019 if (!el->fLayout->References()) {
1020 delete el->fLayout;
1021 }
1022 }
1023 edit->GetTabContainer(subpos)->GetList()->Remove(el);
1024 delete el;
1025 }
1026 fNbTab[pos]--;
1027 edit->RemoveTab(subpos);
1028 SwitchMenus(edit->GetTabContainer(edit->GetCurrent()));
1029}
1030
1031////////////////////////////////////////////////////////////////////////////////
1032/// Switch to Tab "subpos" in TGTab "pos".
1033
1035{
1036 TGTab *tab = GetTab(pos);
1037 if (subpos == -1)
1038 subpos = fCrTab[pos];
1039
1040 if (tab && tab->SetTab(subpos, kFALSE)) { // Block signal emit
1041 if (pos == kRight)
1042 SwitchMenus(tab->GetTabContainer(subpos));
1043 tab->Layout();
1044 }
1045}
1046
1047////////////////////////////////////////////////////////////////////////////////
1048/// Set text "title" of Tab "subpos" in TGTab "pos".
1049
1050void TRootBrowser::SetTabTitle(const char *title, Int_t pos, Int_t subpos)
1051{
1052 TBrowserPlugin *p = 0;
1053 TGTab *edit = GetTab(pos);
1054 if (!edit) return;
1055 if (subpos == -1)
1056 subpos = fCrTab[pos];
1057
1058 TGTabElement *el = edit->GetTabTab(subpos);
1059 if (el) {
1060 el->SetText(new TGString(title));
1061 edit->Layout();
1062 if ((p = (TBrowserPlugin *)fPlugins.FindObject(title)))
1063 p->SetName(title);
1064 }
1065}
1066
1067////////////////////////////////////////////////////////////////////////////////
1068/// Set text in column col in status bar.
1069
1071{
1072 fStatusBar->SetText(txt, col);
1073}
1074
1075////////////////////////////////////////////////////////////////////////////////
1076/// Show the selected frame's menu and hide previous one.
1077
1079{
1080 TGFrameElement *el = 0;
1081 // temporary solution until I find a proper way to handle
1082 // these bloody menus...
1083 fBindList->Delete();
1085 while ((el = (TGFrameElement *) nextm())) {
1086 TGMenuTitle *t = (TGMenuTitle *) el->fFrame;
1087 Int_t code = t->GetHotKeyCode();
1096 }
1099 menu->Layout();
1100 fMenuFrame->Layout();
1101 fActMenuBar = menu;
1102}
1103
1104////////////////////////////////////////////////////////////////////////////////
1105/// Start embedding external frame in the tab "pos" and tab element "subpos".
1106
1108{
1109 fEditTab = GetTab(pos);
1110 if (!fEditTab) return;
1111 fEditPos = pos;
1113
1114 if (fEditFrame == 0) {
1115 if (subpos == -1) {
1116 fCrTab[pos] = fNbTab[pos]++;
1117 fEditFrame = fEditTab->AddTab(Form("Tab %d",fNbTab[pos]));
1121 if(tabel) {
1122 tabel->MapWindow();
1123 if (fShowCloseTab && (pos == 1))
1124 tabel->ShowClose();
1125 }
1127 fEditTab->Layout();
1128 }
1129 else {
1130 fCrTab[pos] = subpos;
1133 }
1135 }
1136}
1137
1138////////////////////////////////////////////////////////////////////////////////
1139/// Stop embedding external frame in the current editable frame.
1140
1142{
1143 if (fEditFrame != 0) {
1146 if (el && el->fFrame) {
1147 // let be notified when the inside frame gets resized, and tell its
1148 // container to recompute its layout
1149 el->fFrame->Connect("ProcessedConfigure(Event_t*)", "TGCompositeFrame",
1150 fEditFrame, "Layout()");
1151 }
1152 if (layout) {
1153 el = (TGFrameElement*) fEditFrame->GetList()->Last();
1154 // !!!! MT what to do with the old layout? Leak it for now ...
1155 if (el) el->fLayout = layout;
1156 }
1157 fEditFrame->Layout();
1158 if (fEditTab == fTabRight)
1160 }
1161 if (name && strlen(name)) {
1163 }
1165 fEditFrame = fEditTab = 0;
1166 fEditPos = fEditSubPos = -1;
1167}
1168
1169////////////////////////////////////////////////////////////////////////////////
1170/// Move the menu from original frame to our TGMenuFrame, or display the
1171/// menu associated to the current tab.
1172
1174{
1175 if (from == 0)
1176 return;
1177 TGFrameElement *fe = (TGFrameElement *)from->GetList()->First();
1178 if (!fe) {
1179 if (fActMenuBar != fMenuBar)
1181 return;
1182 }
1184 TGFrameElement *el = 0;
1185 if (embed && embed->GetList()) {
1186 TIter next(embed->GetList());
1187 while ((el = (TGFrameElement *)next())) {
1188 if (el->fFrame->InheritsFrom("TGMenuBar")) {
1189 TGMenuBar *menu = (TGMenuBar *)el->fFrame;
1190 if (fActMenuBar == menu)
1191 return;
1194 while ((nw = (TGFrameElement *) nel())) {
1195 if (nw->fFrame == menu) {
1196 ShowMenu(menu);
1197 return;
1198 }
1199 }
1200 ((TGCompositeFrame *)menu->GetParent())->HideFrame(menu);
1201 ((TGCompositeFrame *)menu->GetParent())->SetCleanup(kNoCleanup);
1202 menu->ReparentWindow(fMenuFrame);
1205 TIter mnext(menu->GetList());
1206 while ((mel = (TGFrameElement *) mnext())) {
1207 TGMenuTitle *t = (TGMenuTitle *) mel->fFrame;
1208 TGPopupMenu *popup = menu->GetPopup(t->GetName());
1209 if (popup) {
1211 if (popup->GetEntry("Close Canvas")) {
1212 TGMenuEntry *exit = popup->GetEntry("Close Canvas");
1213 popup->HideEntry(exit->GetEntryId());
1214 }
1215 if (popup->GetEntry("Close Viewer")) {
1216 TGMenuEntry *exit = popup->GetEntry("Close Viewer");
1217 popup->HideEntry(exit->GetEntryId());
1218 }
1219 if (popup->GetEntry("Quit ROOT")) {
1220 TGMenuEntry *exit = popup->GetEntry("Quit ROOT");
1221 popup->HideEntry(exit->GetEntryId());
1222 }
1223 if (popup->GetEntry("Exit")) {
1224 TGMenuEntry *exit = popup->GetEntry("Exit");
1225 popup->HideEntry(exit->GetEntryId());
1226 }
1227 }
1228 }
1229 ShowMenu(menu);
1230 return;
1231 }
1232 }
1233 }
1234 if (fActMenuBar != fMenuBar)
1236}
1237
1238////////////////////////////////////////////////////////////////////////////////
1239/// Emits signal when double clicking on icon.
1240
1242{
1243 Emit("DoubleClicked(TObject*)", (Longptr_t)obj);
1244}
1245
1246////////////////////////////////////////////////////////////////////////////////
1247/// Emits signal when double clicking on icon.
1248
1250{
1251 Longptr_t args[2];
1252
1253 args[0] = (Longptr_t)obj;
1254 args[1] = checked;
1255
1256 Emit("Checked(TObject*,Bool_t)", args);
1257}
1258
1259////////////////////////////////////////////////////////////////////////////////
1260/// Emits signal "ExecuteDefaultAction(TObject*)".
1261
1263{
1264 Emit("ExecuteDefaultAction(TObject*)", (Longptr_t)obj);
1265}
1266
1267
1268////////////////////////////////////////////////////////////////////////////////
1269/// static constructor returning TBrowserImp,
1270/// as needed by the plugin mechanism.
1271
1274 Option_t *opt)
1275{
1276 TRootBrowser *browser = new TRootBrowser(b, title, width, height, opt);
1277 return (TBrowserImp *)browser;
1278}
1279
1280////////////////////////////////////////////////////////////////////////////////
1281/// static constructor returning TBrowserImp,
1282/// as needed by the plugin mechanism.
1283
1286 Option_t *opt)
1287{
1288 TRootBrowser *browser = new TRootBrowser(b, title, x, y, width, height, opt);
1289 return (TBrowserImp *)browser;
1290}
@ 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
#define ClassImp(name)
Definition Rtypes.h:376
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:2496
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:2974
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:491
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:736
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:318
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
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:1164
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1204
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1072
void SetEditable(Bool_t on=kTRUE) override
Switch ON/OFF edit mode.
Definition TGFrame.cxx:948
static TGLayoutHints * fgDefaultHints
Definition TGFrame.h:299
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1190
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:339
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:629
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
void MapWindow() override
map window
Definition TGFrame.h:206
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
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:1858
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:1637
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1801
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
Definition TGFrame.cxx:1606
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:418
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:1152
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition TGMenu.cxx:1724
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1060
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:990
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:663
Int_t GetNumberOfTabs() const
Return number of tabs.
Definition TGTab.cxx:709
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:558
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:614
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
Definition TGTab.cxx:376
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:576
void Add(TObject *obj) override
Definition TList.h:81
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:820
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:468
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:544
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:869
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:640
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition TSystem.cxx:1870
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1075
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition TSystem.cxx:946
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition TSystem.cxx:437
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:416
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