Instead of using either a wxBitmap or a wxIcon, always use the same
wxBitmapBundle object to store whatever we are rendering.
This slightly simplifies the code and prepares for further changes, but
nothing real changes yet.
This is intentional and won't be changed, although we could, perhaps,
add a wxGetDST() function or similar to make it easier to take DST into
account as well.
Closes#22399.
No real changes, just get rid of a trivial helper function which is only
used once since the changes of the previous commit and copy its code
directly into the caller.
For some reason, calls to wxGtkTreeSetVisibleProp() were skipped when
using virtual list model in wxGTK implementation, resulting in showing
the value of the previous (i.e. upper) cell for the rows of this model
for which no value was available.
Simply remove IsVirtualListModel() checks and always set the cell
visibility to fix this.
This commit is best viewed ignoring whitespace-only changes.
Don't offset the DC in the unwanted direction as this resulted in not
drawing anything at all when the grid was scrolled.
Also fix off by one error in the marker line length.
Closes#22403.
Keys such as Ctrl-C etc could be unexpectedly intercepted by
accelerators defined for the menu items when wxSpinCtrl had focus.
Fix this by always preprocessing such keys in wxSpinCtrl itself, just as
it was already done for wxTextCtrl and even reuse the same function for
doing it (which had to be factored out in order to allow it).
Closes#22404.
Ensure that the accelerators using non-English strings are recognized
properly again, provided the translations for these prefixes are
available, just as it was the case before the changes of e6abc4ca12
(Update message catalogs after adding keyboard key context, 2022-04-27)
See #22354.
Closes#22388.
There are several ways to do it, and it's not clear which one of them
should be illustrated here, but it should definitely be one that works.
Closes#22389.
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.