Commit Graph

18933 Commits

Author SHA1 Message Date
Vadim Zeitlin
dc9040cc89 Merge branch 'grid-autosize'
Optimize wxGrid::AutoSizeColumns() for big grids.

This includes an optimization of wxDC::GetTextExtent() at the price of
slightly reduced precision in wxMSW.

See https://github.com/wxWidgets/wxWidgets/pull/1893
2020-06-16 20:37:57 +02:00
Vadim Zeitlin
d2a403408f Implement wxGridCellNumberRenderer::GetMaxBestSize()
This allows to make computing the best width of numeric columns an O(1)
operation instead of O(number-of-rows), which can make a huge difference
for big grids.
2020-06-13 16:37:21 +02:00
Vadim Zeitlin
96de24d1bb Add wxGridCellChoiceRenderer to optimize column size calculation
Previously columns using a set of predetermined values used plain
wxGridCellStringRenderer, which didn't allow to determine their best
size efficiently, as wxGrid had to iterate over all the rows of the
table, even if they only took a couple of possible values.

Add wxGridCellChoiceRenderer (refactoring wxGridCellEnumRenderer to
extract the common code from it in the process) which implements
GetMaxBestSize() by just finding the best size of all of these values,
which is much faster for large grids.

This does result in a change in behaviour, as the column now adapts to
its "theoretical" best size and not just the size of the values actually
shown in it, but this seems to be a worthwhile trade-off and could even
be seen as an advantage, as editing a cell won't make its value overflow
the auto-sized column width any more, as it is wide enough to show any
of the column values.
2020-06-13 16:10:14 +02:00
Vadim Zeitlin
71d42a8290 Add wxGridCellRenderer::GetMaxBestSize()
This is another optimization, useful for the renderers that are used
with the values of a fixed form or part of a limited set, as it is much
faster to compute the best size for all values of the set rather than
computing them for all the cells in the column.
2020-06-13 15:51:20 +02:00
Vadim Zeitlin
a1a5c8c1ae Merge branch 'toolbar-bottom'
Fix handling of toolbars using both wxTB_HORIZONTAL and wxTB_BOTTOM (or
both wxTB_VERTICAL and wxTB_RIGHT) styles.

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

Closes #18769.
2020-06-13 14:59:00 +02:00
PB
13b15fecc0 Simplify code dealing with toolbar position in associated frame 2020-06-13 14:57:30 +02:00
Artur Wieczorek
32bb2edac7 Mark overriding functions with wxOVERRIDE 2020-06-11 15:47:35 +02:00
Artur Wieczorek
7c3d540c70 Validate input in generic wxSpinCtrl and wxSpinCtrlDouble
Use respective validator to control what is typed in the text field.

Closes #17882.
2020-06-11 15:47:12 +02:00
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
Vadim Zeitlin
69a05b0340 Use the same selection expansion logic for Shift-Ctrl-cursor
Expanding the selection from keyboard with Ctrl pressed should move in
the same way Ctrl-cursor does, but use the same selection anchor as
Shift-cursor does instead of always using the current cell.

This makes the expansion work much more intuitively in the grid, e.g.
pressing Shift-Ctrl-Down in

    1 2
    3 4

grid when 1 and 2 are selected now selects all the cells instead of
selecting 1 and 3 as it did before.
2020-04-06 02:39:21 +02:00
Vadim Zeitlin
fe6d07d2d1 Some minor comments wording changes in wxGridSelection
Try to better explain the behaviour of the methods of this class.
2020-04-06 02:26:02 +02:00
Vadim Zeitlin
a5b5573ee1 Restore lost check for __WXUNIVERSAL__ in wx/animate.h
Don't use native version when building wxUniv.
2020-04-06 01:28:01 +02:00
Vadim Zeitlin
d9b1ca54ca Stop deriving native wxGTK wxAnimationCtrl from generic one
This is unnecessary and confusing.
2020-04-06 01:09:36 +02:00
Vadim Zeitlin
3678d67f92 Move wxGenericAnimationCtrl::m_animation to the base class
API of wxAnimationCtrlBase practically forces the derived classes to
have such method, so just add it and make GetAnimation() a simple
non-virtual accessor.
2020-04-06 01:03:39 +02:00
Vadim Zeitlin
b08db49bf6 Make wxAnimationImpl private and get rid of wxAnimationImplType
Simplify and streamline animation classes relationship: wxAnimation is
the only public class representing an animation and it can be created by
both the native wxAnimationCtrl and wxGenericAnimationCtrl using the new
public CreateAnimation() method.

Replace wxAnimationImplType enum with more flexible type info based
check.
2020-04-06 01:00:15 +02:00
Vadim Zeitlin
86d6cb8d1f Don't derive wxAnimationImpl from wxObject
This is just unnecessary and having wxAnimation::m_refData->m_refData is
confusing, both in wxGTK version where it's not used and in the generic
one where it is, but can be replaced by more type-safe m_decoder.
2020-04-06 00:00:10 +02:00
Vadim Zeitlin
b17d3ecb52 Remove unused private BlockContain() function
This was probably left over after wxGridBlockCoords::ContainsBlock()
introduction.
2020-04-05 17:38:08 +02:00
Vadim Zeitlin
1bf48dfe29 Remove wxAnimationCtrlBase from wxRTTI
This is consistent with the other wxFooBase classes which are not part
of it, as they're considered implementation details and not parts of the
API.
2020-04-05 17:01:37 +02:00
Vadim Zeitlin
d0371d75f7 Define wxHAS_NATIVE_ANIMATIONCTRL
This allows to easily test for the native control existence and also
whether wxGenericAnimationCtrl is really different from wxAnimationCtrl.

It also allows to avoid explicit check for wxGTK in common code.
2020-04-05 16:56:58 +02:00
Vadim Zeitlin
6f2a5937f5 Remove some recently added trailing spaces
No changes.
2020-04-05 16:05:48 +02:00
Vadim Zeitlin
cdff0bc1db Use WXDLLIMPEXP_CORE instead of WXDLLIMPEXP_ADV in new code
They're the same thing, and we still keep WXDLLIMPEXP_ADV in the
existing code, but as this line was just moved to a new place, update it
to use the more appropriate DLL export declaration too.

No real changes.
2020-04-05 16:04:50 +02:00
Vadim Zeitlin
1d43ae7dc6 Refactor selection expansion code to use actual wxKeyboardState
Switch from using just "bool expandSelection" in the grid functions
(possibly) extending the current selection to using the full
wxKeyboardState.

This allows to pass it to ExtendOrCreateCurrentBlock() and slightly
simplify the code by using DoMoveCursorFromKeyboard().
2020-04-05 15:56:45 +02:00
Vadim Zeitlin
791a9e68ae Rename and simplify wxGridBlockCoords::ContainsBlock()
Change the return type of this function to a simple and clear bool
instead of 3-valued int requiring a special explanation. This is simpler
and not any less efficient as checking for whether one block contains
another or the other one contains this one are separate operations
anyhow.

Rename the function to a more grammatically correct name.

Also move it inline as it's now trivial enough for this to be worth it.
2020-04-05 01:37:56 +02:00
Vadim Zeitlin
a5952ee087 Rename wxGridBlockCoords::ContainsCell() and move it inline
Make the function name more grammatically correct.

No real changes.
2020-04-04 19:45:19 +02:00
Vadim Zeitlin
0a5a904d8d Simplify wxGridSelectionRange to provide only iterators
This class was a strange hybrid of a container/view/range and iterator,
as it both provided begin()/end() container-like methods and
iterator-like methods for dereferencing/advancing.

Simplify this by removing the latter part and making this class really
just a range, with its own iterator class in order to avoid leaking the
exact type of the iterator used in the API.

Note that while it's now completely trivial, it is still useful as it
isolates the application code from the vector used to store the selected
blocks currently and will allow to change internal representation in the
future without breaking the existing code.
2020-04-04 19:37:23 +02:00
Vadim Zeitlin
0f8e985252 Define wxGridSelectionRange::iterator in terms of vector iterator
This fixes compilation when using std::vector<> implementation for
wxVector (i.e. with wxUSE_STD_CONTAINERS==1).
2020-04-04 19:04:17 +02:00
Ilya Sinitsyn
f8015b13b1 Implement wxGrid selection blocks iterating interface 2020-04-04 18:50:37 +02:00
Ilya Sinitsyn
0920a1646b Make wxGrid row selecting more user friendly 2020-04-04 18:50:37 +02:00
Ilya Sinitsyn
89dd47edee Make wxGrid column selecting more user friendly 2020-04-04 18:50:37 +02:00
Ilya Sinitsyn
e1b9ece9a4 Edit the current wxGrid selection block
Really edit the current selection block instead of storing the temporary
information about the current selection and applying it on releasing Shift
key or LKM.
2020-04-04 18:50:37 +02:00
Ilya Sinitsyn
d4919d3334 Remove wxGridSelection::ToggleCellSelection()
Remove the function because it's not usefull anymore and used only in one
place.
2020-04-04 18:50:36 +02:00
Ilya Sinitsyn
cdf3187fe5 Improve rows, columns and cells deselection in wxGrid
Use DeselectBlock() instead of ToggleCellSelection() to improve execution
speed and make the code more clean.
2020-04-04 18:50:36 +02:00
Ilya Sinitsyn
02509cbc39 Refactor wxGridSelection to store selection as blocks only
Store all types of selection with an array of blocks instead of arrays of
cells, blocks, rows and columns.

It (hopefully) simplifies the code and allows us to implement editing of
the last selection block much easier.
2020-04-04 18:50:36 +02:00
Ilya Sinitsyn
acd72efbf1 Implement wxGridBlockCoords class
wxGridBlockCoords represents a location of a block of cells in the grid.
2020-04-04 18:50:36 +02:00
Ilya Sinitsyn
673ed29d7b Make wxGridSelection to be non-friend to wxGrid
Improve integrity of the wxGridSelection internal data by removing `friend`
declaration.
2020-04-04 18:50:36 +02:00
Ilya Sinitsyn
79219fdbb2 Remove unused wxGrid member variable 2020-04-04 18:50:36 +02:00
Vadim Zeitlin
43b3a3fc5b Merge branch 'grid-hidpi'
wxGrid improvements for high DPI and DPI changes

See https://github.com/wxWidgets/wxWidgets/pull/1776
2020-04-04 18:46:54 +02:00
Robin Dunn
e258a9d982 Move the animation Impl classes to private headers 2020-04-03 13:22:35 -07:00
Robin Dunn
4545d93924 Move wxAnimationDecoderList-related methods to wxAnimation 2020-04-03 12:49:15 -07:00
Robin Dunn
784f330838 Add assignment operator to wxAnimation 2020-04-02 14:35:30 -07:00
Robin Dunn
8153605cf0 No need for wxRTTI in wxAnimationImpl 2020-04-02 13:48:53 -07:00
Robin Dunn
6f79567f3b Use better names for the Impl accessor methods 2020-04-02 13:21:49 -07:00
Robin Dunn
a7fd4db107 Use wxDECLARE_NO_COPY_CLASS in the Impl classes 2020-04-02 13:14:38 -07:00
Robin Dunn
06bda3e5de Revert change that ended up just moving some lines 2020-04-02 12:59:26 -07:00
Robin Dunn
c532edfe67 Fix class names in the header 2020-04-02 12:51:16 -07:00
Robin Dunn
52d4bad3df
Apply suggestions from code review
Co-Authored-By: VZ <vadim@wxwidgets.org>
2020-04-02 12:35:58 -07:00
Paul Cornett
6240ecf153 Fix virtual call of Destroy() in wxDocChildFrameAny
Allow derived class override to be called.
See #18694
2020-04-02 09:03:35 -07:00
Robin Dunn
fb69a2975f Add missing wxOVERRIDE, and some other cleanup 2020-04-01 14:55:08 -07:00
Robin Dunn
6b6a930e9c Update GTK animation classes for the new pattern 2020-04-01 14:16:15 -07:00
Robin Dunn
f641601ea9 Remove the wxOVERRIDEs too 2020-04-01 13:37:38 -07:00
Vadim Zeitlin
d41d159576 Replace wxGridCellBoolRenderer::ms_sizeCheckMark with a local var
This variable is (now) only used in a single function, so there is no
reason to declare it as a class member.

No real changes.
2020-04-01 22:33:02 +02:00