Commit Graph

4084 Commits

Author SHA1 Message Date
Vadim Zeitlin
30b37b610d Revert "Merge branch 'string-art-ids'"
This reverts commit 8c9ba23eae, reversing
changes made to 5192feb38e.

Upcoming commits will try to work around the issues with art IDs related
to wxNO_IMPLICIT_WXSTRING_ENCODING in a different way.
2020-08-24 16:47:37 +02:00
Vadim Zeitlin
3df9d772a4 Merge branch 'display-ppi-from-scaling-factor'
Determine display DPI from scaling factor instead of trying to compute
it from the physical display dimensions.

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

Closes #18855.
2020-08-24 00:14:27 +02:00
Ian McInerney
afbb334a26 Make IsCheckable true by default and switch to explicitly disallowing it
Also add a new accessor to wxAuiToolBarItem to make it easier to
determine when a tool can be checked.
2020-08-21 23:15:38 +01:00
Vadim Zeitlin
6d6c01ff2a Make wxKeyboardState ctor explicit
Avoid accidental conversions of e.g. int to wxKeyboardState.
2020-08-21 11:49:34 +02:00
KT
b50aca9596 Inherit art provider in wxAuiFloatingFrame by default
Use the same art provider for a floating frame detached from an existing
wxAuiManager as was used by the original wxAuiManager itself, to ensure
that the appearance of this frame is consistent with the appearance of
its parent.

Implementing this required adding wxAuiDockArt::Clone() to allow copying
it in the new frame and this patch also adds GetAuiManager() to
wxAuiFloatingFrame, similar to the existing method in wxAuiNotebook, in
order to allow changing the dock art from the application code if
desired.

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

Closes #18882.
2020-08-21 02:43:28 +02:00
Vadim Zeitlin
126c976f5b Merge branch 'taskbar-icon-get-menu'
Add wxTaskBarIcon::GetPopupMenu() allowing to avoid recreating the menu
every time.

See https://github.com/wxWidgets/wxWidgets/pull/2020
2020-08-21 02:42:13 +02:00
Vadim Zeitlin
8c9ba23eae Merge branch 'string-art-ids'
Make the wxART_* constants const wxStrings to improve compatibility with
pre-3.1.4 code and, in particular, allow taking the address of these
constants.

See https://github.com/wxWidgets/wxWidgets/pull/1996
2020-08-21 02:39:12 +02:00
Ian McInerney
65e124bb64 Add a flag to wxUpdateUIEvent to tell if the item supports the check action
Not all items support check being set in an UpdateUIEvent handler,
so it is nice to provide an API to find out if the item supports it.

Fixes #13369
2020-08-20 23:30:19 +01:00
Vadim Zeitlin
9e27efb2cb Further improve wxEVT_GRID_RANGE_SELECT{ED,ING} documentation
Explain when it is preferable to handle events of each kind.
2020-08-20 16:56:23 +02:00
Vadim Zeitlin
e2f316b19d Mention that wxEVT_GRID_RANGE_SELECT{ED,ING} are new in 3.1.5
Also explained that SELECTED is just the new spelling of SELECT.
2020-08-20 16:56:03 +02:00
Daniel Kulp
415f080c80 Split wxGrid RANGE_SELECT event into SELECTING and SELECTED
This will allow the applications that are only interested in the final
selection to ignore the intermediate SELECTING events, which are now
sent as soon as the selection changes while dragging the mouse, and only
handle the final SELECTED ones, when the drag is over.
2020-08-20 16:56:03 +02:00
Vadim Zeitlin
f04c904b60 Improve wxTaskBarIcon::Create/GetPopupMenu() documentation
Try to make the text more clear and prescriptive.

Also add a "@since" tag.
2020-08-14 19:48:29 +02:00
Andreas Falkenhahn
c70a8261cb Add wxTaskBarIcon::GetPopupMenu()
This is similar to CreatePopupMenu(), but the menu pointer returned by
the new function won't be deleted by wxWidgets, allowing it to return
the same pointer every time it is called.

Closes #18886.
2020-08-14 19:33:38 +02:00
PB
a4647825cb Do not use wxRegEx in wxCmpNaturalGeneric()
Using wxRegEx in wxCmpNaturalGeneric() introduced a dependency of the
base library on the regex library.

Replace wxRegEx with character classification functions wxIsspace(),
wxIspunct(), and wxIsdigit() to remove this rather unnecessary
dependency.

Closes https://github.com/wxWidgets/wxWidgets/pull/2014
2020-08-14 19:26:33 +02:00
Vadim Zeitlin
8e2aad2621 Merge branch 'webview_ie-js' of https://github.com/MaartenBent/wxWidgets
Fix using JavaScript in wxWebViewIE with custom scheme.

This repairs a regression in 3.1.4 due to the changes of 6787b0548b
(Merge branch 'webview-ie-fixes', 2020-07-23).

See https://github.com/wxWidgets/wxWidgets/pull/2004
2020-08-14 19:23:27 +02:00
Vadim Zeitlin
19fd0fcfd7 Add wxDisplay::GetScaleFactor()
This is conceptually the same as the ratio of the current DPI to the
standard one, but can be implemented more directly for wxGTK3 and wxOSX
(although the latter doesn't implement it yet).
2020-08-14 16:09:27 +02:00
Vadim Zeitlin
52b25211c8 Add wxDisplay::GetStdPPIValue() and GetStdPPI()
Provide public way to access the default platform DPI, which was
previously a constant private to src/common/wincmn.cpp.
2020-08-14 16:09:27 +02:00
Vadim Zeitlin
e96155fece Fix and improve wxDC background mode documentation
Use wxBRUSHSTYLE_SOLID/TRANSPARENT constants instead of wxPENSTYLE_XXX
ones, as even though they have the same values, using brush style for
the background makes more sense.

Also document that the default background mode is transparent.
2020-08-13 23:08:58 +02:00
Vadim Zeitlin
d3cab1bd54 Don't document wxImageList::Replace() as being MSW-only
This method is implemented in the generic version used under the other
platforms as well, but was documented as being MSW-only in 89bb3f0244
(interface revisions, 2008-10-17) for some reason.

Just remove the note added by that commit.
2020-08-13 21:57:18 +02:00
Stefan Brüns
128e3ff123 Make the wxART_* constants const wxStrings with static storage duration
The pre-3.1.4 definitions of the constants were just string literals,
while the type were wxString typedefs. To avoid implicit conversion
these were converted to actual wxStrings.

While the interface now matched the implementation, this has several
drawbacks:
- every use of the "constant" now is a string construction at runtime
- the constant now is an rvalue, i.e. it is impossible to take its
  address.

The latter breaks its use from wxPython.

The IDs are moved to a separate file which can be included multiple
times, once from the header to have the declarations in place, and once
to instantiate the wxStrings. Using a common file avoids the declaration
and definition going out of sync.
2020-08-06 12:31:37 +02:00
Vadim Zeitlin
aa2d159e8c Use more reasonable length for wxSlider in wxGTK by default
Use the same 100 DIPs as in wxMSW, to make the default behaviour more
useful.

Also update documentation to explain which size component should, and
should not, be specified when creating the slider.

Closes https://github.com/wxWidgets/wxWidgets/pull/2012
2020-08-05 00:01:50 +02:00
Maarten Bent
300fe1a6f9 Add option to wxWebViewHandler to set a custom security URL
This will be used by wxWebViewIE to modify the security URL and domain when
parsing a URL.
2020-07-28 21:22:21 +02:00
Vadim Zeitlin
2f450733d4 Merge branch 'dpi-scaling-factor'
Add DPI scaling factor and revert content scaling factor behaviour in
wxMSW and other ports not using logical pixels to be 3.0 compatible.

See https://github.com/wxWidgets/wxWidgets/pull/1985
2020-07-20 15:55:23 +02:00
Vadim Zeitlin
4dd009136c Merge branch 'aui-auto-uninit'
Call wxAuiManager::UnInit() automatically.

Closes #14145.
2020-07-20 15:49:05 +02:00
Tomay
bbdd5b4984 Add wxWindow::DisableFocusFromKeyboard()
This allows to easily exclude a window from the TAB chain.

Closes https://github.com/wxWidgets/wxWidgets/pull/1516
2020-07-19 14:55:51 +02:00
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
ceb21d5e86 Also call wxAuiManager::UnInit() when manager itself is destroyed
This completes the changes of the previous commit and should ensure that
UnInit() is always called, whoever is destroyed first -- the managed
window or the manager itself.

Also update the documentation to mention that calling UnInit()
explicitly is not necessary any longer.
2020-07-18 17:51:41 +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