Commit Graph

18845 Commits

Author SHA1 Message Date
Vadim Zeitlin
47adeb14b9 Remove unnecessary Mac-specific IsShownOnScreen() implementation
It ended up returning the result of the base class method anyhow, just
after doing a lot of unnecessary work, so this commit shouldn't change
anything, but should significantly speed up this function.

We may want to explore the possibility of implementing this method
natively using GetPeer()->IsVisible() later, as it could be faster than
our own implementation, but we need to ensure that this always returns
the same result as before, which might not be the case when the TLW is
in the process of being shown or hidden, so don't do this for now.

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

Closes #18645.
2020-06-28 15:38:50 +02:00
Vadim Zeitlin
fca9460522 Fix typo in wxWebViewEdgeImpl::Uninitialize() name
As this is a private header, we can fix this without any compatibility
concerns.

Thanks codespell for finding it.
2020-06-27 22:56:22 +02:00
Vadim Zeitlin
d7f19ee610 Fix spelling in comments and documentation using codespell
Apply the utility from https://github.com/codespell-project/codespell/
to fix spelling issues in the headers under both include and interface
directories and add a file with a couple of exceptions.

The exact command line used was:

    $ codespell -w -I misc/scripts/codespell.ignore -i 3 in*
2020-06-27 22:56:22 +02:00
Vadim Zeitlin
1905f60b2d Merge branch 'grid-enhance'
Many enhancement to wxGrid UI: fix redraw and (some) flicker bugs; fix
bugs with mouse handling; improve editors positioning etc.

See https://github.com/wxWidgets/wxWidgets/pull/1902
2020-06-26 22:20:41 +02:00
Vadim Zeitlin
f5647828d0 Respect cell alignment when positioning the editors
Define the common logic for positioning editors not taking the entire
cell area (i.e. basically anything other than wxGridCellTextEditor) in
the new DoPositionEditor() function.

Also use the cell and editor alignment to decide where to position the
control if it's smaller than the cell, as it looks better if e.g.
wxGridCellDateEditor appears near the place where the date is displayed
instead of being centered in the middle of a wide column.
2020-06-26 22:19:49 +02:00
Vadim Zeitlin
7e79925fb7 Do erase background even in wxGridCellTextEditor
It is necessary to do it since the switch to double buffering wxGrid
painting in ebbadae09a (Double buffer wxGridWindow drawing, 2020-01-28)
as even a "full cell" editor such as wxGridCellTextEditor still doesn't
fill the entire cell, as there are margins around it, and the backing
bitmap could keep whatever junk happened to be there if we didn't erase
it, so do erase it now.

Remove the code doing the same thing from ShowCellEditControl(),
however, as it's redundant and doesn't do anything except creating some
flicker, and also doesn't work on the platforms not supporting the use
of wxClientDC anyhow.
2020-06-26 22:19:49 +02:00
Vadim Zeitlin
32edcde5bd Remove unused wxGridCellChoiceEditor::PaintBackground() override
This overridden method didn't do anything except calling the base class
version, so just remove it.
2020-06-26 22:19:49 +02:00
Stefan Csomor
80610cb383 switching from AvailabilityMacros.h to Availability.h
The old version is not updated for 10.16 therefore switch to the ‚newer‘ version - that existed since 10.6 - starting with double underscores
2020-06-25 15:59:53 +02:00
Ian McInerney
4ac648901d Don't allow using GetPath/GetFilename() with wxFD_MULTIPLE
GetPaths/GetFilenames() must be used instead when more than one file
could be selected: document this and assert if the wrong functions are
called.

Closes https://github.com/wxWidgets/wxWidgets/pull/1883
2020-06-22 14:04:10 +02:00
Vadim Zeitlin
f8a0438385 Also avoid updating wxHeaderCtrl column when resizing in wxGrid
This is another attempt to get rid of the flicker when using the native
header control with wxGrid under MSW and avoid calling UpdateColumn(),
which is currently implemented in a very inefficient way in wxHeaderCtrl
under MSW, during interactive resizing.

See #18794.
2020-06-21 23:46:59 +02:00
Vadim Zeitlin
867cc2a3eb Handle clicks on grid edges normally when not using drag-resizing
Clicking on (or near) the grid column or row edges was handled specially
to allow dragging them in order to resize the column or row, but this
doesn't need to be done if drag-resizing the columns or rows is not
allowed in the first place and resulted in surprising user-visible
behaviour: e.g. when using row selection, clicking mostly anywhere in
the row selected it, except if the click happened to be between the two
columns, in which case it didn't.

Fix this and always select the row in such scenario now.

Unfortunately, doing this required adding yet more CanDragXXX()
functions in addition to the already impressive panoply of them in
wxGrid, but we need CanDragGridColEdges() as none of the existing
functions checked for m_useNativeHeader (there was instead an ad hoc
check for it directly in the mouse handling code) and the row version
had to be added for symmetry.
2020-06-21 19:29:37 +02:00
Hertatijanto Hartono
895424ecc0 Add wxWebView::SetZoomFactor(float) and GetZoomFactor()
The new method allows to set the zoom level more precisely than the
existing SetZoom(wxWebViewZoom).

Also improve the webview sample by using radio menu items instead of
check items and manually resetting them.

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

Closes #18769.
2020-06-18 03:13:00 +02:00
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