Commit Graph

19203 Commits

Author SHA1 Message Date
Vadim Zeitlin
09060ed262 Move radio group navigation functions to wxRadioButtonBase
Now that this class is not a template any longer, we can have the code
for radio button group navigation directly in it, without making it
inline, so move the existing functions bodies into the new methods and
remove the old functions entirely.

No real changes, this is just a refactoring.
2020-09-21 18:01:47 +02:00
Vadim Zeitlin
bcb016613e Make wxRadioButtonBase a plain class, not template
Use a dirty hack to accommodate wxUniv by deriving wxRadioButtonBase
from wxCheckBox, rather than wxControl, there. This is not pretty, but
should be addressed by refactoring wxUniv code and in the meanwhile all
the other ports don't have to bother with using a template class
unnecessarily.
2020-09-21 18:01:37 +02:00
Vadim Zeitlin
3d72c009be Add wxRadioButtonBase::{Set,Get}Value()
Now that we do have wxRadioButtonBase class, declare wxRadioButton API
methods as pure virtual in it, to force the derived classes to implement
them.

Also remove the outdated comment saying that there is no base class for
wxRadioButtons in different ports, this is not true any longer.
2020-09-21 16:13:55 +02:00
Vadim Zeitlin
1a4f628e40 Make radio button navigation functions const
This requires adding a couple of const_cast<>s in their implementation
in order to still allow them returning non-const wxRadioButton pointers,
but this seems preferable to not being able to call them on a const
wxRadioButton in the first place.
2020-09-21 15:36:41 +02:00
Vadim Zeitlin
24cc6c541e Don't DLL-export wxRadioButtonBase template class
This is unnecessary, this class only has inline functions.
2020-09-21 15:28:06 +02:00
Pavel Tyunin
47d8299c70 Make wxPG_TOOLTIPS work for >2 columns too 2020-09-21 11:27:42 +02:00
Stefan Csomor
593e6a9ca6 Update include/wx/msw/radiobut.h
Co-authored-by: VZ <vz-github@zeitlins.org>
2020-09-20 18:35:51 +02:00
Artur Wieczorek
52631b3368 Use dedicated CRT function to round the value for MSVS 2015+
round() is available since at least VS 2015. It is not available in
VS 2010. VS 2012 and 13 need to be checked.
2020-09-18 11:24:13 +02:00
Stefan Csomor
200c1af697 Going private with the implementations
Although they’re still exported of course …
2020-09-17 23:13:44 +02:00
Stefan Csomor
552dbbe26e Removing const for first version 2020-09-17 22:46:18 +02:00
Stefan Csomor
92ea83f00b First implementation 2020-09-17 22:35:22 +02:00
Artur Wieczorek
32cc9317f2 Use dedicated CRT function to round the value with MSVC 2020-09-17 13:46:53 +02:00
Artur Wieczorek
4b491c19a2 Implement wxRound() with dedicated C++11 standard library function 2020-09-17 13:45:57 +02:00
Artur Wieczorek
864034bddc Get rid of redundant return statement 2020-09-17 13:44:30 +02:00
Paul Cornett
85d63c3150 Add a class derived from GtkImage to support HiDPI bitmaps
And use it to get HiDPI support wherever we use GtkImage. This extends and
consolidates support for custom drawing of images which has already been added
somewhat redundantly in several places.
2020-09-15 11:52:03 -07:00
Artur Wieczorek
e88f248e3a Fix calculating bounding box
We should use platform-specific functions to convert coordinates to take
into account all transformations applied to wxDC (also with transform
matrix).

Closes #18916.
2020-09-13 23:54:16 +02:00
Artur Wieczorek
014bd2ae54 Implement platform-specific coordinate conversion functions
Generic wxDC::DeviceToLogical{X|Y}() and wxDC::LogicalToDevice{X|Y}()
functions don't take into account transformations applied with
wxDC::SetTransformMatrix() so conversion results are invalid if wxDC is
transformed with both e.g. wxDC::SetUserScale() and
wxDC::SetTransformMatrix().
We need to implement functions in wxDCImpl and its platform-specific
derivates to do this conversion with taking into account all applied
transformations.

See #18916.
2020-09-13 23:47:26 +02:00
Stefan Csomor
bc9e7b71e7 macOS wxNativeFontInfo changes (#2045)
* adding native font descriptor serialization = v2

* remove common xml prefix from serialized string

* Update src/osx/carbon/font.cpp

Co-authored-by: VZ <vz-github@zeitlins.org>

* Update src/osx/carbon/font.cpp

Co-authored-by: VZ <vz-github@zeitlins.org>

* static string via accessor

* striping off xml preamble unconditionally

if we use a different format in the future, we will have to increase our version number

* applying italic directly to the font descriptor

thus preserving attributes in the native font descriptor which we don’t store explicitly yet

* Adding support for preserving font width

Although we don’t express this in the public API yet, we try to preserve eg condensed, when changing the font width

* Adding reference, bug fix

double checked the font weight constants,

Co-authored-by: VZ <vz-github@zeitlins.org>
2020-09-12 19:29:26 +02:00
Vadim Zeitlin
e4333fdeac Fix recurrent typo in "usable"
This word has a single "e".
2020-09-02 20:49:39 +02:00
Vadim Zeitlin
bf71a70a12 Merge branch 'updateui-ischeckable'
Add a flag to wxUpdateUIEvent to tell if the item supports the check
action.

See https://github.com/wxWidgets/wxWidgets/pull/2027
2020-09-02 19:34:05 +02:00
Scott Talbert
7cd12a2bd6 Add EGL-based backend for wxGLCanvas
Among other things, this enables wxGLCanvas to be used natively on
Wayland.

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

Closes #17702.
2020-09-01 15:03:30 +02:00
Vadim Zeitlin
ed4b9e5f97 Merge branch 'mac-native-focus-ring' of https://github.com/vslavik/wxWidgets
Draw wxTextCtrl focus ring natively on Mac.

Add wxWindow::EnableVisibleFocus() to explicitly control the focus ring
visibility if necessary.

See https://github.com/wxWidgets/wxWidgets/pull/2037
2020-09-01 14:59:42 +02:00
Stefan Brüns
b8a4b96243 Create underlying bitmap for caret when it is explicitly created
wxCaret::Create implies a size change, so call DoSize to initialize
the underlying wxBitmap.
2020-08-31 16:49:21 +02:00
Vadim Zeitlin
b9f946fcd3 Merge branch 'check-headers-max-warn'
Check compilation of all wx headers with all gcc warnings enabled.

This should make it impossible to introduce problems that only appear
when -Wpedantic or -Wany-other-not-completely-unreasonable-warning is
enabled when building user code including wx headers again.

See https://github.com/wxWidgets/wxWidgets/pull/2033
2020-08-31 15:10:16 +02:00
Vadim Zeitlin
be2a61519b Merge branch 'grid-selected'
Split the wxGrid RANGE_SELECT event into separate SELECTING and SELECTED
events.

See https://github.com/wxWidgets/wxWidgets/pull/2028
2020-08-31 14:55:56 +02:00
Vadim Zeitlin
d41539ef05 Merge branch 'fix-grid-resizing'
Fix bugs in wxGrid mouse handling and simplify the code.

See https://github.com/wxWidgets/wxWidgets/pull/2018
2020-08-31 14:53:37 +02:00
Vadim Zeitlin
82f7cb6e9b Merge branch 'art-ids-literals'
Revert art ids changes and make them `char*` literals again.

See https://github.com/wxWidgets/wxWidgets/pull/2031
2020-08-31 14:51:52 +02:00
Václav Slavík
8efc6fb003 Add wxWindow::WXAdjustFontToOwnPPI()
Avoid calling GeTDPI() in font.WXAdjustToPPI(GetDPI()); invocations in
common code on platforms that don't need any adjustment (i.e. anything
other than MSW).

This fixes wxOSX crashes when GetFont() is called too early during
window creation, but is the right thing to do regardless.

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

Closes #18903.
2020-08-31 14:45:02 +02:00
Vadim Zeitlin
8b7ddbd0ac Use wxOVERRIDE for wxStackWalker and wxStackFrame in wxMSW
Thanks gcc for -Wsuggest-override.
2020-08-31 12:40:50 +02:00
Vadim Zeitlin
3fc5d134a3 Suppress strange -Wunsafe-loop-optimizations in wxString code
The error message

wx/string.h:558:47: error: missed loop optimization, the loop counter may overflow
                    [-Werror=unsafe-loop-optimizations]
       for ( Cache::Element *c = cacheBegin; c != cacheEnd; c++ )
                                             ~~^~~~~~~~~~~

doesn't seem to really make much sense, as it shouldn't overflow here.
2020-08-31 12:40:50 +02:00
Vadim Zeitlin
a535d2c64d Suppress -Wnull-dereference in wxString::GetCacheElement()
It doesn't seem to be really possible here.
2020-08-31 12:40:50 +02:00
Václav Slavík
9f66b03c5c Allow configuring visible focus on Mac
Add wxWindow::EnableVisibleFocus() for changing focus ring behavior on
macOS (currently not implemented elsewhere, although GTK+ has a
discouraged option to do it).
2020-08-31 10:38:59 +02:00
Vadim Zeitlin
24914ec7df Suppress unavoidable -Wformat-literal in wx[F]printf()
Disable gcc format string checks inside these functions.
2020-08-31 01:26:04 +02:00
Vadim Zeitlin
36c5884acb Generalize WX_ATTRIBUTE_PRINTF to WX_ATTRIBUTE_FORMAT
Allow applying gcc "format" attribute to other functions and do apply it
to wxStrftime().

Also suppress -Wformat-nonliteral inside wxStrftime() itself, as it's
now supposed to be checked when calling it.
2020-08-31 01:25:45 +02:00
Vadim Zeitlin
7352a2879c Rename Qt-specific GetEventType() to start with "Qt" prefix
This avoids conflicts with another method with the same name defined in
generic wxGenericFileDirButton, which must neither override nor hide
this method of wxButton.
2020-08-31 01:25:45 +02:00
Vadim Zeitlin
9f63592eba Remove unnecessary wxBitmap copy ctor from wxQt
This ctor is not needed as the inherited wxObject ctor is sufficient and
defining it but not operator=() explicitly results in -Wdeprecated-copy
from gcc 10.
2020-08-31 01:25:45 +02:00
Vadim Zeitlin
19bc293086 Remove extraneous semicolon in wx/qt/menuitem.h
Avoid -Wpedantic from gcc.
2020-08-31 01:25:45 +02:00
Vadim Zeitlin
9c2cf91223 Don't remove const-ness using C-style cast
Avoid another -Wcast-qual from gcc.
2020-08-31 01:25:45 +02:00
Vadim Zeitlin
9c48b0e8e7 Remove redundant wxSetCursor() declarations
Avoid -Wredundant-decls from gcc by not duplicating the declaration from
wx/gdicmn.h in wx/*/cursor.h.
2020-08-31 01:25:45 +02:00
Vadim Zeitlin
9206a9de00 Remove trailing semicolon from wxDFB_DECLARE_INTERFACE()
This avoids -Wpedantic warnings when a semicolon is used after it.
2020-08-31 01:25:45 +02:00
Vadim Zeitlin
dca6f310bb Replace C-style cast with const_cast<> in wxUniv
Don't use C casts to remove const-ness (avoids gcc -Wcast-qual).
2020-08-31 01:25:45 +02:00
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
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
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
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
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