Don't take the value of "mask" parameter of wxImageList constructor too
prescriptively, it predates support for alpha in wxWidgets by many years
and was never meant to actually suppress using it.
Instead, do the best thing we can in all cases, i.e. use alpha if it's
specified and supported and use mask otherwise. But only create the mask
from light grey colour if we have nothing else if "mask" is true in
wxImageList constructor, as this is a potentially destructive action
that must not be performed if the user has explicitly decided to set
this parameter to false.
Incidentally fix handling of alpha with comctl32.dll v5 (which is used
in the absence of any manifest) by converting it to a mask in this case:
this is not ideal, but better than just using black background as it
happened before, and restores pre-3.1.5 behaviour.
Also simplify the generic version which just has to create the default
mask if necessary and doesn't have to do anything at all in all the
other cases.
Note that these changes required relaxing some of the existing unit
tests as wxMSW implementation now can add alpha channel to the bitmaps
that didn't have it -- but this is a more useful behaviour, and so it
makes more sense to adapt the tests to it rather than doing a less
useful thing just to conform to the tests.
This commit is best viewed with git --color-moved
--color-moved-ws=ignore-all-spac options.
Closes#22349.
Allow reusing the code for creating a mask from wxImage mask from
elsewhere.
No real changes yet, this is a just a refactoring.
This commit is best viewed with git --color-moved
--color-moved-ws=ignore-all-space options.
Add information about the recommended way of using wxFrame
as a form, i.e., to not create the input controls as its
direct children but use wxPanel for this instead.
Closes#22395.
Increase usable scrolling range in wxMSW by a factor of 10,000 by
switching to handling the device origin in wxWidgets itself instead of
letting GDI handle it.
See #22382.
Reuse the same code for handling mouse events for both rows and columns
instead of duplicating almost (but not quite) the same code for both of
them.
As part of resolving the inconsistencies between the two versions, add
wxEVT_GRID_ROW_AUTO_SIZE corresponding to the existing event with the
same name for the columns.
Closes#22380.
Use 1992 as the initial date for all non-Mac files, instead of using
slightly later years for some of them without any good reason (or at
least without any good reason still remembered by anybody).
This also allows to simplify the script for updating the year.
On macOS everything is based on 72DPI, while the SVG is based on 96DPI.
As a result, fonts in point-size are too big and squeezed together (due too
textLength).
Fix this by taking the standard screen DPI into account in FromDIP and ToDIP,
so all coordinates and sizes will be in SVG DPI.
wxSVGFileDC should be created with a DIP size, so use FromDIP to get the
correct viewBox size and clear-rectangle size.
Just spell out "Quit Application" and "Hide Application" as is,
without string concatenation.
Translating individual words can be complicated with some languages.
This change affects the case when wxTheApp is NULL, which presumably
is quite rare.
Closes#22384.
Even the normally safe internalYToRow() and internalXToCol() functions
can still return an invalid index when the grid is empty, i.e. when
there are no valid indices at all, so check for their return value
before using it as an argument to Get{Row,Col}Pos() that would
(correctly) assert when passed an invalid value.
This fixes a regression inadvertently introduced by 3719ab3725 (Add
support for rearranging wxGrid rows order interactively, 2022-04-02)
which added non-trivial GetRowPos().
Standardize on a single loop for all versions of it and prefer to use
"for" loops with the iterator increment directly in the loop statement
instead of using "while" loops with the increment somewhere inside the
loop, where it could be possibly skipped by a "continue" statement.
No real changes.
Debugging confirms that DPtoLP() simply returns wrong (i.e. different
from that returned under actual MSW) result when using Wine, so just
account for it in the test as it seems to be better than just skipping
the test entirely under Wine and there doesn't seem to be anything else
to do.
It's not enough to just shift the result by the origin shift if there is
a transform matrix, we need to apply the reverse shift transformed by
this matrix in general.
This is not very efficient as we redo the same matrix operations on
every call, but using both device origin shift and transform matrix
together should be quite rare, so it's not clear if it's worth
optimizing this.
Only translate the labels in the native message box if there is a valid
current wxTranslations instance: this is simpler and more robust than
checking if the current language is different from the system language.
Closes#22383.
Using GDI functions for the device origin translation limits the
scrolling range to 2^27 size of the device space in the controls using
PrepareDC(), as it works by adjusting the device origin, and this may be
too small when having many (millions) of rows, which is perfectly
possible with wxDataViewCtrl or wxGrid, for example.
So handle DC device origin translations ourselves in wxMSW, i.e. offset
the coordinates by device origin before passing them to the native
functions as this allows to use the full 32-bit range.
Closes#17550.
This allows to see that the grid is currently not redrawn correctly
under MSW when it has more than ~6,000,000 rows due to overflowing the
device space span of 2^27.
Some cleanup in wxDC code: remove unnecessary casts, use RAII helpers
instead of manual memory and other resources management.
No real changes.
See #22378.
Instead of defining a manifest for each individual CPU architecture, use
a single manifest with an asterisk for the architecture.
Should have been part of 77d8926126 (Simplify Windows application
manifests, 2021-12-17).
Closes#22376.
Make wxDC and wxGraphicsContext DPI aware, i.e. add {From,To}DIP() to
them too and make the values returned from Get{DPI,PPI}() consistent
with wxWindow.
Also improve CMake build: add support for finding Cairo when not using
GTK, fix a warning when creating the inplace-config, and mark some
variables as advanced.
See #22346.
No real changes, just put this non-wx-prefixed class in an unnamed
namespace to avoid any clashes with user-defined classes (which would be
possible when using wx as a static library).
Update similar code in all ports to use wxScopedArray for arrays of
points, dashes etc in various wxDC implementations instead of using
new[] and delete[] manually.
No real changes, just make the code safer and shorter.
No real changes, just make the code updating the bounding box slightly
shorter by providing convenient and slightly higher-level overloads.
For now these functions are only in wxDCImpl, it's not clear if we
really need them in wxDC, so don't add them to the public API.
It seems that ListView_ApproximateViewRect() always reserves space for
the horizontal scrollbar vertically, even when it isn't needed,
resulting in a lot of blank space remaining in horizontal wxListbook
(e.g. using "top" orientation) in the notebook sample.
So instead of adding extra space when the scrollbar is shown, remove it
when it is not shown.
It looks like ListView_ApproximateViewRect() doesn't actually take the
borders into account and doesn't even take margins into account
correctly.
With this change, vertical wxListbook in the notebook sample doesn't
show any horizontal scrollbar and has symmetric margins around its
contents (whether it shows a vertical scrollbar or not) under both
Windows 7 and 10.
The style needs to be explicitly included in the serialized
representation as it's not necessarily part of the native font
description itself, but can be emulated using a transform matrix.
Also fix the font family handling by recreating the native font info
from the newly generated font.
Closes#22373.
Fix a regression in 3.1.6 which resulted in not showing any images if
the associated image list was empty when it was associated with the
control, as HasImages() returned false in this case and so wxLC_ICON
style was not set.
The fix is to return true from HasImages() if we have image list even if
it is currently empty, as we can't know when (or if) it will become
non-empty and it's better to assume that it will be used (as nothing
really catastrophic should happen if it is not used, finally) rather
than not taking into account the images added to it later.
Closes#22364.
macOS 12 doesn't provide "Courier" and "Times" fonts any longer, so use
their closest replacements "Courier New" and "Times New Roman" instead.
In addition to using them for our own default fonts, also map
user-provided fonts with the old names to the new ones, as in practice
quite a few applications specify these face names rather than relying on
wxFontFamily and it seems better to allow them to keep working correctly
under macOS 12+ rather than using a completely different default system
font when e.g. "Courier" is specified.
Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>
Closes#22355.