Commit Graph

2042 Commits

Author SHA1 Message Date
Vadim Zeitlin
0b20b97704 Merge branch 'spinctrl-digits'
Improve setting the number of digits in wxSpinCtrlDouble and make it
consistent on all platforms.

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

Closes #17085.
2021-05-22 21:25:32 +01:00
Vadim Zeitlin
fc2e01d9a2 Make GtkPageSetup-related functions private
These functions don't need to be members of wxGtkPrintNativeData as they
don't use this object at all, so one shouldn't be required to call them.

And rather than making them static, just make them private functions
instead.

No real changes, this is just a refactoring.
2021-05-16 00:55:04 +02:00
Paul Cornett
43beca8196 Avoid warning: g_object_ref_sink redefined with GTK2 2021-05-02 07:48:35 -07:00
Paul Cornett
3217a4e8a2 Fix best size for windows which are hidden when TLW is shown with GTK3
GTK3's style cache is not updated for hidden windows until after they are shown
See #16088
2021-04-30 12:15:33 -07:00
Vadim Zeitlin
84bcc109ad Merge branch 'cxx20-warning-fixes'
Build fixes for gcc 11 and clang 12, including in C++ 20 mode.

See https://github.com/wxWidgets/wxWidgets/pull/2347
2021-04-26 16:10:33 +02:00
Vadim Zeitlin
86d1a25624 Merge branch 'winsock-2'
Use WinSock 2 rather than 1.1 by default and also enable IPv6 support,
requiring WinSock 2, by default now that it can be done.

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

Closes #15562.
2021-04-26 15:07:13 +01:00
Vadim Zeitlin
ccbf0b2f9a Define wxDataFormat comparison operator overload taking it itself
We still can't avoid defining the overload taking NativeFormat due to an
ambiguity that we would have otherwise between converting from
NativeFormat to wxDataFormat or vice versa when comparing them (it would
have been better to avoid implicit conversions in all directions, of
course, but this is how it was done back in e1ee679c2e (wxDataObejct and
related changes (won't compile right now), 1999-10-21) and it's too late
to change it now), but we can at least define an overload taking
wxDataFormat itself and not wxDataFormatId to make things slightly more
logical and avoid -Wambiguous-reversed-operator clang 12 warnings.
2021-04-26 11:44:40 +02:00
Vadim Zeitlin
3481598cc6 Make wxSpinCtrlDouble::SetIncrement() update digits in wxGTK too
Follow the generic version and increase the number of digits if
necessary.
2021-04-25 21:17:31 +02:00
Vadim Zeitlin
bf5090bcf3 Enable Winsock 2 and IPv6 build options by default
In addition to linking with Winsock 2, also use winsock2.h.

This allows to turn on IPv6 support on by default under MSW, so turn it
on under Unix too for consistency.

Predefine _WINSOCK_DEPRECATED_NO_WARNINGS to avoid warnings about
deprecated (but still available and very unlikely to be ever removed)
Winsock 1 functions that we still use.
2021-04-24 18:06:43 +01:00
Vadim Zeitlin
87fddbdbdb Merge branch 'spinctrl-gettextvalue'
Add wxSpinCtrl::GetTextValue() and allow clearing the text value in
wxGTK version for compatibility with MSW.

See https://github.com/wxWidgets/wxWidgets/pull/2334
2021-04-22 23:55:30 +02:00
Vadim Zeitlin
c356f83da2 Fix resetting text override when manually entering the text
The entered text wasn't taken into account, as the override was still
used when its numeric value was retrieved by GtkSpinButton using our
"input" handler, so reset the override now as soon as we get "changed"
signal.
2021-04-21 09:24:02 +02:00
Vadim Zeitlin
32258bd10a Move wxEVT_TEXT generation to wxSpinCtrlGTKBase::GTKTextChanged()
This is more consistent with GTKValueChanged() and allows making the
change in the upcoming commit.

No real changes yet, this is just a refactoring.
2021-04-21 09:02:51 +02:00
Vadim Zeitlin
ca0cf3ea59 Allow using a different text value in wxGTK wxSpinCtrl
Make it possible to use a string value different from the numeric value,
as wxMSW version allows this and some existing code depends on it.

Closes #19140.
2021-04-20 22:23:14 +02:00
Vadim Zeitlin
e73a0c23ef Replace dynamic cast with a virtual GTKValueChanged() function
No real changes, but using a virtual function is simpler and safer than
using wxIsKindOf().
2021-04-20 01:13:15 +02:00
Vadim Zeitlin
3ac3763705 Always handle "input" and "output" signals in wxGTK wxSpinCtrl
No real changes yet, just refactor the code to always connect these
signals handlers and not just when using non-decimal base.

Add wxSpinCtrl::GTKInput() and GTKOutput() virtual methods to handle
these signals appropriately depending on the type of the control.

This will allow further customizing conversion to/from string in the
upcoming commit and will also make it possible to handle UI locale
different from the C locale in the future.
2021-04-20 01:13:15 +02:00
Dummy
b6f8a8cf5b Add wxSpinCtrl::GetTextValue()
This allows to retrieve the current contents of the text entry part of
wxSpinCtrl.

For now provide a stub in the base class, will be made pure virtual
later.

Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>
2021-04-18 13:09:17 +02:00
Vadim Zeitlin
72500faf7c Add wxCursor ctor from XPM data to all ports
This just uses the existing wxImage ctor from XPM data and wxCursor ctor
from wxImage, but will allow the code creating cursors from XPM to still
work even when wxImage ctor from XPM is made explicit.

Add a trivial test just to check that the new ctor can be used.
2021-04-18 01:14:36 +01:00
Vadim Zeitlin
b26fd44c77 Consistently declare wxCursor(wxImage) ctor when wxUSE_IMAGE==1
wxGTK already did it like this, but also only declared ctor not taking
wxImage in this case, while wxMSW and wxMac declared this ctor in any
case, even when wxUSE_IMAGE==0, but didn't define it then.

This doesn't matter much anyhow, as the build with wxUSE_IMAGE==0 is
clearly broken and these changes are not enough to fix it, but be at
least somewhat consistent and:

1. Don't declare methods using a class which is not available at all.
2. Do define methods using wxImage only internally, even if they do
   nothing when it's not available.

No real changes.
2021-04-18 00:59:52 +01:00
Vadim Zeitlin
b5a78fbac6 Also make SetMinSize() after wxSizer::Fit() work correctly
This fixes a problem similar to that fixed in the previous commit but
for SetMinSize(), which was also ignored if done after calling
wxSizer::Fit() and before showing the window, as the explicitly set min
size was also overwritten by the pending min size computed from the
client size corresponding to the sizer fitting size.

The fix is similar too: just invalidate the pending minimum size if
SetMinSize() is called.
2021-04-12 21:19:25 +02:00
Vadim Zeitlin
fd7386ed83 Move workaround for initial TLW size to wxGTK itself
Add wxWindow::WXSetInitialFittingClientSize() instead of handling wxGTK
TLWs specially in the common wxSizer code and override it in wxGTK to
remember that we need to reset the client size once the window is shown.

This commit shouldn't result in any changes in the observed behaviour.
2021-04-12 21:19:25 +02:00
Vadim Zeitlin
329f60d7f3 Factor out wxTopLevelWindowGTK::GTKDoAfterShow()
Just extract the code generating wxEVT_SHOW for TLWs in wxGTK in its own
function before modifying it to avoid having to do it in two places.

No real changes, this is a pure refactoring.
2021-04-12 17:27:34 +02:00
Paul Cornett
0a28e3267c Remove unused macro definition 2021-03-24 11:25:15 -07:00
Paul Cornett
0995797158 Remove run-time dependencies on X11 backend with GTK3
As with Wayland, the X11 backend may not be available at run-time,
so types defined in it can't be used
2021-03-24 11:25:01 -07:00
Vadim Zeitlin
e442d90b0d Merge branch 'webrequest-build-fixes' of https://github.com/MaartenBent/wxWidgets
wxWebRequest-related build fixes for MinGW.

See https://github.com/wxWidgets/wxWidgets/pull/2283
2021-03-23 14:16:07 +01:00
Maarten Bent
3cc48e2e56 Fix checking __MINGW64_VERSION_MAJOR for wxUSE_WEBREQUEST_WINHTTP
It is not yet defined for setup.h, so check it in chkconf.h.
Fixes #19105
2021-03-23 00:39:16 +01:00
Vadim Zeitlin
5d6525ccf1 Merge branch 'webview_useragent' of https://github.com/TcT2k/wxWidgets
Add support for custom user agent to wxWebView.

See https://github.com/wxWidgets/wxWidgets/pull/2280
2021-03-19 22:39:00 +01:00
Pierluigi Passaro
b824ed8fe6 Support Wayland in wxGTK wxMediaCtrl
For GTK, the current implementation assumes X11 is the only window option.
Introduce runtime checks to manage Wayland too.

Signed-off-by: Pierluigi Passaro <pierluigi.p@variscite.com>

Closes https://github.com/wxWidgets/wxWidgets/pull/2257
2021-03-19 22:36:59 +01:00
Tobias Taschner
7f7191066b Implement user agent access for GTK 2021-03-17 09:42:01 +01:00
Tobias Taschner
80c04e3941 Merge branch 'master' into webview_script_message 2021-03-01 09:57:13 +01:00
Tobias Taschner
e8371824bd Disable new methods for webkit1 2021-02-28 20:48:01 +01:00
Artur Wieczorek
9a29ea6e63 Fix setting wxBU_EXACTFIT style for wxButton under wxGTK2
The way wxBU_EXACTFIT is implemented in commit c1bb80987f
("Improve implementation of wxBU_EXACTFIT style for wxButton under wxGTK2",
2020-04-12) is too intrusive and disrupts button's appearance in some
themes. It should work better with themes if we reduce inner border in
a more GTK-compliant way by applying a dedicated GTK style to the button.

Closes #19081.
2021-02-27 17:08:37 +01:00
Tobias Taschner
c9606d7b5a Implement AddUserScript() for GTK 2021-02-27 10:59:23 +01:00
Tobias Taschner
71f745e647 Implement script message for GTK backend 2021-02-26 21:27:50 +01:00
Tobias Taschner
3af4702b11 Implement wxWebView::EnableAccessToDevTools() for GTK 2021-02-26 18:53:46 +01:00
Paul Cornett
62c119fa1e Fix RTL mirroring for wxClientDC, etc with GTK3
The changes to the Cairo context must be done before wxGC::CreateFromNative()
is called, otherwise they will be overwritten
2021-02-06 08:28:13 -08:00
Vadim Zeitlin
67fc7c5508 Merge branch 'remove-setup0.h'
Drop wx/setup0.h files hack and just use wx/setup.h.

See https://github.com/wxWidgets/wxWidgets/pull/2205
2021-02-06 14:26:25 +01:00
Tobias Taschner
d17e8978a6 Make wxWebView::RunScript() const 2021-02-05 22:18:31 +01:00
Tobias Taschner
b351e7762d Move common wxWebView code to base class
Removes duplicate code in the various webview backends
2021-02-05 22:18:29 +01:00
Tobias Taschner
0d82348328 Add wxWebView::GetBackendVersionInfo()
Allows to get the WebView backend version if available
Currently implemented for IE, Edge and webkit2.
2021-02-05 22:18:28 +01:00
Paul Cornett
e85f89e522 Implement wxDC mirroring for RTL layout with GTK3
Co-Authored-By: AliKet <aliket1435@gmail.com>
2021-01-31 20:59:29 -08:00
Vadim Zeitlin
d1810b0dce Remove setup0.h files
Simplify things by putting setup.h files themselves under version
control and getting rid of setup0.h ones.

The initial motivation for using separate setup0.h files was to allow
having local changes to setup.h, but with Git there is a simple way to
do it by using "git update-index --skip-worktree include/wx/msw/setup.h"
for example, so we don't really need setup0.h any more and dropping them
makes things simpler.
2021-01-31 19:02:56 +01:00
Vadim Zeitlin
fa4339a935 Initialize wxGtkValue in a way not requiring C++11
As we still support C++98, don't use G_VALUE_INIT as the initializer:
it's a braced-init-list, which is only allowed in C++11.

Co-Authored-By: Paul Cornett <paulcor@users.noreply.github.com>
2021-01-25 00:49:27 +01:00
Vadim Zeitlin
3568a160a9 Use wxGtkValue RAII wrapper in wxGTK code
wxGtkValue class was added back in 3f84cb17ca (Add wxActivityIndicator
control., 2015-03-06), but somehow never used. Start using it now
(better late than never...) as it makes the code simpler, shorter and
more robust.

No real changes.
2021-01-24 23:55:43 +01:00
Paul Cornett
638f0f89fc Fix mouse event coordinates for single-line wxTextCtrl with GTK3 2021-01-21 11:27:00 -08:00
Vadim Zeitlin
181be127a5 Simplify wxUSE_WEBREQUEST_XXX logic
Remove automatic definition of wxUSE_WEBREQUEST depending on whether
wxUSE_WEBREQUEST_XXX are defined and follow the same approach as with
wxUSE_GRAPHICS_XXX, i.e. define wxUSE_WEBREQUEST_XXX as wxUSE_WEBREQUEST
by default instead.

Move wxUSE_WEBREQUEST_WINHTTP to wxMSW-specific file, it doesn't need to
be in common one (unfortunately this can't be done for the Mac-specific
wxUSE_WEBREQUEST_URLSESSION yet, because macOS-specific settings are not
injected into setup.h.in currently).

Also fix test for winhttp.h availability: it seems to be present in all
MinGW64 distributions, but not in MinGW32, so test for this and not for
gcc version.

Finally remove the now unnecessary test for macOS 10.9, as we only
support 10.10+ anyhow by now.
2020-12-13 16:34:47 +01:00
Vadim Zeitlin
5c3db1574e Fix typo and slightly improve wxUSE_WEBREQUEST_CURL comment 2020-12-13 00:10:28 +01:00
Vadim Zeitlin
6bdab7b3c8 Merge branch 'master' into web-request
Merge with the latest master in preparation for merging into master.

Rebake to resolve conflicts in generated files.
2020-12-12 18:12:25 +01:00
Vadim Zeitlin
d47fa718cd Add wxDataViewCtrl::ExpandChildren()
This convenient method allows to expand all children of the item
recursively.

This is directly supported by both native implementations, so it makes
sense to have this in wxDataViewCtrl itself, even if it could be also
(less efficiently) implemented in the user code.
2020-12-05 16:37:13 +01:00
Vadim Zeitlin
712c2d4004 Add possibility to create "Close" bitmap button from XRC
This requires refactoring NewCloseButton() in order to extract
CreateCloseButton() from it, as XRC relies on being able to use two-step
creation which was previously impossible for this kind of buttons.

CreateCloseButton() is rather unusual, as it has to be declared in the
derived, platform-specific class, in order to be able to call its
Create(), but is defined only once in common, platform-independent,
code. However the only alternative seems to be to have a static
function, e.g. InitCloseButton(), which wouldn't be very pretty neither.

Closes https://github.com/wxWidgets/wxWidgets/pull/2118
2020-11-19 15:44:54 +01:00
Paul Cornett
ba4df6d996 Build fixes for GTK < 2.14 2020-10-23 09:35:37 -07:00