Commit Graph

26 Commits

Author SHA1 Message Date
Vadim Zeitlin
108108e54e Add wxArtProvider::Get[Native]DIPSizeHint()
Also add "wxWindow* win = NULL" argument to the existing functions to
convert from DIPs using the given window instead of the default DPI
scaling factor.

Closes #22022.
2022-03-24 21:35:26 +01:00
Vadim Zeitlin
024c231624 Replace multiple RescaleBitmap() with wxBitmap::Rescale()
Define a single function and use it in both wxArtProvider and (the
generic implementation of) wxSearchCtrl instead of repeating the same
code elsewhere.

Note that another, but slightly different, version of RescaleBitmap()
still remains in wxPropertyGrid.

Deprecate undocumented wxArtProvider::RescaleBitmap() which is
completely useless now.

No real changes, this is just a refactoring.
2021-09-24 00:30:02 +02:00
Vadim Zeitlin
69e48f036b Add wxApp::GetMainTopWindow() wrapper
This trivial function just allows to avoid checking if wxTheApp is not
null before calling GetTopWindow() on it.

Replace the existing "wxTheApp && wxTheApp->GetTopWindow()" calls with
wxApp::GetMainTopWindow().

No real changes.
2021-03-07 23:51:54 +01:00
PB
f57f214122 Remove BCC-specific hdrstop pragma from everywhere 2020-10-12 21:58:37 +02:00
Maarten Bent
f74d756ca5 Use DPI Aware wxGetSystemMetrics
If no wxWindow is known, use wxTheApp->GetTopWindow().
Also use a wxWindow for all wxSystemSettings::GetMetric calls.
2019-07-15 00:00:18 +02:00
Vadim Zeitlin
1d72f6af7e Fix wxMSW build in non-Unicode mode
Convert WCHAR to TCHAR explicitly in this case.

Closes #18320.
2019-01-05 00:01:09 +01:00
Vadim Zeitlin
ea28f00cb8 Do load SHDefExtractIcon() during run-time for old MinGW
The problem with MinGW 5.3 is not just due to the missing function
declaration in the header, but also due to the function missing from
libshell32.a import library, so we do need to load it during run-time,
contrary to what the comment in the previous commit said.

This should finally fix MinGW build.
2018-11-20 15:29:43 +01:00
Vadim Zeitlin
99247910b9 Declare SHDefExtractIcon() if it's missing from (MinGW) headers
At least the MinGW 5.3 used for AppVeyor builds doesn't declare this
function, so provide its declaration ourselves to fix MinGW build after
the recent changes.
2018-11-19 16:14:58 +01:00
Vadim Zeitlin
3169524864 Don't destroy the HICON returned by SHDefExtractIcon() twice
Surprisingly, this doesn't seem to result in any ill effects, but
passing HICON to wxIcon already ensures that this HICON will be
destroyed in wxIcon dtor, so we shouldn't call ::DestroyIcon() on it
manually.
2018-11-18 23:10:07 +01:00
Vadim Zeitlin
8e740c69cd Initialize icon using InitFromHICON() instead of CreateFromHICON()
The former avoids an unnecessary call to ::GetIconInfo() done by the
latter to retrieve the icon size, as we already have the size here.
2018-11-18 23:09:01 +01:00
Vadim Zeitlin
262124ca1b Remove unnecessary bitmap size check in wxWindowsArtProvider
This "sizeNeeded" is always fully specified as we explicitly use a
fallback size if the input size wasn't, so there is no need for checking
this.
2018-11-18 22:47:29 +01:00
Vadim Zeitlin
49d8491518 Refactor the code to use a wrapper for SHDefExtractIcon()
Avoid duplicating the same code in MSWGetBitmapForPath() and
CreateBitmap().

This also incidentally fixes SHDefExtractIcon() return value check,
which was inverted, in MSWGetBitmapForPath().
2018-11-18 22:43:17 +01:00
Markus Juergens
8698d69c77 Return the best-sized icons from wxWindowsArtProvider
Use SHDefExtractIcon() to retrieve the most appropriately-sized icon
instead of always getting either the small or the large icon and then
scaling it ourselves to make it of the right size.

This results in incomparably better results for large icon sizes, e.g.
256*256, as can be seen in the artprov sample.
2018-11-18 22:34:40 +01:00
Markus Juergens
880b2b0a46 Use icons of correct sizes for wxART_FOLDER in wxMSW
Don't restrict the sizes to just small or large icons but extract the
icon closest to the requested size using SHDefExtractIcon().
2018-11-18 21:16:00 +01:00
Markus Juergens
d5cd939db7 Use native art for PRINT and XXX_FILE art IDs under MSW
These art IDs have natural native equivalents, so do use them.
2018-11-18 20:58:57 +01:00
Maarten Bent
e99af740d9 Make wxArtProvider icon size hints DPI aware 2018-05-17 20:20:06 +02:00
Paul Cornett
9b19a6e529 use wxOVERRIDE in wxMSW sources 2016-09-23 07:59:11 -07:00
Artur Wieczorek
03d9c427e0 Fix size of some bitmaps returned by wxWindowsArtProvider.
Bitmaps obtained using SHGetStockIconInfo can have only some predefined sizes.
If size of the retrieved bitmap doesn't correspond to the needed size or the
size given by wxArtProvider::GetNativeSizeHint() then the bitmap should be
rescaled appropriately.

Closes #17071.

Closes https://github.com/wxWidgets/wxWidgets/pull/64
2015-08-08 01:08:14 +02:00
Artur Wieczorek
244ec264af Factor out duplicated code for bitmap scaling in wxArtProvider.
Move duplicated code responsible for rescaling bitmaps in wxArtProvider to the
shared wxArtPrvider::RescaleBitmap() method.

Additionally, make this new method work even in wxUSE_IMAGE==0 case.

See #17071.

See https://github.com/wxWidgets/wxWidgets/pull/64.
2015-08-08 01:04:46 +02:00
Paul Cornett
36e31e515e avoid shadowed variable warnings with VS2015 2015-07-24 20:56:11 -07:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Vadim Zeitlin
f29b59b781 Use more native icons in wxMSW wxArtProvider.
Use SHGetStockIconInfo() and SHGetFileInfo() to look up some icons.

Closes #15068.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73593 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-03-02 12:11:47 +00:00
Vadim Zeitlin
0d68cd1359 Add standard art providers at the bottom of the art providers stack.
This ensures that any user-defined art providers will be in front of them,
even when they are added at module-initialization time i.e. possibly before
the standard ones.

Closes #12519.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70154 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-12-28 13:51:29 +00:00
Vadim Zeitlin
66d9eb612b Return (16,16) as the default list icons size in wxMSW.
The standard size of the small icons in list controls under MSW is
traditionally 16*16 so return this from wxMSW wxArtProvider.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68850 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-08-22 15:31:30 +00:00
Václav Slavík
023f27388f fix message box icons sizes in wxWindowsArtProvider: they should respect client ID and not be 32x32 all the time
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62199 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-29 17:04:08 +00:00
Václav Slavík
7abd9a0331 wxArtProvider cleanup: added artmsw.cpp accidentally missing from r56372
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56373 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-10-16 19:10:55 +00:00