[fxruby-users] FXFileList & default icons

Juraj Sujan juice at sofy.sk
Sun Aug 29 23:06:53 EDT 2004


Hello,

I'm developing the simple file manager using FXFileList. I
don't know how to override the default filelist icons for
directory/file/application with my own icons. There are no
methods/functions to do that. I looked into the cpp fox code
of FXFileList and there are (in constructor) initialized
these variables:


big_folder=new FXGIFIcon(getApp(),bigfolder);
mini_folder=new FXGIFIcon(getApp(),minifolder);
big_doc=new FXGIFIcon(getApp(),bigdoc);
mini_doc=new FXGIFIcon(getApp(),minidoc);
big_app=new FXGIFIcon(getApp(),bigapp);
mini_app=new FXGIFIcon(getApp(),miniapp); 

The icon streams are from icons.cpp. As far as I can
understand, these default icons cannot be customized. Maybe
in cpp but I don't know how it could be done through FXRuby.
 At the beginning I thought I could do it through
associations but it seems to me like these variables have
nothing to do with them. In fact these icons are the
fallback icons, in case there are no defined assotiations.
See the code later in FXFileList.cpp:

      // Assume no associations
      fileassoc=NULL;

      // Determine icons and type
      if(item->state&FXFileItem::FOLDER){
        big=big_folder;
        mini=mini_folder;
        extension="File Folder";
        if(associations)
fileassoc=associations->findDirBinding(pathname.text());
        }
      else if(item->state&FXFileItem::EXECUTABLE){
        big=big_app;
        mini=mini_app;
        extension="Application";
        if(associations)
fileassoc=associations->findExecBinding(pathname.text());
        }
      else{
        big=big_doc;
        mini=mini_doc;
        extension=FXFile::extension(pathname).upper();
        if(!extension.empty()) extension+=" File";
        if(associations)
fileassoc=associations->findFileBinding(pathname.text());
        }

      // If association is found, use it
      if(fileassoc){
        extension=fileassoc->extension;
        if(fileassoc->bigicon) big=fileassoc->bigicon;
        if(fileassoc->miniicon) mini=fileassoc->miniicon;
        // FIXME use open icons also, useful when dragging
over directory
        }
 
Have anybody some solution for this ? Thanks.

Juraj Sujan
juice at sofy.sk



More information about the fxruby-users mailing list