85#include "RConfigure.h"
103 "ROOT files",
"*.root",
133 "TRootBrowser",
this,
134 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
157 "TRootBrowser",
this,
158 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
167 static bool hasRNTupleBrowsing __attribute__((unused)) = []() {
224 fMenuFile->Connect(
"Activated(Int_t)",
"TRootBrowser",
this,
225 "HandleMenu(Int_t)");
245#if defined(R__HAS_COCOA)
271 fTabRight->Connect(
"Selected(Int_t)",
"TRootBrowser",
this,
"DoTab(Int_t)");
272 fTabRight->Connect(
"CloseTab(Int_t)",
"TRootBrowser",
this,
"CloseTab(Int_t)");
292 int parts[] = { 33, 10, 10, 47 };
310 if (!strcmp(
gROOT->GetDefCanvasName(),
"c1"))
311 gROOT->SetDefCanvasName(
"Canvas_1");
418 this,
"EventInfo(Int_t, Int_t, Int_t, TObject*)");
423 for (i=0;i<
fTabLeft->GetNumberOfTabs();i++) {
424 container =
fTabLeft->GetTabContainer(i);
425 if (!container)
continue;
451 for (i=0;i<
fTabRight->GetNumberOfTabs();i++) {
452 container =
fTabRight->GetTabContainer(i);
453 if (!container)
continue;
481 for (i=0;i<
fTabBottom->GetNumberOfTabs();i++) {
483 if (!container)
continue;
508 Emit(
"CloseWindow()");
517 this,
"EventInfo(Int_t, Int_t, Int_t, TObject*)");
538 const Int_t kTMAX=256;
539 static char atext[kTMAX];
550 snprintf(atext, kTMAX,
"%c", (
char) px);
552 snprintf(atext, kTMAX,
"%d,%d", px, py);
567 if (cmd && strlen(cmd)) {
573 else if (fname && strlen(fname)) {
576 if (t > 0) pname.
Remove(t);
577 command.
Form(
"gROOT->Macro(\"%s\");",
gSystem->UnixPathName(fname));
583 Bool_t is_web_canvas = strcmp(
gEnv->GetValue(
"Canvas.Name",
""),
"TWebCanvas") == 0;
585 if (
IsWebGUI() && new_canvas && is_web_canvas)
586 return gROOT->ProcessLine(command.
Data());
588 if (new_canvas && is_web_canvas)
589 gEnv->SetValue(
"Canvas.Name",
"TRootCanvas");
593 retval =
gROOT->ProcessLine(command.
Data());
595 pname =
gPad->GetName();
598 gEnv->SetValue(
"Canvas.Name",
"TWebCanvas");
637 gVirtualX->LookupString(event, input,
sizeof(input), keysym);
656 switch ((
EKeySym)keysym & ~0x20) {
699 static Int_t eNr = 1;
721 gROOT->ProcessLine(
Form(
"new TFile(\"%s\");",
727 gROOT->ProcessLine(
Form(
"new TFile(\"%s\");",
762 hd =
new TRootHelpDialog(
this,
"Help on Graphics Editor...", 600, 400);
790 cmd.
Form(
"new TGTextEditor((const char *)0, gClient->GetRoot())");
798 cmd.
Form(
"new TGHtmlBrowser(\"%s\", gClient->GetRoot())",
799 gEnv->GetValue(
"Browser.StartUrl",
"http://root.cern.ch"));
819 strlcpy(command,
"new TGLSAViewer(gClient->GetRoot(), 0);",
822 "Enter plugin command line:",
824 if (strcmp(command,
"")) {
858 if ((opt == 0) || (!opt[0]))
863 if (strchr(opt,
'F')) {
864 cmd.
Form(
"new TGFileBrowser(gClient->GetRoot(), (TBrowser *)0x%zx, 200, 500);", (
size_t)
fBrowser);
871 Int_t i, len = strlen(opt);
872 for (i=0; i<len; ++i) {
875 cmd.
Form(
"new TGTextEditor((const char *)0, gClient->GetRoot());");
882 if (
gSystem->Load(
"libGuiHtml") >= 0) {
883 cmd.
Form(
"new TGHtmlBrowser(\"%s\", gClient->GetRoot());",
884 gEnv->GetValue(
"Browser.StartUrl",
885 "https://root.cern.ch/doc/master/classes.html"));
893 cmd.
Form(
"new TCanvas();");
900 cmd.
Form(
"new TGLSAViewer(gClient->GetRoot(), 0);");
909 if (strchr(opt,
'I')) {
910 cmd.
Form(
"new TGCommandPlugin(gClient->GetRoot(), 700, 300);");
926 TString factory =
gEnv->GetValue(
"Gui.Factory",
"native");
996 if ((obj =
fPlugins.FindObject(tabName))) {
1148 el->
fFrame->
Connect(
"ProcessedConfigure(Event_t*)",
"TGCompositeFrame",
1184 if (embed && embed->
GetList()) {
1194 if (nw->
fFrame == menu) {
1210 if (popup->
GetEntry(
"Close Canvas")) {
1214 if (popup->
GetEntry(
"Close Viewer")) {
1218 if (popup->
GetEntry(
"Quit ROOT")) {
1255 Emit(
"Checked(TObject*,Bool_t)", args);
const Mask_t kKeyLockMask
const Mask_t kKeyMod1Mask
typically the Alt key
const Mask_t kKeyReleaseMask
const Mask_t kKeyPressMask
const Mask_t kKeyShiftMask
const Mask_t kKeyControlMask
const Mask_t kKeyMod2Mask
typically mod on numeric keys
R__EXTERN const char gHelpObjects[]
R__EXTERN const char gHelpPullDownMenus[]
R__EXTERN const char gHelpRemote[]
R__EXTERN const char gHelpAbout[]
R__EXTERN const char gHelpGraphicsEditor[]
R__EXTERN const char gHelpCanvas[]
R__EXTERN const char gHelpBrowser[]
R__EXTERN const char gHelpPostscript[]
int Int_t
Signed integer 4 bytes (int).
long Longptr_t
Integer large enough to hold a pointer (platform-dependent).
int Ssiz_t
String size (currently int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
const char Option_t
Option string (const char).
externTApplication * gApplication
unsigned int sleep(unsigned int seconds)
static const char * gPluginFileTypes[]
static const char * gOpenFileTypes[]
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
TBrowserImp(const TBrowserImp &)=delete
TBrowser * fBrowser
TBrowser associated with this implementation.
Helper class used to manage plugins (command or macro to be executed).
TString fCommand
Command to be executed.
Int_t fSubTab
Tab element number.
Using a TBrowser one can browse all ROOT objects.
void SetBrowse(ROOT::BrowseFunc_t browseFunc)
Install a new wrapper around 'Browse'.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
virtual TList * GetList() const
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
TGCompositeFrame(const TGCompositeFrame &)=delete
void Layout() override
Layout the elements of the composite frame.
static TGLayoutHints * fgDefaultHints
System file browser, used as TRootBrowser plug-in.
void Selected(char *)
A ROOT File has been selected in TGHtmlBrowser.
This class creates a file selection dialog.
TList * fFileNamesList
list of selected file names
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
Bool_t fMultipleSelection
if true, allow multiple file selection
void SetIniDir(const char *inidir)
Set directory name.
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
void ReparentWindow(const TGWindow *p, Int_t x=0, Int_t y=0) override
Reparent window, make p the new parent and position the window at position (x,y) in new parent.
void MapWindow() override
map window
virtual void DeleteWindow()
Delete window.
void UnmapWindow() override
unmap window
void SetFrameElement(TGFrameElement *fe)
A composite frame that layout their children in horizontal way.
This class describes layout hints used by the layout classes.
TGMainFrame(const TGMainFrame &)=delete
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
TList * fBindList
list with key bindings
virtual Bool_t BindKey(const TGWindow *w, Int_t keycode, Int_t modifier) const
Bind key to a window.
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
const TGPicture * SetIconPixmap(const char *iconName)
Set window icon pixmap by name.
TGClient * fClient
Connection to display server.
Provides a StatusBar widget.
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Service classes of the tab widget.
void SetText(TGString *text)
Set new tab text.
const char * GetString() const
virtual void ShowClose(Bool_t on=kTRUE)
Show/hide close icon on the tab element, then apply layout to compute correct elements size.
A tab widget contains a set of composite frames each with a little tab with a name (like a set of fol...
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
virtual void RemoveTab(Int_t tabIndex=-1, Bool_t storeRemoved=kTRUE)
Remove container and tab of tab with index tabIndex.
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
A composite frame that layout their children in vertical way.
const TGWindow * GetParent() const
TObject * Remove(TObject *obj) override
Remove object from the list.
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
const char * GetName() const override
Returns name of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
Collectable string class.
const TString & GetString() const
Mother of all ROOT objects.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
UInt_t References() const
TGPopupMenu * fMenuExecPlugin
"Exec Plugin" popup menu
TGHorizontalFrame * fMenuFrame
Shared menu frame.
TGTab * GetTab(Int_t pos) const
Returns the TGTab at position pos.
void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1) override
Start embedding external frame in the tab "pos" and tab element "subpos".
Bool_t fShowCloseTab
kTRUE to show close icon on tab elements
void SetTabTitle(const char *title, Int_t pos=kRight, Int_t subpos=-1)
Set text "title" of Tab "subpos" in TGTab "pos".
TGPopupMenu * fMenuHelp
"Browser Help" popup menu
Int_t fCrTab[3]
Actual (active) tab elements (for each Tab).
void ExecuteDefaultAction(TObject *obj) override
Emits signal "ExecuteDefaultAction(TObject*)".
TRootBrowser(const TRootBrowser &)=delete
Longptr_t ExecPlugin(const char *name=nullptr, const char *fname=nullptr, const char *cmd=nullptr, Int_t pos=kRight, Int_t subpos=-1) override
Execute a macro and embed the created frame in the tab "pos" and tab element "subpos".
TGHorizontalFrame * fH2
Horizontal frame.
Int_t fNbTab[3]
Number of tab elements (for each Tab).
TGStatusBar * fStatusBar
Status bar.
Bool_t IsWebGUI()
Check if the GUI factory is set to use the Web GUI.
TGVerticalFrame * fVf
Vertical frame.
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
TGHSplitter * fHSplitter
Horizontal splitter.
TBrowserImp * fActBrowser
Actual (active) browser imp.
TGCompositeFrame * fEditFrame
Frame in "Edit" mode.
virtual void CloseTab(Int_t id)
Remove tab element id from right tab.
static TBrowserImp * NewBrowser(TBrowser *b=nullptr, const char *title="ROOT Browser", UInt_t width=800, UInt_t height=500, Option_t *opt="")
static constructor returning TBrowserImp, as needed by the plugin mechanism.
TGCompositeFrame * fActMenuBar
Actual (active) menu bar.
Int_t fEditPos
Id of tab in "Edit" mode.
void ReallyDelete() override
Really delete the browser and the this GUI.
void StopEmbedding(const char *name=nullptr) override
const TGPicture * fIconPic
icon picture
Int_t fEditSubPos
Id of subtab in "Edit" mode.
TGTab * fEditTab
Tab in "Edit" mode.
TGVerticalFrame * fV1
Vertical frame.
void DoTab(Int_t id)
Handle Tab navigation.
void RecursiveRemove(TObject *obj) override
Recursively remove object from browser.
void CreateBrowser(const char *name)
TGHorizontalFrame * fPreMenuFrame
First (owned) menu frame.
void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Display a tooltip with infos about the primitive below the cursor.
~TRootBrowser() override
Clean up all widgets, frames and layouthints that were used.
TList fPlugins
List of plugins.
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
void SetTab(Int_t pos=kRight, Int_t subpos=-1)
Switch to Tab "subpos" in TGTab "pos".
void CloneBrowser()
Clone the browser.
TGTab * fTabRight
Right Tab.
void HandleMenu(Int_t id)
Handle menu entries events.
TGVSplitter * fVSplitter
Vertical splitter.
TGHorizontalFrame * fHf
Horizontal frame.
void RemoveTab(Int_t pos, Int_t subpos)
Remove tab element "subpos" from tab "pos".
TGTab * fTabBottom
Bottom Tab.
void Refresh(Bool_t force=kFALSE) override
Refresh the actual browser contents.
TGPopupMenu * fMenuFile
"File" popup menu
void SwitchMenus(TGCompositeFrame *from)
Move the menu from original frame to our TGMenuFrame, or display the menu associated to the current t...
void BrowseObj(TObject *obj) override
Browse object.
TGLayoutHints * fLH7
Layout hints, part 2.
virtual void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
void ShowMenu(TGCompositeFrame *menu)
Show the selected frame's menu and hide previous one.
void SetStatusText(const char *txt, Int_t col) override
Set text in column col in status bar.
void CloseWindow() override
Called when window is closed via the window manager.
TGTab * fTabLeft
Left Tab.
void Add(TObject *obj, const char *name=nullptr, Int_t check=-1) override
Add items to the actual browser.
TGHorizontalFrame * fTopMenuFrame
Top menu frame.
TGLayoutHints * fLH3
Layout hints, part 1.
TGMenuBar * fMenuBar
Main (owned) menu bar.
Int_t fNbInitPlugins
Number of initial plugins (from .rootrc).
void InitPlugins(Option_t *opt="")
Initialize default plugins.
TGVerticalFrame * fV2
Vertical frame.
void RecursiveReparent(TGPopupMenu *popup)
Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
void CloseTabs() override
Properly close the mainframes embedded in the different tabs.
Option_t * GetDrawOption() const override
Returns drawing option.
TGHorizontalFrame * fH1
Horizontal frame.
TGHorizontalFrame * fToolbarFrame
Toolbar frame.
A TRootHelpDialog is used to display help text (or any text in a dialog window).
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
void Popup()
Show help dialog.
const char * Data() const
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static void Terminate()
Close the global pad editor. Static method.
void BrowseRNTuple(const void *ntuple, TBrowser *b)
EGEventType fType
of event (see EGEventType)
UInt_t fState
key or button mask