Logo ROOT   6.12/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 {
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  TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
402  this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
403  Disconnect(fMenuFile, "Activated(Int_t)", this, "HandleMenu(Int_t)");
404  Disconnect(fTabRight, "Selected(Int_t)", this, "DoTab(Int_t)");
405  if (fPlugins.IsEmpty()) return;
406  fActBrowser = 0;
407  for (i=0;i<fTabLeft->GetNumberOfTabs();i++) {
408  container = fTabLeft->GetTabContainer(i);
409  if (!container) continue;
410  el = (TGFrameElement *)container->GetList()->First();
411  if (el && el->fFrame) {
412  el->fFrame->SetFrameElement(0);
413  if (el->fFrame->InheritsFrom("TVirtualPadEditor")) {
415  }
416  else if (el->fFrame->InheritsFrom("TGMainFrame")) {
417  el->fFrame->UnmapWindow();
418  ((TGMainFrame *)el->fFrame)->CloseWindow();
420  }
421  else
422  delete el->fFrame;
423  el->fFrame = 0;
424  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
425  (el->fLayout->References() > 0)) {
426  el->fLayout->RemoveReference();
427  if (!el->fLayout->References()) {
428  delete el->fLayout;
429  }
430  }
431  container->GetList()->Remove(el);
432  delete el;
433  }
434  }
435  for (i=0;i<fTabRight->GetNumberOfTabs();i++) {
436  container = fTabRight->GetTabContainer(i);
437  if (!container) continue;
438  el = (TGFrameElement *)container->GetList()->First();
439  if (el && el->fFrame) {
440  el->fFrame->SetFrameElement(0);
441  if (el->fFrame->InheritsFrom("TGMainFrame")) {
442  el->fFrame->UnmapWindow();
443  Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
444  if (sleep)
445  gSystem->Sleep(150);
446  ((TGMainFrame *)el->fFrame)->CloseWindow();
447  if (sleep)
448  gSystem->Sleep(150);
450  }
451  else
452  delete el->fFrame;
453  el->fFrame = 0;
454  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
455  (el->fLayout->References() > 0)) {
456  el->fLayout->RemoveReference();
457  if (!el->fLayout->References()) {
458  delete el->fLayout;
459  }
460  }
461  container->GetList()->Remove(el);
462  delete el;
463  }
464  }
465  for (i=0;i<fTabBottom->GetNumberOfTabs();i++) {
466  container = fTabBottom->GetTabContainer(i);
467  if (!container) continue;
468  el = (TGFrameElement *)container->GetList()->First();
469  if (el && el->fFrame) {
470  el->fFrame->SetFrameElement(0);
471  if (el->fFrame->InheritsFrom("TGMainFrame")) {
472  el->fFrame->UnmapWindow();
473  ((TGMainFrame *)el->fFrame)->CloseWindow();
474  gSystem->Sleep(150);
476  }
477  else
478  delete el->fFrame;
479  el->fFrame = 0;
480  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
481  (el->fLayout->References() > 0)) {
482  el->fLayout->RemoveReference();
483  if (!el->fLayout->References()) {
484  delete el->fLayout;
485  }
486  }
487  container->GetList()->Remove(el);
488  delete el;
489  }
490  }
491  fPlugins.Delete();
492  Emit("CloseWindow()");
493 }
494 
495 ////////////////////////////////////////////////////////////////////////////////
496 /// Called when window is closed via the window manager.
497 
499 {
500  TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
501  this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
502  CloseTabs();
503  DeleteWindow();
504 }
505 
506 ////////////////////////////////////////////////////////////////////////////////
507 /// Handle Tab navigation.
508 
510 {
511  TGTab *sender = (TGTab *)gTQSender;
512  if ((sender) && (sender == fTabRight)) {
513  SwitchMenus(sender->GetTabContainer(id));
514  }
515 }
516 
517 ////////////////////////////////////////////////////////////////////////////////
518 /// Display a tooltip with infos about the primitive below the cursor.
519 
520 void TRootBrowser::EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
521 {
522  const Int_t kTMAX=256;
523  static char atext[kTMAX];
524  if (selected == 0 || event == kMouseLeave) {
525  SetStatusText("", 0);
526  SetStatusText("", 1);
527  SetStatusText("", 2);
528  SetStatusText("", 3);
529  return;
530  }
531  SetStatusText(selected->GetTitle(), 0);
532  SetStatusText(selected->GetName(), 1);
533  if (event == kKeyPress)
534  snprintf(atext, kTMAX, "%c", (char) px);
535  else
536  snprintf(atext, kTMAX, "%d,%d", px, py);
537  SetStatusText(atext, 2);
538  SetStatusText(selected->GetObjectInfo(px,py), 3);
539 }
540 
541 ////////////////////////////////////////////////////////////////////////////////
542 /// Execute a macro and embed the created frame in the tab "pos"
543 /// and tab element "subpos".
544 
545 Long_t TRootBrowser::ExecPlugin(const char *name, const char *fname,
546  const char *cmd, Int_t pos, Int_t subpos)
547 {
548  Long_t retval = 0;
549  TBrowserPlugin *p;
550  TString command, pname;
551  StartEmbedding(pos, subpos);
552  if (cmd && strlen(cmd)) {
553  command = cmd;
554  if (name) pname = name;
555  else pname = TString::Format("Plugin %d", fPlugins.GetSize());
556  p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
557  }
558  else if (fname && strlen(fname)) {
559  pname = name ? name : gSystem->BaseName(fname);
560  Ssiz_t t = pname.Last('.');
561  if (t > 0) pname.Remove(t);
562  command.Form("gROOT->Macro(\"%s\");", gSystem->UnixPathName(fname));
563  p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
564  }
565  else return 0;
566  fPlugins.Add(p);
567  retval = gROOT->ProcessLine(command.Data());
568  if (command.Contains("new TCanvas")) {
569  pname = gPad->GetName();
570  p->SetName(pname.Data());
571  }
572  SetTabTitle(pname.Data(), pos, subpos);
573  StopEmbedding();
574  return retval;
575 }
576 
577 ////////////////////////////////////////////////////////////////////////////////
578 /// Returns drawing option.
579 
581 {
582  if (fActBrowser)
583  return fActBrowser->GetDrawOption();
584  return 0;
585 }
586 
587 ////////////////////////////////////////////////////////////////////////////////
588 /// Returns the TGTab at position pos.
589 
591 {
592  switch (pos) {
593  case kLeft: return fTabLeft;
594  case kRight: return fTabRight;
595  case kBottom: return fTabBottom;
596  default: return 0;
597  }
598 }
599 
600 ////////////////////////////////////////////////////////////////////////////////
601 /// Handle keyboard events.
602 
604 {
605  char input[10];
606  UInt_t keysym;
607 
608  if (event->fType == kGKeyPress) {
609  gVirtualX->LookupString(event, input, sizeof(input), keysym);
610 
611  if (!event->fState && (EKeySym)keysym == kKey_F5) {
612  Refresh(kTRUE);
613  return kTRUE;
614  }
615  switch ((EKeySym)keysym) { // ignore these keys
616  case kKey_Shift:
617  case kKey_Control:
618  case kKey_Meta:
619  case kKey_Alt:
620  case kKey_CapsLock:
621  case kKey_NumLock:
622  case kKey_ScrollLock:
623  return kTRUE;
624  default:
625  break;
626  }
627  if (event->fState & kKeyControlMask) { // Cntrl key modifier pressed
628  switch ((EKeySym)keysym & ~0x20) { // treat upper and lower the same
629  case kKey_B:
631  return kTRUE;
632  case kKey_O:
634  return kTRUE;
635  case kKey_E:
637  return kTRUE;
638  case kKey_C:
640  return kTRUE;
641  case kKey_H:
643  return kTRUE;
644  case kKey_N:
646  return kTRUE;
647  case kKey_T:
649  return kTRUE;
650  case kKey_W:
652  return kTRUE;
653  case kKey_Q:
655  return kTRUE;
656  default:
657  break;
658  }
659  }
660  }
661  return TGMainFrame::HandleKey(event);
662 }
663 
664 ////////////////////////////////////////////////////////////////////////////////
665 /// Handle menu entries events.
666 
668 {
669  TRootHelpDialog *hd;
670  TString cmd;
671  static Int_t eNr = 1;
672  TGPopupMenu *sender = (TGPopupMenu *)gTQSender;
673  if (sender != fMenuFile)
674  return;
675  switch (id) {
676  case kBrowse:
677  new TBrowser();
678  break;
679  case kOpenFile:
680  {
681  Bool_t newfile = kFALSE;
682  static TString dir(".");
683  TGFileInfo fi;
685  fi.fIniDir = StrDup(dir);
686  new TGFileDialog(gClient->GetDefaultRoot(), this,
687  kFDOpen,&fi);
688  dir = fi.fIniDir;
689  if (fi.fMultipleSelection && fi.fFileNamesList) {
690  TObjString *el;
691  TIter next(fi.fFileNamesList);
692  while ((el = (TObjString *) next())) {
693  gROOT->ProcessLine(Form("new TFile(\"%s\");",
694  gSystem->UnixPathName(el->GetString())));
695  }
696  newfile = kTRUE;
697  }
698  else if (fi.fFilename) {
699  gROOT->ProcessLine(Form("new TFile(\"%s\");",
701  newfile = kTRUE;
702  }
703  if (fActBrowser && newfile) {
704  TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(fActBrowser);
705  if (fb) fb->Selected(0);
706  }
707  }
708  break;
709  // Handle Help menu items...
710  case kHelpAbout:
711  {
712 #ifdef R__UNIX
713  TString rootx = TROOT::GetBinDir() + "/root -a &";
714  gSystem->Exec(rootx);
715 #else
716 #ifdef WIN32
718 #else
719  char str[32];
720  sprintf(str, "About ROOT %s...", gROOT->GetVersion());
721  hd = new TRootHelpDialog(this, str, 600, 400);
722  hd->SetText(gHelpAbout);
723  hd->Popup();
724 #endif
725 #endif
726  }
727  break;
728  case kHelpOnCanvas:
729  hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
730  hd->SetText(gHelpCanvas);
731  hd->Popup();
732  break;
733  case kHelpOnMenus:
734  hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
736  hd->Popup();
737  break;
738  case kHelpOnGraphicsEd:
739  hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
741  hd->Popup();
742  break;
743  case kHelpOnBrowser:
744  hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
745  hd->SetText(gHelpBrowser);
746  hd->Popup();
747  break;
748  case kHelpOnObjects:
749  hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
750  hd->SetText(gHelpObjects);
751  hd->Popup();
752  break;
753  case kHelpOnPS:
754  hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
756  hd->Popup();
757  break;
758  case kHelpOnRemote:
759  hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
760  hd->SetText(gHelpRemote);
761  hd->Popup();
762  break;
763  case kClone:
764  CloneBrowser();
765  break;
766  case kNewEditor:
767  cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot())");
768  ++eNr;
769  ExecPlugin(Form("Editor %d", eNr), "", cmd.Data(), 1);
770  break;
771  case kNewCanvas:
772  ExecPlugin("", "", "new TCanvas()", 1);
773  break;
774  case kNewHtml:
775  cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot())",
776  gEnv->GetValue("Browser.StartUrl", "http://root.cern.ch"));
777  ExecPlugin("HTML", "", cmd.Data(), 1);
778  break;
779  case kExecPluginMacro:
780  {
781  static TString dir(".");
782  TGFileInfo fi;
784  fi.fIniDir = StrDup(dir);
785  new TGFileDialog(gClient->GetDefaultRoot(), this,
786  kFDOpen,&fi);
787  dir = fi.fIniDir;
788  if (fi.fFilename) {
789  ExecPlugin(0, fi.fFilename, 0, kRight);
790  }
791  }
792  break;
793  case kExecPluginCmd:
794  {
795  char command[1024];
796  strlcpy(command, "new TGLSAViewer(gClient->GetRoot(), 0);",
797  sizeof(command));
798  new TGInputDialog(gClient->GetRoot(), this,
799  "Enter plugin command line:",
800  command, command);
801  if (strcmp(command, "")) {
802  ExecPlugin("User", 0, command, kRight);
803  }
804  }
805  break;
806  case kCloseTab:
808  break;
809  case kCloseWindow:
810  CloseWindow();
811  break;
812  case kQuitRoot:
813  CloseWindow();
815  break;
816  default:
817  break;
818  }
819 }
820 
821 ////////////////////////////////////////////////////////////////////////////////
822 /// Initialize default plugins. Could be also of the form:
823 /// StartEmbedding(0);
824 /// TPluginHandler *ph;
825 /// ph = gROOT->GetPluginManager()->FindHandler("TGClassBrowser");
826 /// if (ph && ph->LoadPlugin() != -1) {
827 /// ph->ExecPlugin(3, gClient->GetRoot(), 200, 500);
828 /// }
829 /// StopEmbedding();
830 
832 {
833  TString cmd;
834 
835  if ((opt == 0) || (!opt[0]))
836  return;
837  // --- Left vertical area
838 
839  // File Browser plugin
840  if (strchr(opt, 'F')) {
841  cmd.Form("new TGFileBrowser(gClient->GetRoot(), (TBrowser *)0x%lx, 200, 500);", (ULong_t)fBrowser);
842  ExecPlugin("Files", 0, cmd.Data(), 0);
843  ++fNbInitPlugins;
844  }
845 
846  // --- Right main area
847 
848  Int_t i, len = strlen(opt);
849  for (i=0; i<len; ++i) {
850  // Editor plugin...
851  if (opt[i] == 'E') {
852  cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot());");
853  ExecPlugin("Editor 1", 0, cmd.Data(), 1);
854  ++fNbInitPlugins;
855  }
856 
857  // HTML plugin...
858  if (opt[i] == 'H') {
859  if (gSystem->Load("libGuiHtml") >= 0) {
860  cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot());",
861  gEnv->GetValue("Browser.StartUrl",
862  "http://root.cern.ch/root/html/ClassIndex.html"));
863  ExecPlugin("HTML", 0, cmd.Data(), 1);
864  ++fNbInitPlugins;
865  }
866  }
867 
868  // Canvas plugin...
869  if (opt[i] == 'C') {
870  cmd.Form("new TCanvas();");
871  ExecPlugin("c1", 0, cmd.Data(), 1);
872  ++fNbInitPlugins;
873  }
874 
875  // GLViewer plugin...
876  if (opt[i] == 'G') {
877  cmd.Form("new TGLSAViewer(gClient->GetRoot(), 0);");
878  ExecPlugin("OpenGL", 0, cmd.Data(), 1);
879  ++fNbInitPlugins;
880  }
881 
882  // PROOF plugin...
883  if (opt[i] == 'P') {
884  cmd.Form("new TSessionViewer();");
885  ExecPlugin("PROOF", 0, cmd.Data(), 1);
886  ++fNbInitPlugins;
887  }
888  }
889  // --- Right bottom area
890 
891  // Command plugin...
892  if (strchr(opt, 'I')) {
893  cmd.Form("new TGCommandPlugin(gClient->GetRoot(), 700, 300);");
894  ExecPlugin("Command", 0, cmd.Data(), 2);
895  ++fNbInitPlugins;
896  }
897 
898  // --- Select first tab everywhere
899  SetTab(0, 0);
900  SetTab(1, 0);
901  SetTab(2, 0);
902 }
903 
904 ////////////////////////////////////////////////////////////////////////////////
905 /// Really delete the browser and the this GUI.
906 
908 {
910  delete this;
911 }
912 
913 ////////////////////////////////////////////////////////////////////////////////
914 /// Recursively remove object from browser.
915 
917 {
918  if (fActBrowser)
920 }
921 
922 ////////////////////////////////////////////////////////////////////////////////
923 /// Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
924 
926 {
927  TGMenuEntry *entry = 0;
928  TIter next(popup->GetListOfEntries());
929  while ((entry = (TGMenuEntry *)next())) {
930  if (entry->GetPopup()) {
931  RecursiveReparent(entry->GetPopup());
932  }
933  }
934  popup->ReparentWindow(gClient->GetDefaultRoot());
935 }
936 
937 ////////////////////////////////////////////////////////////////////////////////
938 /// Refresh the actual browser contents.
939 
941 {
942  if (fActBrowser)
943  fActBrowser->Refresh(force);
944 }
945 
946 ////////////////////////////////////////////////////////////////////////////////
947 /// Remove tab element "subpos" from tab "pos".
948 
950 {
951  TGTab *edit = 0;
952  switch (pos) {
953  case kLeft: // left
954  edit = fTabLeft;
955  break;
956  case kRight: // right
957  edit = fTabRight;
960  fActMenuBar = 0;
961  break;
962  case kBottom: // bottom
963  edit = fTabBottom;
964  break;
965  }
966  if (!edit || !edit->GetTabTab(subpos))
967  return;
968  const char *tabName = edit->GetTabTab(subpos)->GetString();
969  TObject *obj = 0;
970  if ((obj = fPlugins.FindObject(tabName))) {
971  fPlugins.Remove(obj);
972  }
973  TGFrameElement *el = 0;
974  if (edit->GetTabContainer(subpos))
975  el = (TGFrameElement *)edit->GetTabContainer(subpos)->GetList()->First();
976  if (el && el->fFrame) {
977  el->fFrame->Disconnect("ProcessedConfigure(Event_t*)");
978  el->fFrame->SetFrameElement(0);
979  if (el->fFrame->InheritsFrom("TGMainFrame")) {
980  Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
981  ((TGMainFrame *)el->fFrame)->CloseWindow();
982  if (sleep)
983  gSystem->Sleep(150);
985  }
986  else
987  delete el->fFrame;
988  el->fFrame = 0;
989  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
990  (el->fLayout->References() > 0)) {
991  el->fLayout->RemoveReference();
992  if (!el->fLayout->References()) {
993  delete el->fLayout;
994  }
995  }
996  edit->GetTabContainer(subpos)->GetList()->Remove(el);
997  delete el;
998  }
999  fNbTab[pos]--;
1000  edit->RemoveTab(subpos);
1001  SwitchMenus(edit->GetTabContainer(edit->GetCurrent()));
1002 }
1003 
1004 ////////////////////////////////////////////////////////////////////////////////
1005 /// Switch to Tab "subpos" in TGTab "pos".
1006 
1008 {
1009  TGTab *tab = GetTab(pos);
1010  if (subpos == -1)
1011  subpos = fCrTab[pos];
1012 
1013  if (tab && tab->SetTab(subpos, kFALSE)) { // Block signal emit
1014  if (pos == kRight)
1015  SwitchMenus(tab->GetTabContainer(subpos));
1016  tab->Layout();
1017  }
1018 }
1019 
1020 ////////////////////////////////////////////////////////////////////////////////
1021 /// Set text "title" of Tab "subpos" in TGTab "pos".
1022 
1023 void TRootBrowser::SetTabTitle(const char *title, Int_t pos, Int_t subpos)
1024 {
1025  TBrowserPlugin *p = 0;
1026  TGTab *edit = GetTab(pos);
1027  if (!edit) return;
1028  if (subpos == -1)
1029  subpos = fCrTab[pos];
1030 
1031  TGTabElement *el = edit->GetTabTab(subpos);
1032  if (el) {
1033  el->SetText(new TGString(title));
1034  edit->Layout();
1035  if ((p = (TBrowserPlugin *)fPlugins.FindObject(title)))
1036  p->SetName(title);
1037  }
1038 }
1039 
1040 ////////////////////////////////////////////////////////////////////////////////
1041 /// Set text in culumn col in status bar.
1042 
1043 void TRootBrowser::SetStatusText(const char* txt, Int_t col)
1044 {
1045  fStatusBar->SetText(txt, col);
1046 }
1047 
1048 ////////////////////////////////////////////////////////////////////////////////
1049 /// Show the selected frame's menu and hide previous one.
1050 
1052 {
1053  TGFrameElement *el = 0;
1054  // temporary solution until I find a proper way to handle
1055  // these bloody menus...
1056  fBindList->Delete();
1057  TIter nextm(fMenuBar->GetList());
1058  while ((el = (TGFrameElement *) nextm())) {
1059  TGMenuTitle *t = (TGMenuTitle *) el->fFrame;
1060  Int_t code = t->GetHotKeyCode();
1061  BindKey(fMenuBar, code, kKeyMod1Mask);
1069  }
1071  fMenuFrame->ShowFrame(menu);
1072  menu->Layout();
1073  fMenuFrame->Layout();
1074  fActMenuBar = menu;
1075 }
1076 
1077 ////////////////////////////////////////////////////////////////////////////////
1078 /// Start embedding external frame in the tab "pos" and tab element "subpos".
1079 
1081 {
1082  fEditTab = GetTab(pos);
1083  if (!fEditTab) return;
1084  fEditPos = pos;
1085  fEditSubPos = subpos;
1086 
1087  if (fEditFrame == 0) {
1088  if (subpos == -1) {
1089  fCrTab[pos] = fNbTab[pos]++;
1090  fEditFrame = fEditTab->AddTab(Form("Tab %d",fNbTab[pos]));
1092  fEditFrame->MapWindow();
1094  if(tabel) {
1095  tabel->MapWindow();
1096  if (fShowCloseTab && (pos == 1))
1097  tabel->ShowClose();
1098  }
1100  fEditTab->Layout();
1101  }
1102  else {
1103  fCrTab[pos] = subpos;
1104  fEditFrame = fEditTab->GetTabContainer(subpos);
1105  fEditTab->SetTab(subpos);
1106  }
1108  }
1109 }
1110 
1111 ////////////////////////////////////////////////////////////////////////////////
1112 /// Stop embedding external frame in the current editable frame.
1113 
1115 {
1116  if (fEditFrame != 0) {
1119  if (el && el->fFrame) {
1120  // let be notified when the inside frame gets resized, and tell its
1121  // container to recompute its layout
1122  el->fFrame->Connect("ProcessedConfigure(Event_t*)", "TGCompositeFrame",
1123  fEditFrame, "Layout()");
1124  }
1125  if (layout) {
1126  el = (TGFrameElement*) fEditFrame->GetList()->Last();
1127  // !!!! MT what to do with the old layout? Leak it for now ...
1128  if (el) el->fLayout = layout;
1129  }
1130  fEditFrame->Layout();
1131  if (fEditTab == fTabRight)
1133  }
1134  if (name && strlen(name)) {
1136  }
1138  fEditFrame = fEditTab = 0;
1139  fEditPos = fEditSubPos = -1;
1140 }
1141 
1142 ////////////////////////////////////////////////////////////////////////////////
1143 /// Move the menu from original frame to our TGMenuFrame, or display the
1144 /// menu associated to the current tab.
1145 
1147 {
1148  if (from == 0)
1149  return;
1150  TGFrameElement *fe = (TGFrameElement *)from->GetList()->First();
1151  if (!fe) {
1152  if (fActMenuBar != fMenuBar)
1153  ShowMenu(fMenuBar);
1154  return;
1155  }
1156  TGCompositeFrame *embed = (TGCompositeFrame *)fe->fFrame;
1157  TGFrameElement *el = 0;
1158  if (embed && embed->GetList()) {
1159  TIter next(embed->GetList());
1160  while ((el = (TGFrameElement *)next())) {
1161  if (el->fFrame->InheritsFrom("TGMenuBar")) {
1162  TGMenuBar *menu = (TGMenuBar *)el->fFrame;
1163  if (fActMenuBar == menu)
1164  return;
1165  TGFrameElement *nw;
1166  TIter nel(fMenuFrame->GetList());
1167  while ((nw = (TGFrameElement *) nel())) {
1168  if (nw->fFrame == menu) {
1169  ShowMenu(menu);
1170  return;
1171  }
1172  }
1173  ((TGCompositeFrame *)menu->GetParent())->HideFrame(menu);
1175  menu->ReparentWindow(fMenuFrame);
1176  fMenuFrame->AddFrame(menu, fLH2);
1177  TGFrameElement *mel;
1178  TIter mnext(menu->GetList());
1179  while ((mel = (TGFrameElement *) mnext())) {
1180  TGMenuTitle *t = (TGMenuTitle *) mel->fFrame;
1181  TGPopupMenu *popup = menu->GetPopup(t->GetName());
1182  if (popup) {
1183  RecursiveReparent(popup);
1184  if (popup->GetEntry("Close Canvas")) {
1185  TGMenuEntry *exit = popup->GetEntry("Close Canvas");
1186  popup->HideEntry(exit->GetEntryId());
1187  }
1188  if (popup->GetEntry("Close Viewer")) {
1189  TGMenuEntry *exit = popup->GetEntry("Close Viewer");
1190  popup->HideEntry(exit->GetEntryId());
1191  }
1192  if (popup->GetEntry("Quit ROOT")) {
1193  TGMenuEntry *exit = popup->GetEntry("Quit ROOT");
1194  popup->HideEntry(exit->GetEntryId());
1195  }
1196  if (popup->GetEntry("Exit")) {
1197  TGMenuEntry *exit = popup->GetEntry("Exit");
1198  popup->HideEntry(exit->GetEntryId());
1199  }
1200  }
1201  }
1202  ShowMenu(menu);
1203  return;
1204  }
1205  }
1206  }
1207  if (fActMenuBar != fMenuBar)
1208  ShowMenu(fMenuBar);
1209 }
1210 
1211 ////////////////////////////////////////////////////////////////////////////////
1212 /// Emits signal when double clicking on icon.
1213 
1215 {
1216  Emit("DoubleClicked(TObject*)", (Long_t)obj);
1217 }
1218 
1219 ////////////////////////////////////////////////////////////////////////////////
1220 /// Emits signal when double clicking on icon.
1221 
1223 {
1224  Long_t args[2];
1225 
1226  args[0] = (Long_t)obj;
1227  args[1] = checked;
1228 
1229  Emit("Checked(TObject*,Bool_t)", args);
1230 }
1231 
1232 ////////////////////////////////////////////////////////////////////////////////
1233 /// Emits signal "ExecuteDefaultAction(TObject*)".
1234 
1236 {
1237  Emit("ExecuteDefaultAction(TObject*)", (Long_t)obj);
1238 }
1239 
1240 
1241 ////////////////////////////////////////////////////////////////////////////////
1242 /// static contructor returning TBrowserImp,
1243 /// as needed by the plugin mechanism.
1244 
1246  UInt_t width, UInt_t height,
1247  Option_t *opt)
1248 {
1249  TRootBrowser *browser = new TRootBrowser(b, title, width, height, opt);
1250  return (TBrowserImp *)browser;
1251 }
1252 
1253 ////////////////////////////////////////////////////////////////////////////////
1254 /// static contructor returning TBrowserImp,
1255 /// as needed by the plugin mechanism.
1256 
1258  Int_t y, UInt_t width, UInt_t height,
1259  Option_t *opt)
1260 {
1261  TRootBrowser *browser = new TRootBrowser(b, title, x, y, width, height, opt);
1262  return (TBrowserImp *)browser;
1263 }
TGCompositeFrame * fEditFrame
Definition: TRootBrowser.h:76
void SetBrowserImp(TBrowserImp *i)
Definition: TBrowser.h:93
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1172
const Mask_t kKeyReleaseMask
Definition: GuiTypes.h:159
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:932
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
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:424
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:467
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:105
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:18
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
Definition: TGTab.cxx:563
const Mask_t kKeyMod2Mask
Definition: GuiTypes.h:198
Definition: TGTab.h:62
virtual void BrowseObj(TObject *)
Definition: TBrowserImp.h:51
TList fPlugins
Definition: TRootBrowser.h:88
Collectable string class.
Definition: TObjString.h:28
TGPopupMenu * fMenuExecPlugin
Definition: TRootBrowser.h:83
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:61
const char Option_t
Definition: RtypesCore.h:62
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:194
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:45
const Mask_t kKeyMod1Mask
Definition: GuiTypes.h:197
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:222
TGVerticalFrame * fVf
Definition: TRootBrowser.h:68
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
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:689
R__EXTERN const char gHelpPullDownMenus[]
Definition: HelpText.h:21
const TGPicture * SetIconPixmap(const char *iconName)
Set window icon pixmap by name.
Definition: TGFrame.cxx:1774
#define gROOT
Definition: TROOT.h:402
TGHorizontalFrame * fToolbarFrame
Definition: TRootBrowser.h:80
TGCompositeFrame * fActMenuBar
Definition: TRootBrowser.h:85
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1829
Basic string class.
Definition: TString.h:125
#define gClient
Definition: TGClient.h:166
TGHorizontalFrame * fH2
Definition: TRootBrowser.h:71
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
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
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:60
virtual void Activated(Int_t id)
Definition: TGMenu.h:232
R__EXTERN TApplication * gApplication
Definition: TApplication.h:165
TGLayoutHints * fLH5
Definition: TRootBrowser.h:61
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:386
TGStatusBar * fStatusBar
Definition: TRootBrowser.h:89
R__EXTERN const char gHelpBrowser[]
Definition: HelpText.h:15
virtual void AddSeparator(TGMenuEntry *before=0)
Add a menu separator to the menu.
Definition: TGMenu.cxx:1057
Handle_t GetId() const
Definition: TGObject.h:47
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:288
R__EXTERN const char gHelpAbout[]
Definition: HelpText.h:14
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
Definition: TList.cxx:574
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
Definition: TSystem.cxx:1044
TGLayoutHints * fLH7
Definition: TRootBrowser.h:61
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
Int_t fEditSubPos
Definition: TRootBrowser.h:67
TGLayoutHints * fLayout
Definition: TGLayout.h:121
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:122
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:2365
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition: TSystem.cxx:445
const char ** fFileTypes
Definition: TGFileDialog.h:63
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:77
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:249
const Mask_t kKeyLockMask
Definition: GuiTypes.h:195
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events.
virtual void RecursiveRemove(TObject *)
Definition: TBrowserImp.h:56
TGVSplitter * fVSplitter
Definition: TRootBrowser.h:74
TGTab * GetTab(Int_t pos) const
Returns the TGTab at position pos.
virtual TList * GetList() const
Definition: TGFrame.h:369
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:60
TGLayoutHints * fLH6
Definition: TRootBrowser.h:61
TGVerticalFrame * fV2
Definition: TRootBrowser.h:73
Int_t fEditPos
Definition: TRootBrowser.h:66
TGTab * fTabRight
Definition: TRootBrowser.h:63
TGHorizontalFrame * fHf
Definition: TRootBrowser.h:69
const Mask_t kKeyPressMask
Definition: GuiTypes.h:158
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
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:867
const TString & GetString() const
Definition: TObjString.h:47
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:106
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:655
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
void Popup()
Show help dialog.
EGEventType fType
Definition: GuiTypes.h:174
Bool_t fMultipleSelection
Definition: TGFileDialog.h:66
R__EXTERN const char gHelpCanvas[]
Definition: HelpText.h:22
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:375
void SetTabTitle(const char *title, Int_t pos=kRight, Int_t subpos=-1)
Set text "title" of Tab "subpos" in TGTab "pos".
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:818
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:443
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:356
Int_t fCrTab[3]
Definition: TRootBrowser.h:92
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2343
unsigned int UInt_t
Definition: RtypesCore.h:42
TString fCommand
Definition: TRootBrowser.h:39
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from browser.
char * Form(const char *fmt,...)
TGTab * fTabBottom
Definition: TRootBrowser.h:64
virtual void SetFrame(TGFrame *frame, Bool_t above)
Set frame to be resized.
Definition: TGSplitter.cxx:339
TGFrame * fFrame
Definition: TGLayout.h:119
TList * fFileNamesList
Definition: TGFileDialog.h:67
virtual void CloseTab(Int_t id)
Remove tab element id from right tab.
TGPopupMenu * GetPopup() const
Definition: TGMenu.h:100
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition: TSystem.cxx:661
UInt_t References() const
Definition: TRefCnt.h:38
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:57
TGTab * fTabLeft
Definition: TRootBrowser.h:62
void RecursiveReparent(TGPopupMenu *popup)
Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
#define gVirtualX
Definition: TVirtualX.h:350
R__EXTERN const char gHelpObjects[]
Definition: HelpText.h:23
void Selected(char *)
A ROOT File has been selected in TGHtmlBrowser.
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2544
const Bool_t kFALSE
Definition: RtypesCore.h:88
EKeySym
Definition: KeySymbols.h:25
TGLayoutHints * fLH0
Definition: TRootBrowser.h:60
static const char * gPluginFileTypes[]
virtual void CloseTabs()
Properly close the mainframes embedded in the different tabs.
TString & Remove(Ssiz_t pos)
Definition: TString.h:619
long Long_t
Definition: RtypesCore.h:50
int Ssiz_t
Definition: RtypesCore.h:63
virtual Bool_t IsEmpty() const
Definition: TCollection.h:184
#define ClassImp(name)
Definition: Rtypes.h:359
virtual void Add(TObject *, const char *, Int_t)
Definition: TBrowserImp.h:47
virtual void CloseWindow()
Called when window is closed via the window manager.
UInt_t RemoveReference()
Definition: TRefCnt.h:41
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:875
virtual ~TRootBrowser()
Clean up all widgets, frames and layouthints that were used.
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
unsigned long ULong_t
Definition: RtypesCore.h:51
static const char * gOpenFileTypes[]
TGHorizontalFrame * fPreMenuFrame
Definition: TRootBrowser.h:78
const TGPicture * fIconPic
Definition: TRootBrowser.h:95
char * fFilename
Definition: TGFileDialog.h:61
Double_t y[n]
Definition: legend1.C:17
R__EXTERN const char gHelpGraphicsEditor[]
Definition: HelpText.h:20
TGPopupMenu * fMenuFile
Definition: TRootBrowser.h:82
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:570
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:1025
virtual void StopEmbedding(const char *name=0)
Definition: TRootBrowser.h:152
Int_t fNbTab[3]
Definition: TRootBrowser.h:91
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:85
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
R__EXTERN C unsigned int sleep(unsigned int seconds)
TGHSplitter * fHSplitter
Definition: TRootBrowser.h:75
Mother of all ROOT objects.
Definition: TObject.h:37
TGHorizontalFrame * fMenuFrame
Definition: TRootBrowser.h:79
TBrowserImp * fActBrowser
Definition: TRootBrowser.h:86
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:401
virtual void UnmapWindow()
Definition: TGFrame.h:253
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:283
Int_t GetEntryId() const
Definition: TGMenu.h:95
virtual void Add(TObject *obj)
Definition: TList.h:87
void CreateBrowser(const char *name)
TGPopupMenu * fMenuHelp
Definition: TRootBrowser.h:84
virtual void MapWindow()
Definition: TGFrame.h:251
TGClient * fClient
Definition: TGObject.h:37
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:90
#define snprintf
Definition: civetweb.c:822
const char * GetString() const
Definition: TGTab.h:159
#define gPad
Definition: TVirtualPad.h:285
UInt_t fState
Definition: GuiTypes.h:180
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:60
R__EXTERN const char gHelpRemote[]
Definition: HelpText.h:25
static void Terminate()
Close the global pad editor. Static method.
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition: TROOT.cxx:2842
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
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:165
const Mask_t kKeyControlMask
Definition: GuiTypes.h:196
void ShowMenu(TGCompositeFrame *menu)
Show the selected frame&#39;s menu and hide previous one.
Int_t GetHotKeyCode() const
Definition: TGMenu.h:286
TList * fBindList
Definition: TGFrame.h:483
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:357
virtual Int_t GetSize() const
Definition: TCollection.h:180
TBrowser * fBrowser
Definition: TBrowserImp.h:32
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:258
TRootBrowser(const TRootBrowser &)
Int_t GetNumberOfTabs() const
Return number of tabs.
Definition: TGTab.cxx:658
const TList * GetListOfEntries() const
Definition: TGMenu.h:213
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
TGVerticalFrame * fV1
Definition: TRootBrowser.h:72
const Bool_t kTRUE
Definition: RtypesCore.h:87
TGHorizontalFrame * fH1
Definition: TRootBrowser.h:70
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:65
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:94
TGMenuBar * fMenuBar
Definition: TRootBrowser.h:81
char * fIniDir
Definition: TGFileDialog.h:62
TGLayoutHints * fLH1
Definition: TRootBrowser.h:60
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:29
const char * Data() const
Definition: TString.h:345