Commit Graph

1087 Commits

Author SHA1 Message Date
Vadim Zeitlin
802c81fff7 Merge branch 'mac-search-menu-check'
Fix check items state in wxSearchCtrl menu under macOS.

See https://github.com/wxWidgets/wxWidgets/pull/2304
2021-04-04 17:04:18 +02:00
Vadim Zeitlin
9c1c4817db Remove unused senderWindow argument of wxMenu::HandleCommandXXX()
This parameter isn't used anywhere, so just remove it to simplify the
code.
2021-04-04 14:29:34 +02:00
Vadim Zeitlin
0f1d1d2ae9 Update wxSearchCtrl popup menu state after showing it
Fix the state of the check/radio items in the menu by updating the
template used by macOS to create the actual menu after showing it and
possibly changing the items state.

This is not ideal because changing the state from the program, e.g.
using wxMenuItem::Check(), still doesn't work correctly, i.e. isn't
reflected in the menu when it's shown, but better than nothing until a
better solution (which ideally would update the menu just before showing
it, but it's not clear how exactly can we do it, knowing that we don't
get wxEVT_MENU_OPEN for this menu neither) can be found.
2021-04-04 14:21:27 +02:00
Vadim Zeitlin
5f482e15ab Merge branch 'osx-set-color-without-font'
Set colour without changing font in wxOSX.

See https://github.com/wxWidgets/wxWidgets/pull/2278
2021-04-04 14:19:39 +02:00
Tobias Taschner
e63fd03611 macOS: Improve wxWebView::Paste()
The default (javascript) implementation presents the user with a popup
menu containing a single 'Paste' menu item.
Send this action to directly paste as expected.
2021-03-26 10:28:48 +01:00
Stefan Csomor
d1c0d3b18c keeping the OSX specific use of origin for non-native borders
fixes #19108
2021-03-20 22:09:31 +01:00
Tobias Taschner
18f5b01cc6 Implement user agent access for macOS 2021-03-17 09:42:01 +01:00
Stefan Csomor
0afd3143d8 support building against iOS 12 SDK
where UIMenuElement is not present yet
2021-03-15 08:43:15 +01:00
Vadim Zeitlin
ac4634b294 Update just the colour, not font, in wxOSX SetForegroundColour()
Calling wxWindow::SetForegroundColour() also changed the window font,
which was unexpected and unnecessary.

Add a separate peer SetForegroundColour() method and implement it to
change just the colour in Cocoa version (and leave unimplemented, just
as it was before, for iOS) and use it in wxWindow to avoid the font
change.
2021-03-13 23:03:28 +01:00
Vadim Zeitlin
ede4ff9490 Factor out wxWidgetCocoaImpl::GetViewWithText()
Extract this function from wxWidgetCocoaImpl::SetFont() to allow its
reuse.

No changes, this is a pure refactoring.
2021-03-13 23:01:21 +01:00
Václav Slavík
aa2a291891 Support underline and strikethrough in wxMarkupToAttrString
Honor wxFont's strikethrough and underline attributes when converting
label markup to NSAttributedString. On macOS, strikethrough and
underline are properties of (rich) text, not of fonts, so a conversion
like this is necessary.
2021-03-13 19:38:16 +01:00
Tobias Taschner
4ab9ee32a8 macOS: Implement access to dev tools for wxWebView 2021-03-08 12:32:53 +01:00
Tobias Taschner
a27f73367c Implement AddUserScript() for WKWebView backend 2021-02-28 19:55:19 +01:00
Tobias Taschner
04d22cc9f6 Add RemoveScriptMessage handler and return bool 2021-02-26 16:59:57 +01:00
Tobias Taschner
a7ff7a8012 Implement script message for WKWebView backend 2021-02-26 16:59:56 +01:00
Tobias Taschner
e0c705648f Add missing wxOVERRIDE to wxWebViewFactoryWebKit 2021-02-08 09:20:53 +01:00
Tobias Taschner
8a9db461ff Implement wxWebView::GetVersionInfo() for macOS
Return the operating system version as the WebKit
version used by WKWebView is bound to the OS.
(Also works for iOS)
2021-02-07 22:14:18 +01: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
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
Stefan Csomor
f8af2601c2 Add wxOSX_VERIFY_NOERR macro and use it in wxOSX code
This macro replaces the deprecated __Verify_noErr defined in the SDK.

It is different from assert, as the expression given to the macro is
always evaluated and then, if the result is not zero, and asserts are
on, an assert containing a human readable message with the description
of the error code is triggered.

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

Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
2021-01-17 23:57:38 +01:00
Vadim Zeitlin
febd185fc6 Merge branch 'web-request'
Add wxWebViewRequest and related classes allowing to use HTTPS and
HTTP/2.

See https://github.com/wxWidgets/wxWidgets/pull/977
2021-01-17 18:19:47 +01:00
Vadim Zeitlin
9c66a9a8db Merge branch 'macos-native-statusbar' of https://github.com/vslavik/wxWidgets
Improve macOS status bar appearance and simplify code.

See https://github.com/wxWidgets/wxWidgets/pull/2160
2021-01-16 18:57:23 +01:00
Václav Slavík
634f60ff23 Remove redundant code from wxStatusBarMac
Remove a lot of Mac-specific code from wxStatusBarMac in favour of using
shared wxStatusBarGeneric:

- Now that wxFRAME_EX_METAL aka NSWindowStyleMaskTexturedBackground
  doesn’t affect text placement, there’s no reason for customized
  DrawFieldText(). As a side effect of this removal, ellipsizing fields
  is now supported.

- Remove customized DoUpdateStatusText() code that is no longer needed.

See https://github.com/wxWidgets/wxWidgets/pull/2160#pullrequestreview-563916013
2021-01-16 18:30:55 +01:00
Vadim Zeitlin
717e6590bd Merge branch 'macos_wkwebview' of https://github.com/TcT2k/wxWidgets
Use WKWebView for wxWebView Implementation under Apple systems.

See https://github.com/wxWidgets/wxWidgets/pull/2113
2021-01-16 16:20:58 +01:00
Vadim Zeitlin
508a4f6ca8 Fix Cancel() semantics under MSW and other improvements to it
Under MSW, don't set the state to State_Cancelled as soon as Cancel()
was called, as the request was still used from the other threads
afterwards, resulting in race conditions and crashes.

Fix this by just removing the SetState(State_Cancelled) call from the
main thread, as it was redundant anyhow. This also makes the behaviour
correspond to the documentation, which indicates that Cancel() works
asynchronously.

Also ensure, for all backends, that we actually cancel the request only
once, even if public Cancel() is called multiple times. This required
renaming the existing wxWebRequestImpl::Cancel() to DoCancel().
2021-01-16 13:50:29 +01:00
Vadim Zeitlin
65aad890e3 Add GetNativeHandle() to wxWebSession and wxWebRequest
This allows to retrieve the handles used internally in order to do
something not supported by the public API yet.
2021-01-16 00:21:00 +01:00
Vadim Zeitlin
70e7861a7d Implement authentication support for wxWebRequest under Mac
Add wxWebAuthChallengeURLSession and use the appropriate delegate
callback to create it.
2021-01-15 00:46:45 +01:00
Vadim Zeitlin
d0f56b1d04 Document wxWebResponse::GetContentLength()
Also change its return type from wxInt64 to wxFileOffset for consistency
with all the other length/progress-related functions in wxWebRequest.
2021-01-12 03:25:16 +01:00
Václav Slavík
e687d0c4f6 Render statusbar natively on macOS
Instead of trying to mimic native statusbar background rendering in our
own code, use NSWindow setContentBorderThickness:forEdge: to extend the
border that is drawn by the system. This is the canonical way of doing
statusbars ("bottom bar") in AppKit.

The text is still drawn generically, but that's a much smaller issue
than trying to match the border gradient.
2020-12-31 18:51:46 +01:00
Vadim Zeitlin
50424cba2c Change wxWebRequest and related objects to hide ref counting
Don't force the application code to deal with wxObjectDataPtr<> or,
worse, calling {Inc,Dec}Ref() manually by hiding it inside the wx
objects themselves and giving the value-like semantics to them.

There should be no real changes in the behaviour, but the API does
change significantly. Notably, wxWebRequest is not a wxEvtHandler itself
any longer, as this would be incompatible with the value semantics, and
an event handler needs to be specified when creating it, so that it
could be notified about the request state changes.
2020-12-30 02:02:20 +01:00
Vadim Zeitlin
71d5729171 Make wxWebSessionFactory private
Having wxWebSessionFactory part of the public API implies keeping
compatibility with the possible ways of implementing it which is too
restrictive for no good reason, so move this class to the private header
and don't document it nor wxWebSession::RegisterFactory() (which is now
private).
2020-12-27 01:03:08 +01:00
Vadim Zeitlin
e5bd5a926c Move backend-specific wxWebRequest headers to private subdirs
There is no need to make these headers public and keeping them private
will allow making backwards-incompatible changes to them in the future.
2020-12-26 17:00:07 +01:00
Andreas Falkenhahn
9a78bfb553 Mac: Add wxDataViewCtrl::AdjustAutosizedColumns()
Refactor common code and also for upcoming accessibility from
wxCocoaOutlineView.

Part of #19003.

Co-Authored-By: Dimitri Schoolwerth <dimitri@schoolwerth.com>
2020-12-22 02:03:38 +01:00
Tobias Taschner
4df334cec4 macOS/iOS: Use WKWebView for wxWebView Implementation
WKWebView replaces
WebView on macOS (available since 10.10, deprecated since 10.14) and
UIWebView on iOS (available since 8.0 deprecated since 10.0).
Using WKWebView ensures future compatiblity and unifies the interface
used for iOS and macOS.
2020-12-14 10:18:01 +01:00
Vadim Zeitlin
889e974700 Fix typo in wxWebSessionDelegate name
No real changes, just add the missing "a".
2020-12-13 20:45:18 +01: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
700d6ddea6 Minor code formatting changes
No real changes at all, just improve layout, consistency etc.
2020-12-13 00:35:24 +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
938e493456 Merge branch 'osx-fixes'
Miscellaneous macOS bug fixes.

See https://github.com/wxWidgets/wxWidgets/pull/2136
2020-12-08 18:43:05 +01:00
Vadim Zeitlin
65955a1d91 Merge branch 'dvc-kbd-shortcuts'
Add wxDVC::ExpandChildren() and handle standard keyboard shortcuts in
the generic version.

See https://github.com/wxWidgets/wxWidgets/pull/2135
2020-12-07 14:07:20 +01:00
Stefan Csomor
4aafab47e7 Simplify SetFont() in wxOSX implementations
It doesn't need to take the colour and other parameters unused any more.

Closes https://github.com/wxWidgets/wxWidgets/pull/2103
2020-12-06 00:33:30 +01:00
Andreas Falkenhahn
8bf53a7782 Fix selection after inserting items in wxListBox in wxOSX
We need to adjust the indices of the currently selected items as we need
to keep the same items, not the same indices, selected after new items
insertion.

Closes #18902.
2020-12-05 23:39:17 +01:00
Andreas Falkenhahn
e89e76bb82 Make wxCOL_WIDTH_AUTOSIZE work correctly in Mac wxDataViewCtrl
Update the width when items are expanded and collapsed and also take the
expander width into account.

Change m_ModelNotifier type to avoid casts when calling wxOSX-specific
method on it.

Closes #14939.

Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>
2020-12-05 22:45:13 +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
Stefan Csomor
14fb1c5fe1 wrapping private types properly in UTI 2020-11-29 20:42:26 +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
Vadim Zeitlin
da3aef753e Remove variadic macros test from configure
This is useless, all still supported compilers except ancient MSVS
versions (for which configure is not used anyhow) support variadic
macros, so don't waste time testing for them.

Note that the checks for HAVE_VARIADIC_MACROS in the sources are still
left because it is still possible to explicitly disable variadic macros
support using --disable-vararg_macros for strict C++98 compatibility.
2020-10-20 01:59:00 +02:00