Commit Graph

18875 Commits

Author SHA1 Message Date
Vadim Zeitlin
249db04dd3 Add wxGridTableBase::CanMeasureColUsingSameAttr()
This allows to optimize AutoSizeColumns() in the common case when all
cells in the same column can be measured using the same attribute.
2020-06-11 10:03:13 +02:00
Vadim Zeitlin
5e06174c95 Merge branch 'cotaskmemptr' of https://github.com/PBfordev/wxWidgets
Add wxCoTaskMemPtr and use it instead of manual calls to
::CoTaskMemFree().

See https://github.com/wxWidgets/wxWidgets/pull/1890
2020-06-10 18:02:50 +02:00
PB
88965fc588 Fix whitespace 2020-06-10 17:17:48 +02:00
Vadim Zeitlin
968e94c36d Merge branch 'mac-textctrl-size-refactor'
Don't call GetBestSize() from DoGetSizeFromTextSize() in wxOSX.

See https://github.com/wxWidgets/wxWidgets/pull/1888
2020-06-10 15:48:57 +02:00
Vadim Zeitlin
13477ee164 Merge branch 'xrc-generic-animation-ctrl'
Extend wxAnimationCtrl XRC handler to cover wxGenericAnimationCtrl too.

Also fix a bug with wxGenericAnimationCtrl inactive bitmap background.

See https://github.com/wxWidgets/wxWidgets/pull/1889
2020-06-10 00:02:59 +02:00
Vadim Zeitlin
f72f2bec3a Merge branch 'dpi-stc' of https://github.com/MaartenBent/wxWidgets
Fix and improve DPI handling in wxStyledTextCtrl.

Fix cursor size after DPI change.

Enable handling DPI events in wxSTCPopupWindow and other popup windows
(that do not inherit from wxTopLevelWindow).

Some cleanup of STC example, and add option to select drawing
technology.

See https://github.com/wxWidgets/wxWidgets/pull/1885
2020-06-09 23:56:37 +02:00
PB
d445111e77 Create wxCoTaskMemPtr class
wxCoTaskMemPtr is a barebone RAII class for pointers
that must freed with ::CoTaskMemFree().
2020-06-09 20:14:33 +02:00
Vadim Zeitlin
8ff6fa6f54 Use GetAnimation() in wxAnimationCtrlXmlHandler again
This function basically only exists in order to be used in this handler,
so extend it to allow doing it by adding wxAnimationCtrlBase argument to
it, allowing it to create wxAnimation object compatible with the given
control.

This reduces code duplication and, incidentally, makes GetAnimation()
more useful for any user-defined XRC handlers.
2020-06-09 18:07:10 +02:00
Vadim Zeitlin
ac7c40b141 Add dummy wxBitmap::HasAlpha() to wxX11
This allows to write code using this function without any preprocessor
checks.

It should arguably be added to wxBitmapBase to ensure that it's
available in all ports, but should be done together with UseAlpha(),
which is not quite trivial, so leave it for later.
2020-06-09 18:07:10 +02:00
Ilya Sinitsyn
cc5fb63bf7 Add wxXmlResourceHandler::GetFilePath()
The function already implemented in wxXmlResourceHandlerImpl. Just make it
accessible from wxXmlResourceHandler.
2020-06-09 21:34:10 +07: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
Vadim Zeitlin
90783fec05 Merge branch 'generic-dvc-improve-dnd'
Improve drag-and-drop in generic wxDataViewCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/1836
2020-06-07 17:22:05 +02:00
Vadim Zeitlin
f9780847b8 Refactor dialog testing code to avoid gcc 10 -Wduplicated-branches
The old version resulted in

error: this condition has identical branches [-Werror=duplicated-branches]
    |                                 (dlg ? typeid(*dlg) : typeid(T)).name());
    |                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

from gcc 10 when compiling with -O2.

Change the code to avoid using this condition entirely: not only this
avoids the warning, but it also makes it unnecessary to make
wxGetDialogClassDescription() function a template, so should result in
slightly faster compilation and smaller code size too.

No real changes.
2020-06-07 13:00:14 +02:00
Paul Cornett
d0ed90075c Fix wxToggleButton image when state is changed programmatically
See #18779
2020-06-02 12:16:57 -07:00
Maarten Bent
379cff7d19 Fix building with wxUSE_POPUP==0 2020-06-01 18:16:52 +02:00
Maarten Bent
4700298c26 Move DPI handling from wxTopLevelWindow to wxNonOwnedWindow
This way, other windows (like wxPopupWindow) will also be able to handle DPI events.

Override InheritAttributes() and use it to set the initial DPI values.
2020-06-01 16:47:50 +02:00
Vadim Zeitlin
123e21c181 Refactor wxGrid::SetOrCalcColumnSizes() and SetOrCalcRowSizes()
Get rid of the unnecessarily complicated functions doing two quite
different things depending on whether their first boolean parameter was
true of false.

Instead, split their body between AutoSize{Columns,Rows}() (which used
to call them) and DoGetBestSize(), keeping just the part needed in each
case.

This is much simpler and even more efficient, as it avoids a completely
unnecessary call to CalcDimensions() and Refresh() from DoGetBestSize(),
which doesn't change the current size at all and so doesn't need to
refresh anything, but previously did it and not only once, but twice,
because both of SetOrCalc{Column,Row}Sizes() did it.
2020-05-31 17:51:12 +02:00
Vadim Zeitlin
789c7cec7b Merge branch 'grid-col-row-sel'
Fix returning duplicates from Get{Row,Col}Selection(); add more tests.

See https://github.com/wxWidgets/wxWidgets/pull/1874
2020-05-31 00:43:23 +02:00
Vadim Zeitlin
27495c5484 Merge branch 'textctrl-getsizefromtextsize'
Improve wxTextCtrl and wxSpinCtrl sizing under macOS.

See https://github.com/wxWidgets/wxWidgets/pull/1861
2020-05-28 02:21:35 +02:00
Vadim Zeitlin
5a5ed51528 Merge branch 'aui-repaint-optimize'
Optimize AUI repainting under MSW and always use live resize mode with
GTK3.

See https://github.com/wxWidgets/wxWidgets/pull/1869
2020-05-27 13:40:04 +02:00
Vadim Zeitlin
3307000baa Add wxGrid::GetSelectedRowBlocks() and GetSelectedColBlocks()
These functions are much simpler to use in the application code using
wxGrid in row- or column-only selection mode than GetSelectedBlocks()
itself because they take care of deduplicating, ordering and squashing
together the adjacent ranges, so that the application can use their
results directly, unlike with GetSelectedBlocks().
2020-05-27 03:19:34 +02:00
Vadim Zeitlin
d48013a322 Disable OpenGL functions deprecation warnings in wxOSX
Don't generate dozens of deprecation warnings (one for each OpenGL
function used in the code) for any program using wxGLCanvas being built
using macOS 10.14 or later SDK.

Closes https://github.com/wxWidgets/wxWidgets/pull/1875
2020-05-27 00:28:21 +02:00
Vadim Zeitlin
f6727a17a2 Add wxAuiManager::AlwaysUsesLiveResize()
This allows to check if it's worth specifying wxAUI_MGR_LIVE_RESIZE or
not and allows to get rid of the corresponding menu item in the sample
if it doesn't do anything anyhow.
2020-05-25 18:01:09 +02:00
Vadim Zeitlin
74bc08535b Replace wxAuiManager_HasLiveResize() hack with normal accessor
For some unknown reason a free function taking "*this" was used instead
of just an accessor. Add the latter to make this code less unusual.
2020-05-25 17:52:08 +02:00
Vadim Zeitlin
758a81bc89 Allow using wxWindowUpdateLocker conditionally
This can be useful if the window needs to be frozen only if some
run-time condition holds true.
2020-05-25 17:52:08 +02:00
Vadim Zeitlin
152f3154be Make wxWindowUpdateLocker ctor explicit
No real changes, just avoid using ctor allowing implicit conversions
when none are desired.
2020-05-25 17:52:08 +02:00
Vadim Zeitlin
7338f30167 Document wxDataViewEvent::GetProposedDropIndex()
This method was added back in d3e8d3f271 (Support or disable "insert"
for drag/drop wxDataViewCtrl on OSX, 2018-07-16) but didn't appear in
the documentation at all, so describe it, at least minimally.

See #18167.
2020-05-25 01:52:32 +02:00
Vadim Zeitlin
a087d7c8da Merge branch 'fix-stc-ime' of https://github.com/wangqr/wxWidgets
Fix position of IME in wxSTC in wxMSW.

See https://github.com/wxWidgets/wxWidgets/pull/1852
2020-05-25 01:33:00 +02:00
Artur Wieczorek
8ebdf2c798 Fix disposing wxComboBox with data objects
Under wxOSX the order of calls to wxItemContainer::Clear()
and wxTextEntry::Clear() matters.
Number of data objects to delete in wxItemContainer::Clear()
is obtained by call to wxComboBox::Count(). Counter of items
in wxComboBox is reset by wxTextEntry()::Clear()
so this method has to be called after wxItemContainer::Clear().

Closes #18768.
2020-05-24 19:11:05 +02:00
Vadim Zeitlin
53a35d15bc Merge branch 'dynlib-simplify'
Enhance wxDynamicLibrary error logging and simplify code by not checking
for dlopen() and dlerror() that are always available nowadays.

See https://github.com/wxWidgets/wxWidgets/pull/1849
2020-05-21 02:13:10 +02:00
wangqr
dad9a02a40 Remeasure magic values for wxTextCtrl's border width on wxOSX/Cocoa
Measured on macOS Catalina. Also implements GetSizeFromTextSize
2020-05-19 00:18:51 -04:00
Artur Wieczorek
edc553870f Fix displaying wxSpinCtrlDouble values with default precision
For the sake of consistency with native wxGTK implementation,
spin control value should be displayed with fixed precision.

See #17085.
2020-05-18 20:39:05 +02:00
Artur Wieczorek
c963c60a0f Determine initial wxSpinCtrlDouble precision
For native wxGTK implementation default spin control precision is derived
from the precision of the increment value. Fot the sake of consistency the
same should be done in the generic implementation.

Closes #18764.
2020-05-18 18:52:41 +02:00
Vadim Zeitlin
a2a3897124 Simplify wxWindowID definition
Define it in wx/defs.h directly instead of conditionally including
wx/windowid.h from there just in order to get this type definition.

This has several advantages:

- wxWindowIDRef is not defined in (maybe) non-GUI code including
  wx/defs.h, as it should be the case for this class defined in
  core library only.
- wx/windowid.h becomes a normal header, including wx/defs.h as
  (almost) all the other ones instead of being exceptional.
- wx/windowid.h doesn't need to be included by wx/utils.h at all
  just to get wxWindowID definition.

Closes https://github.com/wxWidgets/wxWidgets/pull/1850
2020-05-15 00:02:14 +02:00
Vadim Zeitlin
7a82a0bbf5 Assume dlerror() function is always available when dlopen() is
Remove separate checks for dlerror() which don't seem to be needed under
any platform any longer.

No real changes, just slim down configure/CMake a tiny bit.
2020-05-15 00:00:06 +02:00
Vadim Zeitlin
fea8c608b1 Remove checks for shl_load() from configure/CMake
This function is not used any more since e289eb07e1 (Get rid of
non-POSIX code for loading dynlibs on *nix, 2020-05-13), so don't check
for it and don't defined the corresponding HAVE_SHL_LOAD symbol.
2020-05-14 23:59:38 +02:00
Lauri Nurmi
c50784ba0b Use the same function for logging dynlib errors on all platforms
Reduces the amount of #ifdefs scattered all over the code, thereby
simplifying the code.

The function was renamed from Error() to ReportError() to emphasize what
its purpose is.

Error messages logged on *nix are now a bit more verbose, as they are
prefixed with our own description text, which were earlier omitted on
platforms using the dlxxx() API.
2020-05-13 10:07:47 +03:00
wangqr
e07640fb75 Forward IME messages to ScintillaWX and handle them
The handling code is copied from ScintillaWin

Closes #18759
2020-05-11 00:37:49 -04:00
Vadim Zeitlin
63626acbe4 Fix std::ostream::operator<<(wxScopedWCharBuffer)
This never worked correctly as using operator<<() with wchar_t pointer
just fell back to the overload for void pointers, i.e. printed out the
address of the wide string, which wasn't especially useful, but with
C++20 it doesn't even compile, as this overload is explicitly deleted.

Fix both problems at once by actually doing something useful for it
instead and printing out data in either current encoding or UTF-8 if
converting it to the current encoding failed.
2020-05-10 23:00:00 +02:00
Vadim Zeitlin
176b9dde90 Fix wxString iterator comparison in C++20
In C++20 the reverse comparison operators are also considered when
searching for the operator to use and a wrong operator was selected for
comparisons between iterator and const_iterator, that would result in an
infinite recursion at run-time.

Fix this, thanks to the nice gcc 10 warning about it, by explicitly
defining the operators for this overload set too instead of relying on
implicit conversions.

Although not all these overloads are necessary, and they are only
necessary in C++20, it seems better to define all of them and always
just to be perfectly explicit and clear, as this code is not exactly
simple to follow.
2020-05-10 22:57:41 +02:00
Vadim Zeitlin
d3b9686099 Take number of digits into account in GTK wxSpinCtrlDouble
When determining the entry width in wxSpinCtrlDouble, we need to account
not only for the width of the integer part, but also for the number of
digits that determines the width of the fractional part.

Do it in the overridden version of (now virtual) GtkSetEntryWidth().

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

Closes #18734.
2020-05-09 23:36:25 +02:00
Stefan Csomor
da48b9e45d
adding an iOS build to travis (#1847)
* fixing compilation of tests that cannot build

bracket code with the corresponding wxUSE… macros

* adding directive for iOS

* adding a switch for skipping the run - not the build of tests

right now I don’t know yet, how to run the test binary in the iOS simulator, but building it is still a good test in itself

* adding skipping of tests

* increasing minimum deployment to get proper c++17 support

* using --disable-sys-libs, restoring other targets

even when the zlib in -isysroot is used, due to deployment on lower iOS versions inflateValidate may not be available and crash. The guards are evaluated using macros from the zlib from the SDK, not from the lowest version supported.
2020-05-08 08:01:56 +02:00
Vadim Zeitlin
7466681607 Merge branch 'grid-event-delete'
Handle deleting grid rows/columns in event handlers gracefully.

See https://github.com/wxWidgets/wxWidgets/pull/1834
2020-05-06 18:45:16 +02:00
Vadim Zeitlin
6a084e799e Merge branch 'dvc-colsize-vert-scroll'
Fix issues with generic wxDVC last column size when using
wxPersistentDVC.

See https://github.com/wxWidgets/wxWidgets/pull/1832
2020-05-06 18:44: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
Maarten Bent
57c385350d Fix inconsistent use of boolean and HRESULT 2020-05-06 01:52:24 +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
63e1697dda Add wxGridBlocks::iterator::operator->()
An iterator should have this operator defined too, and not just
operator*() as it used to.
2020-05-02 18:50:03 +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
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
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
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
44578b883c Don't set m_manuallySetWidth incorrectly
This fix for disallowing shrinking the last column to nothing instead of
showing horizontal scrollbar when it became smaller than its minimum
size was wrong and is not necessary any more after the correct fix in
the previous commit.

This effectively reverts 0c90ea40c3 (Don't auto-resize wxDataViewCtrl
columns below their initial size, 2019-10-03).

See #18343.
2020-05-01 03:39:41 +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
Paul Cornett
861cc376d6 Avoid -Wempty-body warning with non-debug build 2020-04-30 09:01:09 -07:00
Maarten Bent
52d830398a Fix -Wsuggest-override warning
Manually checked by adding -Wsuggest-override as compile parameter.
2020-04-27 00:33:03 +02:00
Maarten Bent
abb2eb9ed0 Fix -Wmicrosoft-exception-spec 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
Paul Cornett
b256db8f0f Restore previous behavior of wxString::operator<<(float) 2020-04-22 07:46:06 -07:00
Paul Cornett
c5faf9cfac Avoid passing float argument for "%f" printf specifier
"%f" takes a double. Eliminates some -Wdouble-promotion warnings.
2020-04-21 11:59:36 -07:00
Vadim Zeitlin
62372d4337 Merge branch 'webview_edge3' of https://github.com/TcT2k/wxWidgets
Update wxWebViewEdge for SDK 0.9.488.

It now requires Edge 84.0.488.0 or newer (currently Canary).

See https://github.com/wxWidgets/wxWidgets/pull/1814
2020-04-21 18:30:53 +02:00
Paul Cornett
896512c732 Change fractional point size from float to double
There doesn't seem to be any compelling reason to use float. Using double
is simpler, and avoids otherwise unnecessary float<->double conversions.
2020-04-21 09:00:04 -07:00
Vadim Zeitlin
84e90d93d8 Add back wx/windowid.h include, just not as the first one
Unfortunately the fix of the previous commit broke the build because of
the existence of non-GUI functions using GUI-only wxWindowID class.

This will need to be fixed in a better way later, but for now add the
required header back.

See https://github.com/wxWidgets/wxWidgets/pull/1815
2020-04-21 16:10:14 +02:00
Vadim Zeitlin
71c2e1cc3c Remove wrong wx/windowid.h include, should never be done directly
This #include was mistakenly added by e8b8b0288f (Make wxNewId() and
others return/take wxWindowID rather than int, 2019-12-18) and broke
compilation of the code including wx/utils.h as the first header,
because wx/windowid.h can't be included directly and must be only
included from wx/defs.h.

Fix this by just removing it, including any other header is enough to
pull this one in anyhow, via wx/defs.h.

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

Closes https://github.com/wxWidgets/wxWidgets/pull/1815
2020-04-21 15:20:17 +02:00
Tobias Taschner
7d1c40ecf5
Updated wxWebViewEdge for SDK to 0.9.488
Requires Edge 84.0.488.0 or newer

Another SDK release before 1.0 includes some
breaking changes regarding naming
2020-04-20 23:00:10 +02:00
Vadim Zeitlin
1949b4e358 Remove useless wxMenu::Break() override in wxOSX
There is no real need to override a method not doing anything by default
just to do nothing in it explicitly.
2020-04-18 00:44:20 +02:00
Vadim Zeitlin
e5d03323f9 Rename wxGridBlockCoords::ContainsCell/Block() to just Contains()
These methods do the same thing, so it seems better to use the same name
for them.

This is not really a backwards-incompatible change, as these methods
were just added in the parent commit, so nobody is using them yet.
2020-04-15 18:37:06 +02:00
Vadim Zeitlin
a5a7641616 Merge branch 'grid-selection-refactoring'
Completely overhauled selection handling in wxGrid.

Make various ways of extending selection (using Shift-arrow keys,
Ctrl-Shift-arrows, Shift-click etc) work as expected from the user point
of view instead of producing various bizarre results. Also improve
row/column header click selection as well as Ctrl/Shift-Space handling.

Internally, store selection as just a vector of blocks, independently of
the selection mode, and provide a simple API for iterating over it which
remains usable even with selections containing millions of cells (as
long as they're still composed of only a few blocks, which is the case
in practice).

Add more tests and add display of the current selection to the sample.

See https://github.com/wxWidgets/wxWidgets/pull/1772
2020-04-15 18:10:08 +02:00
Jorge Moraleda
c2e4bc422c Make HasValue virtual in wxDataViewModel and have implementations use it. This addresses issue https://trac.wxwidgets.org/ticket/18724 2020-04-14 17:48:47 -07:00
Vadim Zeitlin
fe7de63730 Merge branch 'default-keyword' of git://github.com/MaartenBent/wxWidgets
Remove wxMEMBER_DEFAULT and just "= default" instead.

See https://github.com/wxWidgets/wxWidgets/pull/1794
2020-04-15 02:17:06 +02:00
Vadim Zeitlin
5d90688723 Fix extending selection starting from unselected current cell
Unselected current cell should always be considered as the current
selection block to extend, as it doesn't make sense to extend any other
block (perhaps selected on another side of the grid) when pressing
Shift-arrow.

This scenario could be achieved by selecting a block and Ctrl-clicking a
cell (either inside or outside the selection) twice and then extending
it using Shift-arrow keys. Previously, this behaved in a strange way,
combining the corner of the selected block with the target of the
movement, whereas now this just starts selecting a new block from the
current cell as expected.
2020-04-14 18:51:23 +02:00
Vadim Zeitlin
ddaa5b5e02 Make wxGridSelection::IsInSelection() const
There is really no reason for it not to be.
2020-04-14 18:50:06 +02:00
Maarten Bent
9039340da9 Revert default-member changes, only keep and use wxHAS_MEMBER_DEFAULT 2020-04-13 19:44:04 +02:00
Maarten Bent
1448b210b8 Use macros to define default copy constructor and assignment operator 2020-04-13 17:46:32 +02:00
PB
56915f30ae Fix broken non-Unicode MSW build
Add a missing parenthesis in a non-Unicode StartDoc() definition which
was forgotten in 948ddc6e0f (Eliminate -Wcast-qual warnings with GCC and
Clang, 2020-02-02).

Closes https://github.com/wxWidgets/wxWidgets/pull/1795
2020-04-13 16:41:33 +02:00
Vadim Zeitlin
b8c3c60316 Allow extending selection using Shift-Page Up/Down keys
Also make Page Up/Down themselves work consistently with the other
cursor movement keys and clear current selection if they move the
cursor.

Even though DoMoveCursorByPage() is simpler than DoMoveCursorByBlock(),
still factor out AdvanceByPage() for consistency with AdvanceByBlock()
and because it still makes the code more clear.
2020-04-13 01:23:25 +02:00
Vadim Zeitlin
bc3c6fea70 Fix Shift-Ctrl-arrows handling
Extending the selection with Ctrl-arrows is different from all the other
cases, as we need to combine both the selection anchor and the current
cell coordinates when doing it.

This means that we can't reuse the same PrepareForSelectionExpansion()
helper for this case, so this function is not useful finally and this
commit removes it entirely. It also replaces GetCurrentBlockCornerRow()
and GetCurrentBlockCornerCol() functions with GetExtensionAnchor() which
combines both of them.

Finally, it adds wxGridDirectionOperations::TryToAdvance() helper to
avoid repeating the IsAtBoundary() check which was previously part of
PrepareForSelectionExpansion() in multiple places.

And because the "extending" and normal parts of DoMoveCursorByBlock()
are so different now, it also factors out AdvanceByBlock() helper which
can be used to keep these parts well separate from each other instead of
intermixing them together.

With all these preparatory changes, it's finally possible to implement
the "extending selection by block" logic relatively easily, with the
bulk of this branch actually taken by comments explaining why do we have
to do what we do.

Add unit tests verifying that the functions used by Shift-Ctrl-arrow
work as expected.
2020-04-13 00:49:22 +02:00
Vadim Zeitlin
287c1b1d11 Merge branch 'noexcept-event-tables'
Allow using noexcept handlers in event tables.

See https://github.com/wxWidgets/wxWidgets/pull/1788
2020-04-12 16:41:55 +02:00
Vadim Zeitlin
413fdfbfa4 Merge branch 'cmake-c++11-stl' of git://github.com/MaartenBent/wxWidgets
CMake: Improve STL checks, improve C++17/20 support.

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

Closes #18718.
2020-04-12 16:37:57 +02:00
Vadim Zeitlin
ed077e17cf Restore wxAnimation::GetFrame() constness
This got lost, almost surely accidentally, in 706c8e8ad6 (Merge branch
'disable-native-animation', 2020-04-07), so just restore it now.

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

Closes #18725.
2020-04-12 16:36:34 +02:00
Vadim Zeitlin
b98f439686 Also rename wxGridSelection::ExtendOrCreateCurrentBlock()
This function finally doesn't ever create a new block, except for the
trivial case when there is no current block, so rename it to a simpler
and more clear name.

No real changes.
2020-04-12 02:43:42 +02:00
Vadim Zeitlin
30eaa28de5 Rename wxGrid::GetSelectionRange() to GetSelectedBlocks()
This seems to be more consistent with the existing functions and doesn't
create ambiguity with a grid range.

Also rename wxGridSelectionRange to just wxGridBlocks as, in principle,
this class could be used for iterating over any blocks, not just the
selected ones.

No changes in functionality, this is just a renaming.
2020-04-12 02:38:37 +02:00
Vadim Zeitlin
32bb5e9157 Fix Shift-click/arrow behaviour for column/row selection
Extend the current block to the entire line when the corresponding
header is Shift-clicked and, importantly, keep the full-line selection
when using Shift-arrows later to make the selection behave in the
expected way.
2020-04-12 02:38:37 +02:00
Vadim Zeitlin
c90bed6f8e Stop passing invalid coordinates to ExtendOrCreateCurrentBlock()
This made the logic of this function unnecessarily more complicated.
Instead, just fall back to the current cell coordinates in the only
place where this could happen before.

Doing this still preserves the correct behaviour of Shift-arrow
selection when entire rows/columns are selected and the current cell is
not the leftmost/topmost cell (due to scrolling), but the code is
simpler.

Remove the now always true condition check and assert that it's indeed
always true.

Note that the changes to gridsel.cpp in this commit are best viewed
ignoring whitespace changes.
2020-04-12 02:38:37 +02:00
Vadim Zeitlin
415bab551c Add wxGridSelection::SelectAll() and use it in wxGrid
The difference between calling SelectAll() and SelectBlock() with a
block covering the entire grid is that the former discards any
previously selected blocks, which become clearly redundant.

As a consequence, clicking on the grid corner 10 times in a row still
results in a selection with a single block, not 10 (identical) blocks.
2020-04-12 02:38:37 +02:00
Vadim Zeitlin
7d56146998 Add a comment for ClearSelection()
No real changes, just mention that this function does more than just
clearing the selection.
2020-04-12 02:38:37 +02:00
Artur Wieczorek
c4f5fd3581 Move duplicated code to rescale the bitmap to the shared function 2020-04-10 20:45:34 +02:00
Maarten Bent
b20daa9fb0 Fix using deleted function in TempStringRef
Use the constructor directly instead of via a make function.
2020-04-10 00:51:17 +02:00
Maarten Bent
52ef7157e7 Define wxMEMBER_DEFAULT similarly to the existing wxOVERRIDE
Also define wxHAS_MEMBER_DEFAULT allowing to check if '= default' is supported
(compilers that define c++11 and VS2015 and later).
2020-04-10 00:51:14 +02:00
Vadim Zeitlin
c3810da549 Allow using noexcept methods with event tables macros
Explicitly remove noexcept before static-casting the member function
pointer to the base class pointer type to avoid compilation error with
C++17.

Add a test checking that this does work now.

Closes #18721.
2020-04-09 22:36:30 +02:00
Vadim Zeitlin
f4f70102ea Define wxNOEXCEPT similarly to the existing wxOVERRIDE
Also define wxHAS_NOEXCEPT allowing to check if noexcept is supported.

This is not used in the library yet, but probably should be.
2020-04-09 22:36:30 +02:00
Maarten Bent
89185875a9 Enable wxMEMBER_DELETE for MSVC
It is available since Visual Studio 2015.
2020-04-08 22:13:53 +02:00
Stefan Csomor
80fd70e8f1 make NSString conversions available for all osx platforms 2020-04-07 12:04:01 +02:00
Paul Cornett
902a2f0885 Remove wxAnimation copy ctor and copy-assignment operator implementations
The compiler-generated defaults will do the same thing
2020-04-06 20:26:49 -07:00
Vadim Zeitlin
706c8e8ad6 Merge branch 'disable-native-animation'
Allow the generic animation classes to be used on all platforms.

See https://github.com/wxWidgets/wxWidgets/pull/1768
2020-04-07 00:40:45 +02:00
Vadim Zeitlin
f2ed3a5376 Add static wxAnimationCtrl::CreateCompatibleAnimation()
This may be more convenient to use than CreateAnimation() if there is no
wxAnimationCtrl object at hand.
2020-04-06 23:33:07 +02:00
Stefan Csomor
eaec76ee97 moving wxOSXCreateURLFromFileSystemPath to common OSX 2020-04-06 16:08:47 +02:00