In the process of fixing #22374 by using native best sizes, empty fields
were getting a small, but positive best width, this broke the trigger
for using default widths for empty fields, so fix this by checking that
the width is big enough and not just zero in DoGetSizeFromTextSize().
See #23295.
Closes#23250.
Add more static casts to avoid harmless warnings about long and/or
size_t to unsigned int conversions and enable -Wshorten-64-to-32 in the
allheaders test to ensure they don't get introduced again in the future.
Add an explicit cast from ptrdiff_t to unsigned int to avoid the
warning which is harmless because the difference here is bound by the
cache size.
See #23297.
Do _not_ provide a valid HBITMAP for them, as this seems to break
measuring such items by not using our WM_MEASUREITEM handler at all.
Note that we could also use HBMMENU_CALLBACK for the bitmap, which also
fixes the problem, but it seems better to just not do anything at all.
Closes#23230.
Co-Authored-by: Jacob Gillespie <jacobgillespie@gmail.com>
There is no real need to document this, it's not a valid enum value and
having it in this file without a trailing comma was a syntax error.
Closes#23298.
This didn't look good with the icon on the left, so left-justify the
text too, which also seems to be much more standard under MSW, where
this dialog is probably going to be used most often.
Use iterators to make RepositionChildren() O(N) instead of O(N^2) it was
before because Item() performs a linear search in the list.
While this shouldn't matter much with a typical number of items, it's
still better to avoid O(N^2) algorithms and it doesn't cost anything
here -- in fact, using iterators makes the code shorter and simpler.
The existing test with this name only checked wxFlexGridSizer::Layout()
and the base class uses a different implementation, which merits its own
unit test.
Add GetChildNode() helper and give more information in the assert
message generated there if the index is invalid, notably the value of
the index itself.
No real changes, this is just a small code simplification and quality of
debugging improvement.
Asserting that a pointer is non-null before dereferencing it is useless
as if it were null, we'd crash anyhow.
In this particular case, the pointer is guaranteed to never be null
because we only call Item() if the index passed to it is valid, so the
assert can never be triggered.
No real changes, just replace the loops using iterators explicitly to
use range-for instead as this makes the code shorter and more clear.
Note that there are still other loops, that need the iterators (usually
to delete the item corresponding to it) remaining.
The call to wxNativeFontInfo::InitFromFont(), added to
wxFontRefData::Alloc() in 74c0fe6dcc (Serialize font style correctly in
Mac wxNativeFontInfo, 2022-04-28), lost the existing values of the
underline and strike-through attributes that are not represented by
CTFont and so resulted in some underlined fonts being actually rendered
without underline.
Fix this by explicitly preserving and restoring these attributes before
and after calling InitFromFont().
Also remove the unneeded assignment to m_info, as InitFromFont() already
fully reinitializes it anyhow.
Closes#23264.
We need to switch to custom-drawing the box if we stop using
WS_EX_COMPOSITED as WS_EX_TRANSPARENT doesn't work correctly without it
(the background is not being painted correctly), so do this by
overriding the new MSWOnDisabledComposited() which is now called by
MSWDisableComposited() if/when it actually does disable it.
Adding such function was discussed a few times in the past and it's
going to be needed by wxWidgets itself in the next commit, so do add it,
finally, so that it could also be used from the application code too.
Unfortunately the fact that is on when wxStaticBox is created doesn't
guarantee that it remains on when it is painted later, as
MSWDisableComposited() could be called in the meanwhile, breaking the
redraw of the box.
Conservatively fix this by just always painting the box ourselves, but
mention a possibly better solution.
This wasn't fixed by 61c28b35e1 (Apply workaround to all sibling
children, not just the first one, 2023-02-20) because the change to
calling MSWDisableComposited() on the window itself, rather than the
static box, was accidentally omitted from it.
This fixes wxCollapsiblePane appearance inside a wxNotebook in wxMSW, as
it now correctly uses wxNotebook (white) background instead of the
default (light grey) one.
Closes#23274.
Although @see was used predominantly, a few places used @sa which is
equivalent to it but less readable, so switch to using @see everywhere.
No real changes.
Store data passed to AddTool() in wxAuiToolBarItem and provide
wxToolBar-like functions for setting and getting this pointer.
See #23276.
Closes#23271.
Use GetCanonicalWithRegion() (instead of LocaleTag) in the Windows
implementation of method wxLanguageInfo::TrySetLocale() -- as is done in
the non-Windows implementation of this method -- and to ensure that we
use the correct "uk-UA" for Ukrainian instead of the wrong (because
conflicting with the UK English) "uk".
See #23269.
Closes#23210.
Since the changes of ce1ee46b0c (Use wxRadioButton in MSW wxRadioBox
implementation, 2022-12-24) the control could be too small because we
only accounted for the extra static box margins in two directions (top
and left) but not the two other ones.
Fix this by adding the border around the buttons in all directions and
also increasing its size to preserve more or less the same appearance as
before.
Closes#23267.
We formatted the value with lesser precision than was used for
displaying it, resulting in unexpected display. Fix this by reducing the
number of digits used in the source (because they're lost anyhow when
formatting using the default precision) and the precision used when
displaying the number.
Closes#23192.
After the grandparent commit we don't need to use 3 states for
m_hasNonBoxChildren any longer and it can become a simple "bool".
No real changes, this is just a simplification.