Once I have an icns file in plist, how do I use it?

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
jdc3
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Mar 30, 2017 6:00 pm

Once I have an icns file in plist, how do I use it?

Post by jdc3 »

Hello,

Apologies upfront for noob question. I've been using widgets on Windows and Linux for more than a few year. Just recently wanted to get into OSX. I'm having a hell of a time figuring out how to call the icns file once its part of my app bundle. There are no MWEs, at least that I saw, that show something to the effect of

MyToolBar->AddTool(MENU_FILTER_UNDO,_T("undo"),wxICON(undo));

for an icon imported on Windows as #include "resources/undo.xpm"

I've tried calling the icns directly, included in my osx folder, like this SetIcon(wxIcon("takeTwo.icns")); While there are no errors, it doesn't do anything. Ultimately, I just want to use the icns files as icons on the frame to link to events.

Thanks for any help.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Once I have an icns file in plist, how do I use it?

Post by ONEEYEMAN »

Hi,
Welcome to the wonderful world of OSX. ;-)
Did you try and build the 'minimal' sample under OSX?
It does have both a Makefile and XCode project (empty one).

Thank you.
jdc3
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Mar 30, 2017 6:00 pm

Re: Once I have an icns file in plist, how do I use it?

Post by jdc3 »

Thanks for the suggestion. I did make the toolbar sample which DOES have icons in the toolbar but it uses XPM Bitmaps. That solution is fine for now and I've been able to get that to work in other applications but I still don't have a sense for how the plist and ICNS file works to place the icon on the toolbar.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Once I have an icns file in plist, how do I use it?

Post by doublemax »

I don't work under OSX, so i can't test any of this, but you should try wxIcon::LoadFile() with type = wxBITMAP_TYPE_ICON_RESOURCE.

Looking at the source in <wxdir>/src/carbon/icon.cpp it seems like this tries to find the icon in the app bundle.
Use the source, Luke!
Post Reply