Commit graph

74483 commits

Author SHA1 Message Date
Vadim Zeitlin
26e99e9337 Include wx/scopedptr.h in the code using wxScopedPtr<>
Don't rely on this header from being included from another header (which
won't be the case soon any more).
2023-03-06 18:36:37 +00:00
Vadim Zeitlin
f1184417a2 Remove unnecessary wxDummyConsoleApp::DoYield()
This function doesn't exist in the base class (any more) and so doesn't
need to be overridden and can be simply removed.
2023-03-06 18:07:11 +00:00
Vadim Zeitlin
67a5106dc2 Replace wxArrayPtrVoid with a std::vector in GTK wxEventLoop
No real changes, just replace wxArray with a type-safe wxVector and use
a range for loop for iterating over it.
2023-03-06 18:05:41 +00:00
Vadim Zeitlin
201089a8a1 Slightly simplify wxEntryStart() app creation code
No real changes, just combine the variable declaration and test in a
single statement.
2023-03-06 17:55:40 +00:00
Vadim Zeitlin
725c9a0bc6 Use better behaving custom validator in wxDatePickerCtrlGeneric
Using wxTextValidator with wxFILTER_INCLUDE_CHAR_LIST was both too
restrictive, as it prevented the user from entering any letters, even if
the locale format required using them for months (as e.g. nb-NO does)
and too lax, as it allowed entering any invalid date as long as it
contained only valid characters.

Fix both of these problems by using a custom validator actually using
wxDateTime::ParseFormat() for validation instead of just checking that
the string consists of valid characters (and doing it wrongly).

This validator could be more generally useful, and so could be extracted
into a public class later, but for now use it only here.

Closes #23310.
2023-03-05 01:45:58 +01:00
Vadim Zeitlin
d40e245abb Put all validator-related code inside wxUSE_VALIDATORS check
Don't bother defining a variable which is only used when
wxUSE_VALIDATORS==1 if it's 0.
2023-03-05 00:07:42 +01:00
Vadim Zeitlin
fb7cde39bc Small cleanup in wxCalendarComboPopup
Make ParseDateTime() member function const (because it doesn't modify
this object at all) and remove a useless (because it wouldn't protect
from dereferencing the null pointer just below) assert.

No real changes.
2023-03-05 00:06:07 +01:00
Vadim Zeitlin
38a0a72b71 Show date format in locale pseudo-test too
In addition to the decimal separator, show the date format for the
current locale too in wxUILocale::ShowSystem pseudo-test to check that
this works as expected.
2023-03-04 23:37:05 +01:00
Vadim Zeitlin
00b2d27224 Switch to using wxUILocale in the calendar sample
No real changes, just follow our own recommendation to use
wxUILocale::UseDefault() instead of wxLocale with wxLANGUAGE_DEFAULT.
2023-03-04 16:47:08 +01:00
Vadim Zeitlin
5f486a0806 A better fix for installing cffi in Ubuntu 18.04 CI builds
Install its binary package from Ubuntu repositories directly instead of
installing libffi-dev to compile it ourselves later, as was done in the
previous commit. This is faster and also fixes the remaining problem in
the CI job using gcc 4.8 as this compiler can't be used to build cffi
because it uses -Wdate-time option incompatible with it.
2023-02-28 20:06:39 +01:00
Vadim Zeitlin
66a39d7230 Fix installing httpbin in Ubuntu 18.04 CI builds
For some reason the wheel (i.e. binary package) that was installed by
python3-pip 9.0.1-2.3~ubuntu1.18.04.6 before is not installed by the
latest 9.0.1-2.3~ubuntu1.18.04.7 version of it which has just appeared
in Ubuntu 18.04 repositories, and cffi is now built as part of the
module installation, see the following pseudo-diff between the old
successful and the new failing builds:

- Downloading https://files.pythonhosted.org/packages/3a/12/d6066828014b9ccb2bbb8e1d9dc28872d20669b65aeb4a86806a0757813f/cffi-1.15.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
+ Downloading https://files.pythonhosted.org/packages/2b/a8/050ab4f0c3d4c1b8aaa805f70e26e84d0e27004907c5b8ecc1d31815f92a/cffi-1.15.1.tar.gz

And building this module requires libffi, so install it.
2023-02-28 18:58:52 +01:00
Vadim Zeitlin
937b068815 Draw borders for scrollable windows in wxGTK too
In many themes tree view window doesn't have a border, and so none of
our windows using wxHSCROLL and/or wxVSCROLL styles had it neither, even
if they didn't have wxNO_BORDER style.

Fix this by using the same border as is used for the entry widget (which
usually does have it) for all windows, not just those without scroll
styles.

In particular, this fixes the problem with the missing border for
wxListCtrl (which uses scrolling).

Closes #23236.
2023-02-28 18:28:39 +01:00
Vadim Zeitlin
1a314b4e10 Merge branch 'msw-about'
Improve "About" dialog appearance under MSW.

See #23294.
2023-02-28 18:26:26 +01:00
Blake-Madden
809d2918cc Document wxSplitterWindow::SetSashPosition() argument better
Explain the special meaning of 0 and negative values in this function.

Closes #23299.
2023-02-28 00:38:36 +01:00
Vadim Zeitlin
2c530fa513 Merge branch 'fix-shorten-64-to-32-warn'
Fix clang warnings about truncating 64 bit ints to 32 bits.

See #23301.
2023-02-27 16:08:55 +01:00
Stefan Csomor
fa23d607e9 Fix initial width of wxTextCtrl in wxOSX
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.
2023-02-27 16:06:59 +01:00
Vadim Zeitlin
7bad8b1060 Fix more -Wshorten-64-to-32 occurrences and test for them
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.
2023-02-27 13:47:57 +01:00
Stefan Csomor
e49b791ca9 Fix background of shaped frames under macOS
Don't set it to avoid overriding the "clear background" used for shaped
windows.

Closes #23286.

See #23296.
2023-02-25 23:02:41 +01:00
Hartwig Wiesmann
313a415e2e Fix harmless warning in wxString in wxUSE_UNICODE_UTF8 build
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.
2023-02-25 22:51:47 +01:00
Vadim Zeitlin
1e98812a56 Fix menu width for owner-drawn items using bitmap in wxMSW
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>
2023-02-25 21:46:03 +00:00
Vadim Zeitlin
5b6b644e8b Remove wxSYS_COLOUR_MAX from documentation
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.
2023-02-25 21:51:14 +01:00
Vadim Zeitlin
fdef316f40 Update wxAboutDialog screenshot under MSW after recent changes 2023-02-24 00:42:13 +00:00
Vadim Zeitlin
020aff8a7f Don't use "Copyright" word in wxAboutDialog under MSW
MSW platform convention is to show just "© whatever" instead of
"Copyright © whatever" in the "About" dialogs, so make it simpler to
conform to it but still keeping using the word under the other
platforms, where it usually is included, by removing the "Copyright"
word under MSW only in wx code.
2023-02-24 00:42:13 +00:00
Vadim Zeitlin
a0a49f5391 Make wxGenericAboutDialog look more similar to MSW message box
Use white background for the upper part to mimic the message box
appearance.
2023-02-24 00:42:13 +00:00
Vadim Zeitlin
ff0a255a80 Replace wxGenericAboutDialog::Init() with member initialization
No real changes, just modernize the code a bit.
2023-02-23 19:07:25 +00:00
Vadim Zeitlin
964f2ee0c5 Stop centering text in the generic "About" dialog
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.
2023-02-23 19:03:59 +00:00
Vadim Zeitlin
ef47a04769 Merge branch 'sizer-cleanup'
Clean up and modernize sizer code without any real changes.

See #23291.
2023-02-23 18:09:34 +01:00
Vadim Zeitlin
dcfe387102 Add checks for Scintilla and Lexilla submodules to configure too
Hopefully this will save some time to people building wx from Git.

Closes #23290.
2023-02-23 18:07:19 +01:00
Vadim Zeitlin
860cc7913b Use compound assignment for clarity
Make it more clear that we increment "x" and "y" in wxGridSizer code.

No real changes.
2023-02-23 15:37:33 +00:00
Vadim Zeitlin
0935e330da Avoid using Item() in a loop in wxGridSizer::RepositionChildren()
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.
2023-02-23 15:37:33 +00:00
Vadim Zeitlin
a0380723ff Loop over columns first in wxGridSizer::RepositionChildren()
No real changes, just inverse the two loops in preparation for further
changes.

This commit is best viewed with Git --color-moved option.
2023-02-23 15:37:33 +00:00
Vadim Zeitlin
7ae9e9b974 Add test really checking wxGridSizer::Layout()
The existing test with this name only checked wxFlexGridSizer::Layout()
and the base class uses a different implementation, which merits its own
unit test.
2023-02-23 15:37:32 +00:00
Vadim Zeitlin
46bfb43d21 Centralize index checking in wxSizer code
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.
2023-02-23 15:37:32 +00:00
Vadim Zeitlin
ab14eecb17 Remove useless assert from the sizer code
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.
2023-02-23 00:35:42 +00:00
Vadim Zeitlin
c8adb54029 Use range-for loops in wxSizer code
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.
2023-02-23 00:35:42 +00:00
Vadim Zeitlin
00ea032483 Merge branch 'collpane-bg'
Fix collapsible pane background inside a wxNotebook in wxMSW.

See #23278.

Closes #23274.
2023-02-23 00:32:55 +00:00
Vadim Zeitlin
3d21a14f95 Merge branch 'msw-statbox-compositing'
Many fixes for handling elements not using wxStaticBox as parent inside
wxStaticBoxSizer.

See #23259.

Closes #23182, #23239.
2023-02-23 00:31:02 +00:00
Vadim Zeitlin
8b5f049315 Fix losing underline/strike-through in wxFont in wxOSX sometimes
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.
2023-02-22 17:27:25 +01:00
Vadim Zeitlin
6f5703a885 Fix wxStaticBox drawing after disabling composition for parent
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.
2023-02-21 18:53:11 +00:00
Vadim Zeitlin
8687a0bad9 Add wxWindow::CallForEachChild()
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.
2023-02-21 18:53:11 +00:00
Vadim Zeitlin
18002cf6ca Use custom painting in wxStaticBox even with double buffering on
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.
2023-02-21 16:31:34 +00:00
Miguel Gimenez
609bcb633a Document that wxAuiToolBar::AddTool() does support client data
This is the case after the changes of 9f55d568c2 (Add support for client
data to wxAuiToolBar, 2023-02-20).

Closes #23283.
2023-02-21 17:08:58 +01:00
Vadim Zeitlin
674bfb5e5a Really fix using sibling wxOwnerDrawnComboBox in wxStaticBoxSizer
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.
2023-02-21 14:43:17 +00:00
Vadim Zeitlin
8505c48a34 Cancel in progress builds of PRs when a new one starts
Add a snippet based on the example in

https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow

to all CI workflows to cancel the currently running build when a new one
starts. This should ensure that we don't keep building the old version
of the PR after a new one has been pushed.
2023-02-21 14:58:57 +01:00
Vadim Zeitlin
0becef5591 Remove unnecessary argument from wxGenericCollapsiblePane code
No real changes, just don't specify wxDefaultSize explicitly when it's
the default value for size anyhow.
2023-02-20 22:12:47 +00:00
Vadim Zeitlin
6bdac08b75 Allow parent background to show through wxCollapsibleHeaderCtrl
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.
2023-02-20 22:11:23 +00:00
Vadim Zeitlin
95f16e63d2 Consistently use @see in Doxygen documentation
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.
2023-02-20 23:02:18 +01:00
Miguel Gimenez
9f55d568c2 Add support for client data to wxAuiToolBar
Store data passed to AddTool() in wxAuiToolBarItem and provide
wxToolBar-like functions for setting and getting this pointer.

See #23276.

Closes #23271.
2023-02-20 22:59:03 +01:00
Vadim Zeitlin
996f1f5415 Update Circle CI workflow to get Scintilla submodules
This is necessary since 3ed5e42441 (Merge branch 'scintilla-5.0' of
https://github.com/MaartenBent/wxWidgets, 2023-02-20).

See #23117.
2023-02-20 18:43:35 +01:00
Ulrich Telle
a0be352a3f Fix setting locale to wxLANGUAGE_UKRAINIAN
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.
2023-02-20 18:32:03 +01:00