32#include "RConfigure.h"
55static 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;
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) {
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;
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 const char * HomeDirectory(const char *userName=0)
Return the user's home directory.
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.
Short_t Max(Short_t a, Short_t b)