Use FromDIP() to ensure that it is not too small when using DPI scaling.
Also make the code slightly more clear by using a meaningful variable
name instead of a (duplicated) comment.
Some of them had been already updated to return the values scaled
appropriately for the current DPI in 56fab0aabb (Improve wxDataView on
DPI change, 2019-01-10), but not all, so add the missing calls to
wxDataView{Progress,IconText}Renderer too.
The change of dcdcbbe078 (Fix wxDataViewCheckIconTextRenderer icon size
with GTK3, 2020-09-17) should really apply to all platforms, especially
those with DPI-independent pixels (a.k.a. really logical pixels), such
as Mac, to have the correct icon sizes in high DPI.
These checks don't seem to make any sense at all, even though they were
there ever since this classes was added in a75124d0da (Added
wxDataViewTreeCtrl, 2007-12-01), and, in fact, were clearly harmful
until they were fixed in e6a2aa5ae3 (Show correct icon for branch nodes
in wxDataViewTreeCtrl, 2018-09-12).
But it seems that even this wasn't the right thing to do, as there
doesn't seem to be any reason to not call ItemChanged() even for the
controls not using images, so just remove them completely.
This is just a convenient wrapper for GetBitmap() that will be useful in
the classes using wxIcon in their public API to preserve compatibility
after switching to using wxBitmapBundle instead of wxIcon internally.
Embed SVG data of the wx logo into the library itself to make it
available to all wx programs, including the samples. This is a bit
wasteful, but <12KiB is not really noticeable compared to the library
size.
This is similar to the existing png2c, but works for any binary data,
not just PNG files.
Another small difference is that this script puts 16 bytes per line
instead of 8 -- this still results in reasonably short lines, but twice
shorter files, so seems to be worth it.
If the art ID is unknown, return an invalid bitmap bundle immediately
rather than returning a non-empty, i.e. apparently valid, bundle which
will be unusable later, as its GetBitmap() will always return an invalid
bitmap.
This allows to just skip using the image if wxArtProvider can't create
it, for whatever reason, rather than asserting when trying to use an
invalid bitmap later, which can often be fatal because it can often have
from wxEVT_PAINT handler and so result in reentering assert handler.
This doesn't really matter for wxMSW, as scale factor is not used by
wxIcon::GetLogicalXXX() anyhow, but it is used by GetDIPSize(), so it
seems better to still preserve it here.
This makes them available in wxIcon (and, less importantly, wxCursor)
too which is needed in order to use icons correctly in high DPI.
This is also more consistent with the other platforms, where wxIcon does
have these methods.
Document these methods in wxIcon now that they're available there under
all platforms and also document wxIcon::GetSize() which had been
available even before, but wasn't documented.
The new function has a more clear name than CreateScaled() it replaces
and uses a more useful parameter order, with the scale factor, which
must always be specified when using it, coming before, and not after,
the depth, which almost never needs to be specified and so can be left
at its default value in 99% of cases.
It seems better to round, rather than truncate, in ToPhys(), for the
same reasons as in wxBitmap::CreateScaled() (see parent commit), and
then ceil() mustn't be used in FromPhys() neither, as this would break
round-tripping via both functions.
So, finally, keep the behaviour simple and, hopefully, the least
surprising, by just rounding the result in both functions.
Round the result of the multiplication by possibly non-integer scaling
factor rather than truncating it. This is more consistent with wxMSW and
other ports not using DIPs (wxOSX doesn't matter, as the scale factor
can only be an integer there anyhow) and seems to be more useful.
E.g. previously creating a bitmap of logical size 5 at 150% DPI scaling
would create a 7px bitmap, for which GetLogicalWidth() would return 4.66
that would be truncated to 4, and not 5, when assigning it to an int,
while now a 8px bitmap will be created and both rounding or truncating
its GetLogicalWidth() value of 5.33 results in the more expected 5.
Replace old functions with the new ones in the library code itself.
Note that wxSTC and wxRichText still use GetScaledXXX(), but they're
different functions that might need to be renamed/dealt with separately.
These functions have better names than the existing GetScaledXXX() ones,
so add them to be able to use them in the new code, even if we still
keep the old ones for compatibility.
This allows to retrieve the native CPU architecture name regardless of
the current process CPU architecture.
Common examples for CPU architecture differences are the following:
- Win32 process in x64 Windows (WoW)
- Win32 or x64 process on ARM64 Windows (WoW64)
- x86_64 process on ARM64 macOS (Rosetta 2)
Closes#22036.
Create wxD2D1Factory with D2D1_DEBUG_LEVEL_WARNING only when debug
features, such as asserts, are enabled at wx level.
This is not the exact equivalent of the "Debug" build commonly used
under MSW with MSVC, but seems to be the closest equivalent, see the
discussion in #22034.
Closes#22039.
Use wxTE_RICH2 for a control that we call EnableProofCheck() on, as
using this function without this style asserts in wxMSW.
This should have been done in 5ba2461fd1 (Switch to using GSpell for
wxTextCtrl proof checker in wxGTK, 2021-09-08).
Also add a diagram showing the functions to use to convert between them,
perhaps this can be more clear than textual description.
Co-Authored-By: Stefan Csomor <csomor@advancedconcepts.ch>
In webview sample toolbar use wxBitmapBundles created from SVG files
instead of XPM bitmaps, as this results in much better appearance in
high DPI.
Closes#2642.
This reverts commit a34ab31453, reversing
changes made to 783df59e66.
Undo the addition of wxBitmapBundle support to XRC, as it is finally
going to be done in a different way soon -- but for now just remove it
to ensure that nobody starts using it before it's finalized.
See #2633.
Closes#22014.
Handle selectors corresponding to key presses, such as cancelOperation:,
ourselves because we never get the keyDown events that are supposed to
take care of generating it from the native code somehow.
This fixes cancelling editing with Escape which stopped working since
26d6f82a81 (Implement EVT_CHAR generation for wxDataViewCtrl under Mac,
2021-04-13).
Closes#17835, #2639.
Co-Authored-By: Stefan Csomor <csomor@advancedconcepts.ch>
Add some templates for GitHub issues.
These templates notably allow associating labels with the new issues,
which would be impossible otherwise.
See #22016.