32#include "RConfigure.h"
56static struct Lbc_t
gLbc[32];
72 Error(
"TGTreeLBEntry",
"icon not found for entry %s",
text->GetString());
85 int max_ascent, max_descent;
144 int max_ascent, max_descent;
237 const char *curdrive =
"";
238 if (volumes && curvol) {
255 gLbc[idx].fId = 1000;
256 gLbc[idx].fIndent = 0;
257 gLbc[idx].fFlags = 0;
264 gLbc[idx].fId = 1000;
265 gLbc[idx].fIndent = 1;
266 gLbc[idx].fFlags = 0;
274 gLbc[idx].fId = 1000;
275 gLbc[idx].fIndent = 1;
276 gLbc[idx].fFlags = 0;
281 gLbc[idx].fId = 2000;
282 gLbc[idx].fIndent = 1;
283 gLbc[idx].fFlags = 0;
288 gLbc[idx].fId = 3000;
289 gLbc[idx].fIndent = 1;
290 gLbc[idx].fFlags = 0;
296 gLbc[idx].fId = (idx+1) * 1000;
297 gLbc[idx].fIndent = 1;
298 gLbc[idx].fFlags = 0;
308 gLbc[idx].fId = (idx+1) * 1000;
309 gLbc[idx].fIndent = 1;
310 gLbc[idx].fFlags = 0;
313 if (volumes && curvol) {
316 while ((drive = (
TNamed *)next())) {
317 if (!strcmp(drive->
GetName(), curdrive))
332 gLbc[idx].fId = (idx+1) * 1000;
333 gLbc[idx].fIndent = 0;
334 gLbc[idx].fFlags = 0;
342 gLbc[idx].fPixmap = 0;
343 gLbc[idx].fId = (idx+1) * 1000;
344 gLbc[idx].fIndent = 0;
345 gLbc[idx].fFlags = 0;
347 for (i = 0;
gLbc[i].fPath != 0; ++i) {
348 if (strstr(
gLbc[i].fPath,
"$HOME") != 0) {
350 int hlen = strlen(homeDir);
351 int blen = hlen + strlen(
gLbc[i].fPath) - 3;
353 strlcpy(p, homeDir, blen);
354 strlcat(p, &
gLbc[i].fPath[5], blen-strlen(&
gLbc[i].fPath[5]));
355 delete []
gLbc[i].fPath;
368 if (strstr(
gLbc[i].fPath,
"$ROOTSYS") != 0) {
372 int hlen = strlen(rootSys);
377 int blen = hlen + strlen(
gLbc[i].fPath) - plen + 1;
379 strlcpy(p, rootSys, blen);
380 strlcat(p, &(
gLbc[i].fPath[plen]), blen-strlen(&
gLbc[i].fPath[plen]));
382 int npos = hlen + strlen(&(
gLbc[i].fPath[plen]));
384 delete []
gLbc[i].fPath;
397 for (i = 0;
gLbc[i].fName != 0; ++i) {
401 if (!pic)
Error(
"TGFSComboBox",
"pixmap not found: %s",
gLbc[i].fPixmap);
416 char dirname[1024], mpath[1024];
417 const char *tailpath = 0;
418 int i, indent_lvl = 0, afterID = -1, sel = -1;
422 for (i = 0;
gLbc[i].fPath != 0; ++i)
426 for (i = 0;
gLbc[i].fName != 0; ++i) {
428 int slen = strlen(
gLbc[i].fPath);
429 if (strncmp(path,
gLbc[i].fPath, slen) == 0) {
431 sel = afterID =
gLbc[i].fId;
432 indent_lvl =
gLbc[i].fIndent + 1;
433 if ((len > 0) && ((path[slen] ==
'\\') || (path[slen] ==
'/') ||
435 tailpath = path + slen;
436 strlcpy(mpath,
gLbc[i].fPath, 1024);
443 if (tailpath && *tailpath) {
444 if ((*tailpath ==
'/') || (*tailpath ==
'\\')) ++tailpath;
448 const char *semi = strchr(tailpath,
'/');
449 if (semi == 0) semi = strchr(tailpath,
'\\');
451 strlcpy(dirname, tailpath, 1024);
452 picname =
"ofolder_t.xpm";
454 strlcpy(dirname, tailpath, (semi-tailpath)+1);
455 picname =
"folder_t.xpm";
457 if ((mpath[strlen(mpath)-1] !=
'/') &&
458 (mpath[strlen(mpath)-1] !=
'\\')) {
459 strlcat(mpath,
"/", 1024-strlen(mpath));
461 strlcat(mpath, dirname, 1024-strlen(mpath));
462 int indent = 4 + (indent_lvl * 10);
464 if (!pic)
Error(
"Update",
"pixmap not found: %s", picname);
466 new TGString(dirname), pic, afterID+1,
473 if (semi == 0)
break;
487 out << std::endl <<
" // file system combo box" << std::endl;
488 out <<
" TGFSComboBox *";
493 out <<
");" << std::endl;
500 if (option && strstr(option,
"keep_names"))
501 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");" << std::endl;
const Mask_t kButtonPressMask
const Mask_t kPointerMotionMask
const Mask_t kButtonReleaseMask
static void indent(ostringstream &buf, int indent_level)
static struct Lbc_t gLbc[32]
char * Form(const char *fmt,...)
char * StrDup(const char *str)
Duplicate the string str.
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.
virtual Int_t GetSelected() const
virtual void AddEntry(TGString *s, Int_t id)
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)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a file system combo box as a C++ statement(s) on output stream out.
TGFSComboBox(const TGWindow *p=0, Int_t id=-1, UInt_t options=kHorizontalFrame|kSunkenFrame|kDoubleBorder, Pixel_t back=GetWhitePixel())
Create a file system combobox showing system directories.
virtual void Update(const char *path)
Update file system combo box.
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.
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().
static Pixel_t fgBlackPixel
virtual TGFrame * GetContainer() const
void Draw(Option_t *="")
Default Draw method for all objects.
Pixel_t GetSelectedFgndColor() const
const char * GetString() const
virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw string.
virtual void Activate(Bool_t a)
Make entry active (highlight picture).
static const TGFont * fgDefaultFont
virtual ~TGTreeLBEntry()
Delete tree listbox entry.
static TGGC * fgDefaultGC
virtual TGDimension GetDefaultSize() const
Return default size of tree listbox entry.
virtual void DoRedraw()
Redraw the tree listbox entry.
const TGPicture * GetPicture() const
TGTreeLBEntry(const TGWindow *p=0, TGString *text=0, const TGPicture *pic=0, Int_t id=-1, TGString *path=0, GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), UInt_t options=kHorizontalFrame, Pixel_t back=GetWhitePixel())
Create a tree (i.e.
virtual void Update(TGLBEntry *e)
Update text and picture of a listbox entry.
static const TGGC & GetDefaultGC()
Return default graphics context.
const TGString * GetText() const
virtual void DrawCopy(Handle_t id, Int_t x, Int_t y)
Redraw the tree listbox entry on pixmap/window.
TGSelectedPicture * fSelPic
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
virtual void SetWindowName(const char *name=0)
Set window name.
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
virtual TObject * At(Int_t idx) const
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.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
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)