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 - P: Proof
59 - G: GL viewer
60
61*/
62
63#include "TROOT.h"
64#include "TSystem.h"
65#include "TApplication.h"
66#include "TBrowser.h"
67#include "TClass.h"
68#include "TGClient.h"
69#include "TGFrame.h"
70#include "TGTab.h"
71#include "TGMenu.h"
72#include "TGLayout.h"
73#include "TGSplitter.h"
74#include "TGStatusBar.h"
75#include "Varargs.h"
76#include "TInterpreter.h"
77#include "TGFileDialog.h"
78#include "TObjString.h"
79#include "TVirtualPad.h"
80#include "TEnv.h"
81#include <KeySymbols.h>
82
83#include "RConfigure.h"
84
85#include "TRootBrowser.h"
86#include "TGFileBrowser.h"
87#include "TGInputDialog.h"
88#include "TRootHelpDialog.h"
89#include "TVirtualPadEditor.h"
90#include "HelpText.h"
91#include "Getline.h"
92#include "TVirtualX.h"
93#include "strlcpy.h"
94#include "snprintf.h"
95
96#ifdef WIN32
97#include <TWin32SplashThread.h>
98#endif
99
100static const char *gOpenFileTypes[] = {
101 "ROOT files", "*.root",
102 "All files", "*",
103 0, 0
104};
105
106static const char *gPluginFileTypes[] = {
107 "ROOT files", "*.C",
108 "All files", "*",
109 0, 0
110};
111
112
114
115////////////////////////////////////////////////////////////////////////////////
116/// Create browser with a specified width and height.
117
119 UInt_t height, Option_t *opt, Bool_t initshow) :
120 TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
121{
123 fActBrowser = 0;
124 fIconPic = 0;
127 if (initshow) {
128 InitPlugins(opt);
129 MapWindow();
130 }
131 TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
132 "TRootBrowser", this,
133 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
134 gVirtualX->SetInputFocus(GetId());
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// Create browser with a specified width and height and at position x, y.
139
142 Bool_t initshow) :
143 TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
144{
146 fActBrowser = 0;
147 fIconPic = 0;
150 SetWMPosition(x, y);
151 if (initshow) {
152 InitPlugins(opt);
153 MapWindow();
154 }
155 TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
156 "TRootBrowser", this,
157 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
158 gVirtualX->SetInputFocus(GetId());
159}
160
161
162////////////////////////////////////////////////////////////////////////////////
163
165{
166 // Create the actual interface.
167
168 fVf = new TGVerticalFrame(this, 100, 100);
169
171 fLH1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
172 fLH2 = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 1);
178
179 // Menubar Frame
180 fTopMenuFrame = new TGHorizontalFrame(fVf, 100, 20);
181
184 fMenuFile = new TGPopupMenu(gClient->GetDefaultRoot());
185 fMenuFile->AddEntry("&Browse...\tCtrl+B", kBrowse);
186 fMenuFile->AddEntry("&Open...\tCtrl+O", kOpenFile);
188
190 fMenuHelp->AddEntry("&About ROOT...", kHelpAbout);
192 fMenuHelp->AddEntry("Help On Browser...", kHelpOnBrowser);
193 fMenuHelp->AddEntry("Help On Canvas...", kHelpOnCanvas);
194 fMenuHelp->AddEntry("Help On Menus...", kHelpOnMenus);
195 fMenuHelp->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
196 fMenuHelp->AddEntry("Help On Objects...", kHelpOnObjects);
197 fMenuHelp->AddEntry("Help On PostScript...", kHelpOnPS);
198 fMenuHelp->AddEntry("Help On Remote Session...", kHelpOnRemote);
199 fMenuFile->AddPopup("Browser Help...", fMenuHelp);
200
202 fMenuFile->AddEntry("&Clone\tCtrl+N", kClone);
204 fMenuFile->AddEntry("New &Editor\tCtrl+E", kNewEditor);
205 fMenuFile->AddEntry("New &Canvas\tCtrl+C", kNewCanvas);
206 fMenuFile->AddEntry("New &HTML\tCtrl+H", kNewHtml);
210 fMenuExecPlugin->AddEntry("&Command...", kExecPluginCmd);
211 fMenuFile->AddPopup("Execute &Plugin...", fMenuExecPlugin);
213 fMenuFile->AddEntry("Close &Tab\tCtrl+T", kCloseTab);
214 fMenuFile->AddEntry("Close &Window\tCtrl+W", kCloseWindow);
216 fMenuFile->AddEntry("&Quit Root\tCtrl+Q", kQuitRoot);
217 fMenuBar->AddPopup("&Browser", fMenuFile, fLH1);
218 fMenuFile->Connect("Activated(Int_t)", "TRootBrowser", this,
219 "HandleMenu(Int_t)");
222
223 if (!TClass::GetClass("TGHtmlBrowser"))
225
228
231
232 // Toolbar Frame
236
237 fHf = new TGHorizontalFrame(fVf, 100, 100);
238 // Tabs & co...
239#if defined(R__HAS_COCOA)
240 fV1 = new TGVerticalFrame(fHf, 252, 100, kFixedWidth);
241#else
242 fV1 = new TGVerticalFrame(fHf, 250, 100, kFixedWidth);
243#endif
244 fV2 = new TGVerticalFrame(fHf, 600, 100);
245 fH1 = new TGHorizontalFrame(fV2, 100, 100);
246 fH2 = new TGHorizontalFrame(fV2, 100, 100, kFixedHeight);
247
248 // Left tab
249 fTabLeft = new TGTab(fV1,100,100);
250 //fTabLeft->AddTab("Tab 1");
253
254 // Vertical splitter
255 fVSplitter = new TGVSplitter(fHf, 4, 4);
257 fHf->AddFrame(fV1, fLH7);
259
260 // Right tab
261 fTabRight = new TGTab(fH1, 500, 100);
262 //fTabRight->AddTab("Tab 1");
265 fTabRight->Connect("Selected(Int_t)", "TRootBrowser", this, "DoTab(Int_t)");
266 fTabRight->Connect("CloseTab(Int_t)", "TRootBrowser", this, "CloseTab(Int_t)");
267 fV2->AddFrame(fH1, fLH4);
268
269 // Horizontal splitter
270 fHSplitter = new TGHSplitter(fV2, 4, 4);
272
273 // Bottom tab
274 fTabBottom = new TGTab(fH2, 100, 100);
275 //fTabBottom->AddTab("Tab 1");
277 fV2->AddFrame(fH2, fLH3);
278
280 fHf->AddFrame(fV2, fLH5);
281 fVf->AddFrame(fHf, fLH5);
282 AddFrame(fVf, fLH5);
283
284 // status bar
285 fStatusBar = new TGStatusBar(this, 400, 20);
286 int parts[] = { 33, 10, 10, 47 };
287 fStatusBar->SetParts(parts, 4);
289
290 fNbInitPlugins = 0;
291 fEditFrame = 0;
292 fEditTab = 0;
293 fEditPos = -1;
294 fEditSubPos= -1;
295 fNbTab[0] = fNbTab[1] = fNbTab[2] = 0;
296 fCrTab[0] = fCrTab[1] = fCrTab[2] = -1;
297
298 // Set a name to the main frame
301 fIconPic = SetIconPixmap("rootdb_s.xpm");
302 SetClassHints("ROOT", "Browser");
303
304 if (!strcmp(gROOT->GetDefCanvasName(), "c1"))
305 gROOT->SetDefCanvasName("Canvas_1");
306
307 SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
311
313}
314
315////////////////////////////////////////////////////////////////////////////////
316/// Clean up all widgets, frames and layouthints that were used
317
319{
320 if (fIconPic) gClient->FreePicture(fIconPic);
321 delete fLH0;
322 delete fLH1;
323 delete fLH2;
324 delete fLH3;
325 delete fLH4;
326 delete fLH5;
327 delete fLH6;
328 delete fLH7;
329 delete fMenuHelp;
330 delete fMenuExecPlugin;
331 delete fMenuFile;
332 delete fMenuBar;
333 delete fMenuFrame;
334 delete fPreMenuFrame;
335 delete fTopMenuFrame;
336 delete fToolbarFrame;
337 delete fVSplitter;
338 delete fHSplitter;
339 delete fTabLeft;
340 delete fTabRight;
341 delete fTabBottom;
342 delete fH1;
343 delete fH2;
344 delete fV1;
345 delete fV2;
346 delete fHf;
347 delete fStatusBar;
348 delete fVf;
349}
350
351////////////////////////////////////////////////////////////////////////////////
352/// Add items to the actual browser. This function has to be called
353/// by the Browse() member function of objects when they are
354/// called by a browser. If check < 0 (default) no check box is drawn,
355/// if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
356
357void TRootBrowser::Add(TObject *obj, const char *name, Int_t check)
358{
359 if (obj->InheritsFrom("TObjectSpy"))
360 return;
361 if (fActBrowser)
362 fActBrowser->Add(obj, name, check);
363}
364
365////////////////////////////////////////////////////////////////////////////////
366/// Browse object. This, in turn, will trigger the calling of
367/// TRootBrowser::Add() which will fill the IconBox and the tree.
368/// Emits signal "BrowseObj(TObject*)".
369
371{
372 if (fActBrowser)
374 Emit("BrowseObj(TObject*)", (Longptr_t)obj);
375}
376
377////////////////////////////////////////////////////////////////////////////////
378/// Clone the browser. A new Browser will be created, with the same
379/// plugins executed in the current one.
380
382{
383 Int_t loop = 1;
384 TBrowserPlugin *plugin = 0;
385 TBrowser *b = new TBrowser();
386 TIter next(&fPlugins);
387 while ((plugin = (TBrowserPlugin *)next())) {
388 if (loop > fNbInitPlugins)
389 b->ExecPlugin(plugin->GetName(), "", plugin->fCommand.Data(), plugin->fTab,
390 plugin->fSubTab);
391 ++loop;
392 }
393}
394
395////////////////////////////////////////////////////////////////////////////////
396/// Remove tab element id from right tab.
397
399{
400 RemoveTab(kRight, id);
401}
402
403////////////////////////////////////////////////////////////////////////////////
404/// Properly close the mainframes embedded in the different tabs
405
407{
408 TGFrameElement *el;
409 TGCompositeFrame *container;
410 Int_t i;
411 TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
412 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
413 Disconnect(fMenuFile, "Activated(Int_t)", this, "HandleMenu(Int_t)");
414 Disconnect(fTabRight, "Selected(Int_t)", this, "DoTab(Int_t)");
415 if (fPlugins.IsEmpty()) return;
416 fActBrowser = 0;
417 for (i=0;i<fTabLeft->GetNumberOfTabs();i++) {
418 container = fTabLeft->GetTabContainer(i);
419 if (!container) continue;
420 el = (TGFrameElement *)container->GetList()->First();
421 if (el && el->fFrame) {
422 el->fFrame->SetFrameElement(0);
423 if (el->fFrame->InheritsFrom("TVirtualPadEditor")) {
425 }
426 else if (el->fFrame->InheritsFrom("TGMainFrame")) {
427 el->fFrame->UnmapWindow();
428 ((TGMainFrame *)el->fFrame)->CloseWindow();
430 }
431 else
432 delete el->fFrame;
433 el->fFrame = 0;
434 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
435 (el->fLayout->References() > 0)) {
437 if (!el->fLayout->References()) {
438 delete el->fLayout;
439 }
440 }
441 container->GetList()->Remove(el);
442 delete el;
443 }
444 }
445 for (i=0;i<fTabRight->GetNumberOfTabs();i++) {
446 container = fTabRight->GetTabContainer(i);
447 if (!container) continue;
448 el = (TGFrameElement *)container->GetList()->First();
449 if (el && el->fFrame) {
450 el->fFrame->SetFrameElement(0);
451 if (el->fFrame->InheritsFrom("TGMainFrame")) {
452 el->fFrame->UnmapWindow();
453 Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
454 if (sleep)
455 gSystem->Sleep(150);
456 ((TGMainFrame *)el->fFrame)->CloseWindow();
457 if (sleep)
458 gSystem->Sleep(150);
460 }
461 else
462 delete el->fFrame;
463 el->fFrame = 0;
464 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
465 (el->fLayout->References() > 0)) {
467 if (!el->fLayout->References()) {
468 delete el->fLayout;
469 }
470 }
471 container->GetList()->Remove(el);
472 delete el;
473 }
474 }
475 for (i=0;i<fTabBottom->GetNumberOfTabs();i++) {
476 container = fTabBottom->GetTabContainer(i);
477 if (!container) continue;
478 el = (TGFrameElement *)container->GetList()->First();
479 if (el && el->fFrame) {
480 el->fFrame->SetFrameElement(0);
481 if (el->fFrame->InheritsFrom("TGMainFrame")) {
482 el->fFrame->UnmapWindow();
483 ((TGMainFrame *)el->fFrame)->CloseWindow();
484 gSystem->Sleep(150);
486 }
487 else
488 delete el->fFrame;
489 el->fFrame = 0;
490 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
491 (el->fLayout->References() > 0)) {
493 if (!el->fLayout->References()) {
494 delete el->fLayout;
495 }
496 }
497 container->GetList()->Remove(el);
498 delete el;
499 }
500 }
502 Emit("CloseWindow()");
503}
504
505////////////////////////////////////////////////////////////////////////////////
506/// Called when window is closed via the window manager.
507
509{
510 TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
511 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
512 CloseTabs();
513 DeleteWindow();
514}
515
516////////////////////////////////////////////////////////////////////////////////
517/// Handle Tab navigation.
518
520{
521 TGTab *sender = (TGTab *)gTQSender;
522 if ((sender) && (sender == fTabRight)) {
523 SwitchMenus(sender->GetTabContainer(id));
524 }
525}
526
527////////////////////////////////////////////////////////////////////////////////
528/// Display a tooltip with infos about the primitive below the cursor.
529
531{
532 const Int_t kTMAX=256;
533 static char atext[kTMAX];
534 if (selected == 0 || event == kMouseLeave) {
535 SetStatusText("", 0);
536 SetStatusText("", 1);
537 SetStatusText("", 2);
538 SetStatusText("", 3);
539 return;
540 }
541 SetStatusText(selected->GetTitle(), 0);
542 SetStatusText(selected->GetName(), 1);
543 if (event == kKeyPress)
544 snprintf(atext, kTMAX, "%c", (char) px);
545 else
546 snprintf(atext, kTMAX, "%d,%d", px, py);
547 SetStatusText(atext, 2);
548 SetStatusText(selected->GetObjectInfo(px,py), 3);
549}
550
551////////////////////////////////////////////////////////////////////////////////
552/// Execute a macro and embed the created frame in the tab "pos"
553/// and tab element "subpos".
554
555Longptr_t TRootBrowser::ExecPlugin(const char *name, const char *fname,
556 const char *cmd, Int_t pos, Int_t subpos)
557{
558 Longptr_t retval = 0;
560 TString command, pname;
561 if (cmd && strlen(cmd)) {
562 command = cmd;
563 if (name) pname = name;
564 else pname = TString::Format("Plugin %d", fPlugins.GetSize());
565 p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
566 }
567 else if (fname && strlen(fname)) {
568 pname = name ? name : gSystem->BaseName(fname);
569 Ssiz_t t = pname.Last('.');
570 if (t > 0) pname.Remove(t);
571 command.Form("gROOT->Macro(\"%s\");", gSystem->UnixPathName(fname));
572 p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
573 }
574 else return 0;
575
576 Bool_t new_canvas = command.Contains("new TCanvas");
577 Bool_t is_web_canvas = strcmp(gEnv->GetValue("Canvas.Name", ""), "TWebCanvas") == 0;
578
579 if (IsWebGUI() && gROOT->IsWebDisplay() && new_canvas && is_web_canvas)
580 return gROOT->ProcessLine(command.Data());
581
582 if (new_canvas && is_web_canvas)
583 gEnv->SetValue("Canvas.Name", "TRootCanvas");
584
585 StartEmbedding(pos, subpos);
586 fPlugins.Add(p);
587 retval = gROOT->ProcessLine(command.Data());
588 if (new_canvas) {
589 pname = gPad->GetName();
590 p->SetName(pname.Data());
591 if (is_web_canvas)
592 gEnv->SetValue("Canvas.Name", "TWebCanvas");
593 }
594 SetTabTitle(pname.Data(), pos, subpos);
596 return retval;
597}
598
599////////////////////////////////////////////////////////////////////////////////
600/// Returns drawing option.
601
603{
604 if (fActBrowser)
605 return fActBrowser->GetDrawOption();
606 return 0;
607}
608
609////////////////////////////////////////////////////////////////////////////////
610/// Returns the TGTab at position pos.
611
613{
614 switch (pos) {
615 case kLeft: return fTabLeft;
616 case kRight: return fTabRight;
617 case kBottom: return fTabBottom;
618 default: return 0;
619 }
620}
621
622////////////////////////////////////////////////////////////////////////////////
623/// Handle keyboard events.
624
626{
627 char input[10];
628 UInt_t keysym;
629
630 if (event->fType == kGKeyPress) {
631 gVirtualX->LookupString(event, input, sizeof(input), keysym);
632
633 if (!event->fState && (EKeySym)keysym == kKey_F5) {
634 Refresh(kTRUE);
635 return kTRUE;
636 }
637 switch ((EKeySym)keysym) { // ignore these keys
638 case kKey_Shift:
639 case kKey_Control:
640 case kKey_Meta:
641 case kKey_Alt:
642 case kKey_CapsLock:
643 case kKey_NumLock:
644 case kKey_ScrollLock:
645 return kTRUE;
646 default:
647 break;
648 }
649 if (event->fState & kKeyControlMask) { // Cntrl key modifier pressed
650 switch ((EKeySym)keysym & ~0x20) { // treat upper and lower the same
651 case kKey_B:
653 return kTRUE;
654 case kKey_O:
656 return kTRUE;
657 case kKey_E:
659 return kTRUE;
660 case kKey_C:
662 return kTRUE;
663 case kKey_H:
665 return kTRUE;
666 case kKey_N:
668 return kTRUE;
669 case kKey_T:
671 return kTRUE;
672 case kKey_W:
674 return kTRUE;
675 case kKey_Q:
677 return kTRUE;
678 default:
679 break;
680 }
681 }
682 }
684}
685
686////////////////////////////////////////////////////////////////////////////////
687/// Handle menu entries events.
688
690{
691 TRootHelpDialog *hd;
692 TString cmd;
693 static Int_t eNr = 1;
694 TGPopupMenu *sender = (TGPopupMenu *)gTQSender;
695 if (sender != fMenuFile)
696 return;
697 switch (id) {
698 case kBrowse:
699 new TBrowser();
700 break;
701 case kOpenFile:
702 {
703 Bool_t newfile = kFALSE;
704 static TString dir(".");
705 TGFileInfo fi;
707 fi.SetIniDir(dir);
708 new TGFileDialog(gClient->GetDefaultRoot(), this,
709 kFDOpen,&fi);
710 dir = fi.fIniDir;
711 if (fi.fMultipleSelection && fi.fFileNamesList) {
712 TObjString *el;
713 TIter next(fi.fFileNamesList);
714 while ((el = (TObjString *) next())) {
715 gROOT->ProcessLine(Form("new TFile(\"%s\");",
717 }
718 newfile = kTRUE;
719 }
720 else if (fi.fFilename) {
721 gROOT->ProcessLine(Form("new TFile(\"%s\");",
723 newfile = kTRUE;
724 }
725 if (fActBrowser && newfile) {
726 TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(fActBrowser);
727 if (fb) fb->Selected(0);
728 }
729 }
730 break;
731 // Handle Help menu items...
732 case kHelpAbout:
733 {
734#ifdef R__UNIX
735 TString rootx = TROOT::GetBinDir() + "/root -a &";
736 gSystem->Exec(rootx);
737#else
738#ifdef WIN32
740#else
741 char str[32];
742 sprintf(str, "About ROOT %s...", gROOT->GetVersion());
743 hd = new TRootHelpDialog(this, str, 600, 400);
744 hd->SetText(gHelpAbout);
745 hd->Popup();
746#endif
747#endif
748 }
749 break;
750 case kHelpOnCanvas:
751 hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
752 hd->SetText(gHelpCanvas);
753 hd->Popup();
754 break;
755 case kHelpOnMenus:
756 hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
758 hd->Popup();
759 break;
761 hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
763 hd->Popup();
764 break;
765 case kHelpOnBrowser:
766 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
768 hd->Popup();
769 break;
770 case kHelpOnObjects:
771 hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
773 hd->Popup();
774 break;
775 case kHelpOnPS:
776 hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
778 hd->Popup();
779 break;
780 case kHelpOnRemote:
781 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
782 hd->SetText(gHelpRemote);
783 hd->Popup();
784 break;
785 case kClone:
786 CloneBrowser();
787 break;
788 case kNewEditor:
789 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot())");
790 ++eNr;
791 ExecPlugin(Form("Editor %d", eNr), "", cmd.Data(), 1);
792 break;
793 case kNewCanvas:
794 ExecPlugin("", "", "new TCanvas()", 1);
795 break;
796 case kNewHtml:
797 cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot())",
798 gEnv->GetValue("Browser.StartUrl", "http://root.cern.ch"));
799 ExecPlugin("HTML", "", cmd.Data(), 1);
800 break;
801 case kExecPluginMacro:
802 {
803 static TString dir(".");
804 TGFileInfo fi;
806 fi.SetIniDir(dir);
807 new TGFileDialog(gClient->GetDefaultRoot(), this,
808 kFDOpen,&fi);
809 dir = fi.fIniDir;
810 if (fi.fFilename) {
811 ExecPlugin(0, fi.fFilename, 0, kRight);
812 }
813 }
814 break;
815 case kExecPluginCmd:
816 {
817 char command[1024];
818 strlcpy(command, "new TGLSAViewer(gClient->GetRoot(), 0);",
819 sizeof(command));
820 new TGInputDialog(gClient->GetRoot(), this,
821 "Enter plugin command line:",
822 command, command);
823 if (strcmp(command, "")) {
824 ExecPlugin("User", 0, command, kRight);
825 }
826 }
827 break;
828 case kCloseTab:
830 break;
831 case kCloseWindow:
832 CloseWindow();
833 break;
834 case kQuitRoot:
835 CloseWindow();
837 break;
838 default:
839 break;
840 }
841}
842
843////////////////////////////////////////////////////////////////////////////////
844/// Initialize default plugins. Could be also of the form:
845/// StartEmbedding(0);
846/// TPluginHandler *ph;
847/// ph = gROOT->GetPluginManager()->FindHandler("TGClassBrowser");
848/// if (ph && ph->LoadPlugin() != -1) {
849/// ph->ExecPlugin(3, gClient->GetRoot(), 200, 500);
850/// }
851/// StopEmbedding();
852
854{
855 TString cmd;
856
857 if ((opt == 0) || (!opt[0]))
858 return;
859 // --- Left vertical area
860
861 // File Browser plugin
862 if (strchr(opt, 'F')) {
863 cmd.Form("new TGFileBrowser(gClient->GetRoot(), (TBrowser *)0x%zx, 200, 500);", (size_t)fBrowser);
864 ExecPlugin("Files", 0, cmd.Data(), 0);
866 }
867
868 // --- Right main area
869
870 Int_t i, len = strlen(opt);
871 for (i=0; i<len; ++i) {
872 // Editor plugin...
873 if (opt[i] == 'E') {
874 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot());");
875 ExecPlugin("Editor 1", 0, cmd.Data(), 1);
877 }
878
879 // HTML plugin...
880 if (opt[i] == 'H') {
881 if (gSystem->Load("libGuiHtml") >= 0) {
882 cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot());",
883 gEnv->GetValue("Browser.StartUrl",
884 "http://root.cern.ch/root/html/ClassIndex.html"));
885 ExecPlugin("HTML", 0, cmd.Data(), 1);
887 }
888 }
889
890 // Canvas plugin...
891 if (opt[i] == 'C') {
892 cmd.Form("new TCanvas();");
893 ExecPlugin("c1", 0, cmd.Data(), 1);
895 }
896
897 // GLViewer plugin...
898 if (opt[i] == 'G') {
899 cmd.Form("new TGLSAViewer(gClient->GetRoot(), 0);");
900 ExecPlugin("OpenGL", 0, cmd.Data(), 1);
902 }
903
904 // PROOF plugin...
905 if (opt[i] == 'P') {
906 cmd.Form("new TSessionViewer();");
907 ExecPlugin("PROOF", 0, cmd.Data(), 1);
909 }
910 }
911 // --- Right bottom area
912
913 // Command plugin...
914 if (strchr(opt, 'I')) {
915 cmd.Form("new TGCommandPlugin(gClient->GetRoot(), 700, 300);");
916 ExecPlugin("Command", 0, cmd.Data(), 2);
918 }
919
920 // --- Select first tab everywhere
921 SetTab(0, 0);
922 SetTab(1, 0);
923 SetTab(2, 0);
924}
925
926////////////////////////////////////////////////////////////////////////////////
927/// Check if the GUI factory is set to use the Web GUI.
928
930{
931 TString factory = gEnv->GetValue("Gui.Factory", "native");
932 return (factory.Contains("web", TString::kIgnoreCase));
933}
934
935////////////////////////////////////////////////////////////////////////////////
936/// Really delete the browser and the this GUI.
937
939{
941 delete this;
942}
943
944////////////////////////////////////////////////////////////////////////////////
945/// Recursively remove object from browser.
946
948{
949 if (fActBrowser)
951}
952
953////////////////////////////////////////////////////////////////////////////////
954/// Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
955
957{
958 TGMenuEntry *entry = 0;
959 TIter next(popup->GetListOfEntries());
960 while ((entry = (TGMenuEntry *)next())) {
961 if (entry->GetPopup()) {
962 RecursiveReparent(entry->GetPopup());
963 }
964 }
965 popup->ReparentWindow(gClient->GetDefaultRoot());
966}
967
968////////////////////////////////////////////////////////////////////////////////
969/// Refresh the actual browser contents.
970
972{
973 if (fActBrowser)
974 fActBrowser->Refresh(force);
975}
976
977////////////////////////////////////////////////////////////////////////////////
978/// Remove tab element "subpos" from tab "pos".
979
981{
982 TGTab *edit = 0;
983 switch (pos) {
984 case kLeft: // left
985 edit = fTabLeft;
986 break;
987 case kRight: // right
988 edit = fTabRight;
991 fActMenuBar = 0;
992 break;
993 case kBottom: // bottom
994 edit = fTabBottom;
995 break;
996 }
997 if (!edit || !edit->GetTabTab(subpos))
998 return;
999 const char *tabName = edit->GetTabTab(subpos)->GetString();
1000 TObject *obj = 0;
1001 if ((obj = fPlugins.FindObject(tabName))) {
1002 fPlugins.Remove(obj);
1003 }
1004 TGFrameElement *el = 0;
1005 if (edit->GetTabContainer(subpos))
1006 el = (TGFrameElement *)edit->GetTabContainer(subpos)->GetList()->First();
1007 if (el && el->fFrame) {
1008 el->fFrame->Disconnect("ProcessedConfigure(Event_t*)");
1009 el->fFrame->SetFrameElement(0);
1010 if (el->fFrame->InheritsFrom("TGMainFrame")) {
1011 Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
1012 ((TGMainFrame *)el->fFrame)->CloseWindow();
1013 if (sleep)
1014 gSystem->Sleep(150);
1016 }
1017 else
1018 delete el->fFrame;
1019 el->fFrame = 0;
1020 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
1021 (el->fLayout->References() > 0)) {
1022 el->fLayout->RemoveReference();
1023 if (!el->fLayout->References()) {
1024 delete el->fLayout;
1025 }
1026 }
1027 edit->GetTabContainer(subpos)->GetList()->Remove(el);
1028 delete el;
1029 }
1030 fNbTab[pos]--;
1031 edit->RemoveTab(subpos);
1032 SwitchMenus(edit->GetTabContainer(edit->GetCurrent()));
1033}
1034
1035////////////////////////////////////////////////////////////////////////////////
1036/// Switch to Tab "subpos" in TGTab "pos".
1037
1039{
1040 TGTab *tab = GetTab(pos);
1041 if (subpos == -1)
1042 subpos = fCrTab[pos];
1043
1044 if (tab && tab->SetTab(subpos, kFALSE)) { // Block signal emit
1045 if (pos == kRight)
1046 SwitchMenus(tab->GetTabContainer(subpos));
1047 tab->Layout();
1048 }
1049}
1050
1051////////////////////////////////////////////////////////////////////////////////
1052/// Set text "title" of Tab "subpos" in TGTab "pos".
1053
1054void TRootBrowser::SetTabTitle(const char *title, Int_t pos, Int_t subpos)
1055{
1056 TBrowserPlugin *p = 0;
1057 TGTab *edit = GetTab(pos);
1058 if (!edit) return;
1059 if (subpos == -1)
1060 subpos = fCrTab[pos];
1061
1062 TGTabElement *el = edit->GetTabTab(subpos);
1063 if (el) {
1064 el->SetText(new TGString(title));
1065 edit->Layout();
1066 if ((p = (TBrowserPlugin *)fPlugins.FindObject(title)))
1067 p->SetName(title);
1068 }
1069}
1070
1071////////////////////////////////////////////////////////////////////////////////
1072/// Set text in column col in status bar.
1073
1074void TRootBrowser::SetStatusText(const char* txt, Int_t col)
1075{
1076 fStatusBar->SetText(txt, col);
1077}
1078
1079////////////////////////////////////////////////////////////////////////////////
1080/// Show the selected frame's menu and hide previous one.
1081
1083{
1084 TGFrameElement *el = 0;
1085 // temporary solution until I find a proper way to handle
1086 // these bloody menus...
1087 fBindList->Delete();
1088 TIter nextm(fMenuBar->GetList());
1089 while ((el = (TGFrameElement *) nextm())) {
1090 TGMenuTitle *t = (TGMenuTitle *) el->fFrame;
1091 Int_t code = t->GetHotKeyCode();
1100 }
1102 fMenuFrame->ShowFrame(menu);
1103 menu->Layout();
1104 fMenuFrame->Layout();
1105 fActMenuBar = menu;
1106}
1107
1108////////////////////////////////////////////////////////////////////////////////
1109/// Start embedding external frame in the tab "pos" and tab element "subpos".
1110
1112{
1113 fEditTab = GetTab(pos);
1114 if (!fEditTab) return;
1115 fEditPos = pos;
1116 fEditSubPos = subpos;
1117
1118 if (fEditFrame == 0) {
1119 if (subpos == -1) {
1120 fCrTab[pos] = fNbTab[pos]++;
1121 fEditFrame = fEditTab->AddTab(Form("Tab %d",fNbTab[pos]));
1125 if(tabel) {
1126 tabel->MapWindow();
1127 if (fShowCloseTab && (pos == 1))
1128 tabel->ShowClose();
1129 }
1131 fEditTab->Layout();
1132 }
1133 else {
1134 fCrTab[pos] = subpos;
1136 fEditTab->SetTab(subpos);
1137 }
1139 }
1140}
1141
1142////////////////////////////////////////////////////////////////////////////////
1143/// Stop embedding external frame in the current editable frame.
1144
1146{
1147 if (fEditFrame != 0) {
1150 if (el && el->fFrame) {
1151 // let be notified when the inside frame gets resized, and tell its
1152 // container to recompute its layout
1153 el->fFrame->Connect("ProcessedConfigure(Event_t*)", "TGCompositeFrame",
1154 fEditFrame, "Layout()");
1155 }
1156 if (layout) {
1157 el = (TGFrameElement*) fEditFrame->GetList()->Last();
1158 // !!!! MT what to do with the old layout? Leak it for now ...
1159 if (el) el->fLayout = layout;
1160 }
1161 fEditFrame->Layout();
1162 if (fEditTab == fTabRight)
1164 }
1165 if (name && strlen(name)) {
1167 }
1169 fEditFrame = fEditTab = 0;
1170 fEditPos = fEditSubPos = -1;
1171}
1172
1173////////////////////////////////////////////////////////////////////////////////
1174/// Move the menu from original frame to our TGMenuFrame, or display the
1175/// menu associated to the current tab.
1176
1178{
1179 if (from == 0)
1180 return;
1181 TGFrameElement *fe = (TGFrameElement *)from->GetList()->First();
1182 if (!fe) {
1183 if (fActMenuBar != fMenuBar)
1185 return;
1186 }
1188 TGFrameElement *el = 0;
1189 if (embed && embed->GetList()) {
1190 TIter next(embed->GetList());
1191 while ((el = (TGFrameElement *)next())) {
1192 if (el->fFrame->InheritsFrom("TGMenuBar")) {
1193 TGMenuBar *menu = (TGMenuBar *)el->fFrame;
1194 if (fActMenuBar == menu)
1195 return;
1196 TGFrameElement *nw;
1197 TIter nel(fMenuFrame->GetList());
1198 while ((nw = (TGFrameElement *) nel())) {
1199 if (nw->fFrame == menu) {
1200 ShowMenu(menu);
1201 return;
1202 }
1203 }
1204 ((TGCompositeFrame *)menu->GetParent())->HideFrame(menu);
1207 fMenuFrame->AddFrame(menu, fLH2);
1208 TGFrameElement *mel;
1209 TIter mnext(menu->GetList());
1210 while ((mel = (TGFrameElement *) mnext())) {
1211 TGMenuTitle *t = (TGMenuTitle *) mel->fFrame;
1212 TGPopupMenu *popup = menu->GetPopup(t->GetName());
1213 if (popup) {
1214 RecursiveReparent(popup);
1215 if (popup->GetEntry("Close Canvas")) {
1216 TGMenuEntry *exit = popup->GetEntry("Close Canvas");
1217 popup->HideEntry(exit->GetEntryId());
1218 }
1219 if (popup->GetEntry("Close Viewer")) {
1220 TGMenuEntry *exit = popup->GetEntry("Close Viewer");
1221 popup->HideEntry(exit->GetEntryId());
1222 }
1223 if (popup->GetEntry("Quit ROOT")) {
1224 TGMenuEntry *exit = popup->GetEntry("Quit ROOT");
1225 popup->HideEntry(exit->GetEntryId());
1226 }
1227 if (popup->GetEntry("Exit")) {
1228 TGMenuEntry *exit = popup->GetEntry("Exit");
1229 popup->HideEntry(exit->GetEntryId());
1230 }
1231 }
1232 }
1233 ShowMenu(menu);
1234 return;
1235 }
1236 }
1237 }
1238 if (fActMenuBar != fMenuBar)
1240}
1241
1242////////////////////////////////////////////////////////////////////////////////
1243/// Emits signal when double clicking on icon.
1244
1246{
1247 Emit("DoubleClicked(TObject*)", (Longptr_t)obj);
1248}
1249
1250////////////////////////////////////////////////////////////////////////////////
1251/// Emits signal when double clicking on icon.
1252
1254{
1255 Longptr_t args[2];
1256
1257 args[0] = (Longptr_t)obj;
1258 args[1] = checked;
1259
1260 Emit("Checked(TObject*,Bool_t)", args);
1261}
1262
1263////////////////////////////////////////////////////////////////////////////////
1264/// Emits signal "ExecuteDefaultAction(TObject*)".
1265
1267{
1268 Emit("ExecuteDefaultAction(TObject*)", (Longptr_t)obj);
1269}
1270
1271
1272////////////////////////////////////////////////////////////////////////////////
1273/// static constructor returning TBrowserImp,
1274/// as needed by the plugin mechanism.
1275
1278 Option_t *opt)
1279{
1280 TRootBrowser *browser = new TRootBrowser(b, title, width, height, opt);
1281 return (TBrowserImp *)browser;
1282}
1283
1284////////////////////////////////////////////////////////////////////////////////
1285/// static constructor returning TBrowserImp,
1286/// as needed by the plugin mechanism.
1287
1290 Option_t *opt)
1291{
1292 TRootBrowser *browser = new TRootBrowser(b, title, x, y, width, height, opt);
1293 return (TBrowserImp *)browser;
1294}
@ 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
Definition RtypesCore.h:82
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
R__EXTERN TApplication * gApplication
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:405
static const char * gPluginFileTypes[]
static const char * gOpenFileTypes[]
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2467
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
#define gPad
#define gVirtualX
Definition TVirtualX.h:338
#define snprintf
Definition civetweb.c:1540
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).
TString fCommand
Command to be executed.
Int_t fSubTab
Tab element number.
Int_t fTab
Tab number.
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
void SetBrowserImp(TBrowserImp *i)
Definition TBrowser.h:95
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:2968
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:287
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:316
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:310
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:297
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.
TList * fFileNamesList
list of selected file names
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
Bool_t fMultipleSelection
if true, allow multiple file selection
void SetIniDir(const char *inidir)
Set directory name.
TGLayoutHints * fLayout
Definition TGLayout.h:114
TGFrame * fFrame
Definition TGLayout.h:112
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 ReparentWindow(const TGWindow *p, Int_t x=0, Int_t y=0) override
Reparent window, make p the new parent and position the window at position (x,y) in new parent.
Definition TGFrame.h:202
void MapWindow() override
map window
Definition TGFrame.h:204
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
void UnmapWindow() override
unmap window
Definition TGFrame.h:206
void SetFrameElement(TGFrameElement *fe)
Definition TGFrame.h:236
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:385
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:397
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:414
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 TGPopupMenu * GetPopup(const char *s)
Return popup menu with the specified name.
Definition TGMenu.cxx:540
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
TGPopupMenu * GetPopup() const
Definition TGMenu.h:88
Int_t GetEntryId() const
Definition TGMenu.h:83
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 HideEntry(Int_t id)
Hide entry (hidden entries are not shown in the menu).
Definition TGMenu.cxx:1751
virtual TGMenuEntry * GetEntry(Int_t id)
Find entry with specified id.
Definition TGMenu.cxx:1897
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
const TList * GetListOfEntries() const
Definition TGMenu.h:200
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
void SetText(TGString *text)
Set new tab text.
Definition TGTab.cxx:213
const char * GetString() const
Definition TGTab.h:146
virtual void ShowClose(Bool_t on=kTRUE)
Show/hide close icon on the tab element, then apply layout to compute correct elements size.
Definition TGTab.cxx:230
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 RemoveTab(Int_t tabIndex=-1, Bool_t storeRemoved=kTRUE)
Remove container and tab of tab with index tabIndex.
Definition TGTab.cxx:427
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:374
const TGWindow * GetParent() const
Definition TGWindow.h:83
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
Definition TList.cxx:578
void Add(TObject *obj) override
Definition TList.h:81
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:822
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:693
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:659
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:470
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
Collectable string class.
Definition TObjString.h:28
const TString & GetString() const
Definition TObjString.h:46
Mother of all ROOT objects.
Definition TObject.h:41
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:439
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
Definition TObject.cxx:468
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:525
virtual const char * GetTitle() const
Returns title of object.
Definition TObject.cxx:483
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.
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition TROOT.cxx:2932
UInt_t RemoveReference()
Definition TRefCnt.h:41
UInt_t References() const
Definition TRefCnt.h:38
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.
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.
virtual ~TRootBrowser()
Clean up all widgets, frames and layouthints that were used.
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).
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
void Popup()
Show help dialog.
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:380
@ kIgnoreCase
Definition TString.h:279
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition TString.cxx:924
TString & Remove(Ssiz_t pos)
Definition TString.h:685
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:2356
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2334
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:636
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition TSystem.cxx:656
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition TSystem.cxx:1858
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1066
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition TSystem.cxx:937
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition TSystem.cxx:440
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:419
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
Event structure.
Definition GuiTypes.h:174