Commit Graph

69237 Commits

Author SHA1 Message Date
Vadim Zeitlin
ca7fcfe9c3 Add wxGCC_ONLY_WARNING_{SUPPRESS,RESTORE} macros
When the original wxGCC_WARNING_SUPPRESS was added, clang understood all
gcc warnings, so it made sense to also apply it when building with
clang, but recent gcc versions have added warnings not available in
clang any more, so we now need a macro for disabling warning the
warnings for gcc only.

Perhaps we should rename the existing wxGCC_XXX macros to use
wxGCC_OR_CLANG prefix.
2020-08-31 01:25:45 +02:00
Vadim Zeitlin
266c3a962f Disable -Winline as we can't ensure all functions are inlined
It doesn't really make sense to enable this for C++ code, with a lot of
implicitly inline functions.
2020-08-31 01:25:07 +02:00
Vadim Zeitlin
1861065ef2 Disable -Wformat in system headers
This is given for the use of %zu by gcc 5.4.
2020-08-31 01:25:07 +02:00
Vadim Zeitlin
3c628138f5 Suppress bogus -Wnoexcept from gcc9 in wx/graphics.h
Due to what looks like a bug, gcc 9.3.0 gives the following incomplete
error message without it:

include/wx/graphics.h:278:7: error: but
‘wxGraphicsGradientStop::wxGraphicsGradientStop(wxGraphicsGradientStop&&)’
does not throw; perhaps it should be declared ‘noexcept’
[-Werror=noexcept]

(without any other diagnostics).
2020-08-31 01:25:07 +02:00
Vadim Zeitlin
7d74df9a03 Add wxNOEXCEPT to the hash structs operator() declarations
gcc 9 gives -Wnoexcept for these operators and, apparently, not making
them noexcept prevents some optimizations in the standard library
implementation of unordered_foo<>, so do add it.
2020-08-31 01:25:07 +02:00
Vadim Zeitlin
831979ead1 Suppress gcc -Wctor-dtor-privacy in wx/strvararg.h
Helper structs declared in this header intentionally define their ctor
as private, avoid gcc complaints about it.
2020-08-31 01:25:07 +02:00
Vadim Zeitlin
2f605badf3 Fix g++ 4.8 -Wshadow for parameter/function conflicts
Unlike the later versions, g++ 4.8 produces a -Wshadow when the name of
a parameter is the same of the name of a method, so rename the (private)
parameters to avoid this.
2020-08-31 01:25:07 +02:00
Vadim Zeitlin
23334af81b Test headers compilation with maximum warnings options with gcc
As wx headers are included from user applications which may compile with
higher warning level than wx itself, try to check headers compilation
with almost all of gcc warning flags turned on.

This notably should prevent the headers from becoming uncompilable with
-pedantic again in the future.
2020-08-31 01:24:57 +02:00
Václav Slavík
58c94d9ec0 Draw wxTextCtrl focus ring natively on Mac
NSTextView doesn't display focus ring by default, which is why wxOSX
did draw it manually, but this behavior can be overriden since OS X
10.3 with NSView.focusRingType property.

The HITheme-based rendering suffered from a number of non-nativeness
issues:
- didn't respect macOS 10.14+ accent colors
- not animated as the native focus ring
- subtly different shape of the outline
- noticeably different outline shape on macOS 11

Remove NeedsFocusRect() and associated workaround for manually drawing
focus ring inside NSTextView (i.e. multiline text controls). This
private interface was only used for wxTextCtrl and nothing else, so
this shouldn't have any impact elsewhere.
2020-08-30 18:32:07 +02:00
Václav Slavík
587190c95c Size preferences pages correctly on macOS 11
Preferences windows traditionally changed their size on macOS when going
between tabs (pages): the window would resize, with animation, to fit the
current tab’s content and avoid wasted space. This worked well, because the
icons toolbar was left-aligned and so changing window size by growing/shrinking
it to the right or down felt natural.

This changes in macOS 11 where preferences toolbar icons are centered and would
shift around if the window resized horizontally. Indeed, the new standard is to
keep the width and only change window height when switching between pages.

Implement this behavior in wxPreferencesEditor too. This requires us to
instantiate all pages early (as is done on other platforms), so this on Big Sur
or newer only.
2020-08-29 19:53:33 +02:00
Václav Slavík
b6bc50d16e Use macOS 11 icons in wxStockPreferencesPage
Ase the appropriate SF Symbols for General and Advanced preferences pages on
macOS 11, while still using the old templates on older systems.
2020-08-27 19:11:07 +02:00
Václav Slavík
acf02be808 Support SF Symbols images on macOS 11
Extend wxOSXGetSystemImage() and thus wxArtProvider with support for directly
loading the new symbolic images in addition to existing support for named
bundle resources.

This enables usage such as wxArtProvider::GetBitmap("gearshape").
2020-08-27 19:11:07 +02:00
Václav Slavík
ab29743097 Use correct toolbar style for preferences on macOS 11
Code compiled against macOS 11 SDK must explicitly specify that the window
should use preferences-style toolbar, otherwise the tabs would be moved to the
right alongside window title, as is done with the standard toolbar now.
2020-08-27 19:11:07 +02:00
Václav Slavík
b03fa9c37f Fix UI font serialization on macOS 11
e86154fc is insufficient, because there's still one situation when
PostScript names can't be avoided: when storing them using
wxNativeFontInfo::ToString().

Co-authored-by: Stefan Csomor <csomor@advancedconcepts.ch>
2020-08-27 13:10:45 +02:00
Václav Slavík
9e68df224f Fix colored markup drawing in Mac wxDataViewCtrl
50ba73c accidentally omitted an if (colText) check, causing calls to
setTextColor:nil - which in turn caused markup text (but curiously, not
plain) rendering to stick with a previously set color even on cells
where the default color should be used.

Restoring the original logic to prevent setTextColor:nil fixes it.
2020-08-26 19:28:32 +02:00
Václav Slavík
e86154fcd2 Fix system UI font handling on macOS 11
PostScript name for the system SF font, starting with a dot, was always
considered private, but it was possible to round-trip it. Starting with
macOS 11, font descriptors can't be created from such names and result
in a Times font fallback.

To complicate matters further, the way PostScript name of the system
font is created changed too: it is no longer universal for entire
family, but specifies the weight too.

This combined together makes it impossible to store or modify system
fonts.

Fix by not relying on PostScript names internally. Only use them when
serializing font description or where needed, and in such cases obtain
it from CTFontDescriptor on demand.

Still preserve m_postScriptName as a user-provided detail, and treat it
as such: if provided, it is sacred and used to create font descriptors;
if not provided, never fill it in from other data.
2020-08-26 19:08:32 +02:00
Andreas Falkenhahn
a59901f8f1 Fix bug in CanUndo() returning true after wxTextCtrl creation
For wxMSW text controls with wxTE_RICH2 style, calling SetFont() counts
as an undoable operation, resulting in CanUndo() returning true even if
no "real" changes have been made yet.

Fix this by resetting the undo stack after creating the control using
ITextDocument::Undo().

Unfortunately this interface is not available in MinGW-32, so this fix
can't be used with it.

Closes https://github.com/wxWidgets/wxWidgets/pull/2010

Closes #17524.
2020-08-25 18:10:20 +02:00
Vadim Zeitlin
1ec571fb64 Avoid -Wshadow warnings when using multiple wxCHECK()s
If the same function used any of macros from wxCHECK() family more than
once, wxDummyCheckStruct was redeclared, resulting in -Wshadow warnings
from gcc.

Fix this by using unique names for the dummy macro.
2020-08-25 17:37:25 +02:00
Vadim Zeitlin
054d98b1df Fix -Wpedantic in wxDECLARE_ABSTRACT_CLASS()
Fix a regression introduced in c924ecb10a (Suppress -Wsuggest-override
warnings in user code for gcc too, 2020-07-27) and rearrange the macro
to make sure a semicolon is necessary after it.

Closes #18901.
2020-08-25 17:36:02 +02:00
Vadim Zeitlin
30fc873626 Remove useless hdrstop pragma from allheaders test
It shouldn't be necessary for a test not using PCH at all and Borland
compiler is almost certainly not supported anyhow any longer.
2020-08-25 16:54:23 +02:00
Vadim Zeitlin
29a2b481a5 Fix documented type of wxART_XXX constants
They're (now, and had always been before the recent changes) string
literals, i.e. of type "const char *", rather than "wxString".
2020-08-25 16:49:24 +02:00
Vadim Zeitlin
873e028ffa Document wxASCII_STR() macro
Also improve wxString::FromAscii() documentation slightly.
2020-08-25 16:49:05 +02:00
Vadim Zeitlin
79c98b31a4 Don't use wxASCII_STR() inside wxART_MAKE_XXX_ID macros
This changed the type of the art and client ID values, which broke
compatibility with existing code, notably in wxPython (see
https://github.com/wxWidgets/wxWidgets/pull/1996), and the attempts to
fix this compatibility broke it with all the existing code using
wxART_MAKE_ART_ID() or wxART_MAKE_CLIENT_ID() for their own IDs.

Keep things simple and just define the macros as they were defined
before 4552009805 (Merge branch 'pr1312-no-unsafe-wxstring-conv',
2020-07-20), except for wxART_MAKE_CLIENT_ID_FROM_STR() whose argument
and produced value was already of wxString type, and use wxASCII_STR()
at the place of use of wxART_XXX constants in wx code.

This is obviously not ideal as it will require using wxASCII_STR() in
the application code as well, but seems to be the least evil.
2020-08-24 16:47:37 +02:00
Vadim Zeitlin
30b37b610d Revert "Merge branch 'string-art-ids'"
This reverts commit 8c9ba23eae, reversing
changes made to 5192feb38e.

Upcoming commits will try to work around the issues with art IDs related
to wxNO_IMPLICIT_WXSTRING_ENCODING in a different way.
2020-08-24 16:47:37 +02:00
Vadim Zeitlin
825fd01beb Test XRC headers compilation without implicit wxString conversion
Add wx/xrc/xmlres.h to the list of headers compiled with
wxNO_IMPLICIT_WXSTRING_ENCODING to test that they can be used even when
the implicit conversions from "char*" to wxString are disabled.
2020-08-24 16:47:37 +02:00
Ilya Sinitsyn
0e8ca0c8f9 Fix the cursor mode switching in wxGrid mouse move event handler
Allow switching between row and column resizing modes in mouse move event
handler.
2020-08-24 02:09:01 +02:00
Ilya Sinitsyn
5d3d376766 Remove unused wxGrid function 2020-08-24 02:09:01 +02:00
Ilya Sinitsyn
d6aec06150 Process the wxGrid mouse click depending on the current mode
Simplify the code of wxGrid::DoGridCellLeftDown() and make it more
correct by using m_cursorMode instead of duplicating (not 100%
correctly) the logic used to set it in DoGridMouseMoveEvent().

If the assumption that m_cursorMode is already set by the time
DoGridCellLeftDown() is called turns out to be wrong, e.g. when wxGrid
is used on touch screens, we would need to refactor these functions to
extract the code determining m_cursorMode from the mouse location into a
separate function that would be called from both.

Note that this commit is best viewed with "git diff -w" to see how little
has really changed.
2020-08-24 02:08:54 +02:00
Vadim Zeitlin
c1d3e65ac4 Merge branch 'wine-heap-fix'
Wine heap fix and other global memory-related cleanup.

See https://github.com/wxWidgets/wxWidgets/pull/2030
2020-08-24 00:18:57 +02:00
Vadim Zeitlin
3df9d772a4 Merge branch 'display-ppi-from-scaling-factor'
Determine display DPI from scaling factor instead of trying to compute
it from the physical display dimensions.

See https://github.com/wxWidgets/wxWidgets/pull/2015

Closes #18855.
2020-08-24 00:14:27 +02:00
Vadim Zeitlin
1bf76ee594 Add a safety check for the buffer size in wxIDataObject
Avoid size overflow if the offset value is greater than it.
2020-08-22 23:48:58 +02:00
Paul Cornett
3f9884817d Allow wxButton to show explicitly set bitmaps regardless of theme setting with GTK3
See #18874
2020-08-22 11:18:48 -07:00
Vadim Zeitlin
75ad798d8b Use GlobalPtrLock instead of manual GlobalUnlock() calls
Make the code safer and shorter by using RAII wrapper instead of manual
Global{Lock,Unlock}() calls.

No real changes.
2020-08-22 19:45:19 +02:00
Vadim Zeitlin
0d7be7c189 Use GlobalPtrLock instead of manual Global{Lock,Unlock}() calls
Also add GlobalPtrLock::GetSize() and use it instead of calling
GetSizeFromBuffer() as it's more direct and doesn't require the use of
::GlobalHandle().
2020-08-22 19:45:19 +02:00
Vadim Zeitlin
aadfaada7a Fix crash when using custom DnD formats under Wine
Using ::HeapSize() on a global pointer is wrong, and even though it
somehow still works under "genuine" MSW, it crashes under Wine.

Fix this by using ::GlobalSize() instead, which is the right function to
use with this kind of pointer.

Thanks to Damjan Jovanovic for the analysis of the problem in Wine
bugzilla (see https://bugs.winehq.org/show_bug.cgi?id=38924#c10).

Closes #18887.
2020-08-22 19:45:19 +02:00
Vadim Zeitlin
93c580ccaf Don't mangle ampersands in wxToolBar tooltips under MSW
Preserve the ampersands in the string, which is consistent with wxGTK
behaviour and less surprising than the default behaviour, which creates
mnemonics in the tooltips that are, of course, perfectly useless, as
they can't be activated from keyboard anyhow.

Turn on TTS_NOPREFIX, which is already used by wxToolTip, to fix this.

Closes #18899.
2020-08-22 18:49:25 +02:00
Václav Slavík
adb7c8a53d cfstring.h compilation fix for ARC builds 2020-08-22 16:46:27 +02:00
Vadim Zeitlin
ff3cb34d18 Add a unit test for using bitmaps with image and empty label
This used to be broken, see #18898, and now that it is fixed by
5a70051c7e (Avoid assertion failure in wxButton with bitmap and empty
label, see #18898, 2020-08-21) add a unit test so that it stays fixed.
2020-08-21 20:21:17 -07:00
Ian McInerney
c0bfaf4104 Use new CanBeToggled function inside wxAuiToolBar where appropriate 2020-08-21 23:29:08 +01:00
Ian McInerney
afbb334a26 Make IsCheckable true by default and switch to explicitly disallowing it
Also add a new accessor to wxAuiToolBarItem to make it easier to
determine when a tool can be checked.
2020-08-21 23:15:38 +01:00
Paul Cornett
5a70051c7e Avoid assertion failure in wxButton with bitmap and empty label, see #18898 2020-08-21 08:43:50 -07:00
Vadim Zeitlin
9765b6d58e Send SELECTING events while selecting rows/columns too
Generalize the changes of 415f080c80 (Split wxGrid RANGE_SELECT event
into SELECTING and SELECTED, 2020-07-27) to the case when the mouse is
dragged over row or column headers: also send SELECTING events while
dragging and a SELECTED event at the end, whether it's due to releasing
the mouse button or losing mouse capture.
2020-08-21 16:10:40 +02:00
Vadim Zeitlin
408ebfd253 Capture mouse while selecting rows/columns too
Change the logic in ChangeCursorMode() to explicitly exclude the modes
for which the mouse should not be captured, as CaptureMouse() should be
called in most cases (and ideally for all of them in the future) and do
capture it for WXGRID_CURSOR_SELECT_{ROW,COL} too, if only to be
notified about mouse capture loss.
2020-08-21 15:54:47 +02:00
Vadim Zeitlin
010007ba17 Fix type of the initial wxGrid selection event when dragging
Pass the same eventType ExtendCurrentBlock() is called with to
SelectBlock() called to perform the initial selection to ensure that
wxEVT_GRID_RANGE_SELECTING is sent while dragging instead of the
unexpected wxEVT_GRID_RANGE_SELECTED (in addition to the expected one
sent at the end when the drag is over).
2020-08-21 11:49:34 +02:00
Vadim Zeitlin
6d6c01ff2a Make wxKeyboardState ctor explicit
Avoid accidental conversions of e.g. int to wxKeyboardState.
2020-08-21 11:49:34 +02:00
Vadim Zeitlin
682cb8355c Replace "sendEvent" parameter in wxGridSelection with "eventType"
Instead of just passing a boolean flag indicating whether
wxEVT_GRID_RANGE_SELECTED should be sent, pass wxEventType to send, with
wxEVT_NULL being interpreted as "don't send anything".

No real changes yet, but this will allow using the existing functions to
send wxEVT_GRID_RANGE_SELECTING and not only SELECTED in the upcoming
commits.
2020-08-21 11:49:34 +02:00
Vadim Zeitlin
767f19cf25 Add menu item to clear log in the grid window
Just make it more convenient to read the logs in it.
2020-08-21 11:49:34 +02:00
Vadim Zeitlin
58456523b5 Merge branch 'dpi-misc' of https://github.com/MaartenBent/wxWidgets
Miscellaneous DPI Improvements.

See https://github.com/wxWidgets/wxWidgets/pull/2025
2020-08-21 02:44:07 +02:00
KT
b50aca9596 Inherit art provider in wxAuiFloatingFrame by default
Use the same art provider for a floating frame detached from an existing
wxAuiManager as was used by the original wxAuiManager itself, to ensure
that the appearance of this frame is consistent with the appearance of
its parent.

Implementing this required adding wxAuiDockArt::Clone() to allow copying
it in the new frame and this patch also adds GetAuiManager() to
wxAuiFloatingFrame, similar to the existing method in wxAuiNotebook, in
order to allow changing the dock art from the application code if
desired.

Closes https://github.com/wxWidgets/wxWidgets/pull/2022

Closes #18882.
2020-08-21 02:43:28 +02:00
Vadim Zeitlin
126c976f5b Merge branch 'taskbar-icon-get-menu'
Add wxTaskBarIcon::GetPopupMenu() allowing to avoid recreating the menu
every time.

See https://github.com/wxWidgets/wxWidgets/pull/2020
2020-08-21 02:42:13 +02:00