Commit graph

20819 commits

Author SHA1 Message Date
Vadim Zeitlin
f072544bd5 Assume sigaction::sa_handler always takes "int"
This is the standard and there doesn't seem to be any contemporary
systems where this is not the case. The configure check for it was
originally added in 101c20d554 (attempting to fix sa_handler signature
for IRIX, 2000-04-01), but IRIX is not supported/doesn't exist any
longer, so don't waste time on checking for this.

The real motivation for this change is that the test failed in CMake
builds, showing just

-- Performing Test wxTYPE_SA_HANDLER_IS_INT - Failed

in the log and then resulting in -fpermissive warnings when assigning
wxFatalSignalHandler to sa_handler and it's simpler to just remove the
check than to debug it.

See #23664.
2023-06-30 00:26:19 +01:00
Vadim Zeitlin
de0595108a Merge branch 'bmp-dataobj-fix'
Fix crash when using wxDataObjectComposite and other clipboard-related
cleanup.

See #23659.
2023-06-30 00:20:12 +01:00
Vadim Zeitlin
0e14cf19d1 Merge branch 'border-fixes'
Various border-related fixes for wxMSW.

See #23644.
2023-06-30 00:19:00 +01:00
taler21
eae24cc3b2 Fix bitmap returned from wxAuiToolBarItem::GetDisabledBitmap()
Return the disabled bitmap and not the normal one.

This fixes a regression introduced in 9a5123afed (Use wxBitmapBundle in
wxAuiToolBar and wxAuiPaneInfo too, 2021-11-14).

Closes #23666.
2023-06-27 19:16:40 +02:00
Vadim Zeitlin
89930c9e5e Deprecate old wxMSW-specific clipboard functions
Formally deprecate these functions that shouldn't be used since a couple
of decades already.
2023-06-20 21:13:45 +01:00
Vadim Zeitlin
8a95a93a1d Remove wxUSE_OLE_CLIPBOARD and always use OLE for wxClipboard
It doesn't make sense to keep the old and almost never used alternative
wxClipboard implementation which has known fatal bugs (such as casts of
wxDataObject that could be wxDataObjectComposite to wxBitmapDataObject,
see #23564) when wxUSE_OLE is never going to be disabled anyhow.

Note that this means wxSetClipboardData() function doesn't exist at all
any longer when previously it was available in the wxUSE_OLE==0 builds.
As the official builds always used wxUSE_OLE==1, this doesn't look like
a huge loss, but if needed, we could add it back later and reimplement
it in terms of wxClipboard::SetData().
2023-06-20 21:00:59 +01:00
Vadim Zeitlin
d5ef9d4387 Add wxGenericAboutDialog::GetCustomControlParent()
This function should be used to get the parent for the custom controls
instead of relying on them being reparented under it by the code added
in the last commit.

Change the type of m_contents to be wxWindow and not wxPanel as it
doesn't really matter, but wxPanel is not fully declared in this header
while wxWindow is.
2023-06-20 19:19:49 +02:00
Vadim Zeitlin
a249e21f65 Fix scrollbar creation for Mac windows not using standard peer
This avoids crash if wxVSCROLL or wxHSCROLL is used with wxGLCanvas
which calls wxWindow::Create() after calling DontCreatePeer() because
the Create() tries to use the not (yet) existent peer in
MacCreateScrollBars().

Avoid this problem by moving the call to MacCreateScrollBars() to
MacPostControlCreate(), which doesn't change anything for the windows
that do not call DontCreatePeer(), but ensures that the peer already
exists by the time MacPostControlCreate() is called for those that do.

Closes #23536.
2023-06-18 17:41:05 +02:00
Vadim Zeitlin
f88c9b7fb7 Make wxWindowMSW::TranslateBorder() non-virtual
It doesn't seem like it is meant to be overridden, so don't imply that
it should be possible to do it and make it non-virtual.

Also rename to DoTranslateBorder() to make it more clear that this is a
private function and not part of the public API.

Finally, improve its comment and never return wxBORDER_THEME from this
functions if themes support is off.
2023-06-16 16:22:40 +01:00
Vadim Zeitlin
4f54919bda Remove overridden wxWindowMSW::GetDefaultBorder()
It simply called the base class function, so just don't override it in
the first place.

No real changes.
2023-06-16 15:55:59 +01:00
Vadim Zeitlin
a89577e8a4 Deprecate useless wxWindow::GetDefaultBorderForControl()
This function was added back in a047aff270 (Added wxBORDER_THEME,
wxWindow::GetDefaultBorderForControl(), wxWindow::CanApplyThemeBorder(),
2007-08-07) but seems to have been made completely unnecessary by
dc797d8e1b (More border rationalisation. GetDefaultBorder is now mostly
defined in base class files., 2007-11-13) soon afterwards and never did
anything other than returning wxBORDER_THEME, with no explanation as to
when it might be useful to override it not to do it.

It also doesn't seem to be really used anywhere outside wxWidgets and
has never been documented, so make it non-virtual and deprecate it to
avoid confusion and simplify things.
2023-06-16 15:55:35 +01:00
Bill Su
7420ab1b26 wxMFCApp::PreTranslateMessage: Give msg to MFC before wxWidgets
because wxWidgets wxGUIEventLoop::PreProcessMessage() seems to
always report that it has consumed msg.

fix #23574
2023-06-11 01:56:21 -04:00
Richard Powell
6c35c708d5 Fix -Wdeprecated-copy warnings when building in C++20 mode
Avoid implicit copy constructor warnings by using
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY/wxDECLARE_NO_ASSIGN_DEF_COPY
instead of wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN.

Closes #23625.

Closes #23626.
2023-06-10 17:02:13 +02:00
Vadim Zeitlin
d80887f302 Merge branch 'listctrl-dark-win11'
Fixes for wxListCtrl drawing under Windows 11 in dark mode and drawing
when using WS_EX_COMPOSITED.

See #23608.
2023-06-05 15:32:58 +02:00
Vadim Zeitlin
4c8ec0ed5d Revert "Add wxWindow::MSWAfterReparent() virtual function"
This reverts commit cd637663c8 (Add wxWindow::MSWAfterReparent() virtual
function, 2022-10-16) and removes wxListCtrl::MSWAfterReparent() added
in ff629f3853 (Fix drawing wxListCtrl since enabling double buffering by
default, 2022-10-16) which is not used any more now.
2023-06-05 14:30:56 +01:00
Brian Nixon
567a66aac2 Remove dependency of wxUSE_SOCKETS on wxUSE_STOPWATCH
It isn't actually needed, so don't check for it in wx/chkconf.h and
remove the comment claiming that it is from various setup.h files.

Closes #23609.
2023-06-05 15:13:21 +02:00
Vadim Zeitlin
456449bcc1 Support wxWinVersion_11 in the private wxGetWinVersion() helper
This can be more convenient to use than public functions and it's just
better to support all Windows versions in this function too.
2023-06-05 00:55:53 +01:00
Vadim Zeitlin
5546733c12 Merge branch 'qt-dc-clip' of https://github.com/AliKet/wxWidgets
Fix wxDC and wxGCDC clipping in wxQt.

See #23600.
2023-06-05 01:47:15 +02:00
Vadim Zeitlin
4c94d5d1e5 Merge branch 'dark-statusbar'
Fixes for status bar and dialog grippers appearance in dark mode.

See #23602.
2023-06-03 22:20:32 +01:00
Vadim Zeitlin
e95073c24b Merge branch 'init-keyevent-repeat'
Ensure that wxKeyEvent::m_isRepeat is initialized.

See #23596.
2023-06-03 21:07:40 +02:00
Vadim Zeitlin
1a1790350f Merge branch 'htmllbox-fix-ub'
Fix undefined behaviour in wxHtmlListBox::OnDrawItem().

See #23595.
2023-06-03 21:07:40 +02:00
Vadim Zeitlin
a3e925df0a Merge branch 'mac-uilocale-script-fix'
Locale-related fixes for macOS and new calendar names localization
functions.

Closes #23209.

See #23556.
2023-06-03 21:07:40 +02:00
Vadim Zeitlin
946aa6bbc4 Remove redundant "const" from wxItemId conversion operator
This "const" is ignored and just results in a warning from MSVS 17.6.

Closes #23590.
2023-06-03 21:07:40 +02:00
Ian McInerney
5d0c4066d8 Add operators for boolean conversions to wxPGGlobalVars
The old API allowed for users to directly test the variable and find if
it was null, so recreate that API with the new system to preserve
compatibility.

Closes #23445.
2023-06-03 21:07:40 +02:00
Vadim Zeitlin
0e3f010eec Add wxUxThemeHandle::GetTrueSize() and GetDrawSize() helpers
These functions are more convenient to use and, arguably, more clear to
read than calls to ::GetThemePartSize(), so add these wrappers and
replace most of the uses of the Win32 function with them.

This shouldn't result in any real changes to behaviour.
2023-06-03 19:18:57 +01:00
Vadim Zeitlin
ef93da3160 Add wxUxThemeHandle::DrawBackground() wrapper and use it
This is sightly shorter/more convenient to use than providing all the
parameters to ::DrawThemeBackground() every time.

Similarly to ca5f244f15 (Add wxUxThemeHandle::GetColour() replacing
MSWGetThemeColour(), 2022-12-09), this is just a refactoring which
shouldn't result in any changes in behaviour.
2023-06-03 19:18:57 +01:00
Vadim Zeitlin
259a487475 Add support for getting theme data for non-default DPI too
Use OpenThemeDataForDpi() if necessary to retrieve the correct metrics
values for non-default DPI.

Change the existing wxUxThemeHandle ctor taking wxWindow to use the
window DPI automatically and replace the ctor taking HWND with a pair of
functions either explicitly specifying the DPI or indicating that it is
not used -- the latter can be useful to avoid unnecessary complications
when the theme is only used to retrieve some colour values that don't
depend on the DPI anyhow.

Also make wxUxThemeHandle class movable as a side, but possibly useful,
effect of these changes.
2023-06-03 19:18:57 +01:00
Vadim Zeitlin
3bf953bcc3 Factor out CustomPaint() function from dark mode code
No real changes yet, just make it possible to use the function
customizing the default WM_PAINT handle from other places too.
2023-06-03 19:15:12 +01:00
Artur Wieczorek
57a9247889 Fix wxPG_PROP_ACTIVE_BTN flag definition
wxPG_PROP_ACTIVE_BTN and wxPG_PROP_SHOW_FULL_FILENAME can be used together
(like e.g. in wxFileProperty) so they can't share the same value
(wxPG_PROP_CLASS_SPECIFIC_1).

Closes #23565.
2023-06-03 00:07:45 +02:00
ali kettab
f26f1cc701 Fix wxDC::GetClippingBox() in wxQt 2023-06-02 18:38:08 +01:00
Vadim Zeitlin
865def904b Merge branch 'html-dark-mode'
Fixes for wxHtmlWindow in dark mode.

See #23588.
2023-06-02 19:15:45 +02:00
Vadim Zeitlin
30de30eec1 Merge branch 'rle-bitmaps'
Fix loading RLE bitmaps in wxMSW.

See #23573, #23584.
2023-06-02 19:14:36 +02:00
Vadim Zeitlin
5988812efa Initialize some wxKeyEvent members in their declarations
Initialize at least boolean members when they are declared to ensure
that we don't forget to do it later (see #23593).

The other ones are already initialized later, normally, so don't touch
them for now.

No real changes.
2023-06-02 16:20:04 +02:00
Vadim Zeitlin
c0f226e674 Initialize wxHtmlSelection members in their declaration
No real changes, just prefer initializing members when declaring them
instead of doing it in the ctor.
2023-06-02 16:09:27 +02:00
Vadim Zeitlin
94e80dc21a Move wxGenericHyperlinkCtrl GetLinkColour() to a private header
No changes yet, but this will allow reusing the same function from
wxHTML in the upcoming commit.
2023-06-01 17:00:13 +01:00
Vadim Zeitlin
b9e93e7e6b Generalize IFileDialog::Show() workaround to wxDirDialog too
Move the check for multi-threaded COM apartment into a new helper
function and use it from both wxFileDialog and wxDirDialog, which should
be subject to the same problem.
2023-06-01 14:25:58 +01:00
Vadim Zeitlin
a2f6e01bea Delete wxDIB copy ctor and assignment operator
No real changes, just use C++11 feature instead of declaring these
special member functions as private without defining them.
2023-05-31 21:16:35 +01:00
Vadim Zeitlin
07408ed1df Initialize wxDIB members in their declarations and drop Init()
Remove the Init() helper initializing all members as we can now do it in
their declarations instead which is even better.

Also drop Free() which existed mostly for symmetry with Init().

As a side effect, this change allows to include this header from outside
the library (e.g. from the tests code), while previously it would result
in the following warning from gcc:

‘void wxDIB::Init()’ redeclared without dllimport attribute after being
referenced with dll linkage
2023-05-31 21:16:35 +01:00
Vadim Zeitlin
ade7e88672 Update wxOleInitialize() comment
No real changes, just don't say that this function calls CoInitialize()
because this is not the case any longer, and do advise using the RAII
wrapper instead of calling it directly.
2023-05-31 19:40:00 +01:00
utelle
5b424ea181 Add wxUILocale methods for getting month and day names
Implement wxUILocale::GetMonthName() and wxUILocale::GetWeekDayName() in
wxMSW, wxGTK, and wxOSX.

Also extend the existing wxDateTime methods to support a 3rd month and
weekday name representation (Name_Shortest) and a usage context
(Context_Formatting and Context_Standalone).

These changes make wxDateTime methods for getting the localized date and
month names use the current UI locale, as set by wxUILocale, instead of
the current C locale set by the standard C library function, which is a
change in behaviour but a desired one and notably fixes the display of
the months in generic calendar control in wxOSX where the current C
locale is not changed when the UI locale is set.

Replaces #23551.

Closes #23191.
2023-05-31 18:53:45 +02:00
Vadim Zeitlin
f2f2868de5 Add support for dark mode colours to XRC
Allow specifying a different colour to use in the dark mode in XRC
colour properties.

Closes #23571.
2023-05-27 21:51:51 +02:00
Vadim Zeitlin
fff31e01b7 Merge branch 'dark-mode-fixes'
Various cosmetic -- but rather important -- fixes for MSW dark mode.

See #23570.
2023-05-27 21:46:34 +02:00
Christian Beier
1a64e17ccc Add EVT_FULLSCREEN event macro
This macro was mentioned in the docs added by 0ff1bdec09 (Add
wxFullScreenEvent for macOS, 2021-03-18), but its implementation was not
added by said commit.

Closes #23566.
2023-05-27 21:44:55 +02:00
Vadim Zeitlin
bc72a5d003 Fix drawing of disabled wxStaticText in dark mode
Disabled static controls looked ugly as greying out the label doesn't
work at all when the background is dark, so override their drawing in
this case and just draw them using the same grey-ish colour that is
already used for the disabled menu items.

This is somewhat of a hack, but doesn't seem to have any bad effects and
is much simpler than using owner-drawn controls.
2023-05-18 01:31:25 +01:00
Vadim Zeitlin
cc07a0fd9b Add trivial wxSocketInitializer helper
This can and will be used instead of calling wxSocketBase::Initialize()
manually.
2023-05-18 00:04:59 +02:00
Vadim Zeitlin
563cc11151 Revert to using wxBaseObjectArray for wxAuiPaneInfoArray
This reverts changes to one of the arrays in 39706e4db0 (Use wxBaseArray
instead of object arrays in wxAuiManager, 2023-04-11) as this array is
returned by wxAuiManager::GetPane() and the existing code relies on the
references to the elements of this array remaining stable even if the
array is modified, which would be impossible with an array storing the
objects directly, so return to storing heap-allocated pointers to it.

There should be no such problems with the other arrays changed by that
commit, so leave them unchanged.

Closes #23545.
2023-05-16 00:12:27 +01:00
Vadim Zeitlin
e866db985a Merge branch 'link-col'
Improve wxHyperLinkCtrl colours management and support MSW dark mode.

See #23549.
2023-05-15 23:39:33 +01:00
Antti Nietosvaara
d666d1e222 Fix a memory leak when using non-wx threads
The wxThreadSpecificInfo object created by wxThreadSpecificInfo::Get()
was only released by the wxThreadInternal's cleanup, which meant that it
was leaked if wxThreadSpecificInfo::Get() was called by a thread not
created by wxThread, e.g. when using std::async or std::thread.

Fix this by simply using C++11 thread_local and removing the entire
wxThreadSpecificInfo machinery entirely.

See #23535.

Closes #23543.
2023-05-16 00:36:00 +02:00
Vadim Zeitlin
89efbf1a80 Add support for changing native wxHyperlinkCtrl colour
Set LIS_DEFAULTCOLORS to allow the already existing code calling
SetForegroundColour() in wxGenericHyperlinkCtrl to work.

Changing the foreground colour has an unfortunate side effect of also
changing the colour of the focus rectangle, but it doesn't seem possible
to avoid this.
2023-05-15 21:39:13 +01:00
Vadim Zeitlin
501cc65933 Implement accessors for native wxHyperlinkCtrl colours
The native control uses wxSYS_COLOUR_HOTLIGHT as its foreground and
doesn't change it when the mouse hovers over it.
2023-05-15 21:39:13 +01:00