Friday, May 30, 2008

Displaying Gruff Graphs in RubyCocoa v2

After getting the last post to be as minimal as possible and popping a window using RubyCocoa I wanted something more complete...

There were lots of little goals here:
a) Add a real icon (I assumed this was drag-n-drop in IB or XCode, not so much, but it is simple) b) dynamically generate an interesting icon at run-time (this is actually really easy) c) generate "interesting random" graphs for gruff.

Solution a) Edit the
Info.plist and set the CFBundleIconFile entry to an appropriately created .icns file

Solution b) in some method (I chose awakeFromMib) simply fetch the currently running application thusly: @thisApp = OSX::NSApplication.sharedApplication and call the setApplicationIconImage method with and NSImage (BOOM!)

Solution c) trivial

I've done all of those things in the
attached code

No comments:

Powered By Blogger