Commit Graph

3547 Commits

Author SHA1 Message Date
Vadim Zeitlin
379e718a33 Remove recently added GetOpenGLScaleFactor()
It has become unnecessary after the previous commit, as now the generic
GetContentScaleFactor() can be used instead of it on all platforms, so
revert the changes of f6cc8ff52c (Add GetOpenGLScaleFactor() to abstract
OpenGL coordinates scaling, 2020-07-10).

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

See #17391.
2020-07-18 23:51:05 +02:00
Vadim Zeitlin
cd8b2d3096 Make wxWindow::GetContentScaleFactor() return 1 under MSW again
This reverts bc492a9e6e (Make wxWindow::GetContentScaleFactor() useful
for non-OSX platforms., 2015-03-18) and restores the old behaviour from
wxWidgets 3.0, which consisted in only returning factor different from 1
from this function for the platforms distinguishing logical and physical
pixels.

After this change, the return value of this function can be portably
used on all platforms to convert between logical and physical pixels,
independently of the current DPI.
2020-07-18 23:44:58 +02:00
Vadim Zeitlin
1422991602 Add wxWindow::GetDPIScaleFactor()
This function replaces some uses of GetContentScaleFactor(), where a
factor greater than 1 must be used even under the platforms not doing
any logical/physical pixel mapping, such as MSW.

For now GetContentScaleFactor() is still unchanged, but it will return 1
for such platforms in the future and adding GetDPIScaleFactor() allows
to avoid changing the behaviour of the code which relied on its current
behaviour.
2020-07-18 23:42:44 +02:00
Vadim Zeitlin
d57c688d89 Return non-zero height from GetMultiLineTextExtent("") in wxMSW
This restores the previous behaviour inadvertently changed by bfeae1922d
(Minor optimizations in GetMultiLineTextExtent(), 2020-06-10) and makes
it official by documenting it and adding tests checking for it.

It wasn't completely obviously if this was intentional or accidental
before, but at least wxStaticText itself relied on the old behaviour,
and chances are that so did some code outside the library, so make this
part of the API now.

See #18825.
2020-07-15 02:10:49 +02:00
Vadim Zeitlin
46d6866c9f Make wxGCDC::GetTextExtent("") return (0, 0)
This seems more logical and is compatible with wxDC in wxMSW and wxGTK2,
as well as other kinds of DC, e.g. wxPostScriptDC.

It also looks like the current behaviour was unintentional as it
happened only because wxGCDCImpl::DoGetTextExtent() always passed all
non-null parameters to wxGraphicsContext::GetTextExtent(), even if it
didn't need the values for all of them, and thus bypassed the special
case for the empty string which was already present in the latter
function.

Fix this, making DoGetTextExtent() more efficient as a side effect (we
now avoid unnecessary calls to pango_layout_iter_get_baseline() in the
most common case), and also add another test for empty string to
wxGraphicsContext itself, for non-GTK case.

Also document this behaviour and add a test checking for it.
2020-07-15 02:10:34 +02:00
Vadim Zeitlin
69e27acf0d Merge branch 'im/clipboard' of https://github.com/imciner2/wxWidgets
Ensure the clipboard contents are stored properly on GTK.

See https://github.com/wxWidgets/wxWidgets/pull/1953
2020-07-13 15:33:58 +02:00
Vadim Zeitlin
98241e21cd Merge branch 'colour-as-string'
Return empty string from wxColour::GetAsString() if it's invalid.

See https://github.com/wxWidgets/wxWidgets/pull/1947
2020-07-12 22:29:09 +02:00
tm
f6cc8ff52c Add GetOpenGLScaleFactor() to abstract OpenGL coordinates scaling
The fix for OpenGL coordinates when using high DPI in b134589cbb (Fix
OpenGL samples when using HiDPI displays, 2019-08-06) did fix it for GTK
3 and macOS, but broke it for MSW and other platforms not using pixel
scaling, as window coordinates are the same as OpenGL ones there, while
GetContentScaleFactor() can still return values > 1 even on these
platforms.

Provide new GetOpenGLScaleFactor() function abstracting this platform
difference and use it in all OpenGL samples to make them work correctly
in high DPI under all platforms.

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

Closes #17391.
2020-07-12 22:28:29 +02:00
Artur Wieczorek
776b28cba7 Don't allow wxSpinCtrl range to include negative values if base != 10 (wxOSX)
For the sake of consistency with another ports only unsigned
hexadecimal numbers should be supported. To do so we need
to prevent:
- Setting a range including negative values if base == 16.
- Setting base != 10 if current range includes negative values.

Closes #18805.
2020-07-12 19:58:30 +02:00
Artur Wieczorek
845988e0ed Don't allow wxSpinCtrl range to include negative values if base != 10 (wxGTK)
Hexadecimal numbers are always unsigned in the native wxSpinCtrl
implementation under wxMSW so for the sake of consistency we need
to prevent:
- Setting a range including negative values if base == 16.
- Setting base != 10 if current range includes negative values.

See #18805.
2020-07-12 19:58:30 +02:00
Artur Wieczorek
ae1e93cbae Don't allow wxSpinCtrl range to include negative values if base != 10 (wxMSW)
In a native up-down control hexadecimal numbers are always unsigned (see
UDM_SETBASE message documentation) so we need to prevent:
- Setting a range including negative values if base == 16.
- Setting base != 10 if current range includes negative values.

See #18805.
2020-07-12 19:58:30 +02:00
Ian McInerney
04ff2254a0 Ensure the clipboard contents are stored properly on GTK
GTK needs to be told the data on the clipboard can be stored
before the store is attempted.

Also, document that the clipboard behavior on GTK is very
dependent on the configuration of the user's machine.

Closes #10515
2020-07-12 00:39:33 +01:00
Vadim Zeitlin
9890cf6bac Return empty string from wxColour::GetAsString() if it's invalid
This is consistent with wxToString(wxColour) and seems more useful than
either returning black string representation (as wxMSW used to do) or
asserting (as wxGTK did).

Document this behaviour and add a test checking for it.

Closes #18623.
2020-07-11 14:31:54 +02:00
Ian McInerney
ade5030c56 Warn on incompatible wxDirDialog styles 2020-07-10 03:32:49 +02:00
Ian McInerney
7230acd110 Fix setting the title for the wxDirDialog on OSX
OSX 10.11+ doesn't actually display the title, so update documentation
to reference SetMessage instead. For pre-10.11 override the SetTitle
method to set the title of the NSOpenPanel instead of the window.

Also change so the directory is not updated unless it is provided.

Closes #15143.
2020-07-10 03:32:48 +02:00
Ian McInerney
79d73d4eb3 Add show hidden folders flag to wxDirDialog
Add wxDD_SHOW_HIDDEN similar to the existing wxFD_SHOW_HIDDEN.
2020-07-10 03:29:16 +02:00
Ian McInerney
f9e9b19c92 Add wxDD_MULTIPLE wxDirDialog style and implement it for GTK
Add wxDirDialog::GetPaths() similar to the existing member of
wxFileDialog with the same name and also taking, for consistency,
wxArrayString as the output parameter.
2020-07-10 03:24:42 +02:00
Robin Dunn
4c0288435b Add missing wxRICHTEXT_HANDLER_USE_CSS 2020-07-08 16:38:02 -07:00
PB
83a2a1e505 Refactor the natural string compare and sort algorithm
Add a new string fragment type for whitespace and punctuation which needs
to be assessed separately from letters and symbols.

Use wxUint64 instead of long for storing the value for numeric fragment.

Use collate instead of compare for non-numeric fragments.

Change names for the public comparison functions: wxWidgets provided function
is now named wxCmpGenericNatural() and for common public use is wxCmpNatural()
which calls a native function in wxMSW and wxCmpGenericNatural() elsewhere.

Try harder in wxCmpNaturalGeneric() if wxRegEx is unavailable: do not
just make a simple string comparison, but perform a case-insensitive
collation.

Make some other changes to simplify and possibly speed up the code.
2020-07-07 23:10:18 +02:00
Hugo Elias
371c4b1366 Add functions for sorting strings in natural sort order
Use StrCmpLogicalW() under MSW and generic implementation under the
other platforms.

See https://github.com/wxWidgets/wxWidgets/pull/780
2020-07-07 23:10:11 +02:00
Vadim Zeitlin
f259f4152b Merge branch 'safer-sizers'
Improvements to the safety of wxSizer API.

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

Closes #18611.
2020-07-06 17:54:46 +02:00
Vadim Zeitlin
65d890f33e Document important requirements of wxSizerItem::AssignWindow()
Failure to call SetContainingSizer() on the window passed to it can have
catastrophic consequences, so make sure to document the need to do it.
2020-07-05 23:28:28 +02:00
Stefan Csomor
52ab8c43dd
Merge branch 'master' into osx-10_10-min-10_11-SDK 2020-07-04 23:03:55 +02:00
Tobias Taschner
1666f58bc6
Change documentation references from OS X to macOS (#1927)
Since OS X 10.12 it has been named macOS so it makes sense
to reference it in documentation as such, even when it
sometimes refers to older versions which were called (Mac) OS X.
2020-07-04 22:08:24 +02:00
Stefan Csomor
6cab9052b8 updating docs for min system 2020-07-04 21:28:13 +02:00
Gilbert Pelletier
76c7f723fc Add wxFontDialog::RestrictSelection() to disallow raster fonts
Under MSW it is possible to restrict the native font dialog to showing
only scalable fonts only, disallowing the raster fonts, so add a method
to wxFontDialog exposing this functionality in wxWidgets API.

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

Closes #16988.
2020-07-04 13:14:38 +02:00
Vadim Zeitlin
ca84560350 Add wxGridCellActivatableEditor and show it in the grid sample
Add a helper class making it easier to define activation-only editors
and use it to implement MyGridStarEditor in the sample, showing a
typical example of using such editor.
2020-06-30 02:30:36 +02:00
Vadim Zeitlin
3cc3236f10 Add support for "activatable" editors to wxGrid
This is useful for editors which don't really need to show any control
as they can change their value directly and will be used to reimplement
wxGridCellBoolEditor in the upcoming commits.
2020-06-30 02:25:14 +02:00
Vadim Zeitlin
d14a33bf37 Merge branch 'grid-streamline'
Various simplifications and bug fixes in wxGrid code, mostly related to
handling in-place cell editing.

See https://github.com/wxWidgets/wxWidgets/pull/1910
2020-06-30 00:25:46 +02:00
Robin Dunn
c43af017c9 Document wxDC::[GS]etGraphicsContext 2020-06-29 10:14:43 -07:00
Vadim Zeitlin
c73634c520 Add DoShowCellEditControl() showing the editor unconditionally
It doesn't make sense to perform the checks in ShowCellEditControl()
when it's called from EnableCellEditControl() and this makes the code
unnecessarily fragile as m_cellEditCtrlEnabled needs to be set at just
the right moment for it to work correctly.

Call the new DoShowCellEditControl() instead and perform the checks only
in the public function, for compatibility.

Also note in a comment and the documentation that ShowCellEditControl()
is not very useful anyhow and that EnableCellEditControl() should most
often be used instead.

No real changes (the commit is best viewed ignoring whitespace changes).
2020-06-28 00:30:57 +02:00
Vadim Zeitlin
63643eb122 Fix typo in wxGrid::EnableCellEditControl() documentation
Just s/show/shown/
2020-06-28 00:02:43 +02:00
Vadim Zeitlin
45bc2e648b Remove check for read only cells from IsCellEditControlEnabled()
This check was introduced back in 283b7808d8 (added support for readonly
cells and 3d border drawing, 2000-02-16), but was wrong even then and
remained wrong ever since: we must not set m_cellEditCtrlEnabled to true
when the current cell is read-only, so there is no need to check for the
latter condition if m_cellEditCtrlEnabled is indeed true.

Ensure that we really never erroneously set m_cellEditCtrlEnabled for
the read-only cells by replacing an wxASSERT_MSG checking for this in
EnableCellEditControl() with wxCHECK_RET().

Also explicitly document this function precondition, also added back in
b54ba67107 ([...] added CanEnableCellControl() and use it before calling
EnableEC, 2000-02-17) but never documented so far.
2020-06-28 00:02:29 +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
2a368fec9f Document that using wxClientDC for drawing is not portable
We can't make wxClientDC work on the platforms not supporting drawing
outside of wxEVT_PAINT handler, but at least document that this doesn't
work.

Also add an example of using this class for the purpose for which it
still works (measuring) and remove references to it and wxWindowDC from
wxPaintDC documentation as we don't want to encourage people using it.

See #17820.
2020-06-27 16:37:48 +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
Hertatijanto Hartono
8ff434c2a5 Fix typo in settings.h and wxListCtrl Class Reference
Consistently use "colour" spelling.

Closes https://github.com/wxWidgets/wxWidgets/pull/1903
2020-06-23 01:35:54 +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
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
Vadim Zeitlin
350ae65cb6 Fix parameter name in wxDC::DrawBitmap() documentation
Closes #18795.
2020-06-21 00:07:01 +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
036ab992d5 Merge branch 'list-deselect-event'
Consistently send DESELECTED events from virtual wxListCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/1857
2020-06-13 22:50:55 +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
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
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
de2fba540b Document wxSizer::RecalcSizes() and RepositionChildren() better
Mention that RecalcSizes() shouldn't be called any more, after the
changes of 622deec262 (Replace wxSizer::RecalcSizes() with
RepositionChildren(), 2015-10-11), and that RepositionChildren()
replacing it shouldn't be directly called neither.
2020-06-08 13:26:59 +02:00
Vadim Zeitlin
0d68a6d42e Fix formatting of @since in the list items in wxGauge docs
The line break after "Since" doesn't look good in this context, so avoid
using @since and spell it out explicitly.
2020-06-07 18:55:11 +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
cbe21c0cc9 Recommend SetMinSize() instead of wxSizerItem::SetInitSize()
It's not really clear why do we have this function at all, but
SetMinSize() name is more clear and consistent with wxWindow, so prefer
using it instead.
2020-06-02 18:33:57 +02:00