Commit Graph

39762 Commits

Author SHA1 Message Date
Vadim Zeitlin
b0c36d02ef Decrease precision for values using factor with number validator
Using too high precision could result in bogus digits appearing in the
displayed value, e.g. 0.058 shown in percents (with a factor of 100)
appeared as 5.800000000000001 before this change.

Closes https://github.com/wxWidgets/wxWidgets/pull/1831
2020-05-06 18:43:43 +02:00
Vadim Zeitlin
e60d43c21e Add compilation guards for macOS 10.10 to avoid warnings
"[NSColor linkColor]" gives a compile-time warning even if we don't use
it during the run-time, so check MAC_OS_X_VERSION_MAX_ALLOWED before
using it.
2020-05-06 17:48:28 +02:00
Vadim Zeitlin
d0fb641498 Merge branch 'cmake-warnings' of https://github.com/MaartenBent/wxWidgets
Enable warnings for CMake builds and fix some warnings that this
exposed.

Also add wxUSE_NATIVE_DATAVIEWCTRL option and change default GTK version
to 3 for CMake too.

See https://github.com/wxWidgets/wxWidgets/pull/1825
2020-05-06 14:34:34 +02:00
Vadim Zeitlin
46dfc54e8d Generalize changes of the previous commits to wxMac too
Handle "impossible" flag combinations such as wxTB_LEFT|wxTB_RIGHT and
wxTB_TOP|wxTB_BOTTOM that are actually possible under Mac too.
2020-05-06 02:14:02 +02:00
Vadim Zeitlin
101f135445 Fix problem with wxTB_VERTICAL | wxTB_RIGHT too
This is similar to the previous commit, but for the other direction.
2020-05-06 02:09:34 +02:00
Maarten Bent
57c385350d Fix inconsistent use of boolean and HRESULT 2020-05-06 01:52:24 +02:00
Teodor Petrov
5dab468444 Implement wxSYS_COLOUR_HOTLIGHT on macOS
* There is linkColor avaiable since 10.10. Just use it.
* https://developer.apple.com/documentation/appkit/nscolor/2998828-linkcolor
* https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color/
2020-05-05 23:40:10 +03:00
PB
33cda12b74 Handle wxToolBars created with wxTB_HORIZONTAL | wxTB_BOTTOM style correctly
wxToolBar created with wxTB_HORIZONTAL | wxTB_BOTTOM had two issues:
(1) There was a toolbar-high gap below the menu bar.
(2) The status bar was not positioned correctly.

Fix both issues by taking into account that wxTB_TOP is an alias for wxTB_HORIZONTAL
and so a wxToolBar can have quite counter-intuitively set both wxTB_TOP and wxTB_BOTTOM.

In such cases it means that the toolbar is horizontal and on the frame bottom,
this needs to be accounted for when computing the origin of the frame client
area as well as the status bar position.

Closes #18760
2020-05-05 20:22:11 +02:00
Vadim Zeitlin
013cacee4d Don't use unsigned variables for pixel values
This is not a good idea because we really don't want them to wrap around
and it also provokes signed/unsigned comparison warnings when using
them.

Also make this variable and the other related one const.
2020-05-03 21:10:03 +02:00
Konstantin S. Matveyev
403a8ed115 Improve drag-and-drop support in generic wxDataViewCtrl
Set the proposed drop index in wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE event
generated by the control to allow dropping either on or between the
items in the control, as it was already possible with the Mac version.

Closes https://github.com/wxWidgets/wxWidgets/pull/1822
2020-05-03 21:10:04 +02:00
Vadim Zeitlin
05bf67df1e Fix parent/child relationship in MSW wxFindReplaceDialog
It's not enough to set the parent pointer in the child, the parent also
needs to be aware of its child, so call AddChild() to do both at once.

This ensures that find dialog with non-null parent is destroyed by it
when it is itself destroyed.

Closes #18747.
2020-05-03 20:17:31 +02:00
Anton Triest
35f1cb417b Fix hit testing in generic wxTreeCtrl in high DPI
Update the code doing hit testing to use FromDIP() too, to be consistent
with the changes of 3a9b5001ce (Fix size of wxGenericTreeCtrl buttons
when using high DPI, 2020-02-23) # Please enter the commit message for
your changes. Lines starting.

See #18674.

Closes #18749.
2020-05-03 19:59:37 +02:00
Vadim Zeitlin
b6c593af45 Fix regression in MSW DoDragDrop() return code
It always returned wxDragNone since the changes of f5548e399e (Fix
problem with dragged icon remaining on screen under MSW 10, 2020-01-11)
which wrongly changed pdwEffect to DROPEFFECT_NONE before doing anything
else, disregarding the fact that it's an in-out parameter and not just
an output one.

Fix this by simply not doing this, just as it hadn't been done before.

See #18499.
2020-05-03 03:13:01 +02:00
Vadim Zeitlin
c88f3a114c Fix warnings in recently added MSWSetTabStops()
gcc complained about converting NULL to long (-Wconversion-null), so use
0 explicitly. Also really pass the pointer to the first element, rather
than iterator, which is not guaranteed to be a pointer.

This amends the changes of d1553c63ed (Improve support for TABs in
wxListBox under MSW, 2020-04-13).

See https://github.com/wxWidgets/wxWidgets/pull/1789
2020-05-03 03:02:20 +02:00
Vadim Zeitlin
43bdadda0d Update PNG library to avoid more -Wundef warnings in MinGW build
Define symbols used in MIPS/PPC code which are also tested using "#if
PNG_FOO > 0" as 0 instead of leaving them undefined.
2020-05-03 02:57:58 +02:00
Konstantin S. Matveyev
bcddfd6efb Don't start dragging invalid items in generic wxDataViewCtrl
It's not useful to allow dragging from the control area where there are
no items and it resulted in assert failures due to using an invalid row
in wxDataViewDropSource::GiveFeedback(), so simply don't do it at all.

Note that native GTK wxDataViewCtrl implementation doesn't do this
neither, so it also makes the behaviour more consistent.

Closes https://github.com/wxWidgets/wxWidgets/pull/1828
2020-05-02 20:06:49 +02:00
Lauri Nurmi
42af101836 Remove obsolete Darwin-specific code in dynlib.*/dlunix.cpp
We don't have our own dlxxx() implementations under Darwin since 76c5594
(Remove our own dlxxx() functions emulation for OS X <= 10.3.,
2013-10-17).

wxHAVE_DYNLIB_ERROR is reduced to being the same HAVE_DLERROR, so use
the latter one instead.

Closes https://github.com/wxWidgets/wxWidgets/pull/1826
2020-05-02 19:30:28 +02:00
Kvaz1r
67c1c412c6 Implement support for copying wxGrid cells to clipboard
This is useful for read-only grids, in which an editor can't be shown to
copy the value of a cell, and also for copying an entire selection block
and not just a single cell.

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

Closes #13562.
2020-05-02 19:20:48 +02:00
Vadim Zeitlin
e6ab2391c4 Merge branch 'dvc-virtual-has-value'
Allow overriding wxDataViewModel::HasValue() to specify which cells
should, and should not, show anything.

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

Closes #18724.
2020-05-02 18:22:27 +02:00
Artur Sochirca
d1553c63ed Improve support for TABs in wxListBox under MSW
Always set the LB_USETABSTOPS style flag to achieve behaviour more
compatible with other platforms and expand TABs to align them at tab
stops positioned at every 8 characters.

Also add MSW-specific MSWSetTabStops() method allowing to customize tab
stops.

Update the documentation and the sample to demonstrate using TABs.

Closes https://github.com/wxWidgets/wxWidgets/pull/1789
2020-05-02 18:07:50 +02:00
Vadim Zeitlin
ebe7816516 Finish editing on Enter in cells in the last shown row of wxGrid
Previously, pressing Enter in a cell of a row which wasn't the last one,
but was the last shown one, didn't do anything because we explicitly
checked whether the cell was in the last row and not in the last visible
row, but MoveCursorDown() doesn't move the cursor for the latter, and
not just for the former.

Fix this by avoiding any row checks at all and just calling
MoveCursorDown() in any case and DisableCellEditControl() if it didn't
do anything.

Closes #18754.
2020-05-02 17:45:51 +02:00
Vadim Zeitlin
2be019f8f8 Fix integer overflow when reading ZIP central directory
Our code didn't convert 32-bit offset to (possibly 64-bit) m_Offset
correctly in the first place, and didn't check if the offset remained
valid after adjustment.

Fix both problems by using explicit cast and checking for the latter
explicitly.

Credit to OSS-Fuzz: this solves its issue 20527.
2020-05-02 03:38:57 +02:00
Vadim Zeitlin
e6e6dbe077 Fix problems due to deleting grid cells in the event handlers
Deleting last grid rows or column in a few event handlers could result
in asserts/crashes in wxGrid code if the event handler also called
event.Skip(), as wxGrid still tried to perform the default action using
the deleted cell, when these events happened in the last row or column.

It's not totally clear whether calling event.Skip() after performing an
action modifying the grid should be allowed at all, but, in doubt, at
least avoid crashing if it does happen, by considering the event as
being handled (and even vetoed) if its handler deleted the cell in which
it was generated.

Closes #18731.
2020-05-02 00:53:59 +02:00
Vadim Zeitlin
5cdcfddc61 Refactor event sending code in wxGrid to use even more functions
Move the logic determining the return value of SendEvent() into its own
function instead of repeating it twice.

No real changes, this is a pure refactoring.
2020-05-02 00:49:08 +02:00
Artur Wieczorek
f938402dd0 Use conditional operator instead of conditional statement 2020-05-01 19:38:52 +02:00
Artur Wieczorek
c0f7275b11 Get rid of redundant return statement 2020-05-01 19:36:09 +02:00
Artur Wieczorek
b9ebffd832 Set also wxPGEditor items while changing wxPGProperty choices
If we replace current set of choices when editor is active
we need also replace editor items.

Closes #18741.
2020-05-01 19:35:29 +02:00
Artur Wieczorek
8a9e5e5ac7 Implement method to set items of wxPGChoiceEditor
In addition to the current methods to add/delete one item to the control
we would need a method to replace all existing control items with new ones
at once.
2020-05-01 17:57:46 +02:00
Ben Bronk
10ee1b8d10 Fix use of invalid find iterator in wxMemoryFSHandler
Calling FindFirst() with an URL without wildcards returned the correct
result, but didn't reset m_findIter, which kept its value from the
previous search that could have been invalidated since then, e.g. if
RemoveFile() has been called. Using this value could result in a crash
during the next call to FindNext().

Fix this by ensuring that we always reset m_findIter to the valid (even
if pointing to the end) value as the first thing we do in FindFirst().

Closes #18744.
2020-05-01 15:40:43 +02:00
Vadim Zeitlin
aacd26c27b Save specified, not actual, col width in wxPersistentDataViewCtrl
This is more correct as saving the current width of the last column
would prevent the user from shrinking it under the last automatically
set size, i.e. the UI behaviour would change after restarting the
program, which shouldn't be the case.

Doing this required making WXGetManuallySetWidth(), which previously
existed in the generic version only, available in all ports, so do it
and also rename it to WXGetSpecifiedWidth() in the process, as this
seems a somewhat better name (it doesn't have to be manually specified,
i.e. it could also be done by the program itself or even implicitly by
wxPersistentDataViewCtrl).

Don't make this function public, at least for now, because it's not
clear how could it be useful and it might still need to be changed to
behave differently in the other ports.
2020-05-01 03:39:40 +02:00
Vadim Zeitlin
d74389f930 Fix WXGetManuallySetWidth() for columns using wxCOL_WIDTH_DEFAULT
Columns without any explicitly specified width still shouldn't be shrunk
down to 0 size by UpdateColumnSizes(), so handle them as if they were
created using wxDVC_DEFAULT_WIDTH instead -- which is what their actual
width is/would be.

This is a better fix than the one in 0c90ea40c3 (Don't auto-resize
wxDataViewCtrl columns below their initial size, 2019-10-03) and that
commit can be reverted now, as will be done soon.

See #18343.
2020-05-01 03:39:21 +02:00
Vadim Zeitlin
6c5f3f8929 Refactor generic wxDataViewColumn to use DoGetEffectiveWidth()
This function will be used for m_manuallySetWidth too, in addition to
m_width, in the next commit.

No changes yet in this one.
2020-05-01 03:25:52 +02:00
Vadim Zeitlin
ecc58e5211 Allow shrinking last column down to its minimal size
Not doing this when the last column size should have been exactly equal
to its manually set size resulted in showing the horizontal scrollbar
unnecessarily.
2020-05-01 03:23:52 +02:00
Vadim Zeitlin
9ed122b31f Update column sizes after updating scrollbars, not before
As UpdateColumnSizes() uses client size, call it after the client size
is set correctly after adjusting scrollbars to the new virtual size.
2020-05-01 03:22:40 +02:00
Vadim Zeitlin
7a8f04302f Use client size for calculating column sizes, not the full size
We need account for the place taken by the vertical scrollbar, if any.
2020-05-01 03:21:45 +02:00
Vadim Zeitlin
f10d9e199f Remove unnecessary GetColumnCount() test in wxDataViewCtrl code
The presence of columns is already checked inside UpdateColumnSizes()
itself, so there is no need to do it before calling it too.

No real changes.
2020-04-30 23:37:00 +02:00
Vadim Zeitlin
fa9b13f64b Decrease precision for values using factor with number validator
Using too high precision could result in bogus digits appearing in the
displayed value, e.g. 0.058 shown in percents (with a factor of 100)
appeared as 5.800000000000001 before this change.
2020-04-30 23:32:42 +02:00
Paul Cornett
9d4bb47050 Don't compile Cairo dynamic linking code with GTK
It's useless as Cairo is always linked to any program using GTK
2020-04-30 09:11:37 -07:00
Paul Cornett
af5950c108 Avoid Gtk-CRITICAL with GTK3 when calling SetFont() before Create() 2020-04-29 07:35:44 -07:00
Maarten Bent
3631951928 Fix -Wunused-const-variable warning 2020-04-27 00:33:03 +02:00
Maarten Bent
1607ec48c3 Fix -Wunused-function warning 2020-04-27 00:33:02 +02:00
Maarten Bent
4d81cc3ae9 Fix -Wunused-const-variable warning 2020-04-27 00:33:02 +02:00
Maarten Bent
c8ca4bde06 Fix -Wunused-function warning 2020-04-27 00:33:02 +02:00
Maarten Bent
542887080b Fix -Wdelete-non-abstract-non-virtual-dtor warning 2020-04-27 00:33:01 +02:00
Maarten Bent
abb2eb9ed0 Fix -Wmicrosoft-exception-spec warning 2020-04-27 00:33:01 +02:00
Maarten Bent
08ae164417 Fix -Wreorder-ctor warning 2020-04-27 00:33:01 +02:00
Stefan Csomor
7c61841d27 adding implementation for GetMatchingPair on macOS, streamlining wxDataObject
When adding the GetMatchinPair implementation, some clean-ups were done, for further details please see #1821
2020-04-26 17:50:33 +02:00
Stefan Csomor
a235f8e04c bracket code not working on ios 2020-04-26 11:54:54 +02:00
Stefan Csomor
68b22e65b8 adding bitmap button implementation to ios 2020-04-26 11:54:04 +02:00
Vadim Zeitlin
dc34600c0c Fix built-in PNG library build with MSVC 9 and older
Upgrade the submodule to a version which doesn't try to use SSE2 with
this old compiler, as it doesn't support the required intrinsics.

See https://github.com/wxWidgets/libpng/pull/4
2020-04-24 00:42:41 +02:00