Commit Graph

72662 Commits

Author SHA1 Message Date
Vadim Zeitlin
9d86ba11e2 Add support for wxBitmapBundle to wxGTK wxNotebook
Just use wxWithImages::GetBitmapBundle() directly with wxGtkImage
without passing by wxImageList -- this suffices to have working high DPI
support for notebook page icons.
2021-11-07 23:40:47 +01:00
Vadim Zeitlin
f1da96db27 Add helper wxWithImages::GetBitmapBundle()
This function can be used in the ports that don't require wxImageList
(i.e. anything but wxMSW) to use wxBitmapBundle if it's available,
rather than passing by wxImageList.
2021-11-07 23:39:59 +01:00
Vadim Zeitlin
0588bc8820 Fix size of wxImageList created by wxBitmapBundle
The size must be specified in logical, and not physical, pixels and the
failure to do use the correct units results in a silent (!) failure to
add any bitmaps to the wxImageList later.
2021-11-07 23:23:47 +01:00
Vadim Zeitlin
73886b1bb2 Significantly extend wxWithImages documentation
Notably explain that SetImages() should be preferred to the old methods
taking wxImageList and why.
2021-11-07 22:07:00 +00:00
Vadim Zeitlin
99c30e488c Document the use of wxWithImages methods with wxTreeCtrl
Also remove the documentation of the inherited methods from wxTreeCtrl
itself.
2021-11-07 21:57:42 +00:00
Vadim Zeitlin
ced845f006 Update wxTreeCtrl and its sample to work with wxBitmapBundle
Override OnImagesChanged() to call UpdateImageListIfNecessary() even in
wxGenericTreeCtrl for now, although in the future it would really make
sense to stop using wxImageList in its implementation and just use
wxBitmapBundle directly instead.

wxMSW is the only one which really needs an image list, as it's required
by the native control.

Also update the sample, even though it doesn't look very nice because
its icons are only available in a single size, so we have to always
scale them.
2021-11-07 21:46:42 +00:00
Artur Wieczorek
755ee1cf10 Get rid of unnecessary casting 2021-11-07 22:39:10 +01:00
Artur Wieczorek
789b39be81 Fix deleting wxPGProperty from wxPropertyGridPageState in alphabetical mode
Categories of properties can be nested so we need to search on all category
levels for the the category wxPGProperty belongs to.
And wxPGProperty removed from the alphabetical list can be a subproperty
of another property so it's parent doesn't have to be the root of the list
and we don't have to check this with assertion.

Closed #19310.
2021-11-07 22:35:22 +01:00
Vadim Zeitlin
e293a3a6e3 Remove unnecessary wxBusyCursor from the treectrl sample
This was added way back in 618a5e382a (Applied Greg's patch to tree
control and related., 2001-08-18) for some reason, but probably was
never needed and definitely isn't any more.
2021-11-07 21:15:02 +00:00
Vadim Zeitlin
c777a34d78 Move wxBookCtrlBase::WXHandleDPIChanged() to wxWithImages itself
This function is not really wxBookCtrl-specific and can be used with
other classes as well, so allow reusing it in them.

No real changes, this is just a refactoring.
2021-11-07 21:13:39 +00:00
Artur Wieczorek
5f0dc6cc0a Fix adding wxPGProperty to wxPropertyPageState in alphabetical mode
If given wxPGProperty is a subproperty of another property (its parent
is neither root nor category) it shouldn't be added directly
to the alphabetical list. It should be just added as a child property.
2021-11-07 22:09:05 +01:00
Artur Wieczorek
198bd1fe1f Fix setting categorized/alphabetic mode for inserted wxPropertyGridPage
State of the newly added wxPropertyGridPage should have the same
categorized/alphabetic mode like associated wxPropertyGrid.
2021-11-07 21:59:47 +01:00
Vadim Zeitlin
ddb3b4a80a Use wxWithImages in wxTreeCtrl
Replace direct use of wxImageList with the use of wxWithImages, which
will make adding support for using wxBitmapBundle later simpler.

In fact, this already somewhat simplifies the code by removing the need
to manually take care of m_ownsImageListXXX flags.
2021-11-07 17:52:35 +00:00
Vadim Zeitlin
34a730f89c Small cleanup of wxGenericTreeCtrl-specific parts of the sample
Use HAS_GENERIC_TREECTRL for testing whether we're actually using it or
not instead of checking for USE_GENERIC_TREECTRL and then port names
with a native control, which was done inconsistently, as it included
wxQt in one place, but not the other one.

Also avoid repeating CreateButtonsImageList() declaration twice, as this
resulted in having unbalanced curly braces in this file, which was just
unpleasant.

No real changes.
2021-11-07 16:36:43 +00:00
Vadim Zeitlin
725c3d5608 Update images when DPI changes in wxBookCtrlBase-derived classes
Just pretend that the images themselves have changed, this should be
enough to recreate wxImageList from the bundle using the new scale
factor in UpdateImageListIfNecessary().
2021-11-07 16:06:55 +00:00
David Costanzo
20208cc81f Fix loading bitmaps with malformed biClrUsed field
Stop throwing std::bad_alloc when BMP has large/negative biClrUsed by
checking that biClrUsed has a reasonable value before attempting to
allocate however much memory it indicates.

Add unit tests showing the loading such invalid bitmaps now correctly
returns an error rather than throwing an exception.

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

Closes #19295.
2021-11-06 16:12:04 +01:00
Vadim Zeitlin
58d2243f7b Improve wxTE_RICH(2) styles documentation
Mention that wxTE_RICH2 should be used instead of wxTE_RICH and that it
can now be turned out automatically if the initial text is too long.

See #19303.
2021-11-06 16:00:49 +01:00
Lauri Nurmi
aace36b17f Add static SetNameForCurrent for setting name of non-wxThreads
Co-authored-by: PB <PBforDev@gmail.com>
2021-11-05 16:11:56 +02:00
Lauri Nurmi
fc756d06a6 Add wxThread::SetName for naming threads for debugging purposes
Such thread names can be shown by some debuggers, and depending on
the OS and compiler versions used, they can be visible in process
lists and crash dumps.

Co-authored-by: PB <PBforDev@gmail.com>
2021-11-05 16:11:55 +02:00
Vadim Zeitlin
590d3f1b75 Merge branch 'macos_versionname12' of https://github.com/TcT2k/wxWidgets
Recognize Windows 11 and macOS 12 in wxGetOsDescription().

See https://github.com/wxWidgets/wxWidgets/pull/2580
2021-11-05 13:58:09 +01:00
Lauri Nurmi
7c6b041469 Simplify function pointer syntax in GetPreferredUILanguage()
No need for (*func)(args), just call func(args).

No real changes.

This commit is best viewed ignoring whitespace-only changes.

Closes https://github.com/wxWidgets/wxWidgets/pull/2579
2021-11-05 13:56:55 +01:00
PB
d7e33a5291 Extend wxMSW contributor guide
List useful wrapper classes for Windows API provided by wxWidgets.

Closes https://github.com/wxWidgets/wxWidgets/pull/2578
2021-11-05 13:56:10 +01:00
Vadim Zeitlin
cce8e41b20 Merge branch 'gtk_unknown_keys' of https://github.com/martinetd/wxWidgets
Generate wxKeyEvents even for unknown keys in wxGTK.

See https://github.com/wxWidgets/wxWidgets/pull/2576
2021-11-05 13:55:12 +01:00
Vadim Zeitlin
de3d95a7b3 Merge branch 'gtk-launch-keys'
Generate events for GDK_KEY_LaunchX keys too in wxGTK.

See https://github.com/wxWidgets/wxWidgets/pull/2575
2021-11-05 13:53:30 +01:00
Vadim Zeitlin
089b72b762 Merge branch 'msw-long-text'
Fixes for creating wxTextCtrl with long text in wxMSW.

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

Closes #19303.
2021-11-05 13:50:20 +01:00
Tobias Taschner
69aedae382 Include Windows 11 in wxGetOsVersion() table 2021-11-05 13:07:32 +01:00
Tobias Taschner
6cef0c0464 Include Windows 11 name in wxGetOsDescription()
The major version is not changed for Windows 11 from
Windows 10, but the build number 22000 can be used to
determine it's Win 11.
2021-11-05 11:55:51 +01:00
Tobias Taschner
2c6651ef12 Include macOS 12 name in wxGetOsDescription() 2021-11-05 11:19:06 +01:00
Tobias Taschner
ab7098b33b Add note to RunScript() to recommend RunScriptAsync() 2021-11-05 10:04:45 +01:00
Tobias Taschner
04e4b57a05 Remove unused m_runScriptCount
This was no longer used after the changes to the javascript wrapper
2021-11-05 09:54:44 +01:00
Tobias Taschner
9f9ccf33e1 Initialize syncScriptResult and remove unused parameter 2021-11-05 09:52:53 +01:00
Tobias Taschner
8613f3aa6b Apply suggestions from code review
Co-authored-by: VZ <vz-github@zeitlins.org>
2021-11-05 09:41:39 +01:00
Dominique Martinet
5f0749f4fd Document generation of WXK_NONE key events for unknown keys
Add a paragraph for keys where GetUnicodeKey and GetKeyCode both return
WXK_NONE, that GetRawKeyCode is platform specific, and that such keys
generate no wxEVT_CHAR event.
2021-11-05 09:46:53 +09:00
Vadim Zeitlin
eb6e0289d6 Make WXK_LAUNCH_x constants consecutive
No real changes, but don't complicate the constants definitions
needlessly just to avoid changing the numeric value of WXK_LAUNCH_APP
constants as nobody should rely on them anyhow.

Not doing it simplifies things and allows to condense the mapping from
GDK keys to wx ones.
2021-11-05 00:43:39 +01:00
Vadim Zeitlin
77f81bae07 Improve multimedia key constants documentation
Add "since 3.1.0" for the constants introduced back in abd46cb99a (Add
support for multimedia keys to wxMSW and wxGTK, 2016-01-08) and also for
the new constants added in the previous commit.

Also document that WXK_LAUNCH_n keys are only generated by wxGTK.
2021-11-05 00:42:46 +01:00
Tobias Taschner
0921d0508a Add tests for wxWebView::RunScriptAsync() 2021-11-03 14:04:24 +01:00
Tobias Taschner
9114122837 Additional wxWebView::RunScriptAsync() documentation 2021-11-03 14:04:23 +01:00
Tobias Taschner
d31f1dc400 Add wxWebViewEvent::IsError() 2021-11-03 13:35:24 +01:00
Tobias Taschner
47833a6d24 Add RunScriptAsync() to webview sample 2021-11-03 11:19:09 +01:00
Tobias Taschner
d93db6bba5 Add initial RunScriptAsync() documentation 2021-11-03 11:19:09 +01:00
Tobias Taschner
93f7df50d5 Implement RunScriptAsync for webkit2 2021-11-03 11:19:08 +01:00
Tobias Taschner
e1bd17d883 Use new JS wrapper with webkit2 2021-11-03 11:19:08 +01:00
Tobias Taschner
7aa1d84e4a Implement RunScriptAsync for macOS 2021-11-03 11:19:08 +01:00
Tobias Taschner
e9dc74cb6d Add wxWebView::RunScriptAsync() 2021-11-03 11:19:07 +01:00
Tobias Taschner
cf6a947dab Use new JS wrapper with edge and IE 2021-11-03 11:19:00 +01:00
Tobias Taschner
2fe12ae6af Restructure javascript result wrapper 2021-11-03 11:18:53 +01:00
Tobias Taschner
fd2920ff22 Fix wxWebViewEdge tests
Edge does not support the about: URL using it in the test resulted
in various problems. Just use about:blank for now as the edge backend
does not merge them for the history checks.
2021-11-03 11:18:53 +01:00
Dominique Martinet
61d835d8b3 wxKeyCode: add WXK_LAUNCH_[0-9A-F] for gtk bindings
X11 defines Xf86Launch[0-9a-f], which are then also defined as
GDK_KEY_Launch[0-9A-F].

Unfortunately, keys which are not mapped are just plain ignored and the
application is then not able to receive these keyboard events at all.

The original PR https://github.com/wxWidgets/wxWidgets/pull/157 mapped
only LaunchA/B to WXK_LAUNCH_APP1/2, this patch adds the whole range of
keys and keeps LAUNCH_A/B as aliases for WXK_LAUNCH_APP1/2
2021-11-02 10:18:02 +09:00
Dominique Martinet
307aaf83d8 gtk/window: cleanup dead code around wxTranslateGTKKeyEventToWx
The previous commit made wxTranslateGTKKeyEventToWx never fail, so make it void
and remove all dead code resulting from the lack of failure.
2021-11-02 10:09:28 +09:00
Dominique Martinet
33553ed141 gtk/window: generate WXK_NONE key event for unknown keys
There are still plenty of X11 keys which have no WXK mapping and might be useful
for applications to act upon.

Instead of trying to remap all of them, generate a WXK_NONE key event and let
applications deal with it using GetRawKeyCode() if appropriate.
2021-11-02 10:09:28 +09:00