Commit Graph

253 Commits

Author SHA1 Message Date
Vadim Zeitlin
db22d12a47 Merge branch 'osx-dataview-native-key'
Implement wxEVT_CHAR generation for wxDataViewCtrl under Mac.

Closes https://github.com/wxWidgets/wxWidgets/pull/2324
2021-04-24 00:40:15 +02:00
Vadim Zeitlin
16ba1daebf Use wxOVERRIDE in wx/osx/cocoa/dataview.h
No real changes, just add wxOVERRIDE.
2021-04-24 00:38:29 +02:00
Stefan Csomor
26d6f82a81 Implement EVT_CHAR generation for wxDataViewCtrl under Mac
This requires manually sending the original key event back to the native
control because NSOutlineView doesn't implement the NSTextInputClient
protocol and so doesn't allow handling the keys in the usual way.
2021-04-24 00:30:30 +02:00
Stefan Csomor
18c45321f4 Return bool from wxWidgetCocoaImpl::doCommandBySelector()
This allows to determine whether the event was handled by wx code and
perform further processing by feeding things back to native code if not.
2021-04-24 00:27:26 +02:00
Václav Slavík
db3e54b3dc macOS: Don't interfere with native views' drag and drop
wxWidgetCocoaImpl injects implementation of several
NSDraggingDestination protocol methods, but never called their base
implementations, presumably on the assumption that drag and drop is
explicitly supported and not builtin into native NSView-derived
controls.

This prevented native builtin d'n'd in e.g. NSTextView (text can be
copied and inserted by dragging it to the insertion point) from
working. Fixed by always calling base implementation.

Closes https://github.com/wxWidgets/wxWidgets/pull/2320
2021-04-14 17:59:28 +02:00
Vadim Zeitlin
b671d230f2 Merge remote-tracking branch 'MaartenBent/bitmap_cursor_osx'
Add wxBitmap(const wxCursor &cursor) constructor to wxOSX.

See https://github.com/wxWidgets/wxWidgets/pull/2314
2021-04-11 16:46:58 +02:00
Igor Korot
9394d26c40 Implement wxBitmap(const wxCursor&) constructor for OSX 2021-04-10 14:17:27 +02:00
Vadim Zeitlin
a02690f957 Merge branch 'mac-dvc-autosize'
Fixes for wxDVC columns autosizing under Mac.

See https://github.com/wxWidgets/wxWidgets/pull/2305
2021-04-08 01:39:21 +02:00
Stefan Csomor
26bc2c015b remove obsolete macOS SDK guards
we need SDK 10.11 now
2021-04-07 16:37:58 +02:00
Tobias Taschner
0ff1bdec09 Add wxFullScreenEvent for macOS
Send a wxFullScreenEvent when the user enters or exits full screen on
macOS. EnableFullScreenView() has to be used to enable the native
full screen API.

Closes https://github.com/wxWidgets/wxWidgets/pull/2284
2021-04-06 19:01:25 +02:00
Andreas Falkenhahn
c9221fd538 Fix sizing of temporarily last columns in macOS wxDataViewCtrl
Update the column width if it used to be the last one but isn't last one
any longer.

Closes #14939.
2021-04-04 17:48:25 +02: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
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
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
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
Václav Slavík
9457c35d42 Speed up wxDataViewCtrl::SetSelections() on macOS
Don't make many single-item selection adjustments in SetSelections() in
wxOSX and instead implement it with a single native call to
selectRowIndexes:byExtendingSelection:

This has a dramatic, orders of magnitude effect on this call's
performance when selecting many items: selecting 10 thousand items goes
from minutes of runtime and gigabytes of RAM  to unobservable impact in
both.
2020-10-12 18:32:11 +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
Stefan Csomor
9be2c3717d Improve native keyDown handling in wxOSX
Provide API for dealing with m_lastKeyDownEvent instead of using it
directly and extend it to avoid sending duplicate events for keys which
are mapped to multiple selectors, such as Ctrl-O with the default key
bindings.

Closes https://github.com/wxWidgets/wxWidgets/pull/1928
2020-07-06 00:13:18 +02:00
Stefan Csomor
80610cb383 switching from AvailabilityMacros.h to Availability.h
The old version is not updated for 10.16 therefore switch to the ‚newer‘ version - that existed since 10.6 - starting with double underscores
2020-06-25 15:59:53 +02:00
Vadim Zeitlin
41f4b1716d Set initial wxTextCtrl text earlier in wxOSX
This reverts the changes of 63bcc669d8 (fixing setting initial value
under osx_cocoa for single line text controls, 2009-10-01) and fixes the
problem which this commit probably tried to fix in a different way,
using the same approach as in 98f5315405 (Don't set initial label in
wxNativeWindow on OS X, 2016-04-29) as the real root of the problem was
that the text set in CreateTextControl() was overwritten later when the
label was set from SetPeer().

This change means that the text is now set correctly before SetPeer()
calls SetInitialSize() call, which makes it possible to set the correct
initial size based on the initial text, as will be done in later
commits.

It also makes Cocoa port more consistent with iOS one, as a nice side
effect.
2020-06-08 15:29:42 +02:00
Stefan Csomor
80fd70e8f1 make NSString conversions available for all osx platforms 2020-04-07 12:04:01 +02:00
Ian McInerney
540fed9216 Implement background color attribute for wxDataViewCtrl in wxOSX
Add support for this attribute for text-like cells to the native macOS
version too, to bring it up to parity with the generic and GTK ones.

Closes https://github.com/wxWidgets/wxWidgets/pull/1673
2019-12-09 22:45:06 +01:00
Stefan Csomor
715cb66ac4 Fixing IconRef Build re adding support for reading icns files 2019-11-05 09:46:02 +01:00
Vadim Zeitlin
87bba02fef Stop handling performKeyEquivalent: in wxOSX
We can't handle the accelerators (known as "key equivalents" in Cocoa)
in this function because it is called for the views in top to bottom
order, while wx semantics is for accelerators to be handled in the
accelerator table closest to the focused window.

So just remove this code and rely on accelerator handling happening in
wxWindowMac::OSXHandleKeyEvent() instead.

Closes #13937.
2019-10-27 00:02:29 +02:00
Vadim Zeitlin
c0df6ec475 Merge two wxDataViewWidgetImpl::Remove() overloads into one
Having 2 different overloads might have been useful for Carbon
implementation, but as they do exactly the same thing in the Cocoa
version, leave only one of them -- and don't pass it the item, or items,
being deleted as they're not used anyhow.

No real changes.
2019-09-16 17:48:00 +02:00
Vadim Zeitlin
5488a1438f Globally replace vadim@wxwindows.org with vadim@wxwidgets.org
The old email address is invalid since many years and shouldn't be used
any longer.

No real changes.
2019-04-22 14:12:05 +02:00
Vadim Zeitlin
fe311b9cc5 Use __builtin_available() when available in wxMac builds
The advantage of using this compiler builtin instead of our own platform
checks is that the compiler will warn us (if -Wunguarded-availability is
turned on for APIs introduced before 10.13 or by default for later ones)
if a check is forgotten, which is not the case for the manual checks.

Update the code to use WX_IS_MACOS_AVAILABLE() macro, which expands to
__builtin_available() when supported, and also use API_AVAILABLE() where
it makes sense to avoid having too many checks.
2019-04-18 00:02:34 +02:00
Paul Cornett
9511ab08f1 More use of wxOVERRIDE 2019-04-05 11:08:53 -07:00
Vadim Zeitlin
8fbca5cb70 Remove all trailing spaces
No real changes, just clean up sources by removing trailing spaces from
all the non-generated files.

This should hopefully avoid future commits mixing significant changes
with insignificant whitespace ones.
2019-01-30 17:35:54 +01:00
Stefan Csomor
e5e6ee7e77 macOS wxWidgetImpl constructor with flags
replacing bools with int flag
2019-01-03 20:02:24 +01:00
Stefan Csomor
a29ea16ccd separate non-native key handling from IsUserPane
NSOpenGLView is needed under 10.14 as a native view, but it doesn’t have its own native key handling, therefore use the same code we have for non-native custom views.
2019-01-03 13:26:50 +01:00
Stefan Csomor
ef48d7f184 set wxOSX_USE_ICONREF to 0 if not defined 2018-10-01 07:21:49 +02:00
Stefan Csomor
19c4d8cf3e macOS, iOS native implementation for wxStaticBitmap
templated native images are not drawing correctly using the low-level drawing calls, therefore use the native Image Views
2018-09-25 15:22:56 +02:00
Stefan Csomor
f29faa0217 optimize handling of high-res native images 2018-09-24 00:12:33 +02:00
Stefan Csomor
266f32493e Removing non-native bitmap code, using common code for iOS and macOS 2018-09-24 00:11:31 +02:00
Stefan Csomor
3370b76318 Direct NSImage drawing 2018-09-24 00:11:31 +02:00
Stefan Csomor
148732993a only use native NSImage dimension 2018-09-24 00:11:31 +02:00
Stefan Csomor
e7d21f6638 Initial Commit of full native bitmap macOS implementation
Right now, to better test regressions, with dual implementation
2018-09-24 00:11:31 +02:00
Stefan Csomor
0e92eb13dc initializing m_ItemCell always 2018-07-13 18:22:45 +02:00
Stefan Csomor
616f0ca7f9 Fixing notebook drawing
Workaround for drawing problems under 10.14 as we do not draw the notebook ourselves, this should be ok on all system versions, for details see #18146
2018-06-27 18:33:23 +02:00
mrX
89ecd81460 Don't change wxTextCtrl colour automatically under macOS
When wxColourDialog is shown, any changes to the colour selected in it
apparently result in broadcast messages to all currently visible text
controls, which was unexpected.

Block the changeColor: message to prevent this from happening.

Closes https://github.com/wxWidgets/wxWidgets/pull/830
2018-06-22 19:45:28 +02:00
Stefan Csomor
9cef8282ab Supporting Appearance Mode change under macOS 10.14
The system color functions depend on the current appearance, this is not automatically set to the effective appearance (that can be changed during runtime via the system preferences), added a helper class to make sure the correct version is used for retrieval.
2018-06-13 23:02:50 +02:00
Vadim Zeitlin
b97ea90f4f Add default value for MakeConfigFileName() 2nd argument
Make it possible to call wxStandardPaths::MakeConfigFileName() without
explicitly specifying the convention to use, to make it conform to the
documentation (previously this only worked when calling the
wxStandardPathsBase version of the method).

Closes #18106.
2018-03-17 17:17:05 +01:00
Stefan Csomor
0fc53016a9 making NSString conversion functions available in private.h 2018-02-28 21:08:27 +01:00
Stefan Csomor
ce90336dff Fixing popup windows with a modal dialog as parent
When having a certain creation sequence, these popup windows were not focused correctly, see https://github.com/wxWidgets/wxWidgets/pull/672 , commit d2265136e359df4d14054860a68bbc7f4910279d , revert this change if problems arise to see whether this is a recursion
2018-01-21 20:41:52 +01:00