Fix and improve DPI handling in wxStyledTextCtrl.
Fix cursor size after DPI change.
Enable handling DPI events in wxSTCPopupWindow and other popup windows
(that do not inherit from wxTopLevelWindow).
Some cleanup of STC example, and add option to select drawing
technology.
See https://github.com/wxWidgets/wxWidgets/pull/1885
This function basically only exists in order to be used in this handler,
so extend it to allow doing it by adding wxAnimationCtrlBase argument to
it, allowing it to create wxAnimation object compatible with the given
control.
This reduces code duplication and, incidentally, makes GetAnimation()
more useful for any user-defined XRC handlers.
It contained a single function which can be defined in xh_animatctrl.cpp
instead as it's only used there anyhow, and this file has no more reason
to exist, as "adv" library itself doesn't exist any longer.
This allows to write code using this function without any preprocessor
checks.
It should arguably be added to wxBitmapBase to ensure that it's
available in all ports, but should be done together with UseAlpha(),
which is not quite trivial, so leave it for later.
This is consistent with the current behaviour of GetSizeFromTextSize()
and the behaviour of GetBestSize() before the changes in this branch.
This is still not consistent with the behaviour of the other ports, but
this will be addressed later, by replacing the currently hardcoded 5.
Note that calling usedRectForTextContainer: here was apparently wrong in
any case because we were not sure to have already performed a layout and
we should have had a call to ensureLayoutForTextContainer: before it to
make it actually work. However, this made it work "too well" because it
then correctly returned potentially very big sizes for the text controls
containing a lot of text, which is not what we need here, as explained
in the comment added by this commit.
This could easily result in infinite recursion, as it is very natural to
implement DoGetBestSize() in terms of GetSizeFromTextSize() and, in
fact, our own implementation of the generic wxSpinCtrl did exactly this.
Avoid such problems by only calling GetSizeFromTextSize() from
DoGetBestSize(), but not in the other direction.
This shouldn't have any effect on the returned size values.
This reverts the changes of 63bcc669d8 (fixing setting initial value
under osx_cocoa for single line text controls, 2009-10-01) and fixes the
problem which this commit probably tried to fix in a different way,
using the same approach as in 98f5315405 (Don't set initial label in
wxNativeWindow on OS X, 2016-04-29) as the real root of the problem was
that the text set in CreateTextControl() was overwritten later when the
label was set from SetPeer().
This change means that the text is now set correctly before SetPeer()
calls SetInitialSize() call, which makes it possible to set the correct
initial size based on the initial text, as will be done in later
commits.
It also makes Cocoa port more consistent with iOS one, as a nice side
effect.
Mention that RecalcSizes() shouldn't be called any more, after the
changes of 622deec262 (Replace wxSizer::RecalcSizes() with
RepositionChildren(), 2015-10-11), and that RepositionChildren()
replacing it shouldn't be directly called neither.
The old version resulted in
error: this condition has identical branches [-Werror=duplicated-branches]
| (dlg ? typeid(*dlg) : typeid(T)).name());
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
from gcc 10 when compiling with -O2.
Change the code to avoid using this condition entirely: not only this
avoids the warning, but it also makes it unnecessary to make
wxGetDialogClassDescription() function a template, so should result in
slightly faster compilation and smaller code size too.
No real changes.
The correct condition for adding the extra border to the buttons that
would be clipped without it due to the bezel style used for them is to
check that their height is < 20, as SetBezelStyleFromBorderFlags(),
which determines the bezel to use, does, and not if their width is 16,
as this is not the same thing, especially for non-square buttons.
Closes https://github.com/wxWidgets/wxWidgets/pull/1887
It's not really clear why do we have this function at all, but
SetMinSize() name is more clear and consistent with wxWindow, so prefer
using it instead.
This function explicitly accepts ASCII strings only, so it's limited to
"const char*", but was incorrectly documented as taking wxString.
Closes https://github.com/wxWidgets/wxWidgets/pull/1879
After a DPI change, the position of the popup is wrong. It is not shown at the
cursor position anymore.
The correct size and position are calculated by scintilla, and there is no easy
way to access this without modifying scintilla sources.
This way, other windows (like wxPopupWindow) will also be able to handle DPI events.
Override InheritAttributes() and use it to set the initial DPI values.
wxSYS_ANSI_FIXED_FONT uses 'Courier' font, which is rendered small on high DPI displays.
Use wxFONTFAMILY_TELETYPE instead, which will use font 'Courier New'.
Adjusting the zoom level does not work correctly. It could lead to ever
increasing zoom.
Instead, set the correct DPI of the underlying device context.
There is no reason to use wxMutex and wxCondition in C++11 programs as
they have about the same API as the corresponding standard classes but
are, well, non-standard.
wxThread API is different from std::thread, so it's a less obvious
replacement, but still at least mention the standard class in its
documentation.
Get rid of the unnecessarily complicated functions doing two quite
different things depending on whether their first boolean parameter was
true of false.
Instead, split their body between AutoSize{Columns,Rows}() (which used
to call them) and DoGetBestSize(), keeping just the part needed in each
case.
This is much simpler and even more efficient, as it avoids a completely
unnecessary call to CalcDimensions() and Refresh() from DoGetBestSize(),
which doesn't change the current size at all and so doesn't need to
refresh anything, but previously did it and not only once, but twice,
because both of SetOrCalc{Column,Row}Sizes() did it.
Remove needless subtraction of row/column label size before adding it
back again, as this seems completely unnecessary.
No real changes, this is just a simplification.
In the case when a listctrl is clicked outside of any item, the item is
visually deselected, and it is logical that a DESELECTED is sent.
For non-virtual lists this would happen, but for virtual lists it would
either happen or not happen depending on implementation (MSW/generic)
and mode (single/multi). From now on the DESELECTED event is always sent.