32 #include "RConfigure.h" 55 static struct Lbc_t
gLbc[32];
71 Error(
"TGTreeLBEntry",
"icon not found for entry %s", text->
GetString());
84 int max_ascent, max_descent;
143 int max_ascent, max_descent;
165 return TGDimension(isize.fWidth + lsize.fWidth + 4,
166 TMath::Max(isize.fHeight, lsize.fHeight) + 2);
236 const char *curdrive =
"";
237 if (volumes && curvol) {
254 gLbc[idx].fId = 1000;
255 gLbc[idx].fIndent = 0;
256 gLbc[idx].fFlags = 0;
263 gLbc[idx].fId = 1000;
264 gLbc[idx].fIndent = 1;
265 gLbc[idx].fFlags = 0;
273 gLbc[idx].fId = 1000;
274 gLbc[idx].fIndent = 1;
275 gLbc[idx].fFlags = 0;
280 gLbc[idx].fId = 2000;
281 gLbc[idx].fIndent = 1;
282 gLbc[idx].fFlags = 0;
287 gLbc[idx].fId = 3000;
288 gLbc[idx].fIndent = 1;
289 gLbc[idx].fFlags = 0;
295 gLbc[idx].fId = (idx+1) * 1000;
296 gLbc[idx].fIndent = 1;
297 gLbc[idx].fFlags = 0;
307 gLbc[idx].fId = (idx+1) * 1000;
308 gLbc[idx].fIndent = 1;
309 gLbc[idx].fFlags = 0;
312 if (volumes && curvol) {
315 while ((drive = (
TNamed *)next())) {
316 if (!strcmp(drive->
GetName(), curdrive))
331 gLbc[idx].fId = (idx+1) * 1000;
332 gLbc[idx].fIndent = 0;
333 gLbc[idx].fFlags = 0;
341 gLbc[idx].fPixmap = 0;
342 gLbc[idx].fId = (idx+1) * 1000;
343 gLbc[idx].fIndent = 0;
344 gLbc[idx].fFlags = 0;
346 for (i = 0;
gLbc[i].fPath != 0; ++i) {
347 if (strstr(
gLbc[i].fPath,
"$HOME") != 0) {
349 int hlen = strlen(homeDir);
350 int blen = hlen + strlen(
gLbc[i].fPath) - 3;
352 strlcpy(p, homeDir, blen);
353 strlcat(p, &
gLbc[i].fPath[5], blen-strlen(&
gLbc[i].fPath[5]));
354 delete []
gLbc[i].fPath;
367 if (strstr(
gLbc[i].fPath,
"$ROOTSYS") != 0) {
371 int hlen = strlen(rootSys);
376 int blen = hlen + strlen(
gLbc[i].fPath) - plen + 1;
378 strlcpy(p, rootSys, blen);
379 strlcat(p, &(
gLbc[i].fPath[plen]), blen-strlen(&
gLbc[i].fPath[plen]));
381 int npos = hlen + strlen(&(
gLbc[i].fPath[plen]));
383 delete []
gLbc[i].fPath;
396 for (i = 0;
gLbc[i].fName != 0; ++i) {
397 if (
gLbc[i].fFlags) {
398 indent = 4 + (
gLbc[i].fIndent * 10);
400 if (!pic)
Error(
"TGFSComboBox",
"pixmap not found: %s",
gLbc[i].fPixmap);
415 char dirname[1024], mpath[1024];
416 const char *tailpath = 0;
417 int i, indent_lvl = 0, afterID = -1, sel = -1;
421 for (i = 0;
gLbc[i].fPath != 0; ++i)
425 for (i = 0;
gLbc[i].fName != 0; ++i) {
426 if (
gLbc[i].fFlags) {
427 int slen = strlen(
gLbc[i].fPath);
428 if (strncmp(path,
gLbc[i].fPath, slen) == 0) {
430 sel = afterID =
gLbc[i].fId;
431 indent_lvl =
gLbc[i].fIndent + 1;
432 if ((len > 0) && ((path[slen] ==
'\\') || (path[slen] ==
'/') ||
434 tailpath = path + slen;
435 strlcpy(mpath,
gLbc[i].fPath, 1024);
442 if (tailpath && *tailpath) {
443 if ((*tailpath ==
'/') || (*tailpath ==
'\\')) ++tailpath;
447 const char *semi = strchr(tailpath,
'/');
448 if (semi == 0) semi = strchr(tailpath,
'\\');
450 strlcpy(dirname, tailpath, 1024);
451 picname =
"ofolder_t.xpm";
453 strlcpy(dirname, tailpath, (semi-tailpath)+1);
454 picname =
"folder_t.xpm";
456 if ((mpath[strlen(mpath)-1] !=
'/') &&
457 (mpath[strlen(mpath)-1] !=
'\\')) {
458 strlcat(mpath,
"/", 1024-strlen(mpath));
460 strlcat(mpath, dirname, 1024-strlen(mpath));
461 int indent = 4 + (indent_lvl * 10);
463 if (!pic)
Error(
"Update",
"pixmap not found: %s", picname);
465 new TGString(dirname), pic, afterID+1,
472 if (semi == 0)
break;
486 out << std::endl <<
" // file system combo box" << std::endl;
487 out <<
" TGFSComboBox *";
492 out <<
");" << std::endl;
499 if (option && strstr(option,
"keep_names"))
500 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");" << std::endl;
virtual const char * GetName() const
Returns name of object.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual UInt_t GetOptions() const
static TGGC * fgDefaultGC
virtual TGFrame * GetContainer() 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.
virtual const char * HomeDirectory(const char *userName=0)
Return the user's home directory.
const TGResourcePool * GetResourcePool() const
static const TGFont * fgDefaultFont
static Pixel_t fgWhitePixel
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
virtual void InsertEntry(TGString *s, Int_t id, Int_t afterID)
static Pixel_t fgDefaultSelectedBackground
virtual void DrawCopy(Handle_t id, Int_t x, Int_t y)
Redraw the tree listbox entry on pixmap/window.
const TGString * GetText() const
virtual ~TGTreeLBEntry()
Delete tree listbox entry.
void Draw(Option_t *="")
Default Draw method for all objects.
const Mask_t kPointerMotionMask
virtual TGDimension GetDefaultSize() const
Return default size of tree listbox entry.
const TGPicture * GetPicture() const
The TNamed class is the base class for all named ROOT classes.
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.
Pixel_t GetSelectedFgndColor() const
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 const char * Getenv(const char *env)
Get environment variable.
static Pixel_t fgBlackPixel
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 Activate(Bool_t a)
Make entry active (highlight picture).
const Mask_t kButtonPressMask
R__EXTERN TSystem * gSystem
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
static struct Lbc_t gLbc[32]
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual void Update(const char *path)
Update file system combo box.
virtual void DoRedraw()
Redraw the tree listbox entry.
char * StrDup(const char *str)
Duplicate the string str.
const char * GetString() const
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a file system combo box as a C++ statement(s) on output stream out.
virtual void AddEntry(TGString *s, Int_t id)
const Mask_t kButtonReleaseMask
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
FontStruct_t GetFontStruct() const
virtual void Update(TGLBEntry *e)
Update text and picture of a listbox entry.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
TGSelectedPicture * fSelPic
static const TGGC & GetDefaultGC()
Return default graphics context.
virtual Int_t GetSelected() const
Short_t Max(Short_t a, Short_t b)
virtual TList * GetVolumes(Option_t *) const
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
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 Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw string.
virtual const char * GetTitle() const
Returns title of object.
virtual void SetWindowName(const char *name=0)
Set window name.
const char * Data() const