ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-mac
tcl-mac
Re: [MACTCL] Access Mac-specific system icons from Tk
by Kevin Walzer other posts by this author
Oct 17 2005 9:30AM messages near this date
Re: [MACTCL] Access Mac-specific system icons from Tk | Re: [MACTCL] Access Mac-specific system icons from Tk
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jim,

I've done a bit more digging into this question about native icons,
including recompiling Tk with "icns" replacing "cicn" in the
tkMacOSXBitmap.c file. That yields no change, I still can't load any
native icons. However, I noticed that the icon bitmaps in this file all
seem to be based on resource files (cicn, ICON): that's also what you
indicated. But aren't resource files more or less obsolete on Tiger?

I loaded the "tclresource" extension (for dealing with resource files
under OS X) into Wish and here is the output of a few operations:

% resource open ~/Desktop/Wish.icns
file does not contain resources in any fork

% resource list
%

The "icns" file has no resource data at all, as far as I can see. And,
at least based on what the extension tells me, there are no loaded
resources running in memory.

That would explain why loading "-bitmap application" into a label, for
instance, returns white space: it's looking for a resource file (cicn?)
and not finding any. Because "application" is defined as a native bitmap
in tkMacOSXBitmap.c, calling the "-bitmap application" reference doesn't
return an error.

I've even tried resetting Tk to use QuickDraw instead of CoreGraphics,
as the "cicn" resources are based on QD, correct? Still nothing.

At this point, my conclusion is that the code in tkMacOSXBitmap.c needs
to be updated--as to how, I'm not sure yet. I am going to look at the
Icon Services API more closely to try to understand this better. What
would be ideal is for Tk to be able to read .icns as native bitmaps, so
that a command such as [image create bitmap foo -file foo.icns] would
"just work." I don't know how or where the .icns file format is
documented, however, and will have to delve into that as well.

Whether my work on this will take the form of a patch to
tkMacOSXBitmap.c or a separate "tkIcns" extension remains to be determined.

Any advice is appreciated.

Cheers,

Kevin Walzer, PhD
WordTech Software - "Tame the Terminal"
http://www.wordtech-software.com
sw at wordtech-software.com

Jim Ingham wrote:
| TkAqua is (trying) to use the Icon Services to fetch and draw the
| system icons.  Look at tk/macosx/tkMacOSXBitmap.c.
| TkpCreateNativeBitmap is where the icons are explicitly fetched. I am
| pretty sure this worked at one point on X, but I can't swear to  that.
| It's not a very flexible facility either, it just finds  whatever Icon
| resources are currently loaded
|
| It would be nice to have a facility to do some fancier things with
| Icons (like looking up the icon for a document type from
| LaunchServices, etc...)  I bet most of this stuff would have at least
| Windows equivalents.  But if you want to, cooking something like this
| up on X would be great and very useful.  Then if somebody was
| motivated, they could try to do it for Windows as well.
|
| Jim
|
|
| On Oct 9, 2005, at 2:35 PM, Kevin Walzer wrote:
|
| Well, a quick perusal of the developer documentation shows this API:
|
| http://developer.apple.com/documentation/Carbon/Reference/
| IconServices/index.html
|
| Looks like this is what I would need to work with in terms of  generating
| a Tcl/Tk wrapper for accessing system icons, if there isn't already  the
| capability to do so in Tk Aqua.
|
| Basically, I want to be able to browse a directory, i.e. glob, and
| automatically call the correct bitmap as defined for the system for a
| specific file or folder. I don't want to do a lot of hacks converting
| system icons to .gifs or .pngs, which is what I'm doing now in the  code
| I'm playing with.
|
| Jim or Daniel, is this something that would be useful? A "TkIcns"
| package perhaps? Or is there a way programatically to do this already?
|
|
| Cheers,
|
| Kevin Walzer, PhD
| WordTech Software - "Tame the Terminal"
| http://www.wordtech-software.com
| sw at wordtech-software.com
|
| Kevin Walzer wrote:
| | Thanks for pointing this out, but it appears to be obsolete:
| doesn't the
| | Macintosh platform refer to the Classic MacOS?
| |
| | This sample code produces a blank frame:
| |
| | % frame .w
| | .w
| | % pack .w
| | % label .w.label1 -text "label" -bitmap application
| | .w.label1
| | % pack .w.label1
| | %
| |
| | Kevin
| |
| | Jon Guyer wrote:
| | |
| | | On Oct 9, 2005, at 12:58 PM, Kevin Walzer wrote:
| | |
| | |>  Anyone know ... b) where I
| | |>  can find "GetBitmap.3.html" to see the documentation?
| | |
| | |
| | | man GetBitmap
| | |
| | |
| | | -------------------------------------------------------
| | | This SF.Net email is sponsored by:
| | | Power Architecture Resource Center: Free content, downloads,
| discussions,
| | | and more. http://solutions.newsforge.com/ibmarch.tmpl
| | | _______________________________________________
| | | Tcl-mac mailing list
| | | Tcl-mac@[...].net
| | | https://lists.sourceforge.net/lists/listinfo/tcl-mac
| | |
| | |
|
| -------------------------------------------------------
| This SF.Net email is sponsored by:
| Power Architecture Resource Center: Free content, downloads,
| discussions,
| and more. http://solutions.newsforge.com/ibmarch.tmpl
| _______________________________________________
| Tcl-mac mailing list
| Tcl-mac@[...].net
| https://lists.sourceforge.net/lists/listinfo/tcl-mac
|
|
|> 
|> 
- -------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads,
discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Tcl-mac mailing list
Tcl-mac@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-mac
|> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDU9EWJmdQs+6YVcoRAh+zAJ9iINrg56aXnwDdVhXkbbGPDR3EZACdEkxW
CwfE7EH8aTMSOtctYo/F6h4=
=PgSm
-----END PGP SIGNATURE-----


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Tcl-mac mailing list
Tcl-mac@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-mac
Thread:
Kevin Walzer
Kristoffer Lawson
Jon Guyer
Kevin Walzer
Kevin Walzer
Jim Ingham
Kevin Walzer
Kevin Walzer
Kevin Walzer

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved