Logo ROOT   6.08/07
Reference Guide
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-2007, 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 // //
14 // TRootBrowser //
15 // //
16 // This class creates a ROOT object browser, constitued by three main //
17 // tabs. //
18 // //
19 // All tabs can 'swallow' frames, thanks to the new method: //
20 // ExecPlugin(const char *name = 0, const char *fname = 0, //
21 // const char *cmd = 0, Int_t pos = kRight, //
22 // Int_t subpos = -1) //
23 // allowing to select plugins (can be a macro or a command) //
24 // to be executed, and where to embed the frame created by //
25 // the plugin (tab and tab element). Examples: //
26 // //
27 // create a new browser: //
28 // TBrowser b; //
29 // //
30 // create a new TCanvas in a new top right tab element: //
31 // b.ExecPlugin("Canvas", 0, "new TCanvas()"); //
32 // //
33 // create a new top right tab element embedding the //
34 // TGMainFrame created by the macro 'myMacro.C': //
35 // b.ExecPlugin("MyPlugin", "myMacro.C"); //
36 // //
37 // create a new bottom tab element embedding the //
38 // TGMainFrame created by the macro 'myMacro.C': //
39 // b.ExecPlugin("MyPlugin", "myMacro.C", 0, TRootBrowser::kBottom); //
40 // //
41 // this browser implementation can be selected via the env //
42 // 'Browser.Name' in .rootrc, (TRootBrowser or TRootBrowserLite) //
43 // the default being TRootBrowserLite (old browser) //
44 // a list of options (plugins) for the new TRootBrowser is also //
45 // specified via the env 'Browser.Options' in .rootrc, the default //
46 // being: FECI //
47 // Here is the list of available options: //
48 // F: File browser E: Text Editor H: HTML browser C: Canvas I: I/O //
49 // redirection P: Proof G: GL viewer //
50 // //
51 //////////////////////////////////////////////////////////////////////////
52 
53 #include "TROOT.h"
54 #include "TSystem.h"
55 #include "TApplication.h"
56 #include "TBrowser.h"
57 #include "TGClient.h"
58 #include "TGFrame.h"
59 #include "TGTab.h"
60 #include "TGMenu.h"
61 #include "TGLayout.h"
62 #include "TGSplitter.h"
63 #include "TGStatusBar.h"
64 #include "Varargs.h"
65 #include "TInterpreter.h"
66 #include "TBrowser.h"
67 #include "TGFileDialog.h"
68 #include "TObjString.h"
69 #include "TVirtualPad.h"
70 #include "TEnv.h"
71 #include <KeySymbols.h>
72 
73 #include "RConfigure.h"
74 
75 #include "TRootBrowser.h"
76 #include "TGFileBrowser.h"
77 #include "TGInputDialog.h"
78 #include "TRootHelpDialog.h"
79 #include "TVirtualPadEditor.h"
80 #include "HelpText.h"
81 #include "Getline.h"
82 
83 #ifdef WIN32
84 #include <TWin32SplashThread.h>
85 #endif
86 
87 static const char *gOpenFileTypes[] = {
88  "ROOT files", "*.root",
89  "All files", "*",
90  0, 0
91 };
92 
93 static const char *gPluginFileTypes[] = {
94  "ROOT files", "*.C",
95  "All files", "*",
96  0, 0
97 };
98 
99 //_____________________________________________________________________________
100 //
101 // TRootBrowser
102 //
103 // The main ROOT object browser.
104 //_____________________________________________________________________________
105 
107 
108 ////////////////////////////////////////////////////////////////////////////////
109 /// Create browser with a specified width and height.
110 
112  UInt_t height, Option_t *opt, Bool_t initshow) :
113  TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
114 {
115  fShowCloseTab = kTRUE;
116  fActBrowser = 0;
117  fIconPic = 0;
118  CreateBrowser(name);
119  Resize(width, height);
120  if (initshow) {
121  InitPlugins(opt);
122  MapWindow();
123  }
124  TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
125  "TRootBrowser", this,
126  "EventInfo(Int_t, Int_t, Int_t, TObject*)");
127  gVirtualX->SetInputFocus(GetId());
128 }
129 
130 ////////////////////////////////////////////////////////////////////////////////
131 /// Create browser with a specified width and height and at position x, y.
132 
134  UInt_t width, UInt_t height, Option_t *opt,
135  Bool_t initshow) :
136  TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
137 {
139  fActBrowser = 0;
140  fIconPic = 0;
141  CreateBrowser(name);
142  MoveResize(x, y, width, height);
143  SetWMPosition(x, y);
144  if (initshow) {
145  InitPlugins(opt);
146  MapWindow();
147  }
148  TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
149  "TRootBrowser", this,
150  "EventInfo(Int_t, Int_t, Int_t, TObject*)");
151  gVirtualX->SetInputFocus(GetId());
152 }
153 
154 
155 ////////////////////////////////////////////////////////////////////////////////
156 
158 {
159  // Create the actual interface.
160 
161  fVf = new TGVerticalFrame(this, 100, 100);
162 
164  fLH1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
165  fLH2 = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 1);
171 
172  // Menubar Frame
173  fTopMenuFrame = new TGHorizontalFrame(fVf, 100, 20);
174 
177  fMenuFile = new TGPopupMenu(gClient->GetDefaultRoot());
178  fMenuFile->AddEntry("&Browse...\tCtrl+B", kBrowse);
179  fMenuFile->AddEntry("&Open...\tCtrl+O", kOpenFile);
181 
183  fMenuHelp->AddEntry("&About ROOT...", kHelpAbout);
185  fMenuHelp->AddEntry("Help On Browser...", kHelpOnBrowser);
186  fMenuHelp->AddEntry("Help On Canvas...", kHelpOnCanvas);
187  fMenuHelp->AddEntry("Help On Menus...", kHelpOnMenus);
188  fMenuHelp->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
189  fMenuHelp->AddEntry("Help On Objects...", kHelpOnObjects);
190  fMenuHelp->AddEntry("Help On PostScript...", kHelpOnPS);
191  fMenuHelp->AddEntry("Help On Remote Session...", kHelpOnRemote);
192  fMenuFile->AddPopup("Browser Help...", fMenuHelp);
193 
195  fMenuFile->AddEntry("&Clone\tCtrl+N", kClone);
197  fMenuFile->AddEntry("New &Editor\tCtrl+E", kNewEditor);
198  fMenuFile->AddEntry("New &Canvas\tCtrl+C", kNewCanvas);
199  fMenuFile->AddEntry("New &HTML\tCtrl+H", kNewHtml);
203  fMenuExecPlugin->AddEntry("&Command...", kExecPluginCmd);
204  fMenuFile->AddPopup("Execute &Plugin...", fMenuExecPlugin);
206  fMenuFile->AddEntry("Close &Tab\tCtrl+T", kCloseTab);
207  fMenuFile->AddEntry("Close &Window\tCtrl+W", kCloseWindow);
209  fMenuFile->AddEntry("&Quit Root\tCtrl+Q", kQuitRoot);
210  fMenuBar->AddPopup("&Browser", fMenuFile, fLH1);
211  fMenuFile->Connect("Activated(Int_t)", "TRootBrowser", this,
212  "HandleMenu(Int_t)");
215 
218 
221 
222  // Toolbar Frame
224  kRaisedFrame);
226 
227  fHf = new TGHorizontalFrame(fVf, 100, 100);
228  // Tabs & co...
229 #if defined(R__HAS_COCOA)
230  fV1 = new TGVerticalFrame(fHf, 252, 100, kFixedWidth);
231 #else
232  fV1 = new TGVerticalFrame(fHf, 250, 100, kFixedWidth);
233 #endif
234  fV2 = new TGVerticalFrame(fHf, 600, 100);
235  fH1 = new TGHorizontalFrame(fV2, 100, 100);
236  fH2 = new TGHorizontalFrame(fV2, 100, 100, kFixedHeight);
237 
238  // Left tab
239  fTabLeft = new TGTab(fV1,100,100);
240  //fTabLeft->AddTab("Tab 1");
243 
244  // Vertical splitter
245  fVSplitter = new TGVSplitter(fHf, 4, 4);
247  fHf->AddFrame(fV1, fLH7);
249 
250  // Right tab
251  fTabRight = new TGTab(fH1, 500, 100);
252  //fTabRight->AddTab("Tab 1");
255  fTabRight->Connect("Selected(Int_t)", "TRootBrowser", this, "DoTab(Int_t)");
256  fTabRight->Connect("CloseTab(Int_t)", "TRootBrowser", this, "CloseTab(Int_t)");
257  fV2->AddFrame(fH1, fLH4);
258 
259  // Horizontal splitter
260  fHSplitter = new TGHSplitter(fV2, 4, 4);
262 
263  // Bottom tab
264  fTabBottom = new TGTab(fH2, 100, 100);
265  //fTabBottom->AddTab("Tab 1");
267  fV2->AddFrame(fH2, fLH3);
268 
270  fHf->AddFrame(fV2, fLH5);
271  fVf->AddFrame(fHf, fLH5);
272  AddFrame(fVf, fLH5);
273 
274  // status bar
275  fStatusBar = new TGStatusBar(this, 400, 20);
276  int parts[] = { 33, 10, 10, 47 };
277  fStatusBar->SetParts(parts, 4);
279 
280  fNbInitPlugins = 0;
281  fEditFrame = 0;
282  fEditTab = 0;
283  fEditPos = -1;
284  fEditSubPos= -1;
285  fNbTab[0] = fNbTab[1] = fNbTab[2] = 0;
286  fCrTab[0] = fCrTab[1] = fCrTab[2] = -1;
287 
288  // Set a name to the main frame
289  SetWindowName(name);
290  SetIconName(name);
291  fIconPic = SetIconPixmap("rootdb_s.xpm");
292  SetClassHints("ROOT", "Browser");
293 
294  if (!strcmp(gROOT->GetDefCanvasName(), "c1"))
295  gROOT->SetDefCanvasName("Canvas_1");
296 
297  SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
298  MapSubwindows();
301 
303 }
304 
305 ////////////////////////////////////////////////////////////////////////////////
306 /// Clean up all widgets, frames and layouthints that were used
307 
309 {
310  if (fIconPic) gClient->FreePicture(fIconPic);
311  delete fLH0;
312  delete fLH1;
313  delete fLH2;
314  delete fLH3;
315  delete fLH4;
316  delete fLH5;
317  delete fLH6;
318  delete fLH7;
319  delete fMenuHelp;
320  delete fMenuExecPlugin;
321  delete fMenuFile;
322  delete fMenuBar;
323  delete fMenuFrame;
324  delete fPreMenuFrame;
325  delete fTopMenuFrame;
326  delete fToolbarFrame;
327  delete fVSplitter;
328  delete fHSplitter;
329  delete fTabLeft;
330  delete fTabRight;
331  delete fTabBottom;
332  delete fH1;
333  delete fH2;
334  delete fV1;
335  delete fV2;
336  delete fHf;
337  delete fStatusBar;
338  delete fVf;
339 }
340 
341 ////////////////////////////////////////////////////////////////////////////////
342 /// Add items to the actual browser. This function has to be called
343 /// by the Browse() member function of objects when they are
344 /// called by a browser. If check < 0 (default) no check box is drawn,
345 /// if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
346 
347 void TRootBrowser::Add(TObject *obj, const char *name, Int_t check)
348 {
349  if (obj->InheritsFrom("TObjectSpy"))
350  return;
351  if (fActBrowser)
352  fActBrowser->Add(obj, name, check);
353 }
354 
355 ////////////////////////////////////////////////////////////////////////////////
356 /// Browse object. This, in turn, will trigger the calling of
357 /// TRootBrowser::Add() which will fill the IconBox and the tree.
358 /// Emits signal "BrowseObj(TObject*)".
359 
361 {
362  if (fActBrowser)
363  fActBrowser->BrowseObj(obj);
364  Emit("BrowseObj(TObject*)", (Long_t)obj);
365 }
366 
367 ////////////////////////////////////////////////////////////////////////////////
368 /// Clone the browser. A new Browser will be created, with the same
369 /// plugins executed in the current one.
370 
372 {
373  Int_t loop = 1;
374  TBrowserPlugin *plugin = 0;
375  TBrowser *b = new TBrowser();
376  TIter next(&fPlugins);
377  while ((plugin = (TBrowserPlugin *)next())) {
378  if (loop > fNbInitPlugins)
379  b->ExecPlugin(plugin->GetName(), "", plugin->fCommand.Data(), plugin->fTab,
380  plugin->fSubTab);
381  ++loop;
382  }
383 }
384 
385 ////////////////////////////////////////////////////////////////////////////////
386 /// Remove tab element id from right tab.
387 
389 {
390  RemoveTab(kRight, id);
391 }
392 
393 ////////////////////////////////////////////////////////////////////////////////
394 /// Properly close the mainframes embedded in the different tabs
395 
397 {
398  TGFrameElement *el;
399  TGCompositeFrame *container;
400  Int_t i;
401  Disconnect(fMenuFile, "Activated(Int_t)", this, "HandleMenu(Int_t)");
402  Disconnect(fTabRight, "Selected(Int_t)", this, "DoTab(Int_t)");
403  if (fPlugins.IsEmpty()) return;
404  fActBrowser = 0;
405  for (i=0;i<fTabLeft->GetNumberOfTabs();i++) {
406  container = fTabLeft->GetTabContainer(i);
407  if (!container) continue;
408  el = (TGFrameElement *)container->GetList()->First();
409  if (el && el->fFrame) {
410  el->fFrame->SetFrameElement(0);
411  if (el->fFrame->InheritsFrom("TVirtualPadEditor")) {
413  }
414  else if (el->fFrame->InheritsFrom("TGMainFrame")) {
415  ((TGMainFrame *)el->fFrame)->CloseWindow();
417  }
418  else
419  delete el->fFrame;
420  el->fFrame = 0;
421  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
422  (el->fLayout->References() > 0)) {
423  el->fLayout->RemoveReference();
424  if (!el->fLayout->References()) {
425  delete el->fLayout;
426  }
427  }
428  container->GetList()->Remove(el);
429  delete el;
430  }
431  }
432  for (i=0;i<fTabRight->GetNumberOfTabs();i++) {
433  container = fTabRight->GetTabContainer(i);
434  if (!container) continue;
435  el = (TGFrameElement *)container->GetList()->First();
436  if (el && el->fFrame) {
437  el->fFrame->SetFrameElement(0);
438  if (el->fFrame->InheritsFrom("TGMainFrame")) {
439  Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
440  ((TGMainFrame *)el->fFrame)->CloseWindow();
441  if (sleep)
442  gSystem->Sleep(150);
444  }
445  else
446  delete el->fFrame;
447  el->fFrame = 0;
448  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
449  (el->fLayout->References() > 0)) {
450  el->fLayout->RemoveReference();
451  if (!el->fLayout->References()) {
452  delete el->fLayout;
453  }
454  }
455  container->GetList()->Remove(el);
456  delete el;
457  }
458  }
459  for (i=0;i<fTabBottom->GetNumberOfTabs();i++) {
460  container = fTabBottom->GetTabContainer(i);
461  if (!container) continue;
462  el = (TGFrameElement *)container->GetList()->First();
463  if (el && el->fFrame) {
464  el->fFrame->SetFrameElement(0);
465  if (el->fFrame->InheritsFrom("TGMainFrame")) {
466  ((TGMainFrame *)el->fFrame)->CloseWindow();
468  }
469  else
470  delete el->fFrame;
471  el->fFrame = 0;
472  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
473  (el->fLayout->References() > 0)) {
474  el->fLayout->RemoveReference();
475  if (!el->fLayout->References()) {
476  delete el->fLayout;
477  }
478  }
479  container->GetList()->Remove(el);
480  delete el;
481  }
482  }
483  fPlugins.Delete();
484  Emit("CloseWindow()");
485 }
486 
487 ////////////////////////////////////////////////////////////////////////////////
488 /// Called when window is closed via the window manager.
489 
491 {
492  TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
493  this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
494  CloseTabs();
495  DeleteWindow();
496 }
497 
498 ////////////////////////////////////////////////////////////////////////////////
499 /// Handle Tab navigation.
500 
502 {
503  TGTab *sender = (TGTab *)gTQSender;
504  if ((sender) && (sender == fTabRight)) {
505  SwitchMenus(sender->GetTabContainer(id));
506  }
507 }
508 
509 ////////////////////////////////////////////////////////////////////////////////
510 /// Display a tooltip with infos about the primitive below the cursor.
511 
512 void TRootBrowser::EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
513 {
514  const Int_t kTMAX=256;
515  static char atext[kTMAX];
516  if (selected == 0 || event == kMouseLeave) {
517  SetStatusText("", 0);
518  SetStatusText("", 1);
519  SetStatusText("", 2);
520  SetStatusText("", 3);
521  return;
522  }
523  SetStatusText(selected->GetTitle(), 0);
524  SetStatusText(selected->GetName(), 1);
525  if (event == kKeyPress)
526  snprintf(atext, kTMAX, "%c", (char) px);
527  else
528  snprintf(atext, kTMAX, "%d,%d", px, py);
529  SetStatusText(atext, 2);
530  SetStatusText(selected->GetObjectInfo(px,py), 3);
531 }
532 
533 ////////////////////////////////////////////////////////////////////////////////
534 /// Execute a macro and embed the created frame in the tab "pos"
535 /// and tab element "subpos".
536 
537 Long_t TRootBrowser::ExecPlugin(const char *name, const char *fname,
538  const char *cmd, Int_t pos, Int_t subpos)
539 {
540  Long_t retval = 0;
541  TBrowserPlugin *p;
542  TString command, pname;
543  StartEmbedding(pos, subpos);
544  if (cmd && strlen(cmd)) {
545  command = cmd;
546  if (name) pname = name;
547  else pname = TString::Format("Plugin %d", fPlugins.GetSize());
548  p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
549  }
550  else if (fname && strlen(fname)) {
551  pname = name ? name : gSystem->BaseName(fname);
552  Ssiz_t t = pname.Last('.');
553  if (t > 0) pname.Remove(t);
554  command.Form("gROOT->Macro(\"%s\");", gSystem->UnixPathName(fname));
555  p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
556  }
557  else return 0;
558  fPlugins.Add(p);
559  retval = gROOT->ProcessLine(command.Data());
560  if (command.Contains("new TCanvas")) {
561  pname = gPad->GetName();
562  p->SetName(pname.Data());
563  }
564  SetTabTitle(pname.Data(), pos, subpos);
565  StopEmbedding();
566  return retval;
567 }
568 
569 ////////////////////////////////////////////////////////////////////////////////
570 /// Returns drawing option.
571 
573 {
574  if (fActBrowser)
575  return fActBrowser->GetDrawOption();
576  return 0;
577 }
578 
579 ////////////////////////////////////////////////////////////////////////////////
580 /// Returns the TGTab at position pos.
581 
583 {
584  switch (pos) {
585  case kLeft: return fTabLeft;
586  case kRight: return fTabRight;
587  case kBottom: return fTabBottom;
588  default: return 0;
589  }
590 }
591 
592 ////////////////////////////////////////////////////////////////////////////////
593 /// Handle keyboard events.
594 
596 {
597  char input[10];
598  UInt_t keysym;
599 
600  if (event->fType == kGKeyPress) {
601  gVirtualX->LookupString(event, input, sizeof(input), keysym);
602 
603  if (!event->fState && (EKeySym)keysym == kKey_F5) {
604  Refresh(kTRUE);
605  return kTRUE;
606  }
607  switch ((EKeySym)keysym) { // ignore these keys
608  case kKey_Shift:
609  case kKey_Control:
610  case kKey_Meta:
611  case kKey_Alt:
612  case kKey_CapsLock:
613  case kKey_NumLock:
614  case kKey_ScrollLock:
615  return kTRUE;
616  default:
617  break;
618  }
619  if (event->fState & kKeyControlMask) { // Cntrl key modifier pressed
620  switch ((EKeySym)keysym & ~0x20) { // treat upper and lower the same
621  case kKey_B:
623  return kTRUE;
624  case kKey_O:
626  return kTRUE;
627  case kKey_E:
629  return kTRUE;
630  case kKey_C:
632  return kTRUE;
633  case kKey_H:
635  return kTRUE;
636  case kKey_N:
638  return kTRUE;
639  case kKey_T:
641  return kTRUE;
642  case kKey_W:
644  return kTRUE;
645  case kKey_Q:
647  return kTRUE;
648  default:
649  break;
650  }
651  }
652  }
653  return TGMainFrame::HandleKey(event);
654 }
655 
656 ////////////////////////////////////////////////////////////////////////////////
657 /// Handle menu entries events.
658 
660 {
661  TRootHelpDialog *hd;
662  TString cmd;
663  static Int_t eNr = 1;
664  TGPopupMenu *sender = (TGPopupMenu *)gTQSender;
665  if (sender != fMenuFile)
666  return;
667  switch (id) {
668  case kBrowse:
669  new TBrowser();
670  break;
671  case kOpenFile:
672  {
673  Bool_t newfile = kFALSE;
674  static TString dir(".");
675  TGFileInfo fi;
677  fi.fIniDir = StrDup(dir);
678  new TGFileDialog(gClient->GetDefaultRoot(), this,
679  kFDOpen,&fi);
680  dir = fi.fIniDir;
681  if (fi.fMultipleSelection && fi.fFileNamesList) {
682  TObjString *el;
683  TIter next(fi.fFileNamesList);
684  while ((el = (TObjString *) next())) {
685  gROOT->ProcessLine(Form("new TFile(\"%s\");",
686  gSystem->UnixPathName(el->GetString())));
687  }
688  newfile = kTRUE;
689  }
690  else if (fi.fFilename) {
691  gROOT->ProcessLine(Form("new TFile(\"%s\");",
693  newfile = kTRUE;
694  }
695  if (fActBrowser && newfile) {
696  TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(fActBrowser);
697  if (fb) fb->Selected(0);
698  }
699  }
700  break;
701  // Handle Help menu items...
702  case kHelpAbout:
703  {
704 #ifdef R__UNIX
705  TString rootx;
706 # ifdef ROOTBINDIR
707  rootx = ROOTBINDIR;
708 # else
709  rootx = gSystem->Getenv("ROOTSYS");
710  if (!rootx.IsNull()) rootx += "/bin";
711 # endif
712  rootx += "/root -a &";
713  gSystem->Exec(rootx);
714 #else
715 #ifdef WIN32
717 #else
718  char str[32];
719  sprintf(str, "About ROOT %s...", gROOT->GetVersion());
720  hd = new TRootHelpDialog(this, str, 600, 400);
721  hd->SetText(gHelpAbout);
722  hd->Popup();
723 #endif
724 #endif
725  }
726  break;
727  case kHelpOnCanvas:
728  hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
729  hd->SetText(gHelpCanvas);
730  hd->Popup();
731  break;
732  case kHelpOnMenus:
733  hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
735  hd->Popup();
736  break;
737  case kHelpOnGraphicsEd:
738  hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
740  hd->Popup();
741  break;
742  case kHelpOnBrowser:
743  hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
744  hd->SetText(gHelpBrowser);
745  hd->Popup();
746  break;
747  case kHelpOnObjects:
748  hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
749  hd->SetText(gHelpObjects);
750  hd->Popup();
751  break;
752  case kHelpOnPS:
753  hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
755  hd->Popup();
756  break;
757  case kHelpOnRemote:
758  hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
759  hd->SetText(gHelpRemote);
760  hd->Popup();
761  break;
762  case kClone:
763  CloneBrowser();
764  break;
765  case kNewEditor:
766  cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot())");
767  ++eNr;
768  ExecPlugin(Form("Editor %d", eNr), "", cmd.Data(), 1);
769  break;
770  case kNewCanvas:
771  ExecPlugin("", "", "new TCanvas()", 1);
772  break;
773  case kNewHtml:
774  cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot())",
775  gEnv->GetValue("Browser.StartUrl", "http://root.cern.ch"));
776  ExecPlugin("HTML", "", cmd.Data(), 1);
777  break;
778  case kExecPluginMacro:
779  {
780  static TString dir(".");
781  TGFileInfo fi;
783  fi.fIniDir = StrDup(dir);
784  new TGFileDialog(gClient->GetDefaultRoot(), this,
785  kFDOpen,&fi);
786  dir = fi.fIniDir;
787  if (fi.fFilename) {
788  ExecPlugin(0, fi.fFilename, 0, kRight);
789  }
790  }
791  break;
792  case kExecPluginCmd:
793  {
794  char command[1024];
795  strlcpy(command, "new TGLSAViewer(gClient->GetRoot(), 0);",
796  sizeof(command));
797  new TGInputDialog(gClient->GetRoot(), this,
798  "Enter plugin command line:",
799  command, command);
800  if (strcmp(command, "")) {
801  ExecPlugin("User", 0, command, kRight);
802  }
803  }
804  break;
805  case kCloseTab:
807  break;
808  case kCloseWindow:
809  CloseWindow();
810  break;
811  case kQuitRoot:
812  CloseWindow();
814  break;
815  default:
816  break;
817  }
818 }
819 
820 ////////////////////////////////////////////////////////////////////////////////
821 /// Initialize default plugins. Could be also of the form:
822 /// StartEmbedding(0);
823 /// TPluginHandler *ph;
824 /// ph = gROOT->GetPluginManager()->FindHandler("TGClassBrowser");
825 /// if (ph && ph->LoadPlugin() != -1) {
826 /// ph->ExecPlugin(3, gClient->GetRoot(), 200, 500);
827 /// }
828 /// StopEmbedding();
829 
831 {
832  TString cmd;
833 
834  if ((opt == 0) || (!opt[0]))
835  return;
836  // --- Left vertical area
837 
838  // File Browser plugin
839  if (strchr(opt, 'F')) {
840  cmd.Form("new TGFileBrowser(gClient->GetRoot(), (TBrowser *)0x%lx, 200, 500);", (ULong_t)fBrowser);
841  ExecPlugin("Files", 0, cmd.Data(), 0);
842  ++fNbInitPlugins;
843  }
844 
845  // --- Right main area
846 
847  Int_t i, len = strlen(opt);
848  for (i=0; i<len; ++i) {
849  // Editor plugin...
850  if (opt[i] == 'E') {
851  cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot());");
852  ExecPlugin("Editor 1", 0, cmd.Data(), 1);
853  ++fNbInitPlugins;
854  }
855 
856  // HTML plugin...
857  if (opt[i] == 'H') {
858  if (gSystem->Load("libGuiHtml") >= 0) {
859  cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot());",
860  gEnv->GetValue("Browser.StartUrl",
861  "http://root.cern.ch/root/html/ClassIndex.html"));
862  ExecPlugin("HTML", 0, cmd.Data(), 1);
863  ++fNbInitPlugins;
864  }
865  }
866 
867  // Canvas plugin...
868  if (opt[i] == 'C') {
869  cmd.Form("new TCanvas();");
870  ExecPlugin("c1", 0, cmd.Data(), 1);
871  ++fNbInitPlugins;
872  }
873 
874  // GLViewer plugin...
875  if (opt[i] == 'G') {
876  cmd.Form("new TGLSAViewer(gClient->GetRoot(), 0);");
877  ExecPlugin("OpenGL", 0, cmd.Data(), 1);
878  ++fNbInitPlugins;
879  }
880 
881  // PROOF plugin...
882  if (opt[i] == 'P') {
883  cmd.Form("new TSessionViewer();");
884  ExecPlugin("PROOF", 0, cmd.Data(), 1);
885  ++fNbInitPlugins;
886  }
887  }
888  // --- Right bottom area
889 
890  // Command plugin...
891  if (strchr(opt, 'I')) {
892  cmd.Form("new TGCommandPlugin(gClient->GetRoot(), 700, 300);");
893  ExecPlugin("Command", 0, cmd.Data(), 2);
894  ++fNbInitPlugins;
895  }
896 
897  // --- Select first tab everywhere
898  SetTab(0, 0);
899  SetTab(1, 0);
900  SetTab(2, 0);
901 }
902 
903 ////////////////////////////////////////////////////////////////////////////////
904 /// Really delete the browser and the this GUI.
905 
907 {
908  gInterpreter->DeleteGlobal(fBrowser);
909  if (fBrowser->IsOnHeap())
910  delete fBrowser; // will in turn delete this object
911  else
912  fBrowser->Destructor(); // will in turn delete this object
913 }
914 
915 ////////////////////////////////////////////////////////////////////////////////
916 /// Recursively remove object from browser.
917 
919 {
920  if (fActBrowser)
922 }
923 
924 ////////////////////////////////////////////////////////////////////////////////
925 /// Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
926 
928 {
929  TGMenuEntry *entry = 0;
930  TIter next(popup->GetListOfEntries());
931  while ((entry = (TGMenuEntry *)next())) {
932  if (entry->GetPopup()) {
933  RecursiveReparent(entry->GetPopup());
934  }
935  }
936  popup->ReparentWindow(gClient->GetDefaultRoot());
937 }
938 
939 ////////////////////////////////////////////////////////////////////////////////
940 /// Refresh the actual browser contents.
941 
943 {
944  if (fActBrowser)
945  fActBrowser->Refresh(force);
946 }
947 
948 ////////////////////////////////////////////////////////////////////////////////
949 /// Remove tab element "subpos" from tab "pos".
950 
952 {
953  TGTab *edit = 0;
954  switch (pos) {
955  case kLeft: // left
956  edit = fTabLeft;
957  break;
958  case kRight: // right
959  edit = fTabRight;
962  fActMenuBar = 0;
963  break;
964  case kBottom: // bottom
965  edit = fTabBottom;
966  break;
967  }
968  if (!edit || !edit->GetTabTab(subpos))
969  return;
970  const char *tabName = edit->GetTabTab(subpos)->GetString();
971  TObject *obj = 0;
972  if ((obj = fPlugins.FindObject(tabName))) {
973  fPlugins.Remove(obj);
974  }
975  TGFrameElement *el = 0;
976  if (edit->GetTabContainer(subpos))
977  el = (TGFrameElement *)edit->GetTabContainer(subpos)->GetList()->First();
978  if (el && el->fFrame) {
979  el->fFrame->Disconnect("ProcessedConfigure(Event_t*)");
980  el->fFrame->SetFrameElement(0);
981  if (el->fFrame->InheritsFrom("TGMainFrame")) {
982  Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
983  ((TGMainFrame *)el->fFrame)->CloseWindow();
984  if (sleep)
985  gSystem->Sleep(150);
987  }
988  else
989  delete el->fFrame;
990  el->fFrame = 0;
991  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
992  (el->fLayout->References() > 0)) {
993  el->fLayout->RemoveReference();
994  if (!el->fLayout->References()) {
995  delete el->fLayout;
996  }
997  }
998  edit->GetTabContainer(subpos)->GetList()->Remove(el);
999  delete el;
1000  }
1001  fNbTab[pos]--;
1002  edit->RemoveTab(subpos);
1003  SwitchMenus(edit->GetTabContainer(edit->GetCurrent()));
1004 }
1005 
1006 ////////////////////////////////////////////////////////////////////////////////
1007 /// Switch to Tab "subpos" in TGTab "pos".
1008 
1010 {
1011  TGTab *tab = GetTab(pos);
1012  if (subpos == -1)
1013  subpos = fCrTab[pos];
1014 
1015  if (tab && tab->SetTab(subpos, kFALSE)) { // Block signal emit
1016  if (pos == kRight)
1017  SwitchMenus(tab->GetTabContainer(subpos));
1018  tab->Layout();
1019  }
1020 }
1021 
1022 ////////////////////////////////////////////////////////////////////////////////
1023 /// Set text "title" of Tab "subpos" in TGTab "pos".
1024 
1025 void TRootBrowser::SetTabTitle(const char *title, Int_t pos, Int_t subpos)
1026 {
1027  TBrowserPlugin *p = 0;
1028  TGTab *edit = GetTab(pos);
1029  if (!edit) return;
1030  if (subpos == -1)
1031  subpos = fCrTab[pos];
1032 
1033  TGTabElement *el = edit->GetTabTab(subpos);
1034  if (el) {
1035  el->SetText(new TGString(title));
1036  edit->Layout();
1037  if ((p = (TBrowserPlugin *)fPlugins.FindObject(title)))
1038  p->SetName(title);
1039  }
1040 }
1041 
1042 ////////////////////////////////////////////////////////////////////////////////
1043 /// Set text in culumn col in status bar.
1044 
1045 void TRootBrowser::SetStatusText(const char* txt, Int_t col)
1046 {
1047  fStatusBar->SetText(txt, col);
1048 }
1049 
1050 ////////////////////////////////////////////////////////////////////////////////
1051 /// Show the selected frame's menu and hide previous one.
1052 
1054 {
1055  TGFrameElement *el = 0;
1056  // temporary solution until I find a proper way to handle
1057  // these bloody menus...
1058  fBindList->Delete();
1059  TIter nextm(fMenuBar->GetList());
1060  while ((el = (TGFrameElement *) nextm())) {
1061  TGMenuTitle *t = (TGMenuTitle *) el->fFrame;
1062  Int_t code = t->GetHotKeyCode();
1063  BindKey(fMenuBar, code, kKeyMod1Mask);
1071  }
1073  fMenuFrame->ShowFrame(menu);
1074  menu->Layout();
1075  fMenuFrame->Layout();
1076  fActMenuBar = menu;
1077 }
1078 
1079 ////////////////////////////////////////////////////////////////////////////////
1080 /// Start embedding external frame in the tab "pos" and tab element "subpos".
1081 
1083 {
1084  fEditTab = GetTab(pos);
1085  if (!fEditTab) return;
1086  fEditPos = pos;
1087  fEditSubPos = subpos;
1088 
1089  if (fEditFrame == 0) {
1090  if (subpos == -1) {
1091  fCrTab[pos] = fNbTab[pos]++;
1092  fEditFrame = fEditTab->AddTab(Form("Tab %d",fNbTab[pos]));
1094  fEditFrame->MapWindow();
1096  if(tabel) {
1097  tabel->MapWindow();
1098  if (fShowCloseTab && (pos == 1))
1099  tabel->ShowClose();
1100  }
1102  fEditTab->Layout();
1103  }
1104  else {
1105  fCrTab[pos] = subpos;
1106  fEditFrame = fEditTab->GetTabContainer(subpos);
1107  fEditTab->SetTab(subpos);
1108  }
1110  }
1111 }
1112 
1113 ////////////////////////////////////////////////////////////////////////////////
1114 /// Stop embedding external frame in the current editable frame.
1115 
1117 {
1118  if (fEditFrame != 0) {
1121  if (el && el->fFrame) {
1122  // let be notified when the inside frame gets resized, and tell its
1123  // container to recompute its layout
1124  el->fFrame->Connect("ProcessedConfigure(Event_t*)", "TGCompositeFrame",
1125  fEditFrame, "Layout()");
1126  }
1127  if (layout) {
1128  el = (TGFrameElement*) fEditFrame->GetList()->Last();
1129  // !!!! MT what to do with the old layout? Leak it for now ...
1130  if (el) el->fLayout = layout;
1131  }
1132  fEditFrame->Layout();
1133  if (fEditTab == fTabRight)
1135  }
1136  if (name && strlen(name)) {
1138  }
1140  fEditFrame = fEditTab = 0;
1141  fEditPos = fEditSubPos = -1;
1142 }
1143 
1144 ////////////////////////////////////////////////////////////////////////////////
1145 /// Move the menu from original frame to our TGMenuFrame, or display the
1146 /// menu associated to the current tab.
1147 
1149 {
1150  if (from == 0)
1151  return;
1152  TGFrameElement *fe = (TGFrameElement *)from->GetList()->First();
1153  if (!fe) {
1154  if (fActMenuBar != fMenuBar)
1155  ShowMenu(fMenuBar);
1156  return;
1157  }
1158  TGCompositeFrame *embed = (TGCompositeFrame *)fe->fFrame;
1159  TGFrameElement *el = 0;
1160  if (embed && embed->GetList()) {
1161  TIter next(embed->GetList());
1162  while ((el = (TGFrameElement *)next())) {
1163  if (el->fFrame->InheritsFrom("TGMenuBar")) {
1164  TGMenuBar *menu = (TGMenuBar *)el->fFrame;
1165  if (fActMenuBar == menu)
1166  return;
1167  TGFrameElement *nw;
1168  TIter nel(fMenuFrame->GetList());
1169  while ((nw = (TGFrameElement *) nel())) {
1170  if (nw->fFrame == menu) {
1171  ShowMenu(menu);
1172  return;
1173  }
1174  }
1175  ((TGCompositeFrame *)menu->GetParent())->HideFrame(menu);
1177  menu->ReparentWindow(fMenuFrame);
1178  fMenuFrame->AddFrame(menu, fLH2);
1179  TGFrameElement *mel;
1180  TIter mnext(menu->GetList());
1181  while ((mel = (TGFrameElement *) mnext())) {
1182  TGMenuTitle *t = (TGMenuTitle *) mel->fFrame;
1183  TGPopupMenu *popup = menu->GetPopup(t->GetName());
1184  if (popup) {
1185  RecursiveReparent(popup);
1186  if (popup->GetEntry("Close Canvas")) {
1187  TGMenuEntry *exit = popup->GetEntry("Close Canvas");
1188  popup->HideEntry(exit->GetEntryId());
1189  }
1190  if (popup->GetEntry("Close Viewer")) {
1191  TGMenuEntry *exit = popup->GetEntry("Close Viewer");
1192  popup->HideEntry(exit->GetEntryId());
1193  }
1194  if (popup->GetEntry("Quit ROOT")) {
1195  TGMenuEntry *exit = popup->GetEntry("Quit ROOT");
1196  popup->HideEntry(exit->GetEntryId());
1197  }
1198  if (popup->GetEntry("Exit")) {
1199  TGMenuEntry *exit = popup->GetEntry("Exit");
1200  popup->HideEntry(exit->GetEntryId());
1201  }
1202  }
1203  }
1204  ShowMenu(menu);
1205  return;
1206  }
1207  }
1208  }
1209  if (fActMenuBar != fMenuBar)
1210  ShowMenu(fMenuBar);
1211 }
1212 
1213 ////////////////////////////////////////////////////////////////////////////////
1214 /// Emits signal when double clicking on icon.
1215 
1217 {
1218  Emit("DoubleClicked(TObject*)", (Long_t)obj);
1219 }
1220 
1221 ////////////////////////////////////////////////////////////////////////////////
1222 /// Emits signal when double clicking on icon.
1223 
1225 {
1226  Long_t args[2];
1227 
1228  args[0] = (Long_t)obj;
1229  args[1] = checked;
1230 
1231  Emit("Checked(TObject*,Bool_t)", args);
1232 }
1233 
1234 ////////////////////////////////////////////////////////////////////////////////
1235 /// Emits signal "ExecuteDefaultAction(TObject*)".
1236 
1238 {
1239  Emit("ExecuteDefaultAction(TObject*)", (Long_t)obj);
1240 }
1241 
1242 
1243 ////////////////////////////////////////////////////////////////////////////////
1244 /// static contructor returning TBrowserImp,
1245 /// as needed by the plugin mechanism.
1246 
1248  UInt_t width, UInt_t height,
1249  Option_t *opt)
1250 {
1251  TRootBrowser *browser = new TRootBrowser(b, title, width, height, opt);
1252  return (TBrowserImp *)browser;
1253 }
1254 
1255 ////////////////////////////////////////////////////////////////////////////////
1256 /// static contructor returning TBrowserImp,
1257 /// as needed by the plugin mechanism.
1258 
1260  Int_t y, UInt_t width, UInt_t height,
1261  Option_t *opt)
1262 {
1263  TRootBrowser *browser = new TRootBrowser(b, title, x, y, width, height, opt);
1264  return (TBrowserImp *)browser;
1265 }
TGCompositeFrame * fEditFrame
Definition: TRootBrowser.h:80
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1172
const Mask_t kKeyReleaseMask
Definition: GuiTypes.h:161
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:929
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
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:197
void CloneBrowser()
Clone the browser.
virtual void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition: TSystem.cxx:421
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:405
virtual void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1)
Start embedding external frame in the tab "pos" and tab element "subpos".
Int_t GetCurrent() const
Definition: TGTab.h:109
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:611
R__EXTERN const char gHelpPostscript[]
Definition: HelpText.h:20
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
Definition: TGTab.cxx:563
const Mask_t kKeyMod2Mask
Definition: GuiTypes.h:200
Definition: TGTab.h:66
virtual void BrowseObj(TObject *)
Definition: TBrowserImp.h:53
TList fPlugins
Definition: TRootBrowser.h:92
Collectable string class.
Definition: TObjString.h:32
TGPopupMenu * fMenuExecPlugin
Definition: TRootBrowser.h:87
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:321
TGLayoutHints * fLH4
Definition: TRootBrowser.h:65
const char Option_t
Definition: RtypesCore.h:62
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:196
virtual void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add items to the actual browser.
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events.
Definition: TGFrame.cxx:1564
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
R__EXTERN void * gTQSender
Definition: TQObject.h:49
const Mask_t kKeyMod1Mask
Definition: GuiTypes.h:199
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:222
TGVerticalFrame * fVf
Definition: TRootBrowser.h:72
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:131
virtual void SetFrame(TGFrame *frame, Bool_t left)
Set frame to be resized.
Definition: TGSplitter.cxx:140
void InitPlugins(Option_t *opt="")
Initialize default plugins.
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition: TList.cxx:581
R__EXTERN const char gHelpPullDownMenus[]
Definition: HelpText.h:23
const TGPicture * SetIconPixmap(const char *iconName)
Set window icon pixmap by name.
Definition: TGFrame.cxx:1774
#define gROOT
Definition: TROOT.h:364
TGHorizontalFrame * fToolbarFrame
Definition: TRootBrowser.h:84
TGCompositeFrame * fActMenuBar
Definition: TRootBrowser.h:89
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1819
Basic string class.
Definition: TString.h:137
#define gClient
Definition: TGClient.h:174
TGHorizontalFrame * fH2
Definition: TRootBrowser.h:75
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition: TGFrame.cxx:1186
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=0, const TGPicture *p=0, TGMenuEntry *before=0)
Add a menu entry.
Definition: TGMenu.cxx:987
#define gInterpreter
Definition: TInterpreter.h:517
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
TGLayoutHints * fLH2
Definition: TRootBrowser.h:64
virtual void Activated(Int_t id)
Definition: TGMenu.h:240
R__EXTERN TApplication * gApplication
Definition: TApplication.h:171
TGLayoutHints * fLH5
Definition: TRootBrowser.h:65
virtual Long_t ExecPlugin(const char *name=0, const char *fname=0, const char *cmd=0, Int_t pos=kRight, Int_t subpos=-1)
Execute a macro and embed the created frame in the tab "pos" and tab element "subpos".
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition: TGFrame.cxx:1759
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
Definition: TObject.cxx:445
TGStatusBar * fStatusBar
Definition: TRootBrowser.h:93
R__EXTERN const char gHelpBrowser[]
Definition: HelpText.h:17
virtual void AddSeparator(TGMenuEntry *before=0)
Add a menu separator to the menu.
Definition: TGMenu.cxx:1057
Handle_t GetId() const
Definition: TGObject.h:52
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGMenu.h:296
R__EXTERN const char gHelpAbout[]
Definition: HelpText.h:16
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:497
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
Definition: TSystem.cxx:1037
TGLayoutHints * fLH7
Definition: TRootBrowser.h:65
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
Int_t fEditSubPos
Definition: TRootBrowser.h:71
TGLayoutHints * fLayout
Definition: TGLayout.h:127
virtual void ReallyDelete()
Really delete the browser and the this GUI.
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
void SetText(TGString *text)
Set new tab text.
Definition: TGTab.cxx:180
Double_t x[n]
Definition: legend1.C:17
virtual void Selected(Int_t id)
Definition: TGTab.h:126
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:2335
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition: TSystem.cxx:442
const char ** fFileTypes
Definition: TGFileDialog.h:65
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:1862
Option_t * GetDrawOption() const
Returns drawing option.
TGHorizontalFrame * fTopMenuFrame
Definition: TRootBrowser.h:81
virtual void ExecuteDefaultAction(TObject *obj)
Emits signal "ExecuteDefaultAction(TObject*)".
virtual void Refresh(Bool_t force=kFALSE)
Refresh the actual browser contents.
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:265
virtual const char * Getenv(const char *env)
Get environment variable.
Definition: TSystem.cxx:1628
const Mask_t kKeyLockMask
Definition: GuiTypes.h:197
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events.
virtual void RecursiveRemove(TObject *)
Definition: TBrowserImp.h:58
TGVSplitter * fVSplitter
Definition: TRootBrowser.h:78
TGTab * GetTab(Int_t pos) const
Returns the TGTab at position pos.
virtual TList * GetList() const
Definition: TGFrame.h:385
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition: TGFrame.cxx:1814
virtual Bool_t BindKey(const TGWindow *w, Int_t keycode, Int_t modifier) const
Bind key to a window.
Definition: TGFrame.cxx:1595
virtual void SetText(TGString *text, Int_t partidx=0)
Set text in partition partidx in status bar.
TGLayoutHints * fLH3
Definition: TRootBrowser.h:64
TGLayoutHints * fLH6
Definition: TRootBrowser.h:65
void Emit(const char *signal)
Acitvate signal without args.
Definition: TQObject.cxx:561
TGVerticalFrame * fV2
Definition: TRootBrowser.h:77
Int_t fEditPos
Definition: TRootBrowser.h:70
TGTab * fTabRight
Definition: TRootBrowser.h:67
TGHorizontalFrame * fHf
Definition: TRootBrowser.h:73
const Mask_t kKeyPressMask
Definition: GuiTypes.h:160
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
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:1137
Long_t ExecPlugin(const char *name=0, const char *fname=0, const char *cmd=0, Int_t pos=1, Int_t subpos=-1)
Definition: TBrowser.h:110
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:557
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
void Popup()
Show help dialog.
EGEventType fType
Definition: GuiTypes.h:176
Bool_t fMultipleSelection
Definition: TGFileDialog.h:68
R__EXTERN const char gHelpCanvas[]
Definition: HelpText.h:24
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:391
void SetTabTitle(const char *title, Int_t pos=kRight, Int_t subpos=-1)
Set text "title" of Tab "subpos" in TGTab "pos".
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
Definition: TEnv.cxx:496
virtual void SetStatusText(const char *txt, Int_t col)
Set text in culumn col in status bar.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:675
void HandleMenu(Int_t id)
Handle menu entries events.
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
Definition: TGTab.cxx:341
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:488
virtual void BrowseObj(TObject *obj)
Browse object.
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:507
static TGLayoutHints * fgDefaultHints
Definition: TGFrame.h:372
Int_t fCrTab[3]
Definition: TRootBrowser.h:96
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2322
unsigned int UInt_t
Definition: RtypesCore.h:42
TString fCommand
Definition: TRootBrowser.h:43
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from browser.
char * Form(const char *fmt,...)
TGTab * fTabBottom
Definition: TRootBrowser.h:68
virtual void SetFrame(TGFrame *frame, Bool_t above)
Set frame to be resized.
Definition: TGSplitter.cxx:339
TGFrame * fFrame
Definition: TGLayout.h:125
TList * fFileNamesList
Definition: TGFileDialog.h:69
virtual void CloseTab(Int_t id)
Remove tab element id from right tab.
TGPopupMenu * GetPopup() const
Definition: TGMenu.h:108
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition: TSystem.cxx:658
UInt_t References() const
Definition: TRefCnt.h:40
void SetTab(Int_t pos=kRight, Int_t subpos=-1)
Switch to Tab "subpos" in TGTab "pos".
virtual void RemoveTab(Int_t tabIndex=-1, Bool_t storeRemoved=kTRUE)
Remove container and tab of tab with index tabIndex.
Definition: TGTab.cxx:392
virtual void Refresh(Bool_t=kFALSE)
Definition: TBrowserImp.h:59
TGTab * fTabLeft
Definition: TRootBrowser.h:66
void RecursiveReparent(TGPopupMenu *popup)
Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
TString GetString() const
Definition: TObjString.h:50
#define gVirtualX
Definition: TVirtualX.h:362
R__EXTERN const char gHelpObjects[]
Definition: HelpText.h:25
void Selected(char *)
A ROOT File has been selected in TGHtmlBrowser.
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2514
EKeySym
Definition: KeySymbols.h:27
TGLayoutHints * fLH0
Definition: TRootBrowser.h:64
static const char * gPluginFileTypes[]
virtual void CloseTabs()
Properly close the mainframes embedded in the different tabs.
TString & Remove(Ssiz_t pos)
Definition: TString.h:616
long Long_t
Definition: RtypesCore.h:50
int Ssiz_t
Definition: RtypesCore.h:63
virtual Bool_t IsEmpty() const
Definition: TCollection.h:99
Bool_t IsOnHeap() const
Definition: TObject.h:119
#define ClassImp(name)
Definition: Rtypes.h:279
virtual void Add(TObject *, const char *, Int_t)
Definition: TBrowserImp.h:49
virtual void CloseWindow()
Called when window is closed via the window manager.
UInt_t RemoveReference()
Definition: TRefCnt.h:43
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1054
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:865
virtual ~TRootBrowser()
Clean up all widgets, frames and layouthints that were used.
R__EXTERN TEnv * gEnv
Definition: TEnv.h:174
unsigned long ULong_t
Definition: RtypesCore.h:51
static const char * gOpenFileTypes[]
TGHorizontalFrame * fPreMenuFrame
Definition: TRootBrowser.h:82
const TGPicture * fIconPic
Definition: TRootBrowser.h:99
char * fFilename
Definition: TGFileDialog.h:63
Double_t y[n]
Definition: legend1.C:17
R__EXTERN const char gHelpGraphicsEditor[]
Definition: HelpText.h:22
TGPopupMenu * fMenuFile
Definition: TRootBrowser.h:86
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1295
virtual void StopEmbedding(const char *name=0)
Definition: TRootBrowser.h:156
Int_t fNbTab[3]
Definition: TRootBrowser.h:95
void RemoveTab(Int_t pos, Int_t subpos)
Remove tab element "subpos" from tab "pos".
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
const TGWindow * GetParent() const
Definition: TGWindow.h:87
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
Bool_t IsNull() const
Definition: TString.h:387
R__EXTERN C unsigned int sleep(unsigned int seconds)
TGHSplitter * fHSplitter
Definition: TRootBrowser.h:79
Mother of all ROOT objects.
Definition: TObject.h:37
TGHorizontalFrame * fMenuFrame
Definition: TRootBrowser.h:83
TBrowserImp * fActBrowser
Definition: TRootBrowser.h:90
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:460
virtual void Destructor()
Actual browser destructor.
Definition: TBrowser.cxx:246
virtual TGPopupMenu * GetPopup(const char *s)
Return popup menu with the specified name.
Definition: TGMenu.cxx:537
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition: TGFrame.cxx:1837
void SetFrameElement(TGFrameElement *fe)
Definition: TGFrame.h:299
Int_t GetEntryId() const
Definition: TGMenu.h:103
virtual void Add(TObject *obj)
Definition: TList.h:81
void CreateBrowser(const char *name)
TGPopupMenu * fMenuHelp
Definition: TRootBrowser.h:88
virtual void MapWindow()
Definition: TGFrame.h:267
TGClient * fClient
Definition: TGObject.h:41
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
Definition: TGTab.cxx:612
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
Int_t fNbInitPlugins
Definition: TRootBrowser.h:94
#define snprintf
Definition: civetweb.c:822
const char * GetString() const
Definition: TGTab.h:163
#define gPad
Definition: TVirtualPad.h:289
UInt_t fState
Definition: GuiTypes.h:182
virtual void SetParts(Int_t npart)
Divide the status bar in npart equal sized parts.
void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Display a tooltip with infos about the primitive below the cursor.
virtual Option_t * GetDrawOption() const
Definition: TBrowserImp.h:62
R__EXTERN const char gHelpRemote[]
Definition: HelpText.h:27
static void Terminate()
Close the global pad editor. Static method.
virtual void AddPopup(TGHotString *s, TGPopupMenu *popup, TGMenuEntry *before=0, const TGPicture *p=0)
Add a (cascading) popup menu to a popup menu.
Definition: TGMenu.cxx:1149
const Mask_t kKeyControlMask
Definition: GuiTypes.h:198
void ShowMenu(TGCompositeFrame *menu)
Show the selected frame&#39;s menu and hide previous one.
Int_t GetHotKeyCode() const
Definition: TGMenu.h:294
TList * fBindList
Definition: TGFrame.h:499
virtual void SetEditable(Bool_t on=kTRUE)
Switch ON/OFF edit mode.
Definition: TGFrame.cxx:930
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:416
virtual Int_t GetSize() const
Definition: TCollection.h:95
TBrowser * fBrowser
Definition: TBrowserImp.h:34
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:258
const Bool_t kTRUE
Definition: Rtypes.h:91
TRootBrowser(const TRootBrowser &)
Int_t GetNumberOfTabs() const
Return number of tabs.
Definition: TGTab.cxx:658
const TList * GetListOfEntries() const
Definition: TGMenu.h:221
TGVerticalFrame * fV1
Definition: TRootBrowser.h:76
TGHorizontalFrame * fH1
Definition: TRootBrowser.h:74
void SwitchMenus(TGCompositeFrame *from)
Move the menu from original frame to our TGMenuFrame, or display the menu associated to the current t...
void DoTab(Int_t id)
Handle Tab navigation.
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
Add popup menu to menu bar.
Definition: TGMenu.cxx:415
TGTab * fEditTab
Definition: TRootBrowser.h:69
char name[80]
Definition: TGX11.cxx:109
static TBrowserImp * NewBrowser(TBrowser *b=0, const char *title="ROOT Browser", UInt_t width=800, UInt_t height=500, Option_t *opt="")
static contructor returning TBrowserImp, as needed by the plugin mechanism.
Bool_t fShowCloseTab
Definition: TRootBrowser.h:98
if(line.BeginsWith("/*"))
Definition: HLFactory.cxx:443
TGMenuBar * fMenuBar
Definition: TRootBrowser.h:85
char * fIniDir
Definition: TGFileDialog.h:64
TGLayoutHints * fLH1
Definition: TRootBrowser.h:64
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:31
const char * Data() const
Definition: TString.h:349