I'm trying to use IDI_INFORMATION
with wxWidgets 2.8.11 (from wx/version.h) (for wxMemoryDC::DrawIcon
). But first I have to load the icon: wxICON(IDI_INFORMATION)
fails, LoadFile(wxT("IDI_INFORMATION"))
also fails ( but LoadFile(IDI_INFORMATION)
compiles and crashes, IDI_INFORMATION
is a fake string pointer too tricky for wxWidgets
). Hmmm, then I add some ifdef
s to use Windows API: ::LoadIcon(NULL, IDI_INFORMATION)
works, then wxIcon::SetHICON
. While DrawIcon
apparently works, the nasty surprise is that wxIcon::GetWidth
, wxIcon::GetHeight
return 0. Hmmm, let's get the size and use wxIcon::SetSize
. Now it is finally done... wait!, but who's gonna destroy my icon? Not sure, so add the ifdef
, SetHICON(NULL)
and DestroyIcon
.
The small question: do I have to destroy the icon myself?
The big question: is wxIcon
entirely useless in this case?
PS After some debugging I discover that LoadFile(wxT("wxICON_INFORMATION"))
works, wow!, but is it really multi-platform? Do I have read all the wx sources for drawing a standard icon?
The cross-platform solution is provided by wxArtProvider, just use its GetIcon()
method with wxART_INFORMATION
argument.