[openbeos] Re: Icon Artwork

  • From: "Jonas Sundström" <jonas@xxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Mon, 31 Jul 2006 21:02:00 +0200 CEST

"Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx> wrote:
> Mat Hounsell <mat_geek@xxxxxxxxxxxx> wrote:
> > I know it is not in R5 but could we have a find_icon
> > function like find_directory?
> > 
> > It could just return an icon for common things, like
> > all of alert and folders, apps, etc based on an enum.
> > 
> > One for mime types and one for nodes would be
> > desirable but less important.
> 
> You can already have that in BeOS; icons can be stored
> with the MIME type, and they can also be retrieved this way.
> This is where most of  the icons you see in Tracker come 
> from. There is absolutely no need for a find_icon() AFAICT.

Yes, mime types and nodes are already covered, API-wise, and unless we 
want themed icon sets for common things (part of Mat's suggestion) like 
open/save/undo/etc in toolbars, there's no need for another funtion, 
and even so, there's no pressing need for a new API, since the same 
functionality can be had from BMimeType::GetIcon() -if- we invent a new 
set of mime types (a naming convention) similar to Be's URL mimetypes, 
with the sole purpose of being keepers of the current set of icons 
available for toolbars and other widgets. The "current theme", 
essentially.

One nice aspect of that is that apps (or widgets themselves) can 
subscribe to theme changes through BMimeType. 
(BMimeType::StartWatching())  Pretty standard.

The only drawback I see is the icon size being fixed. :P
Perhaps Stippis new "vectopia" will make that less of
a problem? ´:) Anyway. Just an idea.

/Jonas Sundström.         www.kirilla.com

PS: A little mini-article below. Feel free to correct it.


** How to get the icon of a specific node ** 
       (node = a file, folder or symlink)

BNodeInfo::GetTrackerIcon() can be used in, say, a BeOS file manager. 
It will get you an icon for the node regardless of the underlying 
filesystem. For files on BFS and other possible filesystems where files 
can have mime and icon attributes, it should get you the same icon as 
Tracker displays. (I'm not sure it does for all possible cases. I hope 
I remember it incorrectly.) The icon lookup sequence is documented 
here:

http://www.beunited.org/bebook/The%20Storage%20Kit/NodeInfo.html#GetTrackerIcon()


** How to get the icon of a mime type or supertype ** 

BMimeType::GetIcon() is useful when you haven't got a node (in which 
case you can't use BNodeInfo), for example in an FTP client, or in 
BeShare. To display icons for the files you need to know the filetypes, 
and sniffing the files can be costly, so you're likely to first look up 
whether or not the filename extensions match registered mimetypes and 
get their icons. One can of course follow up with sniffing. BeShare 
displays the local mimetype icons for remote files, IIRC, but at least 
the other end provides the mimetypes, unlike FTP. 

http://www.beunited.org/bebook/The%20Storage%20Kit/MimeType.html#GetIcon()



Other related posts: