33#include "RConfigure.h"
64 Error(
"TGTreeLBEntry",
"icon not found for entry %s",
text->GetString());
77 int max_ascent, max_descent;
136 int max_ascent, max_descent;
223 const char *curdrive =
"";
224 if (volumes && curvol) {
230 fLbc.emplace_back(infos.
Data(),
Form(
"%s\\", curdrive),
"hdisk_t.xpm", 0);
232 fLbc.back().fPixmap =
"fdisk_t.xpm";
234 fLbc.back().fPixmap =
"hdisk_t.xpm";
236 fLbc.back().fPixmap =
"cdrom_t.xpm";
238 fLbc.back().fPixmap =
"netdisk_t.xpm";
240 fLbc.emplace_back(
"Root",
"/",
"hdisk_t.xpm", 1);
243 fLbc.emplace_back(
"Root",
"/",
"hdisk_t.xpm", 1);
244 fLbc.emplace_back(
"Floppy",
"/floppy",
"fdisk_t.xpm", 1);
245 fLbc.emplace_back(
"CD-ROM",
"/cdrom",
"cdrom_t.xpm", 1);
247 fLbc.emplace_back(
"Home",
"$HOME",
"home_t.xpm", 1);
249 fLbc.emplace_back(
"RootSys",
"$ROOTSYS",
"root_t.xpm", 1);
251 fLbc.emplace_back(ROOTPREFIX, ROOTPREFIX,
"root_t.xpm", 1);
254 if (volumes && curvol) {
257 while ((drive = (
TNamed *)next())) {
258 if (!strcmp(drive->
GetName(), curdrive))
265 fLbc.back().fPixmap =
"fdisk_t.xpm";
267 fLbc.back().fPixmap =
"hdisk_t.xpm";
269 fLbc.back().fPixmap =
"cdrom_t.xpm";
271 fLbc.back().fPixmap =
"netdisk_t.xpm";
279 for (
auto &entry :
fLbc) {
280 entry.fId = ++cnt * 1000;
281 if (entry.fPath.find(
"$HOME") == 0) {
283 std::string newpath = homeDir;
284 newpath.append(entry.fPath.substr(5));
285 entry.fPath = newpath;
297 if (entry.fPath.find(
"$ROOTSYS") == 0) {
301 std::string newpath = rootSys;
302 newpath.append(entry.fPath.substr(plen));
303 entry.fPath = newpath;
315 for (
auto &entry :
fLbc) {
317 int indent = 4 + (entry.fIndent * 10);
319 if (!pic)
Error(
"TGFSComboBox",
"pixmap not found: %s", entry.fPixmap.c_str());
321 new TGString(entry.fName.c_str()), pic, entry.fId,
334 char dirname[1024], mpath[1024];
335 const char *tailpath = 0;
336 int indent_lvl = 0, afterID = -1,
sel = -1;
340 for (
int i = 0; i < (
int)
fLbc.size() - 1; ++i)
345 for (
auto &entry :
fLbc) {
347 int slen = entry.fPath.length();
348 if (strncmp(path, entry.fPath.c_str(), slen) == 0) {
350 sel = afterID = entry.fId;
351 indent_lvl = entry.fIndent + 1;
352 if ((
len > 0) && ((path[slen] ==
'\\') || (path[slen] ==
'/') ||
354 tailpath = path + slen;
355 strlcpy(mpath, entry.fPath.c_str(), 1024);
362 if (tailpath && *tailpath) {
363 if ((*tailpath ==
'/') || (*tailpath ==
'\\')) ++tailpath;
367 const char *semi = strchr(tailpath,
'/');
368 if (semi == 0) semi = strchr(tailpath,
'\\');
370 strlcpy(dirname, tailpath, 1024);
371 picname =
"ofolder_t.xpm";
373 strlcpy(dirname, tailpath, (semi-tailpath)+1);
374 picname =
"folder_t.xpm";
376 if ((mpath[strlen(mpath)-1] !=
'/') &&
377 (mpath[strlen(mpath)-1] !=
'\\')) {
378 strlcat(mpath,
"/", 1024-strlen(mpath));
380 strlcat(mpath, dirname, 1024-strlen(mpath));
381 int indent = 4 + (indent_lvl * 10);
383 if (!pic)
Error(
"Update",
"pixmap not found: %s", picname);
385 new TGString(dirname), pic, afterID+1,
392 if (semi == 0)
break;
406 out << std::endl <<
" // file system combo box" << std::endl;
407 out <<
" TGFSComboBox *";
412 out <<
");" << std::endl;
420 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");" << std::endl;
const Mask_t kButtonPressMask
Handle_t GContext_t
Graphics context handle.
const Mask_t kPointerMotionMask
const Mask_t kButtonReleaseMask
ULongptr_t Handle_t
Generic resource handle.
Handle_t FontStruct_t
Pointer to font structure.
static void indent(ostringstream &buf, int indent_level)
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char text
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
const TGResourcePool * GetResourcePool() const
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
virtual Int_t GetSelected() const
virtual void AddEntry(TGString *s, Int_t id)
TGListBox * fListBox
the listbox with text items
virtual void SetTopEntry(TGLBEntry *e, TGLayoutHints *lh)
Set a new combo box value (normally update of text string in fSelEntry is done via fSelEntry::Update(...
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
virtual void InsertEntry(TGString *s, Int_t id, Int_t afterID)
This is a combo box that is used in the File Selection dialog box.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a file system combo box as a C++ statement(s) on output stream out.
TGFSComboBox(const TGWindow *p=nullptr, Int_t id=-1, UInt_t options=kHorizontalFrame|kSunkenFrame|kDoubleBorder, Pixel_t back=GetWhitePixel())
Create a file system combobox showing system directories.
std::vector< Lbc_t > fLbc
! list of default entries
virtual void Update(const char *path)
Update file system combo box.
Encapsulate fonts used in the GUI system.
FontStruct_t GetFontStruct() const
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
static Pixel_t GetWhitePixel()
Get white pixel value.
UInt_t fHeight
frame height
static Pixel_t fgDefaultSelectedBackground
virtual UInt_t GetOptions() const
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
static Pixel_t fgWhitePixel
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Pixel_t fBackground
frame background color
static Pixel_t fgBlackPixel
Encapsulate a graphics context used in the low level graphics.
This class describes layout hints used by the layout classes.
virtual TGFrame * GetContainer() const
TGClient * fClient
Connection to display server.
Handle_t fId
X11/Win32 Window identifier.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
void Draw(Option_t *="") override
Default Draw method for all objects.
Pixel_t GetSelectedFgndColor() const
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
const char * GetString() const
virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw string.
static const TGFont * fgDefaultFont
static TGGC * fgDefaultGC
UInt_t fTWidth
width of entry text
void Activate(Bool_t a) override
Make entry active (highlight picture).
const TGPicture * GetPicture() const
const TGPicture * fPic
entry picture
Bool_t fActive
true if active
TGDimension GetDefaultSize() const override
Return default size of tree listbox entry.
FontStruct_t fFontStruct
font
UInt_t fTHeight
height of entry text
TGString * fPath
entry path
static const TGGC & GetDefaultGC()
Return default graphics context.
const TGString * GetText() const
GContext_t fNormGC
entry drawing context
~TGTreeLBEntry() override
Delete tree listbox entry.
TGSelectedPicture * fSelPic
selected picture
TGString * fText
entry description
void Update(TGLBEntry *e) override
Update text and picture of a listbox entry.
TGTreeLBEntry(const TGWindow *p=nullptr, TGString *text=nullptr, const TGPicture *pic=nullptr, Int_t id=-1, TGString *path=nullptr, GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), UInt_t options=kHorizontalFrame, Pixel_t back=GetWhitePixel())
Create a tree (i.e.
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
void DrawCopy(Handle_t id, Int_t x, Int_t y) override
Redraw the tree listbox entry on pixmap/window.
void DoRedraw() override
Redraw the tree listbox entry.
ROOT GUI Window base class.
const TGWindow * fParent
Parent window.
virtual void SetWindowName(const char *name=nullptr)
Set window name.
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual const char * Getenv(const char *env)
Get environment variable.
virtual TList * GetVolumes(Option_t *) const
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.