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