Logo ROOT   6.14/05
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 "TClass.h"
58 #include "TGClient.h"
59 #include "TGFrame.h"
60 #include "TGTab.h"
61 #include "TGMenu.h"
62 #include "TGLayout.h"
63 #include "TGSplitter.h"
64 #include "TGStatusBar.h"
65 #include "Varargs.h"
66 #include "TInterpreter.h"
67 #include "TBrowser.h"
68 #include "TGFileDialog.h"
69 #include "TObjString.h"
70 #include "TVirtualPad.h"
71 #include "TEnv.h"
72 #include <KeySymbols.h>
73 
74 #include "RConfigure.h"
75 
76 #include "TRootBrowser.h"
77 #include "TGFileBrowser.h"
78 #include "TGInputDialog.h"
79 #include "TRootHelpDialog.h"
80 #include "TVirtualPadEditor.h"
81 #include "HelpText.h"
82 #include "Getline.h"
83 
84 #ifdef WIN32
85 #include <TWin32SplashThread.h>
86 #endif
87 
88 static const char *gOpenFileTypes[] = {
89  "ROOT files", "*.root",
90  "All files", "*",
91  0, 0
92 };
93 
94 static const char *gPluginFileTypes[] = {
95  "ROOT files", "*.C",
96  "All files", "*",
97  0, 0
98 };
99 
100 //_____________________________________________________________________________
101 //
102 // TRootBrowser
103 //
104 // The main ROOT object browser.
105 //_____________________________________________________________________________
106 
108 
109 ////////////////////////////////////////////////////////////////////////////////
110 /// Create browser with a specified width and height.
111 
113  UInt_t height, Option_t *opt, Bool_t initshow) :
114  TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
115 {
117  fActBrowser = 0;
118  fIconPic = 0;
119  CreateBrowser(name);
120  Resize(width, height);
121  if (initshow) {
122  InitPlugins(opt);
123  MapWindow();
124  }
125  TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
126  "TRootBrowser", this,
127  "EventInfo(Int_t, Int_t, Int_t, TObject*)");
128  gVirtualX->SetInputFocus(GetId());
129 }
130 
131 ////////////////////////////////////////////////////////////////////////////////
132 /// Create browser with a specified width and height and at position x, y.
133 
135  UInt_t width, UInt_t height, Option_t *opt,
136  Bool_t initshow) :
137  TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
138 {
140  fActBrowser = 0;
141  fIconPic = 0;
142  CreateBrowser(name);
143  MoveResize(x, y, width, height);
144  SetWMPosition(x, y);
145  if (initshow) {
146  InitPlugins(opt);
147  MapWindow();
148  }
149  TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
150  "TRootBrowser", this,
151  "EventInfo(Int_t, Int_t, Int_t, TObject*)");
152  gVirtualX->SetInputFocus(GetId());
153 }
154 
155 
156 ////////////////////////////////////////////////////////////////////////////////
157 
159 {
160  // Create the actual interface.
161 
162  fVf = new TGVerticalFrame(this, 100, 100);
163 
165  fLH1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
166  fLH2 = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 1);
172 
173  // Menubar Frame
174  fTopMenuFrame = new TGHorizontalFrame(fVf, 100, 20);
175 
178  fMenuFile = new TGPopupMenu(gClient->GetDefaultRoot());
179  fMenuFile->AddEntry("&Browse...\tCtrl+B", kBrowse);
180  fMenuFile->AddEntry("&Open...\tCtrl+O", kOpenFile);
182 
184  fMenuHelp->AddEntry("&About ROOT...", kHelpAbout);
186  fMenuHelp->AddEntry("Help On Browser...", kHelpOnBrowser);
187  fMenuHelp->AddEntry("Help On Canvas...", kHelpOnCanvas);
188  fMenuHelp->AddEntry("Help On Menus...", kHelpOnMenus);
189  fMenuHelp->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
190  fMenuHelp->AddEntry("Help On Objects...", kHelpOnObjects);
191  fMenuHelp->AddEntry("Help On PostScript...", kHelpOnPS);
192  fMenuHelp->AddEntry("Help On Remote Session...", kHelpOnRemote);
193  fMenuFile->AddPopup("Browser Help...", fMenuHelp);
194 
196  fMenuFile->AddEntry("&Clone\tCtrl+N", kClone);
198  fMenuFile->AddEntry("New &Editor\tCtrl+E", kNewEditor);
199  fMenuFile->AddEntry("New &Canvas\tCtrl+C", kNewCanvas);
200  fMenuFile->AddEntry("New &HTML\tCtrl+H", kNewHtml);
204  fMenuExecPlugin->AddEntry("&Command...", kExecPluginCmd);
205  fMenuFile->AddPopup("Execute &Plugin...", fMenuExecPlugin);
207  fMenuFile->AddEntry("Close &Tab\tCtrl+T", kCloseTab);
208  fMenuFile->AddEntry("Close &Window\tCtrl+W", kCloseWindow);
210  fMenuFile->AddEntry("&Quit Root\tCtrl+Q", kQuitRoot);
211  fMenuBar->AddPopup("&Browser", fMenuFile, fLH1);
212  fMenuFile->Connect("Activated(Int_t)", "TRootBrowser", this,
213  "HandleMenu(Int_t)");
216 
217  if (!TClass::GetClass("TGHtmlBrowser"))
219 
222 
225 
226  // Toolbar Frame
228  kRaisedFrame);
230 
231  fHf = new TGHorizontalFrame(fVf, 100, 100);
232  // Tabs & co...
233 #if defined(R__HAS_COCOA)
234  fV1 = new TGVerticalFrame(fHf, 252, 100, kFixedWidth);
235 #else
236  fV1 = new TGVerticalFrame(fHf, 250, 100, kFixedWidth);
237 #endif
238  fV2 = new TGVerticalFrame(fHf, 600, 100);
239  fH1 = new TGHorizontalFrame(fV2, 100, 100);
240  fH2 = new TGHorizontalFrame(fV2, 100, 100, kFixedHeight);
241 
242  // Left tab
243  fTabLeft = new TGTab(fV1,100,100);
244  //fTabLeft->AddTab("Tab 1");
247 
248  // Vertical splitter
249  fVSplitter = new TGVSplitter(fHf, 4, 4);
251  fHf->AddFrame(fV1, fLH7);
253 
254  // Right tab
255  fTabRight = new TGTab(fH1, 500, 100);
256  //fTabRight->AddTab("Tab 1");
259  fTabRight->Connect("Selected(Int_t)", "TRootBrowser", this, "DoTab(Int_t)");
260  fTabRight->Connect("CloseTab(Int_t)", "TRootBrowser", this, "CloseTab(Int_t)");
261  fV2->AddFrame(fH1, fLH4);
262 
263  // Horizontal splitter
264  fHSplitter = new TGHSplitter(fV2, 4, 4);
266 
267  // Bottom tab
268  fTabBottom = new TGTab(fH2, 100, 100);
269  //fTabBottom->AddTab("Tab 1");
271  fV2->AddFrame(fH2, fLH3);
272 
274  fHf->AddFrame(fV2, fLH5);
275  fVf->AddFrame(fHf, fLH5);
276  AddFrame(fVf, fLH5);
277 
278  // status bar
279  fStatusBar = new TGStatusBar(this, 400, 20);
280  int parts[] = { 33, 10, 10, 47 };
281  fStatusBar->SetParts(parts, 4);
283 
284  fNbInitPlugins = 0;
285  fEditFrame = 0;
286  fEditTab = 0;
287  fEditPos = -1;
288  fEditSubPos= -1;
289  fNbTab[0] = fNbTab[1] = fNbTab[2] = 0;
290  fCrTab[0] = fCrTab[1] = fCrTab[2] = -1;
291 
292  // Set a name to the main frame
293  SetWindowName(name);
294  SetIconName(name);
295  fIconPic = SetIconPixmap("rootdb_s.xpm");
296  SetClassHints("ROOT", "Browser");
297 
298  if (!strcmp(gROOT->GetDefCanvasName(), "c1"))
299  gROOT->SetDefCanvasName("Canvas_1");
300 
301  SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
302  MapSubwindows();
305 
307 }
308 
309 ////////////////////////////////////////////////////////////////////////////////
310 /// Clean up all widgets, frames and layouthints that were used
311 
313 {
314  if (fIconPic) gClient->FreePicture(fIconPic);
315  delete fLH0;
316  delete fLH1;
317  delete fLH2;
318  delete fLH3;
319  delete fLH4;
320  delete fLH5;
321  delete fLH6;
322  delete fLH7;
323  delete fMenuHelp;
324  delete fMenuExecPlugin;
325  delete fMenuFile;
326  delete fMenuBar;
327  delete fMenuFrame;
328  delete fPreMenuFrame;
329  delete fTopMenuFrame;
330  delete fToolbarFrame;
331  delete fVSplitter;
332  delete fHSplitter;
333  delete fTabLeft;
334  delete fTabRight;
335  delete fTabBottom;
336  delete fH1;
337  delete fH2;
338  delete fV1;
339  delete fV2;
340  delete fHf;
341  delete fStatusBar;
342  delete fVf;
343 }
344 
345 ////////////////////////////////////////////////////////////////////////////////
346 /// Add items to the actual browser. This function has to be called
347 /// by the Browse() member function of objects when they are
348 /// called by a browser. If check < 0 (default) no check box is drawn,
349 /// if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
350 
351 void TRootBrowser::Add(TObject *obj, const char *name, Int_t check)
352 {
353  if (obj->InheritsFrom("TObjectSpy"))
354  return;
355  if (fActBrowser)
356  fActBrowser->Add(obj, name, check);
357 }
358 
359 ////////////////////////////////////////////////////////////////////////////////
360 /// Browse object. This, in turn, will trigger the calling of
361 /// TRootBrowser::Add() which will fill the IconBox and the tree.
362 /// Emits signal "BrowseObj(TObject*)".
363 
365 {
366  if (fActBrowser)
367  fActBrowser->BrowseObj(obj);
368  Emit("BrowseObj(TObject*)", (Long_t)obj);
369 }
370 
371 ////////////////////////////////////////////////////////////////////////////////
372 /// Clone the browser. A new Browser will be created, with the same
373 /// plugins executed in the current one.
374 
376 {
377  Int_t loop = 1;
378  TBrowserPlugin *plugin = 0;
379  TBrowser *b = new TBrowser();
380  TIter next(&fPlugins);
381  while ((plugin = (TBrowserPlugin *)next())) {
382  if (loop > fNbInitPlugins)
383  b->ExecPlugin(plugin->GetName(), "", plugin->fCommand.Data(), plugin->fTab,
384  plugin->fSubTab);
385  ++loop;
386  }
387 }
388 
389 ////////////////////////////////////////////////////////////////////////////////
390 /// Remove tab element id from right tab.
391 
393 {
394  RemoveTab(kRight, id);
395 }
396 
397 ////////////////////////////////////////////////////////////////////////////////
398 /// Properly close the mainframes embedded in the different tabs
399 
401 {
402  TGFrameElement *el;
403  TGCompositeFrame *container;
404  Int_t i;
405  TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
406  this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
407  Disconnect(fMenuFile, "Activated(Int_t)", this, "HandleMenu(Int_t)");
408  Disconnect(fTabRight, "Selected(Int_t)", this, "DoTab(Int_t)");
409  if (fPlugins.IsEmpty()) return;
410  fActBrowser = 0;
411  for (i=0;i<fTabLeft->GetNumberOfTabs();i++) {
412  container = fTabLeft->GetTabContainer(i);
413  if (!container) continue;
414  el = (TGFrameElement *)container->GetList()->First();
415  if (el && el->fFrame) {
416  el->fFrame->SetFrameElement(0);
417  if (el->fFrame->InheritsFrom("TVirtualPadEditor")) {
419  }
420  else if (el->fFrame->InheritsFrom("TGMainFrame")) {
421  el->fFrame->UnmapWindow();
422  ((TGMainFrame *)el->fFrame)->CloseWindow();
424  }
425  else
426  delete el->fFrame;
427  el->fFrame = 0;
428  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
429  (el->fLayout->References() > 0)) {
430  el->fLayout->RemoveReference();
431  if (!el->fLayout->References()) {
432  delete el->fLayout;
433  }
434  }
435  container->GetList()->Remove(el);
436  delete el;
437  }
438  }
439  for (i=0;i<fTabRight->GetNumberOfTabs();i++) {
440  container = fTabRight->GetTabContainer(i);
441  if (!container) continue;
442  el = (TGFrameElement *)container->GetList()->First();
443  if (el && el->fFrame) {
444  el->fFrame->SetFrameElement(0);
445  if (el->fFrame->InheritsFrom("TGMainFrame")) {
446  el->fFrame->UnmapWindow();
447  Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
448  if (sleep)
449  gSystem->Sleep(150);
450  ((TGMainFrame *)el->fFrame)->CloseWindow();
451  if (sleep)
452  gSystem->Sleep(150);
454  }
455  else
456  delete el->fFrame;
457  el->fFrame = 0;
458  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
459  (el->fLayout->References() > 0)) {
460  el->fLayout->RemoveReference();
461  if (!el->fLayout->References()) {
462  delete el->fLayout;
463  }
464  }
465  container->GetList()->Remove(el);
466  delete el;
467  }
468  }
469  for (i=0;i<fTabBottom->GetNumberOfTabs();i++) {
470  container = fTabBottom->GetTabContainer(i);
471  if (!container) continue;
472  el = (TGFrameElement *)container->GetList()->First();
473  if (el && el->fFrame) {
474  el->fFrame->SetFrameElement(0);
475  if (el->fFrame->InheritsFrom("TGMainFrame")) {
476  el->fFrame->UnmapWindow();
477  ((TGMainFrame *)el->fFrame)->CloseWindow();
478  gSystem->Sleep(150);
480  }
481  else
482  delete el->fFrame;
483  el->fFrame = 0;
484  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
485  (el->fLayout->References() > 0)) {
486  el->fLayout->RemoveReference();
487  if (!el->fLayout->References()) {
488  delete el->fLayout;
489  }
490  }
491  container->GetList()->Remove(el);
492  delete el;
493  }
494  }
495  fPlugins.Delete();
496  Emit("CloseWindow()");
497 }
498 
499 ////////////////////////////////////////////////////////////////////////////////
500 /// Called when window is closed via the window manager.
501 
503 {
504  TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
505  this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
506  CloseTabs();
507  DeleteWindow();
508 }
509 
510 ////////////////////////////////////////////////////////////////////////////////
511 /// Handle Tab navigation.
512 
514 {
515  TGTab *sender = (TGTab *)gTQSender;
516  if ((sender) && (sender == fTabRight)) {
517  SwitchMenus(sender->GetTabContainer(id));
518  }
519 }
520 
521 ////////////////////////////////////////////////////////////////////////////////
522 /// Display a tooltip with infos about the primitive below the cursor.
523 
524 void TRootBrowser::EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
525 {
526  const Int_t kTMAX=256;
527  static char atext[kTMAX];
528  if (selected == 0 || event == kMouseLeave) {
529  SetStatusText("", 0);
530  SetStatusText("", 1);
531  SetStatusText("", 2);
532  SetStatusText("", 3);
533  return;
534  }
535  SetStatusText(selected->GetTitle(), 0);
536  SetStatusText(selected->GetName(), 1);
537  if (event == kKeyPress)
538  snprintf(atext, kTMAX, "%c", (char) px);
539  else
540  snprintf(atext, kTMAX, "%d,%d", px, py);
541  SetStatusText(atext, 2);
542  SetStatusText(selected->GetObjectInfo(px,py), 3);
543 }
544 
545 ////////////////////////////////////////////////////////////////////////////////
546 /// Execute a macro and embed the created frame in the tab "pos"
547 /// and tab element "subpos".
548 
549 Long_t TRootBrowser::ExecPlugin(const char *name, const char *fname,
550  const char *cmd, Int_t pos, Int_t subpos)
551 {
552  Long_t retval = 0;
553  TBrowserPlugin *p;
554  TString command, pname;
555  StartEmbedding(pos, subpos);
556  if (cmd && strlen(cmd)) {
557  command = cmd;
558  if (name) pname = name;
559  else pname = TString::Format("Plugin %d", fPlugins.GetSize());
560  p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
561  }
562  else if (fname && strlen(fname)) {
563  pname = name ? name : gSystem->BaseName(fname);
564  Ssiz_t t = pname.Last('.');
565  if (t > 0) pname.Remove(t);
566  command.Form("gROOT->Macro(\"%s\");", gSystem->UnixPathName(fname));
567  p = new TBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
568  }
569  else return 0;
570  fPlugins.Add(p);
571  retval = gROOT->ProcessLine(command.Data());
572  if (command.Contains("new TCanvas")) {
573  pname = gPad->GetName();
574  p->SetName(pname.Data());
575  }
576  SetTabTitle(pname.Data(), pos, subpos);
577  StopEmbedding();
578  return retval;
579 }
580 
581 ////////////////////////////////////////////////////////////////////////////////
582 /// Returns drawing option.
583 
585 {
586  if (fActBrowser)
587  return fActBrowser->GetDrawOption();
588  return 0;
589 }
590 
591 ////////////////////////////////////////////////////////////////////////////////
592 /// Returns the TGTab at position pos.
593 
595 {
596  switch (pos) {
597  case kLeft: return fTabLeft;
598  case kRight: return fTabRight;
599  case kBottom: return fTabBottom;
600  default: return 0;
601  }
602 }
603 
604 ////////////////////////////////////////////////////////////////////////////////
605 /// Handle keyboard events.
606 
608 {
609  char input[10];
610  UInt_t keysym;
611 
612  if (event->fType == kGKeyPress) {
613  gVirtualX->LookupString(event, input, sizeof(input), keysym);
614 
615  if (!event->fState && (EKeySym)keysym == kKey_F5) {
616  Refresh(kTRUE);
617  return kTRUE;
618  }
619  switch ((EKeySym)keysym) { // ignore these keys
620  case kKey_Shift:
621  case kKey_Control:
622  case kKey_Meta:
623  case kKey_Alt:
624  case kKey_CapsLock:
625  case kKey_NumLock:
626  case kKey_ScrollLock:
627  return kTRUE;
628  default:
629  break;
630  }
631  if (event->fState & kKeyControlMask) { // Cntrl key modifier pressed
632  switch ((EKeySym)keysym & ~0x20) { // treat upper and lower the same
633  case kKey_B:
635  return kTRUE;
636  case kKey_O:
638  return kTRUE;
639  case kKey_E:
641  return kTRUE;
642  case kKey_C:
644  return kTRUE;
645  case kKey_H:
647  return kTRUE;
648  case kKey_N:
650  return kTRUE;
651  case kKey_T:
653  return kTRUE;
654  case kKey_W:
656  return kTRUE;
657  case kKey_Q:
659  return kTRUE;
660  default:
661  break;
662  }
663  }
664  }
665  return TGMainFrame::HandleKey(event);
666 }
667 
668 ////////////////////////////////////////////////////////////////////////////////
669 /// Handle menu entries events.
670 
672 {
673  TRootHelpDialog *hd;
674  TString cmd;
675  static Int_t eNr = 1;
676  TGPopupMenu *sender = (TGPopupMenu *)gTQSender;
677  if (sender != fMenuFile)
678  return;
679  switch (id) {
680  case kBrowse:
681  new TBrowser();
682  break;
683  case kOpenFile:
684  {
685  Bool_t newfile = kFALSE;
686  static TString dir(".");
687  TGFileInfo fi;
689  fi.fIniDir = StrDup(dir);
690  new TGFileDialog(gClient->GetDefaultRoot(), this,
691  kFDOpen,&fi);
692  dir = fi.fIniDir;
693  if (fi.fMultipleSelection && fi.fFileNamesList) {
694  TObjString *el;
695  TIter next(fi.fFileNamesList);
696  while ((el = (TObjString *) next())) {
697  gROOT->ProcessLine(Form("new TFile(\"%s\");",
698  gSystem->UnixPathName(el->GetString())));
699  }
700  newfile = kTRUE;
701  }
702  else if (fi.fFilename) {
703  gROOT->ProcessLine(Form("new TFile(\"%s\");",
705  newfile = kTRUE;
706  }
707  if (fActBrowser && newfile) {
708  TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(fActBrowser);
709  if (fb) fb->Selected(0);
710  }
711  }
712  break;
713  // Handle Help menu items...
714  case kHelpAbout:
715  {
716 #ifdef R__UNIX
717  TString rootx = TROOT::GetBinDir() + "/root -a &";
718  gSystem->Exec(rootx);
719 #else
720 #ifdef WIN32
722 #else
723  char str[32];
724  sprintf(str, "About ROOT %s...", gROOT->GetVersion());
725  hd = new TRootHelpDialog(this, str, 600, 400);
726  hd->SetText(gHelpAbout);
727  hd->Popup();
728 #endif
729 #endif
730  }
731  break;
732  case kHelpOnCanvas:
733  hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
734  hd->SetText(gHelpCanvas);
735  hd->Popup();
736  break;
737  case kHelpOnMenus:
738  hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
740  hd->Popup();
741  break;
742  case kHelpOnGraphicsEd:
743  hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
745  hd->Popup();
746  break;
747  case kHelpOnBrowser:
748  hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
749  hd->SetText(gHelpBrowser);
750  hd->Popup();
751  break;
752  case kHelpOnObjects:
753  hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
754  hd->SetText(gHelpObjects);
755  hd->Popup();
756  break;
757  case kHelpOnPS:
758  hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
760  hd->Popup();
761  break;
762  case kHelpOnRemote:
763  hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
764  hd->SetText(gHelpRemote);
765  hd->Popup();
766  break;
767  case kClone:
768  CloneBrowser();
769  break;
770  case kNewEditor:
771  cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot())");
772  ++eNr;
773  ExecPlugin(Form("Editor %d", eNr), "", cmd.Data(), 1);
774  break;
775  case kNewCanvas:
776  ExecPlugin("", "", "new TCanvas()", 1);
777  break;
778  case kNewHtml:
779  cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot())",
780  gEnv->GetValue("Browser.StartUrl", "http://root.cern.ch"));
781  ExecPlugin("HTML", "", cmd.Data(), 1);
782  break;
783  case kExecPluginMacro:
784  {
785  static TString dir(".");
786  TGFileInfo fi;
788  fi.fIniDir = StrDup(dir);
789  new TGFileDialog(gClient->GetDefaultRoot(), this,
790  kFDOpen,&fi);
791  dir = fi.fIniDir;
792  if (fi.fFilename) {
793  ExecPlugin(0, fi.fFilename, 0, kRight);
794  }
795  }
796  break;
797  case kExecPluginCmd:
798  {
799  char command[1024];
800  strlcpy(command, "new TGLSAViewer(gClient->GetRoot(), 0);",
801  sizeof(command));
802  new TGInputDialog(gClient->GetRoot(), this,
803  "Enter plugin command line:",
804  command, command);
805  if (strcmp(command, "")) {
806  ExecPlugin("User", 0, command, kRight);
807  }
808  }
809  break;
810  case kCloseTab:
812  break;
813  case kCloseWindow:
814  CloseWindow();
815  break;
816  case kQuitRoot:
817  CloseWindow();
819  break;
820  default:
821  break;
822  }
823 }
824 
825 ////////////////////////////////////////////////////////////////////////////////
826 /// Initialize default plugins. Could be also of the form:
827 /// StartEmbedding(0);
828 /// TPluginHandler *ph;
829 /// ph = gROOT->GetPluginManager()->FindHandler("TGClassBrowser");
830 /// if (ph && ph->LoadPlugin() != -1) {
831 /// ph->ExecPlugin(3, gClient->GetRoot(), 200, 500);
832 /// }
833 /// StopEmbedding();
834 
836 {
837  TString cmd;
838 
839  if ((opt == 0) || (!opt[0]))
840  return;
841  // --- Left vertical area
842 
843  // File Browser plugin
844  if (strchr(opt, 'F')) {
845  cmd.Form("new TGFileBrowser(gClient->GetRoot(), (TBrowser *)0x%lx, 200, 500);", (ULong_t)fBrowser);
846  ExecPlugin("Files", 0, cmd.Data(), 0);
847  ++fNbInitPlugins;
848  }
849 
850  // --- Right main area
851 
852  Int_t i, len = strlen(opt);
853  for (i=0; i<len; ++i) {
854  // Editor plugin...
855  if (opt[i] == 'E') {
856  cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot());");
857  ExecPlugin("Editor 1", 0, cmd.Data(), 1);
858  ++fNbInitPlugins;
859  }
860 
861  // HTML plugin...
862  if (opt[i] == 'H') {
863  if (gSystem->Load("libGuiHtml") >= 0) {
864  cmd.Form("new TGHtmlBrowser(\"%s\", gClient->GetRoot());",
865  gEnv->GetValue("Browser.StartUrl",
866  "http://root.cern.ch/root/html/ClassIndex.html"));
867  ExecPlugin("HTML", 0, cmd.Data(), 1);
868  ++fNbInitPlugins;
869  }
870  }
871 
872  // Canvas plugin...
873  if (opt[i] == 'C') {
874  cmd.Form("new TCanvas();");
875  ExecPlugin("c1", 0, cmd.Data(), 1);
876  ++fNbInitPlugins;
877  }
878 
879  // GLViewer plugin...
880  if (opt[i] == 'G') {
881  cmd.Form("new TGLSAViewer(gClient->GetRoot(), 0);");
882  ExecPlugin("OpenGL", 0, cmd.Data(), 1);
883  ++fNbInitPlugins;
884  }
885 
886  // PROOF plugin...
887  if (opt[i] == 'P') {
888  cmd.Form("new TSessionViewer();");
889  ExecPlugin("PROOF", 0, cmd.Data(), 1);
890  ++fNbInitPlugins;
891  }
892  }
893  // --- Right bottom area
894 
895  // Command plugin...
896  if (strchr(opt, 'I')) {
897  cmd.Form("new TGCommandPlugin(gClient->GetRoot(), 700, 300);");
898  ExecPlugin("Command", 0, cmd.Data(), 2);
899  ++fNbInitPlugins;
900  }
901 
902  // --- Select first tab everywhere
903  SetTab(0, 0);
904  SetTab(1, 0);
905  SetTab(2, 0);
906 }
907 
908 ////////////////////////////////////////////////////////////////////////////////
909 /// Really delete the browser and the this GUI.
910 
912 {
914  delete this;
915 }
916 
917 ////////////////////////////////////////////////////////////////////////////////
918 /// Recursively remove object from browser.
919 
921 {
922  if (fActBrowser)
924 }
925 
926 ////////////////////////////////////////////////////////////////////////////////
927 /// Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
928 
930 {
931  TGMenuEntry *entry = 0;
932  TIter next(popup->GetListOfEntries());
933  while ((entry = (TGMenuEntry *)next())) {
934  if (entry->GetPopup()) {
935  RecursiveReparent(entry->GetPopup());
936  }
937  }
938  popup->ReparentWindow(gClient->GetDefaultRoot());
939 }
940 
941 ////////////////////////////////////////////////////////////////////////////////
942 /// Refresh the actual browser contents.
943 
945 {
946  if (fActBrowser)
947  fActBrowser->Refresh(force);
948 }
949 
950 ////////////////////////////////////////////////////////////////////////////////
951 /// Remove tab element "subpos" from tab "pos".
952 
954 {
955  TGTab *edit = 0;
956  switch (pos) {
957  case kLeft: // left
958  edit = fTabLeft;
959  break;
960  case kRight: // right
961  edit = fTabRight;
964  fActMenuBar = 0;
965  break;
966  case kBottom: // bottom
967  edit = fTabBottom;
968  break;
969  }
970  if (!edit || !edit->GetTabTab(subpos))
971  return;
972  const char *tabName = edit->GetTabTab(subpos)->GetString();
973  TObject *obj = 0;
974  if ((obj = fPlugins.FindObject(tabName))) {
975  fPlugins.Remove(obj);
976  }
977  TGFrameElement *el = 0;
978  if (edit->GetTabContainer(subpos))
979  el = (TGFrameElement *)edit->GetTabContainer(subpos)->GetList()->First();
980  if (el && el->fFrame) {
981  el->fFrame->Disconnect("ProcessedConfigure(Event_t*)");
982  el->fFrame->SetFrameElement(0);
983  if (el->fFrame->InheritsFrom("TGMainFrame")) {
984  Bool_t sleep = (el->fFrame->InheritsFrom("TRootCanvas")) ? kTRUE : kFALSE;
985  ((TGMainFrame *)el->fFrame)->CloseWindow();
986  if (sleep)
987  gSystem->Sleep(150);
989  }
990  else
991  delete el->fFrame;
992  el->fFrame = 0;
993  if (el->fLayout && (el->fLayout != fgDefaultHints) &&
994  (el->fLayout->References() > 0)) {
995  el->fLayout->RemoveReference();
996  if (!el->fLayout->References()) {
997  delete el->fLayout;
998  }
999  }
1000  edit->GetTabContainer(subpos)->GetList()->Remove(el);
1001  delete el;
1002  }
1003  fNbTab[pos]--;
1004  edit->RemoveTab(subpos);
1005  SwitchMenus(edit->GetTabContainer(edit->GetCurrent()));
1006 }
1007 
1008 ////////////////////////////////////////////////////////////////////////////////
1009 /// Switch to Tab "subpos" in TGTab "pos".
1010 
1012 {
1013  TGTab *tab = GetTab(pos);
1014  if (subpos == -1)
1015  subpos = fCrTab[pos];
1016 
1017  if (tab && tab->SetTab(subpos, kFALSE)) { // Block signal emit
1018  if (pos == kRight)
1019  SwitchMenus(tab->GetTabContainer(subpos));
1020  tab->Layout();
1021  }
1022 }
1023 
1024 ////////////////////////////////////////////////////////////////////////////////
1025 /// Set text "title" of Tab "subpos" in TGTab "pos".
1026 
1027 void TRootBrowser::SetTabTitle(const char *title, Int_t pos, Int_t subpos)
1028 {
1029  TBrowserPlugin *p = 0;
1030  TGTab *edit = GetTab(pos);
1031  if (!edit) return;
1032  if (subpos == -1)
1033  subpos = fCrTab[pos];
1034 
1035  TGTabElement *el = edit->GetTabTab(subpos);
1036  if (el) {
1037  el->SetText(new TGString(title));
1038  edit->Layout();
1039  if ((p = (TBrowserPlugin *)fPlugins.FindObject(title)))
1040  p->SetName(title);
1041  }
1042 }
1043 
1044 ////////////////////////////////////////////////////////////////////////////////
1045 /// Set text in culumn col in status bar.
1046 
1047 void TRootBrowser::SetStatusText(const char* txt, Int_t col)
1048 {
1049  fStatusBar->SetText(txt, col);
1050 }
1051 
1052 ////////////////////////////////////////////////////////////////////////////////
1053 /// Show the selected frame's menu and hide previous one.
1054 
1056 {
1057  TGFrameElement *el = 0;
1058  // temporary solution until I find a proper way to handle
1059  // these bloody menus...
1060  fBindList->Delete();
1061  TIter nextm(fMenuBar->GetList());
1062  while ((el = (TGFrameElement *) nextm())) {
1063  TGMenuTitle *t = (TGMenuTitle *) el->fFrame;
1064  Int_t code = t->GetHotKeyCode();
1065  BindKey(fMenuBar, code, kKeyMod1Mask);
1073  }
1075  fMenuFrame->ShowFrame(menu);
1076  menu->Layout();
1077  fMenuFrame->Layout();
1078  fActMenuBar = menu;
1079 }
1080 
1081 ////////////////////////////////////////////////////////////////////////////////
1082 /// Start embedding external frame in the tab "pos" and tab element "subpos".
1083 
1085 {
1086  fEditTab = GetTab(pos);
1087  if (!fEditTab) return;
1088  fEditPos = pos;
1089  fEditSubPos = subpos;
1090 
1091  if (fEditFrame == 0) {
1092  if (subpos == -1) {
1093  fCrTab[pos] = fNbTab[pos]++;
1094  fEditFrame = fEditTab->AddTab(Form("Tab %d",fNbTab[pos]));
1096  fEditFrame->MapWindow();
1098  if(tabel) {
1099  tabel->MapWindow();
1100  if (fShowCloseTab && (pos == 1))
1101  tabel->ShowClose();
1102  }
1104  fEditTab->Layout();
1105  }
1106  else {
1107  fCrTab[pos] = subpos;
1108  fEditFrame = fEditTab->GetTabContainer(subpos);
1109  fEditTab->SetTab(subpos);
1110  }
1112  }
1113 }
1114 
1115 ////////////////////////////////////////////////////////////////////////////////
1116 /// Stop embedding external frame in the current editable frame.
1117 
1119 {
1120  if (fEditFrame != 0) {
1123  if (el && el->fFrame) {
1124  // let be notified when the inside frame gets resized, and tell its
1125  // container to recompute its layout
1126  el->fFrame->Connect("ProcessedConfigure(Event_t*)", "TGCompositeFrame",
1127  fEditFrame, "Layout()");
1128  }
1129  if (layout) {
1130  el = (TGFrameElement*) fEditFrame->GetList()->Last();
1131  // !!!! MT what to do with the old layout? Leak it for now ...
1132  if (el) el->fLayout = layout;
1133  }
1134  fEditFrame->Layout();
1135  if (fEditTab == fTabRight)
1137  }
1138  if (name && strlen(name)) {
1140  }
1142  fEditFrame = fEditTab = 0;
1143  fEditPos = fEditSubPos = -1;
1144 }
1145 
1146 ////////////////////////////////////////////////////////////////////////////////
1147 /// Move the menu from original frame to our TGMenuFrame, or display the
1148 /// menu associated to the current tab.
1149 
1151 {
1152  if (from == 0)
1153  return;
1154  TGFrameElement *fe = (TGFrameElement *)from->GetList()->First();
1155  if (!fe) {
1156  if (fActMenuBar != fMenuBar)
1157  ShowMenu(fMenuBar);
1158  return;
1159  }
1160  TGCompositeFrame *embed = (TGCompositeFrame *)fe->fFrame;
1161  TGFrameElement *el = 0;
1162  if (embed && embed->GetList()) {
1163  TIter next(embed->GetList());
1164  while ((el = (TGFrameElement *)next())) {
1165  if (el->fFrame->InheritsFrom("TGMenuBar")) {
1166  TGMenuBar *menu = (TGMenuBar *)el->fFrame;
1167  if (fActMenuBar == menu)
1168  return;
1169  TGFrameElement *nw;
1170  TIter nel(fMenuFrame->GetList());
1171  while ((nw = (TGFrameElement *) nel())) {
1172  if (nw->fFrame == menu) {
1173  ShowMenu(menu);
1174  return;
1175  }
1176  }
1177  ((TGCompositeFrame *)menu->GetParent())->HideFrame(menu);
1179  menu->ReparentWindow(fMenuFrame);
1180  fMenuFrame->AddFrame(menu, fLH2);
1181  TGFrameElement *mel;
1182  TIter mnext(menu->GetList());
1183  while ((mel = (TGFrameElement *) mnext())) {
1184  TGMenuTitle *t = (TGMenuTitle *) mel->fFrame;
1185  TGPopupMenu *popup = menu->GetPopup(t->GetName());
1186  if (popup) {
1187  RecursiveReparent(popup);
1188  if (popup->GetEntry("Close Canvas")) {
1189  TGMenuEntry *exit = popup->GetEntry("Close Canvas");
1190  popup->HideEntry(exit->GetEntryId());
1191  }
1192  if (popup->GetEntry("Close Viewer")) {
1193  TGMenuEntry *exit = popup->GetEntry("Close Viewer");
1194  popup->HideEntry(exit->GetEntryId());
1195  }
1196  if (popup->GetEntry("Quit ROOT")) {
1197  TGMenuEntry *exit = popup->GetEntry("Quit ROOT");
1198  popup->HideEntry(exit->GetEntryId());
1199  }
1200  if (popup->GetEntry("Exit")) {
1201  TGMenuEntry *exit = popup->GetEntry("Exit");
1202  popup->HideEntry(exit->GetEntryId());
1203  }
1204  }
1205  }
1206  ShowMenu(menu);
1207  return;
1208  }
1209  }
1210  }
1211  if (fActMenuBar != fMenuBar)
1212  ShowMenu(fMenuBar);
1213 }
1214 
1215 ////////////////////////////////////////////////////////////////////////////////
1216 /// Emits signal when double clicking on icon.
1217 
1219 {
1220  Emit("DoubleClicked(TObject*)", (Long_t)obj);
1221 }
1222 
1223 ////////////////////////////////////////////////////////////////////////////////
1224 /// Emits signal when double clicking on icon.
1225 
1227 {
1228  Long_t args[2];
1229 
1230  args[0] = (Long_t)obj;
1231  args[1] = checked;
1232 
1233  Emit("Checked(TObject*,Bool_t)", args);
1234 }
1235 
1236 ////////////////////////////////////////////////////////////////////////////////
1237 /// Emits signal "ExecuteDefaultAction(TObject*)".
1238 
1240 {
1241  Emit("ExecuteDefaultAction(TObject*)", (Long_t)obj);
1242 }
1243 
1244 
1245 ////////////////////////////////////////////////////////////////////////////////
1246 /// static contructor returning TBrowserImp,
1247 /// as needed by the plugin mechanism.
1248 
1250  UInt_t width, UInt_t height,
1251  Option_t *opt)
1252 {
1253  TRootBrowser *browser = new TRootBrowser(b, title, width, height, opt);
1254  return (TBrowserImp *)browser;
1255 }
1256 
1257 ////////////////////////////////////////////////////////////////////////////////
1258 /// static contructor returning TBrowserImp,
1259 /// as needed by the plugin mechanism.
1260 
1262  Int_t y, UInt_t width, UInt_t height,
1263  Option_t *opt)
1264 {
1265  TRootBrowser *browser = new TRootBrowser(b, title, x, y, width, height, opt);
1266  return (TBrowserImp *)browser;
1267 }
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
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
Definition: TGaxis.cxx:2551
TGVerticalFrame * fVf
Definition: TRootBrowser.h:68
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition: TGMenu.cxx:1714
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:410
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:131
#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:2286
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:2264
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:2465
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:668
long Long_t
Definition: RtypesCore.h:50
int Ssiz_t
Definition: RtypesCore.h:63
virtual Bool_t IsEmpty() const
Definition: TCollection.h:186
#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:876
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:619
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
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2887
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:1351
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:2928
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
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
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:364