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