GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
GRootBrowser.cxx
Go to the documentation of this file.
1#include "TROOT.h"
2#include "TSystem.h"
3#include "TApplication.h"
4#include "TBrowser.h"
5#include "TGClient.h"
6#include "TGFrame.h"
7#include "TGTab.h"
8#include "TGMenu.h"
9#include "TGLayout.h"
10#include "TGSplitter.h"
11#include "TGStatusBar.h"
12#include "Varargs.h"
13#include "TInterpreter.h"
14#include "TGFileDialog.h"
15#include "TObjString.h"
16#include "TVirtualPad.h"
17#include "TVirtualX.h"
18#include "TEnv.h"
19#include <KeySymbols.h>
20
21#include "RConfigure.h"
22
23#include "GRootBrowser.h"
24#include "TGFileBrowser.h"
25#include "TGInputDialog.h"
26#include "TRootHelpDialog.h"
27#include "TVirtualPadEditor.h"
28#include "HelpText.h"
29#include "Getline.h"
30
31#include "TChannel.h"
32#include "TKey.h"
33
34#ifdef WIN32
35#include <TWin32SplashThread.h>
36#endif
37
38static std::array<const char*, 6> gOpenFileTypes = {"ROOT files", "*.root", "All files", "*", nullptr, nullptr};
39
40static std::array<const char*, 6> gPluginFileTypes = {"ROOT files", "*.C", "All files", "*", nullptr, nullptr};
41
42//______________________________________________________________________________
43GRootBrowser::GRootBrowser(TBrowser* b, const char* name, UInt_t width, UInt_t height, Option_t* opt, Bool_t initshow)
44 : TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
45{
46 /// Create browser with a specified width and height.
47
48 CreateBrowser(name);
49 Resize(width, height);
50 if(initshow) {
51 InitPlugins(opt);
52 MapWindow();
53 }
54 TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)", "GRootBrowser", this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
55 gVirtualX->SetInputFocus(GetId());
56}
57
58//______________________________________________________________________________
59GRootBrowser::GRootBrowser(TBrowser* b, const char* name, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t* opt, Bool_t initshow)
60 : TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
61{
62 /// Create browser with a specified width and height and at position x, y.
63
64 CreateBrowser(name);
65 MoveResize(x, y, width, height);
66 SetWMPosition(x, y);
67 if(initshow) {
68 InitPlugins(opt);
69 MapWindow();
70 }
71 TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)", "GRootBrowser", this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
72 gVirtualX->SetInputFocus(GetId());
73}
74
75//______________________________________________________________________________
76void GRootBrowser::CreateBrowser(const char* name)
77{
78
79 /// Create the actual interface.
80
81 fVf = new TGVerticalFrame(this, 100, 100);
82
83 fLH0 = new TGLayoutHints(kLHintsNormal);
84 fLH1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
85 fLH2 = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 1);
86 fLH3 = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX);
87 fLH4 = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2);
88 fLH5 = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX | kLHintsExpandY);
89 fLH6 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX);
90 fLH7 = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandY);
91
92 // Menubar Frame
93 fTopMenuFrame = new TGHorizontalFrame(fVf, 100, 20);
94
95 fPreMenuFrame = new TGHorizontalFrame(fTopMenuFrame, 0, 20, kRaisedFrame);
96 fMenuBar = new TGMenuBar(fPreMenuFrame, 10, 10, kHorizontalFrame);
97 fMenuFile = new TGPopupMenu(gClient->GetDefaultRoot());
98 fMenuFile->AddEntry("&Browse...\tCtrl+B", static_cast<int>(ENewBrowserMessages::kBrowse));
99 fMenuFile->AddEntry("&Open...\tCtrl+O", static_cast<int>(ENewBrowserMessages::kOpenFile));
100 fMenuFile->AddSeparator();
101
102 fMenuHelp = new TGPopupMenu(fClient->GetRoot());
103 fMenuHelp->AddEntry("&About ROOT...", static_cast<int>(ENewBrowserMessages::kHelpAbout));
104 fMenuHelp->AddSeparator();
105 fMenuHelp->AddEntry("Help On Browser...", static_cast<int>(ENewBrowserMessages::kHelpOnBrowser));
106 fMenuHelp->AddEntry("Help On Canvas...", static_cast<int>(ENewBrowserMessages::kHelpOnCanvas));
107 fMenuHelp->AddEntry("Help On Menus...", static_cast<int>(ENewBrowserMessages::kHelpOnMenus));
108 fMenuHelp->AddEntry("Help On Graphics Editor...", static_cast<int>(ENewBrowserMessages::kHelpOnGraphicsEd));
109 fMenuHelp->AddEntry("Help On Objects...", static_cast<int>(ENewBrowserMessages::kHelpOnObjects));
110 fMenuHelp->AddEntry("Help On PostScript...", static_cast<int>(ENewBrowserMessages::kHelpOnPS));
111 fMenuHelp->AddEntry("Help On Remote Session...", static_cast<int>(ENewBrowserMessages::kHelpOnRemote));
112 fMenuFile->AddPopup("Browser Help...", fMenuHelp);
113
114 fMenuFile->AddSeparator();
115 fMenuFile->AddEntry("&Clone\tCtrl+N", static_cast<int>(ENewBrowserMessages::kClone));
116 fMenuFile->AddSeparator();
117 fMenuFile->AddEntry("New &Editor\tCtrl+E", static_cast<int>(ENewBrowserMessages::kNewEditor));
118 fMenuFile->AddEntry("New &Canvas\tCtrl+C", static_cast<int>(ENewBrowserMessages::kNewCanvas));
119 fMenuFile->AddEntry("New &HTML\tCtrl+H", static_cast<int>(ENewBrowserMessages::kNewHtml));
120 fMenuFile->AddSeparator();
121 fMenuExecPlugin = new TGPopupMenu(fClient->GetRoot());
122 fMenuExecPlugin->AddEntry("&Macro...", static_cast<int>(ENewBrowserMessages::kExecPluginMacro));
123 fMenuExecPlugin->AddEntry("&Command...", static_cast<int>(ENewBrowserMessages::kExecPluginCmd));
124 fMenuFile->AddPopup("Execute &Plugin...", fMenuExecPlugin);
125 fMenuFile->AddSeparator();
126 fMenuFile->AddEntry("Close &Tab\tCtrl+T", static_cast<int>(ENewBrowserMessages::kCloseTab));
127 fMenuFile->AddEntry("Close &Window\tCtrl+W", static_cast<int>(ENewBrowserMessages::kCloseWindow));
128 fMenuFile->AddSeparator();
129 fMenuFile->AddEntry("&Quit Root\tCtrl+Q", static_cast<int>(ENewBrowserMessages::kQuitRoot));
130 fMenuBar->AddPopup("&Browser", fMenuFile, fLH1);
131 fMenuFile->Connect("Activated(Int_t)", "GRootBrowser", this, "HandleMenu(Int_t)");
132 fPreMenuFrame->AddFrame(fMenuBar, fLH2);
133 fTopMenuFrame->AddFrame(fPreMenuFrame, fLH0);
134
135 fMenuFrame = new TGHorizontalFrame(fTopMenuFrame, 100, 20, kRaisedFrame);
136 fTopMenuFrame->AddFrame(fMenuFrame, fLH5);
137
138 fVf->AddFrame(fTopMenuFrame, fLH3);
140
141 // Toolbar Frame
142 fToolbarFrame = new TGHorizontalFrame(fVf, 100, 20, kHorizontalFrame | kRaisedFrame);
143 fVf->AddFrame(fToolbarFrame, fLH3);
144
145 fHf = new TGHorizontalFrame(fVf, 100, 100);
146// Tabs & co...
147#if defined(R__HAS_COCOA)
148 fV1 = new TGVerticalFrame(fHf, 252, 100, kFixedWidth);
149#else
150 fV1 = new TGVerticalFrame(fHf, 250, 100, kFixedWidth);
151#endif
152 fV2 = new TGVerticalFrame(fHf, 600, 100);
153 fH1 = new TGHorizontalFrame(fV2, 100, 100);
154 fH2 = new TGHorizontalFrame(fV2, 100, 100, kFixedHeight);
155
156 // Left tab
157 fTabLeft = new TGTab(fV1, 100, 100);
158 // fTabLeft->AddTab("Tab 1");
159 fTabLeft->Resize(fTabLeft->GetDefaultSize());
160 fV1->AddFrame(fTabLeft, fLH4);
161
162 // Vertical splitter
163 fVSplitter = new TGVSplitter(fHf, 4, 4);
164 fVSplitter->SetFrame(fV1, kTRUE);
165 fHf->AddFrame(fV1, fLH7);
166 fHf->AddFrame(fVSplitter, fLH7);
167
168 // Right tab
169 fTabRight = new TGTab(fH1, 500, 100);
170 // fTabRight->AddTab("Tab 1");
171 fTabRight->Resize(fTabRight->GetDefaultSize());
172 fH1->AddFrame(fTabRight, fLH5);
173 fTabRight->Connect("Selected(Int_t)", "GRootBrowser", this, "DoTab(Int_t)");
174 fTabRight->Connect("CloseTab(Int_t)", "GRootBrowser", this, "CloseTab(Int_t)");
175 fV2->AddFrame(fH1, fLH4);
176
177 // Horizontal splitter
178 fHSplitter = new TGHSplitter(fV2, 4, 4);
179 fV2->AddFrame(fHSplitter, fLH3);
180
181 // Bottom tab
182 fTabBottom = new TGTab(fH2, 100, 100);
183 // fTabBottom->AddTab("Tab 1");
184 fH2->AddFrame(fTabBottom, fLH4);
185 fV2->AddFrame(fH2, fLH3);
186
187 fHSplitter->SetFrame(fH2, kFALSE);
188 fHf->AddFrame(fV2, fLH5);
189 fVf->AddFrame(fHf, fLH5);
190 AddFrame(fVf, fLH5);
191
192 // status bar
193 fStatusBar = new TGStatusBar(this, 400, 20);
194 std::array<int, 4> parts = {33, 10, 10, 47};
195 fStatusBar->SetParts(parts.data(), 4);
196 AddFrame(fStatusBar, fLH6);
197
198 fNbInitPlugins = 0;
199 fEditFrame = nullptr;
200 fEditTab = nullptr;
201 fEditPos = -1;
202 fEditSubPos = -1;
203 fNbTab[0] = fNbTab[1] = fNbTab[2] = 0;
204 fCrTab[0] = fCrTab[1] = fCrTab[2] = -1;
205
206 // Set a name to the main frame
207 SetWindowName(name);
208 SetIconName(name);
209 fIconPic = SetIconPixmap("rootdb_s.xpm");
210 SetClassHints("ROOT", "Browser");
211
212 if(strcmp(gROOT->GetDefCanvasName(), "c1") == 0) {
213 gROOT->SetDefCanvasName("Canvas_1");
214 }
215
216 SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
217 MapSubwindows();
218 Resize(GetDefaultSize());
219 AddInput(kKeyPressMask | kKeyReleaseMask);
220
221 fVf->HideFrame(fToolbarFrame);
222}
223
224//______________________________________________________________________________
226{
227 /// Clean up all widgets, frames and layouthints that were used
228 std::cout << __PRETTY_FUNCTION__ << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay)
229 fflush(stdout);
230
231 if(fIconPic != nullptr) {
232 gClient->FreePicture(fIconPic);
233 }
234 delete fLH0;
235 delete fLH1;
236 delete fLH2;
237 delete fLH3;
238 delete fLH4;
239 delete fLH5;
240 delete fLH6;
241 delete fLH7;
242 delete fMenuHelp;
243 delete fMenuExecPlugin;
244 delete fMenuFile;
245 delete fMenuBar;
246 delete fMenuFrame;
247 delete fPreMenuFrame;
248 delete fTopMenuFrame;
249 delete fToolbarFrame;
250 delete fVSplitter;
251 delete fHSplitter;
252 delete fTabLeft;
253 delete fTabRight;
254 delete fTabBottom;
255 delete fH1;
256 delete fH2;
257 delete fV1;
258 delete fV2;
259 delete fHf;
260 delete fStatusBar;
261 delete fVf;
262}
263
264//______________________________________________________________________________
265void GRootBrowser::Add(TObject* obj, const char* name, Int_t check)
266{
267 /// Add items to the actual browser. This function has to be called
268 /// by the Browse() member function of objects when they are
269 /// called by a browser. If check < 0 (default) no check box is drawn,
270 /// if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
271
272 if(obj->InheritsFrom("TObjectSpy")) {
273 return;
274 }
275 if(obj->InheritsFrom("TKey")) {
276 if(strcmp((static_cast<TKey*>(obj))->GetClassName(), "TChannel") == 0) {
277 (static_cast<TKey*>(obj))->ReadObj();
278 }
279 }
280 if(fActBrowser != nullptr) {
281 fActBrowser->Add(obj, name, check);
282 }
283}
284
285//______________________________________________________________________________
286void GRootBrowser::BrowseObj(TObject* obj)
287{
288 /// Browse object. This, in turn, will trigger the calling of
289 /// GRootBrowser::Add() which will fill the IconBox and the tree.
290 /// Emits signal "BrowseObj(TObject*)".
291
292 if(fActBrowser != nullptr) {
293 fActBrowser->BrowseObj(obj);
294 }
295 Emit("BrowseObj(TObject*)", reinterpret_cast<Long_t>(obj));
296}
297
298//______________________________________________________________________________
300{
301 /// Clone the browser. A new Browser will be created, with the same
302 /// plugins executed in the current one.
303
304 Int_t loop = 1;
305 GBrowserPlugin* plugin = nullptr;
306 auto* browser = new TBrowser();
307 TIter next(&fPlugins);
308 while((plugin = static_cast<GBrowserPlugin*>(next())) != nullptr) {
309 if(loop > fNbInitPlugins) {
310 browser->ExecPlugin(plugin->GetName(), "", plugin->fCommand.Data(), plugin->fTab, plugin->fSubTab);
311 }
312 ++loop;
313 }
314}
315
316//______________________________________________________________________________
318{
319 /// Remove tab element id from right tab.
320
321 RemoveTab(static_cast<Int_t>(EInsertPosition::kRight), id);
322}
323
324//______________________________________________________________________________
326{
327 /// Properly close the mainframes embedded in the different tabs
328
329 Disconnect(fMenuFile, "Activated(Int_t)", this, "HandleMenu(Int_t)");
330 Disconnect(fTabRight, "Selected(Int_t)", this, "DoTab(Int_t)");
331 if(fPlugins.IsEmpty()) {
332 return;
333 }
334 fActBrowser = nullptr;
335 for(Int_t i = 0; i < fTabLeft->GetNumberOfTabs(); i++) {
336 TGCompositeFrame* container = fTabLeft->GetTabContainer(i);
337 if(container == nullptr) {
338 continue;
339 }
340 auto* element = static_cast<TGFrameElement*>(container->GetList()->First());
341 if((element != nullptr) && (element->fFrame != nullptr)) {
342 element->fFrame->SetFrameElement(nullptr);
343 if(element->fFrame->InheritsFrom("TVirtualPadEditor")) {
344 TVirtualPadEditor::Terminate();
345 } else if(element->fFrame->InheritsFrom("TGMainFrame")) {
346 (static_cast<TGMainFrame*>(element->fFrame))->CloseWindow();
347 gSystem->ProcessEvents();
348 } else {
349 delete element->fFrame;
350 }
351 element->fFrame = nullptr;
352 if((element->fLayout != nullptr) && (element->fLayout != fgDefaultHints) && (element->fLayout->References() > 0)) {
353 element->fLayout->RemoveReference();
354 if(element->fLayout->References() == 0u) {
355 delete element->fLayout;
356 }
357 }
358 container->GetList()->Remove(element);
359 delete element;
360 }
361 }
362 for(Int_t i = 0; i < fTabRight->GetNumberOfTabs(); i++) {
363 TGCompositeFrame* container = fTabRight->GetTabContainer(i);
364 if(container == nullptr) {
365 continue;
366 }
367 auto* element = static_cast<TGFrameElement*>(container->GetList()->First());
368 if((element != nullptr) && (element->fFrame != nullptr)) {
369 element->fFrame->SetFrameElement(nullptr);
370 if(element->fFrame->InheritsFrom("TGMainFrame")) {
371 Bool_t sleep = (element->fFrame->InheritsFrom("GRootCanvas")) ? kTRUE : kFALSE;
372 static_cast<TGMainFrame*>(element->fFrame)->CloseWindow();
373 if(sleep) {
374 gSystem->Sleep(150);
375 }
376 gSystem->ProcessEvents();
377 } else {
378 delete element->fFrame;
379 }
380 element->fFrame = nullptr;
381 if((element->fLayout != nullptr) && (element->fLayout != fgDefaultHints) && (element->fLayout->References() > 0)) {
382 element->fLayout->RemoveReference();
383 if(element->fLayout->References() == 0u) {
384 delete element->fLayout;
385 }
386 }
387 container->GetList()->Remove(element);
388 delete element;
389 }
390 }
391 for(Int_t i = 0; i < fTabBottom->GetNumberOfTabs(); i++) {
392 TGCompositeFrame* container = fTabBottom->GetTabContainer(i);
393 if(container == nullptr) {
394 continue;
395 }
396 auto* element = static_cast<TGFrameElement*>(container->GetList()->First());
397 if((element != nullptr) && (element->fFrame != nullptr)) {
398 element->fFrame->SetFrameElement(nullptr);
399 if(element->fFrame->InheritsFrom("TGMainFrame")) {
400 (static_cast<TGMainFrame*>(element->fFrame))->CloseWindow();
401 gSystem->ProcessEvents();
402 } else {
403 delete element->fFrame;
404 }
405 element->fFrame = nullptr;
406 if((element->fLayout != nullptr) && (element->fLayout != fgDefaultHints) && (element->fLayout->References() > 0)) {
407 element->fLayout->RemoveReference();
408 if(element->fLayout->References() == 0u) {
409 delete element->fLayout;
410 }
411 }
412 container->GetList()->Remove(element);
413 delete element;
414 }
415 }
416 fPlugins.Delete();
417 Emit("CloseWindow()");
418}
419
420//______________________________________________________________________________
422{
423 /// Called when window is closed via the window manager.
424
425 TQObject::Disconnect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)", this,
426 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
427 CloseTabs();
428 DeleteWindow();
429}
430
431//______________________________________________________________________________
433{
434 /// Handle Tab navigation.
435
436 auto* sender = reinterpret_cast<TGTab*>(gTQSender);
437 if(sender != nullptr && sender == fTabRight) {
438 SwitchMenus(sender->GetTabContainer(id));
439 }
440}
441
442//______________________________________________________________________________
443void GRootBrowser::EventInfo(Int_t event, Int_t px, Int_t py, TObject* selected)
444{
445 /// Display a tooltip with infos about the primitive below the cursor.
446
447 const Int_t kTMAX = 256;
448 static std::array<char, kTMAX> atext;
449 if(selected == nullptr || event == kMouseLeave) {
450 SetStatusText("", 0);
451 SetStatusText("", 1);
452 SetStatusText("", 2);
453 SetStatusText("", 3);
454 return;
455 }
456 SetStatusText(selected->GetTitle(), 0);
457 SetStatusText(selected->GetName(), 1);
458 if(event == kKeyPress) {
459 snprintf(atext.data(), atext.size(), "%c", static_cast<char>(px));
460 } else {
461 snprintf(atext.data(), atext.size(), "%d,%d", px, py);
462 }
463 SetStatusText(atext.data(), 2);
464 SetStatusText(selected->GetObjectInfo(px, py), 3);
465}
466
467//______________________________________________________________________________
468Long_t GRootBrowser::ExecPlugin(const char* name, const char* fname, const char* cmd, Int_t pos, Int_t subpos)
469{
470 /// Execute a macro and embed the created frame in the tab "pos"
471 /// and tab element "subpos".
472
473 Long_t retval = 0;
474 TString command;
475 TString pname;
476 StartEmbedding(pos, subpos);
477 if(cmd != nullptr && strlen(cmd) != 0u) {
478 command = cmd;
479 if(name != nullptr) {
480 pname = name;
481 } else {
482 pname = TString::Format("Plugin %d", fPlugins.GetSize());
483 }
484 } else if(fname != nullptr && strlen(fname) != 0u) {
485 pname = name != nullptr ? name : gSystem->BaseName(fname);
486 Ssiz_t lastDot = pname.Last('.');
487 if(lastDot > 0) {
488 pname.Remove(lastDot);
489 }
490 command.Form(R"(gROOT->Macro("%s");)", gSystem->UnixPathName(fname));
491 } else {
492 return 0;
493 }
494 auto* plugin = new GBrowserPlugin(pname.Data(), command.Data(), pos, subpos);
495 fPlugins.Add(plugin);
496 retval = gROOT->ProcessLine(command.Data());
497 if(command.Contains("new TCanvas")) {
498 pname = gPad->GetName();
499 plugin->SetName(pname.Data());
500 }
501 SetTabTitle(pname.Data(), pos, subpos);
503 return retval;
504}
505
506//______________________________________________________________________________
508{
509 /// Returns drawing option.
510
511 if(fActBrowser != nullptr) {
512 return fActBrowser->GetDrawOption();
513 }
514 return nullptr;
515}
516
517//______________________________________________________________________________
518TGTab* GRootBrowser::GetTab(Int_t pos) const
519{
520 /// Returns the TGTab at position pos.
521
522 switch(static_cast<EInsertPosition>(pos)) {
523 case EInsertPosition::kLeft: return fTabLeft;
526 default: return nullptr;
527 }
528}
529
530//______________________________________________________________________________
531Bool_t GRootBrowser::HandleKey(Event_t* event)
532{
533 /// Handle keyboard events.
534
535 std::array<char, 10> input{};
536
537 if(event->fType == kGKeyPress) {
538 UInt_t keysym = 0;
539 gVirtualX->LookupString(event, input.data(), input.size(), keysym);
540
541 if((event->fState == 0u) && static_cast<EKeySym>(keysym) == kKey_F5) {
542 Refresh(kTRUE);
543 return kTRUE;
544 }
545 switch(static_cast<EKeySym>(keysym)) { // ignore these keys
546 case kKey_Shift:
547 case kKey_Control:
548 case kKey_Meta:
549 case kKey_Alt:
550 case kKey_CapsLock:
551 case kKey_NumLock:
552 case kKey_ScrollLock: return kTRUE;
553 default: break;
554 }
555 if((event->fState & kKeyControlMask) != 0u) { // Cntrl key modifier pressed
556 switch(static_cast<EKeySym>(keysym) & ~0x20) { // treat upper and lower the same
557 case kKey_B: fMenuFile->Activated(static_cast<int>(ENewBrowserMessages::kBrowse)); return kTRUE;
558 case kKey_O: fMenuFile->Activated(static_cast<int>(ENewBrowserMessages::kOpenFile)); return kTRUE;
559 case kKey_E: fMenuFile->Activated(static_cast<int>(ENewBrowserMessages::kNewEditor)); return kTRUE;
560 case kKey_C: fMenuFile->Activated(static_cast<int>(ENewBrowserMessages::kNewCanvas)); return kTRUE;
561 case kKey_H: fMenuFile->Activated(static_cast<int>(ENewBrowserMessages::kNewHtml)); return kTRUE;
562 case kKey_N: fMenuFile->Activated(static_cast<int>(ENewBrowserMessages::kClone)); return kTRUE;
563 case kKey_T: fMenuFile->Activated(static_cast<int>(ENewBrowserMessages::kCloseTab)); return kTRUE;
564 case kKey_W: fMenuFile->Activated(static_cast<int>(ENewBrowserMessages::kCloseWindow)); return kTRUE;
565 case kKey_Q: fMenuFile->Activated(static_cast<int>(ENewBrowserMessages::kQuitRoot)); return kTRUE;
566 default: break;
567 }
568 }
569 }
570 return TGMainFrame::HandleKey(event);
571}
572
573//______________________________________________________________________________
575{
576 /// Handle menu entries events.
577
578 TRootHelpDialog* helperDialog = nullptr;
579 TString cmd;
580 static Int_t eNr = 1;
581 auto* sender = reinterpret_cast<TGPopupMenu*>(gTQSender);
582 if(sender != fMenuFile) {
583 return;
584 }
585 switch(static_cast<ENewBrowserMessages>(id)) {
586 case ENewBrowserMessages::kBrowse: new TBrowser(); break;
588 Bool_t newfile = kFALSE;
589 static TString dir(".");
590 TGFileInfo fileInfo;
591 fileInfo.fFileTypes = gOpenFileTypes.data();
592 fileInfo.fIniDir = StrDup(dir);
593 new TGFileDialog(gClient->GetDefaultRoot(), this, kFDOpen, &fileInfo);
594 dir = fileInfo.fIniDir;
595 if(fileInfo.fMultipleSelection && (fileInfo.fFileNamesList != nullptr)) {
596 TObjString* element = nullptr;
597 TIter next(fileInfo.fFileNamesList);
598 while((element = static_cast<TObjString*>(next())) != nullptr) {
599 gROOT->ProcessLine(Form(R"(new TFile("%s");)", gSystem->UnixPathName(element->GetString())));
600 }
601 newfile = kTRUE;
602 } else if(fileInfo.fFilename != nullptr) {
603 gROOT->ProcessLine(Form(R"(new TFile("%s");)", gSystem->UnixPathName(fileInfo.fFilename)));
604 newfile = kTRUE;
605 }
606 if((fActBrowser != nullptr) && newfile) {
607 auto* fileBrowser = static_cast<TGFileBrowser*>(fActBrowser);
608 if(fileBrowser != nullptr) {
609 fileBrowser->Selected(nullptr);
610 }
611 }
612 } break;
613 // Handle Help menu items...
615#ifdef R__UNIX
616 TString rootx;
617#ifdef ROOTBINDIR
618 rootx = ROOTBINDIR;
619#else
620 rootx = gSystem->Getenv("ROOTSYS");
621 if(!rootx.IsNull()) {
622 rootx += "/bin";
623 }
624#endif // ROOTBINDIR
625 rootx += "/root -a &";
626 gSystem->Exec(rootx);
627#else // R__UNIX
628#ifdef WIN32
629 new TWin32SplashThread(kTRUE);
630#else
631 std::ostringstream str;
632 str << "About ROOT " << gROOT->GetVersion() << "...";
633 helperDialog = new TRootHelpDialog(this, str.str(), 600, 400);
634 helperDialog->SetText(gHelpAbout);
635 helperDialog->Popup();
636#endif // WIN32
637#endif // R__UNIX
638 } break;
640 helperDialog = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
641 helperDialog->SetText(gHelpCanvas); // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
642 helperDialog->Popup();
643 break;
645 helperDialog = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
646 helperDialog->SetText(gHelpPullDownMenus); // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
647 helperDialog->Popup();
648 break;
650 helperDialog = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
651 helperDialog->SetText(gHelpGraphicsEditor); // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
652 helperDialog->Popup();
653 break;
655 helperDialog = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
656 helperDialog->SetText(gHelpBrowser); // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
657 helperDialog->Popup();
658 break;
660 helperDialog = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
661 helperDialog->SetText(gHelpObjects); // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
662 helperDialog->Popup();
663 break;
665 helperDialog = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
666 helperDialog->SetText(gHelpPostscript); // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
667 helperDialog->Popup();
668 break;
670 helperDialog = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
671 helperDialog->SetText(gHelpRemote); // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
672 helperDialog->Popup();
673 break;
676 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot())");
677 ++eNr;
678 ExecPlugin(Form("Editor %d", eNr), "", cmd.Data(), 1);
679 break;
680 case ENewBrowserMessages::kNewCanvas: ExecPlugin("", "", "new TCanvas()", 1); break;
682 cmd.Form(R"(new TGHtmlBrowser("%s", gClient->GetRoot()))",
683 gEnv->GetValue("Browser.StartUrl", "http://root.cern.ch"));
684 ExecPlugin("HTML", "", cmd.Data(), 1);
685 break;
687 static TString dir(".");
688 TGFileInfo fileInfo;
689 fileInfo.fFileTypes = gPluginFileTypes.data();
690 fileInfo.fIniDir = StrDup(dir);
691 new TGFileDialog(gClient->GetDefaultRoot(), this, kFDOpen, &fileInfo);
692 dir = fileInfo.fIniDir;
693 if(fileInfo.fFilename != nullptr) {
694 ExecPlugin(nullptr, fileInfo.fFilename, nullptr, static_cast<Int_t>(EInsertPosition::kRight));
695 }
696 } break;
698 std::array<char, 1024> command{};
699 strlcpy(command.data(), "new TGLSAViewer(gClient->GetRoot(), 0);", command.size());
700 new TGInputDialog(gClient->GetRoot(), this, "Enter plugin command line:", command.data(), command.data());
701 if(strcmp(command.data(), "") != 0) {
702 ExecPlugin("User", nullptr, command.data(), static_cast<Int_t>(EInsertPosition::kRight));
703 }
704 } break;
705 case ENewBrowserMessages::kCloseTab: CloseTab(fTabRight->GetCurrent()); break;
708 CloseWindow();
709 gApplication->Terminate(0);
710 break;
711 default: break;
712 }
713}
714
715//______________________________________________________________________________
716void GRootBrowser::InitPlugins(Option_t* opt)
717{
718 /// Initialize default plugins. Could be also of the form:
719 ///~~~
720 /// StartEmbedding(0);
721 /// TPluginHandler *ph;
722 /// ph = gROOT->GetPluginManager()->FindHandler("TGClassBrowser");
723 /// if (ph && ph->LoadPlugin() != -1) {
724 /// ph->ExecPlugin(3, gClient->GetRoot(), 200, 500);
725 /// }
726 /// StopEmbedding();
727 ///~~~
728
729 TString cmd;
730
731 if((opt == nullptr) || (strlen(opt) == 0)) {
732 return;
733 }
734 // --- Left vertical area
735
736 // File Browser plugin
737 if(strchr(opt, 'F') != nullptr) {
738 cmd.Form("new TGFileBrowser(gClient->GetRoot(), (TBrowser *)0x%lx, 200, 500);", reinterpret_cast<ULong_t>(fBrowser));
739 ExecPlugin("Files", nullptr, cmd.Data(), 0);
741 }
742
743 // --- Right main area
744
745 unsigned int len = strlen(opt);
746 for(unsigned int i = 0; i < len; ++i) {
747 // Editor plugin...
748 if(opt[i] == 'E') {
749 cmd.Form("new TGTextEditor((const char *)0, gClient->GetRoot());");
750 ExecPlugin("Editor 1", nullptr, cmd.Data(), 1);
752 }
753
754 // HTML plugin...
755 if(opt[i] == 'H') {
756 if(gSystem->Load("libGuiHtml") >= 0) {
757 cmd.Form(R"(new TGHtmlBrowser("%s", gClient->GetRoot());)",
758 gEnv->GetValue("Browser.StartUrl", "http://root.cern.ch/root/html/ClassIndex.html"));
759 ExecPlugin("HTML", nullptr, cmd.Data(), 1);
761 }
762 }
763
764 // Canvas plugin...
765 if(opt[i] == 'C') {
766 fflush(stdout);
767 cmd.Form("new TCanvas();");
768 ExecPlugin("c1", nullptr, cmd.Data(), 1);
770 }
771
772 // GLViewer plugin...
773 if(opt[i] == 'G') {
774 cmd.Form("new TGLSAViewer(gClient->GetRoot(), 0);");
775 ExecPlugin("OpenGL", nullptr, cmd.Data(), 1);
777 }
778
779 // PROOF plugin...
780 if(opt[i] == 'P') {
781 cmd.Form("new TSessionViewer();");
782 ExecPlugin("PROOF", nullptr, cmd.Data(), 1);
784 }
785 }
786 // --- Right bottom area
787
788 // Command plugin...
789 if(strchr(opt, 'I') != nullptr) {
790 cmd.Form("new TGCommandPlugin(gClient->GetRoot(), 700, 300);");
791 ExecPlugin("Command", nullptr, cmd.Data(), 2);
793 }
794
795 // --- Select first tab everywhere
796 SetTab(0, 0);
797 SetTab(1, 0);
798 SetTab(2, 0);
799}
800
801//______________________________________________________________________________
803{
804 /// Really delete the browser and the this GUI.
805
806 gInterpreter->DeleteGlobal(fBrowser);
807 delete fBrowser; // will in turn delete this object
808}
809
810//______________________________________________________________________________
812{
813 /// Recursively remove object from browser.
814
815 if(fActBrowser != nullptr) {
816 fActBrowser->RecursiveRemove(obj);
817 }
818}
819
820//______________________________________________________________________________
821void GRootBrowser::RecursiveReparent(TGPopupMenu* popup)
822{
823 /// Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
824
825 TGMenuEntry* entry = nullptr;
826 TIter next(popup->GetListOfEntries());
827 while((entry = static_cast<TGMenuEntry*>(next())) != nullptr) {
828 if(entry->GetPopup() != nullptr) {
829 RecursiveReparent(entry->GetPopup());
830 }
831 }
832 popup->ReparentWindow(gClient->GetDefaultRoot());
833}
834
835//______________________________________________________________________________
836void GRootBrowser::Refresh(Bool_t force)
837{
838 /// Refresh the actual browser contents.
839
840 if(fActBrowser != nullptr) {
841 fActBrowser->Refresh(force);
842 }
843}
844
845//______________________________________________________________________________
846void GRootBrowser::RemoveTab(Int_t pos, Int_t subpos)
847{
848 /// Remove tab element "subpos" from tab "pos".
849
850 TGTab* edit = nullptr;
851 switch(static_cast<EInsertPosition>(pos)) {
852 case EInsertPosition::kLeft: // left
853 edit = fTabLeft;
854 break;
855 case EInsertPosition::kRight: // right
856 edit = fTabRight;
857 fMenuFrame->HideFrame(fActMenuBar);
858 fMenuFrame->GetList()->Remove(fActMenuBar);
859 fActMenuBar = nullptr;
860 break;
861 case EInsertPosition::kBottom: // bottom
862 edit = fTabBottom;
863 break;
864 }
865 if((edit == nullptr) || (edit->GetTabTab(subpos) == nullptr)) {
866 return;
867 }
868 const char* tabName = edit->GetTabTab(subpos)->GetString();
869 TObject* obj = nullptr;
870 if((obj = fPlugins.FindObject(tabName)) != nullptr) {
871 fPlugins.Remove(obj);
872 }
873 TGFrameElement* element = nullptr;
874 if(edit->GetTabContainer(subpos) != nullptr) {
875 element = static_cast<TGFrameElement*>(edit->GetTabContainer(subpos)->GetList()->First());
876 }
877 if(element != nullptr && element->fFrame != nullptr) {
878 element->fFrame->Disconnect("ProcessedConfigure(Event_t*)");
879 element->fFrame->SetFrameElement(nullptr);
880 if(element->fFrame->InheritsFrom("TGMainFrame")) {
881 Bool_t sleep = (element->fFrame->InheritsFrom("GRootCanvas")) ? kTRUE : kFALSE;
882 static_cast<TGMainFrame*>(element->fFrame)->CloseWindow();
883 if(sleep) {
884 gSystem->Sleep(150);
885 }
886 gSystem->ProcessEvents();
887 } else {
888 delete element->fFrame;
889 }
890 element->fFrame = nullptr;
891 if(element->fLayout != nullptr && element->fLayout != fgDefaultHints && element->fLayout->References() > 0) {
892 element->fLayout->RemoveReference();
893 if(element->fLayout->References() == 0u) {
894 delete element->fLayout;
895 }
896 }
897 edit->GetTabContainer(subpos)->GetList()->Remove(element);
898 delete element;
899 }
900 fNbTab[pos]--;
901 edit->RemoveTab(subpos);
902 SwitchMenus(edit->GetTabContainer(edit->GetCurrent()));
903}
904
905//______________________________________________________________________________
906void GRootBrowser::SetTab(Int_t pos, Int_t subpos)
907{
908 /// Switch to Tab "subpos" in TGTab "pos".
909
910 TGTab* tab = GetTab(pos);
911 if(subpos == -1) {
912 subpos = fCrTab[pos];
913 }
914
915 if((tab != nullptr) && tab->SetTab(subpos, kFALSE)) { // Block signal emit
916 if(static_cast<EInsertPosition>(pos) == EInsertPosition::kRight) {
917 SwitchMenus(tab->GetTabContainer(subpos));
918 }
919 tab->Layout();
920 }
921}
922
923//______________________________________________________________________________
924void GRootBrowser::SetTabTitle(const char* title, Int_t pos, Int_t subpos)
925{
926 /// Set text "title" of Tab "subpos" in TGTab "pos".
927
928 TGTab* edit = GetTab(pos);
929 if(edit == nullptr) {
930 return;
931 }
932 if(subpos == -1) {
933 subpos = fCrTab[pos];
934 }
935
936 TGTabElement* element = edit->GetTabTab(subpos);
937 if(element != nullptr) {
938 element->SetText(new TGString(title));
939 edit->Layout();
940 GBrowserPlugin* plugin = nullptr;
941 if((plugin = static_cast<GBrowserPlugin*>(fPlugins.FindObject(title))) != nullptr) {
942 plugin->SetName(title);
943 }
944 }
945}
946
947//______________________________________________________________________________
948void GRootBrowser::SetStatusText(const char* txt, Int_t col)
949{
950 /// Set text in culumn col in status bar.
951
952 fStatusBar->SetText(txt, col);
953}
954
955//______________________________________________________________________________
956void GRootBrowser::ShowMenu(TGCompositeFrame* menu)
957{
958 /// Show the selected frame's menu and hide previous one.
959
960 TGFrameElement* element = nullptr;
961 // temporary solution until I find a proper way to handle
962 // these bloody menus...
963 fBindList->Delete();
964 TIter nextm(fMenuBar->GetList());
965 while((element = static_cast<TGFrameElement*>(nextm())) != nullptr) {
966 auto* title = static_cast<TGMenuTitle*>(element->fFrame);
967 Int_t code = title->GetHotKeyCode();
968 BindKey(fMenuBar, code, kKeyMod1Mask);
969 BindKey(fMenuBar, code, kKeyMod1Mask | kKeyShiftMask);
970 BindKey(fMenuBar, code, kKeyMod1Mask | kKeyLockMask);
971 BindKey(fMenuBar, code, kKeyMod1Mask | kKeyShiftMask | kKeyLockMask);
972 BindKey(fMenuBar, code, kKeyMod1Mask | kKeyMod2Mask);
973 BindKey(fMenuBar, code, kKeyMod1Mask | kKeyShiftMask | kKeyMod2Mask);
974 BindKey(fMenuBar, code, kKeyMod1Mask | kKeyMod2Mask | kKeyLockMask);
975 BindKey(fMenuBar, code, kKeyMod1Mask | kKeyShiftMask | kKeyMod2Mask | kKeyLockMask);
976 }
977 fMenuFrame->HideFrame(fActMenuBar);
978 fMenuFrame->ShowFrame(menu);
979 menu->Layout();
980 fMenuFrame->Layout();
981 fActMenuBar = menu;
982}
983
984//______________________________________________________________________________
985void GRootBrowser::StartEmbedding(Int_t pos, Int_t subpos)
986{
987 /// Start embedding external frame in the tab "pos" and tab element "subpos".
988
989 fEditTab = GetTab(pos);
990 if(fEditTab == nullptr) {
991 return;
992 }
993 fEditPos = pos;
994 fEditSubPos = subpos;
995
996 if(fEditFrame == nullptr) {
997 if(subpos == -1) {
998 fCrTab[pos] = fNbTab[pos]++;
999 fEditFrame = fEditTab->AddTab(Form("Tab %d", fNbTab[pos]));
1000 fEditSubPos = fEditTab->GetNumberOfTabs() - 1;
1001 fEditFrame->MapWindow();
1002 TGTabElement* tabel = fEditTab->GetTabTab(fEditSubPos);
1003 if(tabel != nullptr) {
1004 tabel->MapWindow();
1005 if(fShowCloseTab && (pos == 1)) {
1006 tabel->ShowClose();
1007 }
1008 }
1009 fEditTab->SetTab(fEditTab->GetNumberOfTabs() - 1);
1010 fEditTab->Layout();
1011 } else {
1012 fCrTab[pos] = subpos;
1013 fEditFrame = fEditTab->GetTabContainer(subpos);
1014 fEditTab->SetTab(subpos);
1015 }
1016 if(fEditFrame != nullptr) {
1017 fEditFrame->SetEditable();
1018 }
1019 }
1020}
1021
1022//______________________________________________________________________________
1023void GRootBrowser::StopEmbedding(const char* name, TGLayoutHints* layout)
1024{
1025 /// Stop embedding external frame in the current editable frame.
1026
1027 if(fEditFrame != nullptr) {
1028 fEditFrame->SetEditable(kFALSE);
1029 auto* element = static_cast<TGFrameElement*>(fEditFrame->GetList()->First());
1030 if((element != nullptr) && (element->fFrame != nullptr)) {
1031 // let be notified when the inside frame gets resized, and tell its
1032 // container to recompute its layout
1033 element->fFrame->Connect("ProcessedConfigure(Event_t*)", "TGCompositeFrame", fEditFrame, "Layout()");
1034 }
1035 if(layout != nullptr) {
1036 element = static_cast<TGFrameElement*>(fEditFrame->GetList()->Last());
1037 // !!!! MT what to do with the old layout? Leak it for now ...
1038 if(element != nullptr) {
1039 element->fLayout = layout;
1040 }
1041 }
1042 fEditFrame->Layout();
1043 if(fEditTab == fTabRight) {
1045 }
1046 }
1047 if((name != nullptr) && (strlen(name) != 0u)) {
1049 }
1050 fEditTab->Selected(fEditSubPos);
1051 fEditFrame = fEditTab = nullptr;
1052 fEditPos = fEditSubPos = -1;
1053}
1054
1055//______________________________________________________________________________
1056void GRootBrowser::SwitchMenus(TGCompositeFrame* from)
1057{
1058 /// Move the menu from original frame to our TGMenuFrame, or display the
1059 /// menu associated to the current tab.
1060
1061 if(from == nullptr) {
1062 return;
1063 }
1064 auto* frameElement = static_cast<TGFrameElement*>(from->GetList()->First());
1065 if(frameElement == nullptr) {
1066 if(fActMenuBar != fMenuBar) {
1068 }
1069 return;
1070 }
1071 auto* embed = static_cast<TGCompositeFrame*>(frameElement->fFrame);
1072 TGFrameElement* element = nullptr;
1073 if(embed != nullptr && embed->GetList() != nullptr) {
1074 TIter next(embed->GetList());
1075 while((element = static_cast<TGFrameElement*>(next())) != nullptr) {
1076 if(element->fFrame->InheritsFrom("TGMenuBar")) {
1077 auto* menu = static_cast<TGMenuBar*>(element->fFrame);
1078 if(fActMenuBar == menu) {
1079 return;
1080 }
1081 TGFrameElement* nw = nullptr;
1082 TIter nel(fMenuFrame->GetList());
1083 while((nw = static_cast<TGFrameElement*>(nel())) != nullptr) {
1084 if(nw->fFrame == menu) {
1085 ShowMenu(menu);
1086 return;
1087 }
1088 }
1089 const_cast<TGCompositeFrame*>(static_cast<const TGCompositeFrame*>(menu->GetParent()))->HideFrame(menu); // NOLINT(cppcoreguidelines-pro-type-const-cast)
1090 const_cast<TGCompositeFrame*>(static_cast<const TGCompositeFrame*>(menu->GetParent()))->SetCleanup(kNoCleanup); // NOLINT(cppcoreguidelines-pro-type-const-cast)
1091 menu->ReparentWindow(fMenuFrame);
1092 fMenuFrame->AddFrame(menu, fLH2);
1093 TGFrameElement* mel = nullptr;
1094 TIter mnext(menu->GetList());
1095 while((mel = static_cast<TGFrameElement*>(mnext())) != nullptr) {
1096 auto* title = static_cast<TGMenuTitle*>(mel->fFrame);
1097 TGPopupMenu* popup = menu->GetPopup(title->GetName());
1098 if(popup != nullptr) {
1099 RecursiveReparent(popup);
1100 if(popup->GetEntry("Close Canvas") != nullptr) {
1101 TGMenuEntry* exit = popup->GetEntry("Close Canvas");
1102 popup->HideEntry(exit->GetEntryId());
1103 }
1104 if(popup->GetEntry("Close Viewer") != nullptr) {
1105 TGMenuEntry* exit = popup->GetEntry("Close Viewer");
1106 popup->HideEntry(exit->GetEntryId());
1107 }
1108 if(popup->GetEntry("Quit ROOT") != nullptr) {
1109 TGMenuEntry* exit = popup->GetEntry("Quit ROOT");
1110 popup->HideEntry(exit->GetEntryId());
1111 }
1112 if(popup->GetEntry("Exit") != nullptr) {
1113 TGMenuEntry* exit = popup->GetEntry("Exit");
1114 popup->HideEntry(exit->GetEntryId());
1115 }
1116 }
1117 }
1118 ShowMenu(menu);
1119 return;
1120 }
1121 }
1122 }
1123 if(fActMenuBar != fMenuBar) {
1125 }
1126}
1127
1128//______________________________________________________________________________
1130{
1131 /// Emits signal when double clicking on icon.
1132 Emit("DoubleClicked(TObject*)", reinterpret_cast<Long_t>(obj));
1133}
1134
1135//______________________________________________________________________________
1136void GRootBrowser::Checked(TObject* obj, Bool_t checked)
1137{
1138 /// Emits signal when double clicking on icon.
1139
1140 std::array<Long_t, 2> args = {reinterpret_cast<Long_t>(obj), static_cast<Long_t>(checked)};
1141
1142 Emit("Checked(TObject*,Bool_t)", args.data());
1143}
1144
1145//______________________________________________________________________________
1147{
1148 /// Emits signal "ExecuteDefaultAction(TObject*)".
1149 Emit("ExecuteDefaultAction(TObject*)", reinterpret_cast<Long_t>(obj));
1150}
1151
1152//______________________________________________________________________________
1153TBrowserImp* GRootBrowser::NewBrowser(TBrowser* b, const char* title, UInt_t width, UInt_t height, Option_t* opt)
1154{
1155 /// static contructor returning TBrowserImp,
1156 /// as needed by the plugin mechanism.
1157
1158 auto* browser = new GRootBrowser(b, title, width, height, opt);
1159 return static_cast<TBrowserImp*>(browser);
1160}
1161
1162//______________________________________________________________________________
1163TBrowserImp* GRootBrowser::NewBrowser(TBrowser* b, const char* title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t* opt)
1164{
1165 /// static contructor returning TBrowserImp,
1166 /// as needed by the plugin mechanism.
1167
1168 auto* browser = new GRootBrowser(b, title, x, y, width, height, opt);
1169 return static_cast<TBrowserImp*>(browser);
1170}
static std::array< const char *, 6 > gPluginFileTypes
static std::array< const char *, 6 > gOpenFileTypes
Int_t fTab
Tab number.
Int_t fSubTab
Tab element number.
TString fCommand
Command to be executed.
TBrowserImp * fActBrowser
Actual (active) browser imp.
void ReallyDelete() override
void InitPlugins(Option_t *opt="")
Int_t fEditSubPos
Id of subtab in "Edit" mode.
TGVerticalFrame * fVf
Vertical frame.
void CloseWindow() override
void CreateBrowser(const char *name)
void HandleMenu(Int_t id)
Long_t ExecPlugin(const char *name=nullptr, const char *fname=nullptr, const char *cmd=nullptr, Int_t pos=static_cast< Int_t >(EInsertPosition::kRight), Int_t subpos=-1) override
TGMenuBar * fMenuBar
Main (owned) menu bar.
TGLayoutHints * fLH3
Layout hints, part 4.
void SetStatusText(const char *txt, Int_t col) override
void RecursiveRemove(TObject *obj) override
TGVerticalFrame * fV1
Vertical frame.
TGPopupMenu * fMenuFile
"File" popup menu
TGHorizontalFrame * fHf
Horizontal frame.
void SwitchMenus(TGCompositeFrame *from)
std::array< Int_t, 3 > fCrTab
Actual (active) tab elements (for each Tab)
TGHorizontalFrame * fToolbarFrame
Toolbar frame.
Int_t fNbInitPlugins
Number of initial plugins (from .rootrc)
TGStatusBar * fStatusBar
Status bar.
void StartEmbedding(Int_t pos=static_cast< Int_t >(EInsertPosition::kRight), Int_t subpos=-1) override
void SetTab(Int_t pos=static_cast< Int_t >(EInsertPosition::kRight), Int_t subpos=-1)
virtual void CloseTab(Int_t id)
void SetTabTitle(const char *title, Int_t pos=static_cast< Int_t >(EInsertPosition::kRight), Int_t subpos=-1)
void Add(TObject *obj, const char *name=nullptr, Int_t check=-1) override
TGHSplitter * fHSplitter
Horizontal splitter.
TGTab * fEditTab
Tab in "Edit" mode.
void CloseTabs() override
TGLayoutHints * fLH1
Layout hints, part 2.
TGPopupMenu * fMenuExecPlugin
"Exec Plugin" popup menu
TGCompositeFrame * fEditFrame
Frame in "Edit" mode.
TGTab * fTabRight
Right Tab.
Bool_t fShowCloseTab
kTRUE to show close icon on tab elements
TGHorizontalFrame * fH2
Horizontal frame.
static TBrowserImp * NewBrowser(TBrowser *b=nullptr, const char *title="ROOT Browser", UInt_t width=800, UInt_t height=500, Option_t *opt="")
const TGPicture * fIconPic
icon picture
TGLayoutHints * fLH6
Layout hints, part 7.
TGTab * fTabBottom
Bottom Tab.
void ExecuteDefaultAction(TObject *obj) override
TGHorizontalFrame * fH1
Horizontal frame.
TGVerticalFrame * fV2
Vertical frame.
TGHorizontalFrame * fMenuFrame
Shared menu frame.
Option_t * GetDrawOption() const override
TGCompositeFrame * fActMenuBar
Actual (active) menu bar.
void Refresh(Bool_t force=kFALSE) override
TGVSplitter * fVSplitter
Vertical splitter.
TGLayoutHints * fLH5
Layout hints, part 6.
void DoTab(Int_t id)
void BrowseObj(TObject *obj) override
void RemoveTab(Int_t pos, Int_t subpos)
Int_t fEditPos
Id of tab in "Edit" mode.
TGTab * fTabLeft
Left Tab.
GRootBrowser(const GRootBrowser &)
TGHorizontalFrame * fTopMenuFrame
Top menu frame.
void StopEmbedding(const char *name=nullptr) override
TGLayoutHints * fLH0
Layout hints, part 1.
TGPopupMenu * fMenuHelp
"Browser Help" popup menu
TGLayoutHints * fLH2
Layout hints, part 3.
TGTab * GetTab(Int_t pos) const
void ShowMenu(TGCompositeFrame *menu)
virtual void DoubleClicked(TObject *obj)
void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Bool_t HandleKey(Event_t *event) override
TList fPlugins
List of plugins.
TGHorizontalFrame * fPreMenuFrame
First (owned) menu frame.
virtual void Checked(TObject *obj, Bool_t checked)
void RecursiveReparent(TGPopupMenu *popup)
TGLayoutHints * fLH7
Layout hints, part 8.
std::array< Int_t, 3 > fNbTab
Number of tab elements (for each Tab)
TGLayoutHints * fLH4
Layout hints, part 5.