Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » Small Upp gems. Native icons in TreeCtrl
Re: Small Upp gems. Native icons in TreeCtrl. (Now Linux&Win) [message #18502 is a reply to message #18448] |
Sat, 04 October 2008 14:39 |
|
koldo
Messages: 3360 Registered: August 2008
|
Senior Veteran |
|
|
Dear all
Thank you for waiting... Now it works also in Linux.
The function is:
Image NativeFileIcon(const char *path, bool folder)
{
#if defined(PLATFORM_WIN32)
if (folder)
return GetFileIcon(path, true, true);
else
return GetFileIcon(path, false);
#endif
#ifdef PLATFORM_POSIX
bool isdrive = folder && ((path == "/media") || (path == "/mnt"));
FindFile ff(path);
return isdrive ? PosixGetDriveImage(ff.GetName())
: GetFileIcon(path, ff.GetName(), folder, ff.GetMode() & 0111);
#endif
}
It is also necessary to add this in FileSel.h
#if defined(PLATFORM_WIN32)
Image GetFileIcon(const char *path, bool dir, bool force = false)
#endif
#ifdef PLATFORM_POSIX
Image GetFileIcon(const String& folder, const String& filename, bool isdir, bool isexe);
Image PosixGetDriveImage(String dir);
#endif
And as I have explained in the first post, go to FileSel.cpp and in the definition remove "= false" from:
Image GetFileIcon(const char *path, bool dir, bool force = false)
This is only a simple patch I have found useful. But it would be great if the FileSel developer could integrate this inside the code. Thank you very much to him/her.
Best regards
Koldo
Best regards
IƱaki
|
|
|
Goto Forum:
Current Time: Tue May 07 05:19:37 CEST 2024
Total time taken to generate the page: 0.02205 seconds
|