Commit Graph
21481 Commits
Author SHA1 Message Date
Vadim Zeitlin 0d44e61208 Default "offset" parameter of CalculateHintRect() to zero
No real changes, just get rid of dummy "zero" variables and don't pass
the offset to CalculateHintRect(), nor DrawHintRect(), at all when it's
zero.
2024-10-27 00:19:52 +02:00
Vadim Zeitlin 42f43fd6b6 Fix fading in hints shown when dragging wxAuiNotebook pages
ShowHint() shouldn't be called directly, as it doesn't set m_hintFadeAmt
correctly and so the hint window is always shown directly, even when
wxAUI_MGR_HINT_FADE flag is set (which is the default).

Fix this by adding wxAuiManager::UpdateHint() which does update
m_hintFadeAmt and use it in wxAuiNotebook.

Also document that ShowHint() shouldn't be called directly.
2024-10-27 00:19:52 +02:00
Vadim Zeitlin 9a24f3a77a Allow setting flags of wxAuiManager used by wxAuiNotebook
Add wxAuiNotebook::SetManagerFlags() and use it in the sample to allow
testing how the different flags, such as wxAUI_MGR_HINT_FADE, affect
wxAuiNotebook behaviour.
2024-10-26 15:53:02 +02:00
Vadim Zeitlin 7b6d56f050 Remove almost empty src/generic/icon.cpp
Don't bother creating a separate object file for just a few lines of
code in the generic wxIcon implementation, just inline them into
wx/generic/icon.h.

There should be no need to ever have any non-trivial code here as
generic wxIcon is the same thing as wxBitmap anyhow.
2024-10-21 22:02:39 +02:00
Vadim Zeitlin b4fcafef92 Initialize wxSashEvent::m_dragStatus
This field could remain uninitialized, resulting in undefined behaviour
when accessing it later, as the random value it contained wasn't a valid
value for wxSashDragStatus enum.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 405b6f529d Remove wxPickerBase::OnTextCtrlDelete() which seems unnecessary
It's not clear why should we be handling wxEVT_DESTROY for our own text
control when it can only be deleted as part of deleting the picker
itself and doing it resulted in UB as we accessed wxPickerBase object
after having already destroyed it, when the text control was destroyed
when destroying its children from wxWindowBase dtor.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin a791ac7024 Initialize wxPickerBase members in their declarations
No real changes, just simplify the members initialized a little.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 2138c71e11 Deprecate wxPickerBase::SetTextCtrl() and SetPickerCtrl()
These functions can't be really used, the controls are managed by the
picker itself and using SetTextCtrl(), in particular, has no chance of
working correctly because the picker wouldn't be connected to
wxEVT_TEXT and wxEVT_KILL_FOCUS events on it, as it should be.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 4ada028064 Avoid undefined behaviour in wxScrollHelperBase ctor
Don't cast the not yet fully constructed object to wxScrollHelper when
passing it to wxWindow::SetScrollHelper() and call the latter in the
derived class ctors instead.

An alternative solution could be to store wxScrollHelperBase pointer in
wxWindow instead of wxScrollHelper, as this would be enough, but this
seems a bit ugly, as "Base" classes are supposed to be implementation
detail more than anything else, and duplicating SetScrollHelper() call
in both generic and GTK implementation doesn't seem to be that bad in
comparison.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 18ff090264 Avoid undefined behaviour in wxDataViewColumnBase ctor
Don't upcast wxDataViewColumnBase pointer to wxDataViewColumn before the
latter is constructed, this is UB.

Unfortunately this means that all the derived classes have to call
wxDataViewRenderer::SetOwner() themselves instead of relying on the base
class to do it, but the only reasonably way to avoid it would be to use
CRTP and this seems too heavy to save just a few of these calls.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin f6b4acf283 Change wxSizer::Detach(wxWindow*) to take wxWindowBase* instead
This function is called from wxWindowBase dtor to detach the window
being destroyed from the containing sizer and casting the pointer to the
object to wxWindow is UB because the object is not actually a wxWindow
any more by then.

Remove the cast and pass wxWindowBase pointer to wxSizer::Detach()
instead, as it doesn't need the full wxWindow anyhow.

Also document that any wxSizer-derived classes overriding Detach() will
need to be modified to follow this change.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin a0cf2f4b6c Initialize member of wxAuiNotebookPage
Ensure that we don't use uninitialized values of boolean member
variables when copying wxAuiNotebookPage objects, as this results in UB.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 5d10c50361 Remove cast resulting in undefined behaviour from wxDynamicCast()
Using static_cast<className*>(obj) when the object is not actually of
the given type is UB, so avoid it even if should be harmless in
practice, by simply omitting it: we only need "obj" to be a wxObject
here.

Note that this means that using wxCheckCast() or wxStaticCast() with a
type not deriving from wxObject is always UB, but there is not much that
we can do about it, so just document this explicitly.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 5156c40e1e Reset status bar pointer in wxFrameBase itself
Don't rely on wxStatusBar dtor resetting the frame status bar, this was
awkward (because the frame should be responsible for maintaining its own
state, instead of letting other classes do it) and resulted in UB when
the status bar was deleted from wxFrameBase dtor, as the cast of its
parent pointer to wxFrame was invalid by then, as the half-destructed
frame wasn't a wxFrame any more.
2024-10-21 21:23:07 +02:00
Vadim Zeitlin 942ad9b89f Avoid undefined behaviour when handling events in wxWebSessionCURL
Inherit from wxEvtHandler as the first base class, not doing it results
in using a wrong pointer when handling events.
2024-10-20 17:29:24 +02:00
Vadim Zeitlin 10181546ee Avoid undefined behaviour in signed integer shift in wxLongLong
Don't shift signed integer which can be negative, cast it to unsigned
first: as we shift it by 32 bits, it doesn't matter that it is not
sign-extended in this case.
2024-10-20 17:29:24 +02:00
Vadim Zeitlin 1712ab5c61 Initialize wxSecretStore::m_valid in its dummy implementation
In build with wxUSE_SECRETSTORE==0 the stand-in implementation of
wxSecretStore was broken (instead of just being insecure) because
objects of this type were never valid, as we forgot to set m_valid.

Thanks UBSAN for flagging access to this uninitialized variable.
2024-10-19 16:43:05 +02:00
Vadim Zeitlin 210e8a7a1c Merge branch 'drop-longlongwx'
Always use wxLongLong and always use its "native" version.

See #24891.
2024-10-19 16:27:39 +02:00
Blake-Madden 5f7d255be3 Add wxTextCtrl::SearchText() for MSW
Add new API allowing for more efficient searches in wxTextCtrl and
implement it in wxMSW only for now.

See #24756.
2024-10-18 19:32:58 +02:00
utelle 670ae7b1b0 Make macOS date picker control locale aware
Use the locale set using wxUILocale or the equivalent of the default "C"
locale (en-US) in the native date picker control instead of always using
the default user locale.

Closes #23956.
2024-10-18 19:27:34 +02:00
Vadim Zeitlin 55cd1c6438 Keep wxLongLongNative and wxULongLongNative defined
Although these types were never supposed to be used outside of wx they,
of course, were, so keep them defined for compatibility.
2024-10-18 19:26:15 +02:00
Vadim Zeitlin 7aa6da06d0 Remove wxUSE_LONGLONG and always use wxLongLong_t
All supported platforms provide 64-bit integer types since many years,
so remove the legacy wxLongLongWx implementation and rename
wxLongLongNative to just wxLongLong and always compile it in.

Note that wxLongLong itself must still be kept for compatibility as it
has member functions, such as GetValue() or ToString(), that can be used
in the existing code.
2024-10-18 19:26:15 +02:00
Vadim Zeitlin 719169c87b Avoid harmless unused parameter warning in wxiOS header 2024-10-18 18:58:44 +02:00
Vadim Zeitlin 8698e760da Merge branch 'aui-serialize'
Provide a way to store AUI layouts in any custom format.

Closes #24225.

See #24235.
2024-10-16 21:14:25 +02:00
Vadim Zeitlin 819b205b8c Merge branch 'webresponse-getheaders' of https://github.com/dinkelacker/wxWidgets
Support multiple HTTP headers with same name.

Closes #24878.

See #24881.
2024-10-16 20:51:57 +02:00
Vadim Zeitlin 9849124fae Provide a way to store AUI layouts in any custom format
Add wxAuiSerializer and wxAuiDeserializer classes and SaveLayout() and
LoadLayout() functions in wxAuiManager using them.

Show how these classes can be used to use XML for storing AUI layout in
the sample.

See #24225.
2024-10-15 23:34:43 +02:00
Vadim Zeitlin eda54e82e2 Merge branch 'dl/fix/missing_help_text_statbar' of https://github.com/mxdamien/wxWidgets
Show help text in status bar when mouse is above submenu-entry in wxMSW.

See #24874.

Closes #24842.
2024-10-15 15:09:57 +02:00
Vadim Zeitlin 3557edb36d Merge branch 'deprecate-screendc'
Deprecate wxScreenDC even more, without formally deprecating it.

See #24864.
2024-10-15 15:06:25 +02:00
Vadim Zeitlin 9c4a376367 Document that wxScreenDC doesn't work in more places
Try to make it as clear as possible that this class shouldn't be used
any longer without formally deprecating it (as it does still work in
wxMSW and, also, is still used in some of our own code).
2024-10-15 15:05:52 +02:00
Stefan Dinkelacker 8395e5733d Add support for multiple headers with same name to wxWebRequest
wxWebRequest::AddHeader() was added to accompany the existing
SetHeader() method. In wxWebSession, AddCommonHeader() did exist
already but behaved like setting a header. Its behavior was adapted
to its name and SetCommonHeader() was added with the old behavior
to accompany AddCommonHeader().

The WinHTTP and CURL implementations of wxWebRequest do now append
multiple headers of the same name. The URLSession implementation
follows in the next commits.
2024-10-15 09:15:07 +02:00
Stefan Dinkelacker ae6dc7b469 Add GetAllHeaderValues() to wxWebResponse
HTTP headers like Set-Cookie can be present multiple times in a
web response by definition. The existing GetHeader() method is
not sufficient to cope with this situation.

This commit already adds an implementation for Windows.
Linux and macOS follow in the next commits.
2024-10-14 21:36:48 +02:00
David Langhals c1e2acd9e6 MSW: Find a wxMenuItem object corresponding to a given ID by iterating through all menu entries in the MSW menu handle and pass the found wxMenuItem to the wxMenuEvent. This gives the wxMenuEvent access to all information stored in the wxMenuItem and not just its ID 2024-10-14 08:36:32 +02:00
David Langhals 74daaf8c36 Let wxMenuEvent carry an optional wxMenuItem to be able to have access to more information about the event 2024-10-14 08:27:20 +02:00
Vadim Zeitlin fcf4883653 Merge branch 'warn-more-unused' of https://github.com/lanurmi/wxWidgets
Add the wxWARN_UNUSED attribute to more classes.

See #24873.
2024-10-12 16:49:50 +02:00
Blake-Madden 27a58fe6fc Fix minor typo in wxNotebook::InsertPage() comment
No real changes.

Closes #24870.
2024-10-12 16:49:01 +02:00
Lauri Nurmi 00df4754fd Add the wxWARN_UNUSED attribute for wxDateTime 2024-10-10 20:21:38 +03:00
Lauri Nurmi 55f0b7f9a8 Add the wxWARN_UNUSED attribute for wxArrayString 2024-10-10 20:21:32 +03:00
Lauri Nurmi 0a75b8a4b7 Add the wxWARN_UNUSED attribute for wxLongLong, wxULongLong 2024-10-10 20:21:25 +03:00
Lauri Nurmi 1d0e1b69cd Add the wxWARN_UNUSED attribute for wxSize, wxRect, wx(Real)Point; remove unused 2024-10-10 20:21:18 +03:00
Lauri Nurmi a76d664283 Add the wxWARN_UNUSED attribute for wxStringTokenizer; remove unused 2024-10-10 20:21:12 +03:00
Lauri Nurmi 463d903b23 Add the wxWARN_UNUSED attribute for wxColour; remove unused 2024-10-10 20:21:06 +03:00
Vadim Zeitlin 57277a922d Merge branch 'commdlg' of https://github.com/MaartenBent/wxWidgets
Cleanup and reorder wrapcdlg.h includes, notably fixing CMake build
without PCH.

See #24860.
2024-10-10 02:39:30 +02:00
Vadim Zeitlin 1204394d31 Merge branch 'numval-empty-blank'
Fix changing value of text control using wxNUM_VAL_ZERO_AS_BLANK on focus loss.

See #24859.
2024-10-10 02:37:56 +02:00
Vadim Zeitlin 7b533eda85 Merge branch 'msw-custombg-win'
Fix wxAuiToolbar refresh after recent changes.

See #24854.
2024-10-10 02:36:03 +02:00
Vadim Zeitlin c9af454ccd Merge branch 'qt-fixes' of https://github.com/AliKet/wxWidgets
Multiple wxQt fixes, notably to allow running wxQt tests in AppVeyor.

See #24837.
2024-10-10 02:34:54 +02:00
Lauri Nurmi a73504cdc5 Enable the possibility to warn about unused wxStrings
Use the wxWARN_UNUSED attribute in wxString's definition. Compilers do not
typically warn about unused non-POD objects, but this attribute makes it
possible (on GCC and Clang).

Whether a warning is actually shown or not still depends on whether
the user has enabled warnings for unused variables in their compiler flags.
2024-10-10 02:31:51 +02:00
Lauri Nurmi a2e2bc57c9 Add macro wxWARN_UNUSED to stand for the attribute 'warn_unused'
Also known as [[gnu::warn_unused]].

Use __has_attribute to check availability of the attribute. (Is available
on recent GCC and Clang versions, not available on MSVC.)
2024-10-10 02:31:51 +02:00
Maarten Bent 9d32805ce0 Remove unused wxUSE_COMMON_DIALOGS option 2024-10-05 20:33:48 +02:00
Maarten Bent b170a58b40 Cleanup and reorder wrapcdlg.h includes
Include wrappers in a specific order so missing.h does not cause macro redefinition warnings.
When wrapcdlg.h/<commdlg.h> is not needed, include wx/msw/private.h instead.

fixes #24851
2024-10-05 20:32:02 +02:00
ali kettab d0fb89708e wxQt: Fix some compilation warnings 2024-10-04 21:51:31 +01:00