I''m working on my first wxRuby project.
Because the example files are on a different drive, I copied the
wxruby.png icon file to the same directory as my ruby program.
The titlebar icon and Taskbar icon (I''m on a WinXP machine) showed up
fine.
When I substitute an alternate 32x32 .png image, it doesn''t:
# Give the frame an icon. Try an alternate to the default wxruby
icon
icon_file = File.join( File.dirname(__FILE__)+"/",
"slate.png")
# icon_file = File.join( File.dirname(__FILE__)+"/",
"wxruby.png")
self.icon = Wx::Icon.new(icon_file)
When I open wxruby.png in Photoshop Elements, it seems a normal 32x32
png file with transparency. If I save slate.png in the .ico format,
WinXP does use it, but seems to shrink it to 24x24 or maybe 16x16 or
something smaller in both the toolbar and Taskbar, but shows a very
clear and crisp image in the Task Switcher (alt-Tab), which is clearly
larger than the toolbar icon. (In other words, it looks like the Task
Switcher is using it at 32x32.)
I know that icons in various sizes are needed, and the art folder in the
examples has the wxRuby image in 64x64, 128x128 and 256x256 sizes in
addition to the 32x32 .png. I''ve also read somewhere that WinXP expects
a 16x16 for the toolbar.
When people say "use .png for the icon" so that it can be used
cross-platform, there seems to be another layer of information I''m
missing. Where can I find out more about what wxRuby or wxWidgets
expects?
Thanks,
Roger Sperberg
rsperberg at gmail
--
Posted via http://www.ruby-forum.com/.
On 23/04/2010 17:10, Roger Sperberg wrote:> I know that icons in various sizes are needed, and the art folder in the > examples has the wxRuby image in 64x64, 128x128 and 256x256 sizes in > addition to the 32x32 .png. I''ve also read somewhere that WinXP expects > a 16x16 for the toolbar. > > When people say "use .png for the icon" so that it can be used > cross-platform, there seems to be another layer of information I''m > missing. Where can I find out more about what wxRuby or wxWidgets > expects? >In the documentation, though it''s nowhere that someone new and asking the very sensible questions that you ask would find it. The same question puzzled me for a long time using wxWidgets, until I pretty much stumbled on (part of) the answer. Frame inherits it #set_icon (or #icon=) method from Wx::TopLevelWindow. TLW also has a method #set_icons/#icons= which accepts an object of class Wx::IconBundle. IB can contain multiple icons at different sizes, for use in different places. http://wxruby.rubyforge.org/doc/toplevelwindow.html#TopLevelWindow_seticons The next question you might have on icons, since you''re trying out on OS X, is why set_icon(s) doesn''t affect an app''s Dock icon. This is because wxWidget''s treats the OS X Dock as analogous to the system tray on Windows, so you use Wx::TaskBarIcon instead. Under Apple''s interface guideliens, the area next to the clock is reserved for system apps - not user apps. So the answer to your question is "in several different places". This ml is happy to help, and I''ve learnt a vast amount from responses to wxPython and wxWidgets questions. A search term with class and method names according to C++ / Python conventions can be fruitful, eg: http://www.google.co.uk/search?q=wxframe+SetIcon+different+sizes best alex