Commit Graph

40660 Commits

Author SHA1 Message Date
Artur Wieczorek
bdfdf82bcd Iterate over wxPointList with STL syntax in wxPostScriptDC::DoDrawSpline
STL syntax is more readable than notation with legacy API
2021-07-04 20:39:11 +02:00
Artur Wieczorek
1e2dbcbc24 Use wxPoint2DDouble in wxPostScriptDC::DrawSpline
We can simplify the code by using wxPoint2DDouble in the calculations.
2021-07-04 20:35:19 +02:00
Artur Wieczorek
9b542a965e Simplify drawing spline in wxPostScriptDC
We can produce simpler and more readable PostScript code by doing
the calculations of Bézier curve parameters in the code instead
of delegating this task to the PostScript processor.
2021-07-04 20:12:45 +02:00
Artur Wieczorek
819b11ff89 Iterate over wxPointList with STL syntax in wxDC::DoDrawSpline
STL syntax is more readable than notation with legacy API.
2021-07-04 20:06:44 +02:00
Artur Wieczorek
4423f6d256 Use wxStack instead of simulating a stack with array
We have a dedicated wxStack class so there is no need
to simulate a stack with array.
2021-07-04 19:35:48 +02:00
Artur Wieczorek
cc5bfc0fb1 Implement DrawSpline in wxSVGFileDC
Drawing Bézier curves is supported natively in SVG so these curves
should be used instead of generic wxDC implementation based on
polygonal approximation.
2021-07-04 19:22:02 +02:00
Vadim Zeitlin
f31a745909 Remove unnecessary c_str() from wx var arg functions arguments
Using c_str() for arguments to wxString::Printf(), Format() and
wxLogXXX() is useless since wx 2.9 days, so simply remove them.

No real changes, this is just a (long due) cleanup.
2021-07-04 15:08:13 +01:00
Artur Wieczorek
b35d595e5d Check that number of points passed to wxDC::DrawSpline() is at least 2
DoDrawSpline() implementations for all ports work for the number of points
>= 2 (for 2 points there is drawn a straight line) so we need to add checks
whether this requirement is met.

See #19172.
2021-06-30 22:24:28 +02:00
Artur Wieczorek
a3988c8db6 Implement getting/releasing HDC in Cairo wxGraphicsContext (wxMSW) 2021-06-28 00:19:15 +02:00
Artur Wieczorek
dd7bcbd9eb Implement getting/releasing HDC in Direct2D wxGraphicsContext
See #19207.
2021-06-28 00:18:16 +02:00
Artur Wieczorek
0939130158 Refactor wxGCDC to delegate acquiring/releasing HDC to wxGraphicsContext
Instead of implementing MSW-specific code to handle HDC for GDI+ context
directly in wxGCDC delegate acquiring/releasing HDC to underlying
wxGraphicsContext. Decoupling GDI+-specific code from wxGCDC will allow
us to implement handling HDC in other graphics renderers in a clean way.
2021-06-27 23:46:21 +02:00
Ian McInerney
fd77020792 Fix wxChoice with items too long to fit into it in wxGTK3
Enable ellipsization to show the items reasonably well even if they're
too long to fit into the available space -- without this, just the tail
of the long items was shown and shorter items could have been not shown
at all, as only the blank part of their label was visible.

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

Co-Authored-By: Kent Tessman <kent@generalcoffee.com>
Co-Authored-By: Paul Cornett <paulcor@users.noreply.github.com>
Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>
2021-06-25 11:32:42 +02:00
Artur Wieczorek
ffc7c036f1 Fix acquiring HDC from wxGCDC with non-GDI+ graphics context
HDC can be acquired/released only when wxGCDC is associated with GDI+
graphics context.

Closes #19207.
2021-06-24 19:50:29 +02:00
Artur Wieczorek
36f84d0257 Add missing reference to dynamically loaded Cairo API 2021-06-24 19:48:19 +02:00
Vadim Zeitlin
2d9c9d9689 Fix handling of ampersands in wxCheckListBox under MSW
They were incorrectly interpreted as mnemonics when drawing
wxCheckListBox items, which didn't make sense and was inconsistent with
the other ports and even wxListBox in wxMSW itself.

It also affected wxRearrangeCtrl under MSW, which uses wxCheckListBox
for its implementation.

Closes #19201.
2021-06-24 14:49:08 +01:00
Vadim Zeitlin
c59ed10c2a Fix DPI change handling in wxGrid with hidden row/column labels
Don't reset the labels windows size to the default value, it should stay
as 0 because otherwise we break the invariants

	m_rowLabelWidth  != 0 <=> m_rowLabelWin->IsShown()
	m_colLabelHeight != 0 <=> m_colLabelWin->IsShown()

that the rest of the code relies on.

Closes #18904.
2021-06-24 14:40:35 +01:00
Kvaz1r
a0d67a3ca5 Remove redundant code 2021-06-14 15:10:46 +03:00
Kvaz1r
c452930615 Fix floating for resizable auitoolbars 2021-06-14 15:06:48 +03:00
Tomay
b52f00492e Fix checks for wxPalette index validity
Consistently check that the index is valid in all ports, instead of
using hard-coded 255 rather than the actual number of colours in some of
them and forgetting to check that the index is positive in others.

Closes #19198.
2021-06-11 00:23:46 +02:00
Andreas Falkenhahn
527bcb246b Fix item position in sorted generic wxDataViewCtrl
Compare the item whose value has changed with both the previous and the
next items, if any.

Closes #19194.
2021-06-11 00:16:12 +02:00
Vadim Zeitlin
80b3348c39 Use real wxAuiNotebook base class in its wxBEGIN_EVENT_TABLE()
This shouldn't really change anything, but is more appropriate and might
matter in the future if other event handlers are added to wxBookCtrlBase
event table.
2021-06-10 14:23:13 +02:00
Vadim Zeitlin
b17e7a7640 Merge branch 'aui-notebook-rtti'
Fix down-casting from wxAuiNotebook to wxBookCtrlBase.

See https://github.com/wxWidgets/wxWidgets/pull/2388
2021-06-10 01:02:01 +02:00
Vadim Zeitlin
9324c7bfdd Fix sending wxEVT_GRID_RANGE_SELECTED from Select{All,Col,Row}()
This was broken in to 682cb8355c (Replace "sendEvent" parameter in
wxGridSelection with "eventType", 2020-08-21) which changed Select() to
take wxEventType argument but still passed it "true" in a few places.

Fix this and add a unit test verifying that this works as expected.

Ideal would, of course, be to avoid implicit conversions from bool to
wxEventType but making wxEventType anything other than int, for which
such conversions are unavoidable, is too backwards-incompatible to
seriously consider.
2021-06-09 16:09:55 +02:00
Dominique Martinet
e3db863a0e wxMediaCtrl wayland support: resize video in expose_event_callback
the Move handler apparently misses some resize events, so move the
gst_player_video_overlay_video_renderer_set_render_rectangle call
to expose_event_callback.
This is kept as a separate commit because it would be more efficient
to keep it in Move once we can catch that initial size change, so
this commit can get reverted then.
2021-06-09 15:38:33 +09:00
Dominique Martinet
0080aa6086 wxMediaCtrl wayland support: disable xvimagesink on wayland
gstreamer is known to crash on xvimagesink if the main window is
wayland-native and DISPLAY is set: try to make it not load.

Also do the same for ximagesink just in case.
2021-06-09 15:38:33 +09:00
Dominique Martinet
b16aba57b1 wxMediaCtrl wayland support: place window where we want it
without this call gstreamer + gtk wayland would just draw the video over the whole window.
There might be a better way to do that
2021-06-09 15:38:33 +09:00
Dominique Martinet
bae3f61a4e wxMediaCtrl wayland support: pass wl_display to gstreamer
gstreamer creates a new connection to the wayland display by default, and
gst_video_overlay_set_window_handle() only works if both the parent surface
(part of the gtk window) and the gstreamer surface are on the same display,
so we need to tell gstreamer about our wl_display when it asks
2021-06-09 15:05:44 +09:00
Vadim Zeitlin
894861becb Fix wxRTTI for wxAuiNotebook by deriving it from wxBookCtrlBase
Otherwise wxDynamicCast-ing wxAuiNotebook to wxBookCtrlBase didn't work
(even if the more usual and useful upcast did still work).

Add a unit test for this.
2021-06-08 22:40:29 +02:00
Václav Slavík
c817a434d8 Fix wxIcon wxDVC columns under wxGTK
b376d1402b accidentally broke columns
with wxIcon type. Contrary to that commit's assumption, operator<<
cannot convert wxIcon to wxBitmap and asserts:

src/common/bmpbase.cpp(33): assert "variant.GetType() == "wxBitmap"" failed in operator<<().

Fixed by restoring explicit conversion.
2021-06-07 07:59:56 -07:00
Tijs Vermeulen
7ca4705bd7 removed build-time condition SDK >= 10.14 (#2377)
"trigger redraw upon shown for layer-backed views" is also needed when building with sdk 10.13

the build-time check that the used SDK must be 10.14 or higher is not needed
I checked building with SDK 10.12 and 10.13

the used NsView functions are available in far older SDK's
* https://developer.apple.com/documentation/appkit/nsview/1483475-setneedsdisplay
 Availability macOS 10.0+ 
* https://developer.apple.com/documentation/appkit/nsview/1483473-ishiddenorhashiddenancestor
 Availability macOS 10.3+

I did not add an ifdef checking for sdk 10.3 or higher - I assume the minimum requirement for building wxWidgets is higher than 10.3

see also e484a2db19
2021-06-03 18:18:20 +02:00
Václav Slavík
3417c8e48b Fix passing of default language to wxTranslations
wxTranslations needs the information that user's default language is
used; in particular, it may choose to use a cascade of user-preferred
languages to choose the best UI language.

This was accidentally broken by
18bf718f60 which changed the logic to
fill shortName from the builtin database. This consequently changed
wxTranslations to use only the single detected language and ignore
user's preference cascade.

Closes https://github.com/wxWidgets/wxWidgets/pull/2385
2021-05-31 16:35:38 +02:00
Vadim Zeitlin
01fd98c783 Merge branch 'generic-dvc-composite'
Use wxCompositeWindow for generic wxDVC implementation.

See https://github.com/wxWidgets/wxWidgets/pull/2382
2021-05-31 16:33:50 +02:00
Vadim Zeitlin
82ebbe880a Merge branch 'grid-colours'
Fix colours of wxGrid cursor after a recent regression.

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

Closes #18941.
2021-05-31 16:28:28 +02:00
Vadim Zeitlin
f1d84277b4 Merge branch 'nicer-boxsizer-asserts'
Improve the error messages by indicating what should be done to avoid
the asserts and provide a way to disable them if really needed.

See https://github.com/wxWidgets/wxWidgets/pull/2375
2021-05-31 15:18:37 +02:00
jwiesemann
5dbdada6aa Fix wxMask copy ctor from an uninitialized mask in wxMSW
Don't assert when copying an invalid, i.e. uninitialized, mask in wxMSW.

Do initialize m_maskBitmap in any case in the copy ctor.

Closes #19171.
2021-05-27 23:54:07 +02:00
Vadim Zeitlin
3ed930c736 Use wxCompositeWindow for generic wxDataViewCtrl implementation
This makes several methods that didn't have any effect before work
correctly, including SetToolTip(), whose effect is now shown in the
sample, but also SetCursor() and SetLayoutDirection().

Some methods would now actually work too well: SetForegroundColour() and
SetBackgroundColour() implementations in wxCompositeWindow apply to all
sub-windows, but in wxDataViewCtrl they are only supposed to affect the
items, but not the header, so we need to override them to prevent the
base class version from being used. It is still preferable to explicitly
disable these two methods and inherit all the other ones (including any
possibly added in the future) from wxCompositeWindow to implementing all
the methods manually in wxDataViewCtrl itself.
2021-05-24 14:24:24 +01:00
Vadim Zeitlin
0f0f9eb790 Merge branch 'gtk-key-events'
Fix key events for wxDataViewCtrl in wxGTK.

See https://github.com/wxWidgets/wxWidgets/pull/2379
2021-05-24 15:20:19 +02:00
Vadim Zeitlin
e067e4233c Revert "Fix showing cells without values in wxDataViewCtrl"
This reverts commit f68c88b8d2 which
doesn't seem necessary any longer: the originally observed problem can't
be reproduced in contemporary macOS versions (10.14+), while calling
SetValue() even for null values results in asserts from several
renderers which don't expect this to happen.

This commit is best viewed ignoring whitespace-only changes.

Closes #18934.
2021-05-24 15:15:17 +02:00
Vadim Zeitlin
25c0e27b6c Remove apparently unnecessary call from wxGTK wxToolBar
ConnectWidget() will be called from PostCreation() just below, so it
doesn't seem necessary to call it explicitly from wxToolBar::Create().
2021-05-24 14:43:05 +02:00
Vadim Zeitlin
c9d7ba3171 Fix key events for native GTK controls such as wxDataViewCtrl
Connect to key-{press,release}-event on the "focus widget" rather than
the main widget, to ensure that we get them before the native control
does and so can generate the key events even for the keys handled by the
control internally.

This allows to get events for the arrow keys in wxDataViewCtrl, for
example, while previously these keys were consumed by the control
itself, as could be seen with the following patch to the sample

---------------------------------- >8 --------------------------------------
diff --git a/samples/treelist/treelist.cpp
b/samples/treelist/treelist.cpp
index af6905cecb..74894cc9a9 100644
--- a/samples/treelist/treelist.cpp
+++ b/samples/treelist/treelist.cpp
@@ -349,6 +349,10 @@ bool MyApp::OnInit()
     sizer->Add(textLog, wxSizerFlags(1).Expand());
     SetSizer(sizer);

+    m_treelist->GetView()->Bind(wxEVT_KEY_DOWN, [](wxKeyEvent& e) {
+        wxLogMessage("Key in tree: %d", e.GetKeyCode());
+        e.Skip();
+    });

     // Finally show everything.
     Show();
---------------------------------- >8 --------------------------------------

Pressing arrow keys didn't generate the expected message before (unless
the focus was on the control header and not on the main area itself).

This may fix similar issues with other controls setting m_focusWidget as
well.
2021-05-24 14:43:05 +02:00
Vadim Zeitlin
01aebc08ee Merge branch 'gtk-fix-bogus-dvc-context-menu'
Fix bogus wxDVC context menu event in wxGTK.

See https://github.com/wxWidgets/wxWidgets/pull/2362
2021-05-22 21:28:09 +01:00
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
7a6bec389b Merge branch 'msw-fix-BCM_GETIDEALSIZE'
Fix size of the buttons when not using manifest in wxMSW.

See https://github.com/wxWidgets/wxWidgets/pull/2346
2021-05-22 21:18:23 +01:00
Vadim Zeitlin
880c50bade Avoid bogus assert failures when releasing mouse capture
Calling ReleaseMouse() from wxEVT_MOUSE_CAPTURE_LOST handler could
result in bogus asserts about ReleaseMouse() reentrancy because the
function generating "capture lost" events in wx itself wrongly set the
wxMouseCapture::changing flag, instead of just examining it, as it was
supposed to do.

This corrects a problem introduced back in b0ad1918b9 (No changes, just
use wxRecursionGuard instead of manual boolean flag., 2013-08-18) which,
contrary to the commit message, did change the behaviour by replacing a
simple test with the use of wxRecursionGuard here.
2021-05-22 16:23:53 +01:00
Vadim Zeitlin
c31b32d756 Group the same colours together in Mac wxSystemSettings code
No real changes, just make it more obvious that wxSYS_COLOUR_BTNSHADOW
and wxSYS_COLOUR_3DDKSHADOW are mapped to the same colour under Mac.
2021-05-22 16:15:24 +01:00
Vadim Zeitlin
092bd70519 Restore lighter shadow colours for wxGrid row/column separators
This was also changed in 3c28244806 (Improve wxGrid appearance in dark
mode under macOS, 2020-08-07) but there doesn't appear to be any good
reason to do it as wxSYS_COLOUR_3DDKSHADOW is the same as the previously
used wxSYS_COLOUR_3DSHADOW (a.k.a. wxSYS_COLOUR_BTNSHADOW) under Mac, so
this didn't change anything there -- but did make the shadows darker and
hence more pronounced and more noticeable under MSW.

Undo this change to restore the old and nicer looking appearance.
2021-05-22 16:13:18 +01:00
Vadim Zeitlin
829d3fd094 Restore wxGrid cursor visibility under non-Mac platforms
The changes of 3c28244806 (Improve wxGrid appearance in dark mode under
macOS, 2020-08-07) resulted in using white highlight colour over white
background under at least MSW and probably elsewhere, making the grid
cursor invisible by default.

Fix this by using wxSYS_COLOUR_WINDOWTEXT which must contrast with
wxSYS_COLOUR_WINDOW used for the background colour.
2021-05-22 16:06:10 +01:00
Vadim Zeitlin
1d6c740f3b Disable sizer flag checks if WXSUPPRESS_SIZER_FLAGS_CHECK is set
This provides a less intrusive, and also usable by the end users rather
than only by the developers, way of doing the same thing as the just
added wxSizerFlags::DisableConsistencyChecks() does.
2021-05-20 13:27:08 +01:00
Vadim Zeitlin
2e289d7231 Add wxSizerFlags::DisableConsistencyChecks()
This allows to (hopefully temporarily) disable size flag check asserts.
2021-05-20 13:27:06 +01:00
Vadim Zeitlin
5502d2d86b Make sizer flag asserts even more verbose and hopefully helpful
Try to indicate that these asserts are informative and don't indicate a
fatal problem.
2021-05-20 13:26:44 +01:00