wxWindowsArtProvider and MSWGetBitmapForPath()

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
Rocketmagnet
Experienced Solver
Experienced Solver
Posts: 84
Joined: Wed Aug 09, 2006 11:14 pm
Location: London
Contact:

wxWindowsArtProvider and MSWGetBitmapForPath()

Post by Rocketmagnet »

I am modifying the wxGenericDirCtrl class to add the Windows folders "Desktop", "My Documents", etc., and I would like them to have the correct icons.

Image

Presumably, the way to get the correct icons is to use something like MSWGetBitmapForPath(). However, I wonder if that's the 'right' way to do it. Should I be using a wxArtProvider like wxWindowsArtProvider ?

If so, I can't quite see how, since wxArtProvider has no function taking a path as an parameter.

Also, I tried using MSWGetBitmapForPath() directly, but it didn't compile. Firstly there's no header file to prototype this function. Then, even if I add a prorotype in my .cpp file, I get a linker error in my application, because it can't find the function. Presumably it's in one of the libraries that I'm not linking in, but I'm not sure which library it's in. All of which make me think I'm not supposed to use that function.

What's the best way to go about what I'm trying to achieve?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4183
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxWindowsArtProvider and MSWGetBitmapForPath()

Post by PB »

There obviously is no such function called MSWGetBitmapForPath(). For starters, all global wxWidgets functions have "wx" prefix. A simple search in the include/wx folder confirms that no such public function declaration exists.

Hence, the simplest thing is probably just to copy all the code from artmsw.cpp.

If you want the control to be more like File Explorer and you care only about Windows, you may be better of using the native IExplorerBrowser control, see e.g. https://github.com/PBfordev/wxExplorerBrowser
Post Reply