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;
126 Resize(width, height);
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
141 UInt_t width, UInt_t height, Option_t *opt,
142 Bool_t initshow) :
143 TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
144{
146 fActBrowser = 0;
147 fIconPic = 0;
149 MoveResize(x, y, width, height);
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 if (IsWebGUI() && command.Contains("new TCanvas"))
576 return gROOT->ProcessLine(command.Data());
577 StartEmbedding(pos, subpos);
578 fPlugins.Add(p);
579 retval = gROOT->ProcessLine(command.Data());
580 if (command.Contains("new TCanvas")) {
581 pname = gPad->GetName();
582 p->SetName(pname.Data());
583 }
584 SetTabTitle(pname.Data(), pos, subpos);
586 return retval;
587}
588
589////////////////////////////////////////////////////////////////////////////////
590/// Returns drawing option.
591
593{
594 if (fActBrowser)
595 return fActBrowser->GetDrawOption();
596 return 0;
597}
598
599////////////////////////////////////////////////////////////////////////////////
600/// Returns the TGTab at position pos.
601
603{
604 switch (pos) {
605 case kLeft: return fTabLeft;
606 case kRight: return fTabRight;
607 case kBottom: return fTabBottom;
608 default: return 0;
609 }
610}
611
612////////////////////////////////////////////////////////////////////////////////
613/// Handle keyboard events.
614
616{
617 char input[10];
618 UInt_t keysym;
619
620 if (event->fType == kGKeyPress) {
621 gVirtualX->LookupString(event, input, sizeof(input), keysym);
622
623 if (!event->fState && (EKeySym)keysym == kKey_F5) {
624 Refresh(kTRUE);
625 return kTRUE;
626 }
627 switch ((EKeySym)keysym) { // ignore these keys
628 case kKey_Shift:
629 case kKey_Control:
630 case kKey_Meta:
631 case kKey_Alt:
632 case kKey_CapsLock:
633 case kKey_NumLock:
634 case kKey_ScrollLock:
635 return kTRUE;
636 default:
637 break;
638 }
639 if (event->fState & kKeyControlMask) { // Cntrl key modifier pressed
640 switch ((EKeySym)keysym & ~0x20) { // treat upper and lower the same
641 case kKey_B:
643 return kTRUE;
644 case kKey_O:
646 return kTRUE;
647 case kKey_E:
649 return kTRUE;
650 case kKey_C:
652 return kTRUE;
653 case kKey_H:
655 return kTRUE;
656 case kKey_N:
658 return kTRUE;
659 case kKey_T:
661 return kTRUE;
662 case kKey_W:
664 return kTRUE;
665 case kKey_Q:
667 return kTRUE;
668 default:
669 break;
670 }
671 }
672 }
674}
675
676////////////////////////////////////////////////////////////////////////////////
677/// Handle menu entries events.
678
680{
681 TRootHelpDialog *hd;
682 TString cmd;
683 static Int_t eNr = 1;
684 TGPopupMenu *sender = (TGPopupMenu *)gTQSender;
685 if (sender != fMenuFile)
686 return;
687 switch (id) {
688 case kBrowse:
689 new TBrowser();
690 break;
691 case kOpenFile:
692 {
693 Bool_t newfile = kFALSE;
694 static TString dir(".");
695 TGFileInfo fi;
697 fi.SetIniDir(dir);
698 new TGFileDialog(gClient->GetDefaultRoot(), this,
699 kFDOpen,&fi);
700 dir = fi.fIniDir;
701 if (fi.fMultipleSelection && fi.fFileNamesList) {
702 TObjString *el;
703 TIter next(fi.fFileNamesList);
704 while ((el = (TObjString *) next())) {
705 gROOT->ProcessLine(Form("new TFile(\"%s\");",
707 }
708 newfile = kTRUE;
709 }
710 else if (fi.fFilename) {
711 gROOT->ProcessLine(Form("new TFile(\"%s\");",
713 newfile = kTRUE;
714 }
715 if (fActBrowser && newfile) {
716 TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(fActBrowser);
717 if (fb) fb->Selected(0);
718 }
719 }
720 break;
721 // Handle Help menu items...
722 case kHelpAbout:
723 {
724#ifdef R__UNIX
725 TString rootx = TROOT::GetBinDir() + "/root -a &";
726 gSystem->Exec(rootx);
727#else
728#ifdef WIN32
730#else
731 char str[32];
732 sprintf(str, "About ROOT %s...", gROOT->GetVersion());
733 hd = new TRootHelpDialog(this, str, 600, 400);
734 hd->SetText(gHelpAbout);
735 hd->Popup();
736#endif
737#endif
738 }
739 break;
740 case kHelpOnCanvas:
741 hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
742 hd->SetText(gHelpCanvas);
743 hd->Popup();
744 break;
745 case kHelpOnMenus:
746 hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
748 hd->Popup();
749 break;
751 hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
753 hd->Popup();
754 break;
755 case kHelpOnBrowser:
756 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
758 hd->Popup();
759 break;
760 case kHelpOnObjects:
761 hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
763 hd->Popup();
764 break;
765 case kHelpOnPS:
766 hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
768 hd->Popup();
769 break;
770 case kHelpOnRemote:
771 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
772 hd->SetText(gHelpRemote);
773 hd->Popup();
774 break;
775 case kClone:
776 CloneBrowser();
777 break;
778 case kNewEditor:
779 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot())");
780 ++eNr;
781 ExecPlugin(Form("Editor %d", eNr), "", cmd.Data(), 1);
782 break;
783 case kNewCanvas:
784 if (IsWebGUI())
785 gROOT->ProcessLine("new TCanvas()");
786 else
787 ExecPlugin("", "", "new TCanvas()", 1);
788 break;
789 case kNewHtml:
790 cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot())",
791 gEnv->GetValue("Browser.StartUrl", "http://root.cern.ch"));
792 ExecPlugin("HTML", "", cmd.Data(), 1);
793 break;
794 case kExecPluginMacro:
795 {
796 static TString dir(".");
797 TGFileInfo fi;
799 fi.SetIniDir(dir);
800 new TGFileDialog(gClient->GetDefaultRoot(), this,
801 kFDOpen,&fi);
802 dir = fi.fIniDir;
803 if (fi.fFilename) {
804 ExecPlugin(0, fi.fFilename, 0, kRight);
805 }
806 }
807 break;
808 case kExecPluginCmd:
809 {
810 char command[1024];
811 strlcpy(command, "new TGLSAViewer(gClient->GetRoot(), 0);",
812 sizeof(command));
813 new TGInputDialog(gClient->GetRoot(), this,
814 "Enter plugin command line:",
815 command, command);
816 if (strcmp(command, "")) {
817 ExecPlugin("User", 0, command, kRight);
818 }
819 }
820 break;
821 case kCloseTab:
823 break;
824 case kCloseWindow:
825 CloseWindow();
826 break;
827 case kQuitRoot:
828 CloseWindow();
830 break;
831 default:
832 break;
833 }
834}
835
836////////////////////////////////////////////////////////////////////////////////
837/// Initialize default plugins. Could be also of the form:
838/// StartEmbedding(0);
839/// TPluginHandler *ph;
840/// ph = gROOT->GetPluginManager()->FindHandler("TGClassBrowser");
841/// if (ph && ph->LoadPlugin() != -1) {
842/// ph->ExecPlugin(3, gClient->GetRoot(), 200, 500);
843/// }
844/// StopEmbedding();
845
847{
848 TString cmd;
849
850 if ((opt == 0) || (!opt[0]))
851 return;
852 // --- Left vertical area
853
854 // File Browser plugin
855 if (strchr(opt, 'F')) {
856 cmd.Form("new TGFileBrowser(gClient->GetRoot(), (TBrowser *)0x%zx, 200, 500);", (size_t)fBrowser);
857 ExecPlugin("Files", 0, cmd.Data(), 0);
859 }
860
861 // --- Right main area
862
863 Int_t i, len = strlen(opt);
864 for (i=0; i<len; ++i) {
865 // Editor plugin...
866 if (opt[i] == 'E') {
867 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot());");
868 ExecPlugin("Editor 1", 0, cmd.Data(), 1);
870 }
871
872 // HTML plugin...
873 if (opt[i] == 'H') {
874 if (gSystem->Load("libGuiHtml") >= 0) {
875 cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot());",
876 gEnv->GetValue("Browser.StartUrl",
877 "http://root.cern.ch/root/html/ClassIndex.html"));
878 ExecPlugin("HTML", 0, cmd.Data(), 1);
880 }
881 }
882
883 // Canvas plugin...
884 if ((opt[i] == 'C') && !IsWebGUI()) {
885 cmd.Form("new TCanvas();");
886 ExecPlugin("c1", 0, cmd.Data(), 1);
888 }
889
890 // GLViewer plugin...
891 if (opt[i] == 'G') {
892 cmd.Form("new TGLSAViewer(gClient->GetRoot(), 0);");
893 ExecPlugin("OpenGL", 0, cmd.Data(), 1);
895 }
896
897 // PROOF plugin...
898 if (opt[i] == 'P') {
899 cmd.Form("new TSessionViewer();");
900 ExecPlugin("PROOF", 0, cmd.Data(), 1);
902 }
903 }
904 // --- Right bottom area
905
906 // Command plugin...
907 if (strchr(opt, 'I')) {
908 cmd.Form("new TGCommandPlugin(gClient->GetRoot(), 700, 300);");
909 ExecPlugin("Command", 0, cmd.Data(), 2);
911 }
912
913 // --- Select first tab everywhere
914 SetTab(0, 0);
915 SetTab(1, 0);
916 SetTab(2, 0);
917}
918
919////////////////////////////////////////////////////////////////////////////////
920/// Check if the GUI factory is set to use the Web GUI.
921
923{
924 TString factory = gEnv->GetValue("Gui.Factory", "native");
925 return (factory.Contains("web", TString::kIgnoreCase));
926}
927
928////////////////////////////////////////////////////////////////////////////////
929/// Really delete the browser and the this GUI.
930
932{
934 delete this;
935}
936
937////////////////////////////////////////////////////////////////////////////////
938/// Recursively remove object from browser.
939
941{
942 if (fActBrowser)
944}
945
946////////////////////////////////////////////////////////////////////////////////
947/// Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
948
950{
951 TGMenuEntry *entry = 0;
952 TIter next(popup->GetListOfEntries());
953 while ((entry = (TGMenuEntry *)next())) {
954 if (entry->GetPopup()) {
955 RecursiveReparent(entry->GetPopup());
956 }
957 }
958 popup->ReparentWindow(gClient->GetDefaultRoot());
959}
960
961////////////////////////////////////////////////////////////////////////////////
962/// Refresh the actual browser contents.
963
965{
966 if (fActBrowser)
967 fActBrowser->Refresh(force);
968}
969
970////////////////////////////////////////////////////////////////////////////////
971/// Remove tab element "subpos" from tab "pos".
972
974{
975 TGTab *edit = 0;
976 switch (pos) {
977 case kLeft: // left
978 edit = fTabLeft;
979 break;
980 case kRight: // right
981 edit = fTabRight;
984 fActMenuBar = 0;
985 break;
986 case kBottom: // bottom
987 edit = fTabBottom;
988 break;
989 }
990 if (!edit || !edit->GetTabTab(subpos))
991 return;
992 const char *tabName = edit->GetTabTab(subpos)->GetString();
993 TObject *obj = 0;
994 if ((obj = fPlugins.FindObject(tabName))) {
995 fPlugins.Remove(obj);
996 }
997 TGFrameElement *el = 0;
998 if (edit->GetTabContainer(subpos))
999 el = (TGFrameElement *)edit->GetTabContainer(subpos)->GetList()->First();
1000 if (el && el->fFrame) {
1001 el->fFrame->Disconnect("ProcessedConfigure(Event_t*)");
1002 el->fFrame->SetFrameElement(0);
1003 if (el->fFrame->InheritsFrom("TGMainFrame")) {
1004 Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
1005 ((TGMainFrame *)el->fFrame)->CloseWindow();
1006 if (sleep)
1007 gSystem->Sleep(150);
1009 }
1010 else
1011 delete el->fFrame;
1012 el->fFrame = 0;
1013 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
1014 (el->fLayout->References() > 0)) {
1015 el->fLayout->RemoveReference();
1016 if (!el->fLayout->References()) {
1017 delete el->fLayout;
1018 }
1019 }
1020 edit->GetTabContainer(subpos)->GetList()->Remove(el);
1021 delete el;
1022 }
1023 fNbTab[pos]--;
1024 edit->RemoveTab(subpos);
1025 SwitchMenus(edit->GetTabContainer(edit->GetCurrent()));
1026}
1027
1028////////////////////////////////////////////////////////////////////////////////
1029/// Switch to Tab "subpos" in TGTab "pos".
1030
1032{
1033 TGTab *tab = GetTab(pos);
1034 if (subpos == -1)
1035 subpos = fCrTab[pos];
1036
1037 if (tab && tab->SetTab(subpos, kFALSE)) { // Block signal emit
1038 if (pos == kRight)
1039 SwitchMenus(tab->GetTabContainer(subpos));
1040 tab->Layout();
1041 }
1042}
1043
1044////////////////////////////////////////////////////////////////////////////////
1045/// Set text "title" of Tab "subpos" in TGTab "pos".
1046
1047void TRootBrowser::SetTabTitle(const char *title, Int_t pos, Int_t subpos)
1048{
1049 TBrowserPlugin *p = 0;
1050 TGTab *edit = GetTab(pos);
1051 if (!edit) return;
1052 if (subpos == -1)
1053 subpos = fCrTab[pos];
1054
1055 TGTabElement *el = edit->GetTabTab(subpos);
1056 if (el) {
1057 el->SetText(new TGString(title));
1058 edit->Layout();
1059 if ((p = (TBrowserPlugin *)fPlugins.FindObject(title)))
1060 p->SetName(title);
1061 }
1062}
1063
1064////////////////////////////////////////////////////////////////////////////////
1065/// Set text in column col in status bar.
1066
1067void TRootBrowser::SetStatusText(const char* txt, Int_t col)
1068{
1069 fStatusBar->SetText(txt, col);
1070}
1071
1072////////////////////////////////////////////////////////////////////////////////
1073/// Show the selected frame's menu and hide previous one.
1074
1076{
1077 TGFrameElement *el = 0;
1078 // temporary solution until I find a proper way to handle
1079 // these bloody menus...
1080 fBindList->Delete();
1081 TIter nextm(fMenuBar->GetList());
1082 while ((el = (TGFrameElement *) nextm())) {
1083 TGMenuTitle *t = (TGMenuTitle *) el->fFrame;
1084 Int_t code = t->GetHotKeyCode();
1093 }
1095 fMenuFrame->ShowFrame(menu);
1096 menu->Layout();
1097 fMenuFrame->Layout();
1098 fActMenuBar = menu;
1099}
1100
1101////////////////////////////////////////////////////////////////////////////////
1102/// Start embedding external frame in the tab "pos" and tab element "subpos".
1103
1105{
1106 fEditTab = GetTab(pos);
1107 if (!fEditTab) return;
1108 fEditPos = pos;
1109 fEditSubPos = subpos;
1110
1111 if (fEditFrame == 0) {
1112 if (subpos == -1) {
1113 fCrTab[pos] = fNbTab[pos]++;
1114 fEditFrame = fEditTab->AddTab(Form("Tab %d",fNbTab[pos]));
1118 if(tabel) {
1119 tabel->MapWindow();
1120 if (fShowCloseTab && (pos == 1))
1121 tabel->ShowClose();
1122 }
1124 fEditTab->Layout();
1125 }
1126 else {
1127 fCrTab[pos] = subpos;
1129 fEditTab->SetTab(subpos);
1130 }
1132 }
1133}
1134
1135////////////////////////////////////////////////////////////////////////////////
1136/// Stop embedding external frame in the current editable frame.
1137
1139{
1140 if (fEditFrame != 0) {
1143 if (el && el->fFrame) {
1144 // let be notified when the inside frame gets resized, and tell its
1145 // container to recompute its layout
1146 el->fFrame->Connect("ProcessedConfigure(Event_t*)", "TGCompositeFrame",
1147 fEditFrame, "Layout()");
1148 }
1149 if (layout) {
1150 el = (TGFrameElement*) fEditFrame->GetList()->Last();
1151 // !!!! MT what to do with the old layout? Leak it for now ...
1152 if (el) el->fLayout = layout;
1153 }
1154 fEditFrame->Layout();
1155 if (fEditTab == fTabRight)
1157 }
1158 if (name && strlen(name)) {
1160 }
1162 fEditFrame = fEditTab = 0;
1163 fEditPos = fEditSubPos = -1;
1164}
1165
1166////////////////////////////////////////////////////////////////////////////////
1167/// Move the menu from original frame to our TGMenuFrame, or display the
1168/// menu associated to the current tab.
1169
1171{
1172 if (from == 0)
1173 return;
1174 TGFrameElement *fe = (TGFrameElement *)from->GetList()->First();
1175 if (!fe) {
1176 if (fActMenuBar != fMenuBar)
1178 return;
1179 }
1181 TGFrameElement *el = 0;
1182 if (embed && embed->GetList()) {
1183 TIter next(embed->GetList());
1184 while ((el = (TGFrameElement *)next())) {
1185 if (el->fFrame->InheritsFrom("TGMenuBar")) {
1186 TGMenuBar *menu = (TGMenuBar *)el->fFrame;
1187 if (fActMenuBar == menu)
1188 return;
1189 TGFrameElement *nw;
1190 TIter nel(fMenuFrame->GetList());
1191 while ((nw = (TGFrameElement *) nel())) {
1192 if (nw->fFrame == menu) {
1193 ShowMenu(menu);
1194 return;
1195 }
1196 }
1197 ((TGCompositeFrame *)menu->GetParent())->HideFrame(menu);
1200 fMenuFrame->AddFrame(menu, fLH2);
1201 TGFrameElement *mel;
1202 TIter mnext(menu->GetList());
1203 while ((mel = (TGFrameElement *) mnext())) {
1204 TGMenuTitle *t = (TGMenuTitle *) mel->fFrame;
1205 TGPopupMenu *popup = menu->GetPopup(t->GetName());
1206 if (popup) {
1207 RecursiveReparent(popup);
1208 if (popup->GetEntry("Close Canvas")) {
1209 TGMenuEntry *exit = popup->GetEntry("Close Canvas");
1210 popup->HideEntry(exit->GetEntryId());
1211 }
1212 if (popup->GetEntry("Close Viewer")) {
1213 TGMenuEntry *exit = popup->GetEntry("Close Viewer");
1214 popup->HideEntry(exit->GetEntryId());
1215 }
1216 if (popup->GetEntry("Quit ROOT")) {
1217 TGMenuEntry *exit = popup->GetEntry("Quit ROOT");
1218 popup->HideEntry(exit->GetEntryId());
1219 }
1220 if (popup->GetEntry("Exit")) {
1221 TGMenuEntry *exit = popup->GetEntry("Exit");
1222 popup->HideEntry(exit->GetEntryId());
1223 }
1224 }
1225 }
1226 ShowMenu(menu);
1227 return;
1228 }
1229 }
1230 }
1231 if (fActMenuBar != fMenuBar)
1233}
1234
1235////////////////////////////////////////////////////////////////////////////////
1236/// Emits signal when double clicking on icon.
1237
1239{
1240 Emit("DoubleClicked(TObject*)", (Longptr_t)obj);
1241}
1242
1243////////////////////////////////////////////////////////////////////////////////
1244/// Emits signal when double clicking on icon.
1245
1247{
1248 Longptr_t args[2];
1249
1250 args[0] = (Longptr_t)obj;
1251 args[1] = checked;
1252
1253 Emit("Checked(TObject*,Bool_t)", args);
1254}
1255
1256////////////////////////////////////////////////////////////////////////////////
1257/// Emits signal "ExecuteDefaultAction(TObject*)".
1258
1260{
1261 Emit("ExecuteDefaultAction(TObject*)", (Longptr_t)obj);
1262}
1263
1264
1265////////////////////////////////////////////////////////////////////////////////
1266/// static constructor returning TBrowserImp,
1267/// as needed by the plugin mechanism.
1268
1270 UInt_t width, UInt_t height,
1271 Option_t *opt)
1272{
1273 TRootBrowser *browser = new TRootBrowser(b, title, width, height, opt);
1274 return (TBrowserImp *)browser;
1275}
1276
1277////////////////////////////////////////////////////////////////////////////////
1278/// static constructor returning TBrowserImp,
1279/// as needed by the plugin mechanism.
1280
1282 Int_t y, UInt_t width, UInt_t height,
1283 Option_t *opt)
1284{
1285 TRootBrowser *browser = new TRootBrowser(b, title, x, y, width, height, opt);
1286 return (TBrowserImp *)browser;
1287}
@ 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
const Bool_t kFALSE
Definition RtypesCore.h:101
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
R__EXTERN TApplication * gApplication
include TDocParser_001 C image html pict1_TDocParser_001 png width
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
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:404
static const char * gPluginFileTypes[]
static const char * gOpenFileTypes[]
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
Definition TSystem.h:559
#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:2966
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
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
virtual TList * GetList() const
Definition TGFrame.h:310
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual void SetEditable(Bool_t on=kTRUE)
Switch ON/OFF edit mode.
Definition TGFrame.cxx:948
virtual void Layout()
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1072
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:316
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1204
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
virtual void ReparentWindow(const TGWindow *p, Int_t x=0, Int_t y=0)
Reparent window, make p the new parent and position the window at position (x,y) in new parent.
Definition TGFrame.h:202
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:605
void SetFrameElement(TGFrameElement *fe)
Definition TGFrame.h:236
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition TGFrame.cxx:629
virtual void MapWindow()
map window
Definition TGFrame.h:204
virtual void UnmapWindow()
unmap window
Definition TGFrame.h:206
virtual void SetFrame(TGFrame *frame, Bool_t above)
Set frame to be resized.
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:386
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:398
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1856
TList * fBindList
list with key bindings
Definition TGFrame.h:415
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
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events.
Definition TGFrame.cxx:1606
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition TGFrame.cxx:1879
void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
Definition TGFrame.cxx:1904
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
const TGPicture * SetIconPixmap(const char *iconName)
Set window icon pixmap by name.
Definition TGFrame.cxx:1816
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=0)
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
Return unique name, used in SavePrimitive methods.
Definition TGMenu.h:274
Int_t GetHotKeyCode() const
Definition TGMenu.h:272
TGClient * fClient
Connection to display server.
Definition TGObject.h:27
Handle_t GetId() const
Definition TGObject.h:37
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
virtual void SetFrame(TGFrame *frame, Bool_t left)
Set frame to be resized.
A composite frame that layout their children in vertical way.
Definition TGFrame.h:375
const TGWindow * GetParent() const
Definition TGWindow.h:76
virtual void Add(TObject *obj)
Definition TList.h:81
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition TList.cxx:822
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition TList.cxx:578
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:693
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:470
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:659
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
virtual const char * GetName() const
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:429
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
Definition TObject.cxx:458
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:515
virtual const char * GetTitle() const
Returns title of object.
Definition TObject.cxx:473
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=0, void *receiver=0, const char *slot=0)
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:2917
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:136
const char * Data() const
Definition TString.h:369
@ kIgnoreCase
Definition TString.h:268
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition TString.cxx:916
TString & Remove(Ssiz_t pos)
Definition TString.h:673
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:2336
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2314
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:624
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:1855
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1063
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition TSystem.cxx:935
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