Commit Graph

4261 Commits

Author SHA1 Message Date
dafe3d11bf Merge remote-tracking branch 'remotes/upstream/master'
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-15 10:27:47 +01:00
Artur Wieczorek
12af82ca38 Use wxBitmapBundle in wxPropertyGridManager
wxBitmapBundle can be used in wxPropertyGridManager to pass images
to the toolbar.
2021-11-14 19:16:00 +01:00
Lauri Nurmi
90c20798b9 Implement wxSecureZeroMemory() for clearing memory securely
Wrap native function when possible, and fallback to a generic
implementation.

Closes https://github.com/wxWidgets/wxWidgets/pull/2582
2021-11-12 17:10:02 +01:00
Vadim Zeitlin
37dbf9f03a Merge branch 'threadname' of https://github.com/lanurmi/wxWidgets
Add wxThread::SetName for naming threads for debugging purposes.

See https://github.com/wxWidgets/wxWidgets/pull/2572
2021-11-12 17:05:12 +01:00
Vadim Zeitlin
6349d0b4ca Update link to the GTK stock items list in the docs
Retarget the link to developer-old.gnome.org, as this documentation is
not available on the current GTK documentation site any longer.

Closes #19316.
2021-11-11 22:39:59 +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
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
Tobias Taschner
69aedae382 Include Windows 11 in wxGetOsVersion() table 2021-11-05 13:07:32 +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
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
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
Stefan Csomor
a7f5e3c5c3 OSX wxBitmapBundle::FromFiles implementation for macOS (#2561)
* adding macOS wxBitmapBundle::FromFiles implementation

* adding FromFiles overload, generic implementation

* Update interface/wx/bmpbndl.h

* Removing outdated comment

Co-authored-by: VZ <vz-github@zeitlins.org>
2021-10-26 22:27:36 +02:00
Vadim Zeitlin
9326aa3b6c Add wxBitmapBundle::GetBitmapFor() helper
This can be used to get the bitmap of the size appropriate for the DPI
scaling used for the given window.
2021-10-25 13:40:18 +01:00
Vadim Zeitlin
e5a7e9ccbd Take const wxWindow in wxBitmapBundle::GetPreferredSizeFor()
This function should be usable in const methods of wxWindow-derived
classes too.
2021-10-25 12:21:15 +01:00
Vadim Zeitlin
2c1f4c002d Add wxBitmap::SetScaleFactor()
We need to be able to change the scale factor of the bitmaps returned by
wxBitmapBundle::GetBitmap(), so add a function allowing to do this.

Also add wxHAS_BITMAP_SCALE_FACTOR allowing to check whether this
function actually does something non-trivial and explain in the docs
that GetScaleFactor() always returns 1 on the platforms where this
symbol is not defined.
2021-10-24 19:04:51 +02:00
Vadim Zeitlin
b258d02be3 Document wxBitmap::GetScaleFactor() and related methods
These methods were added 8+ years ago but never documented for some
reason, finally do it now.
2021-10-23 21:38:32 +02:00
Vadim Zeitlin
691a11989e Move wxBitmap::ConvertToDisabled() to respect alphabetic order
No real changes, just keep the functions sorted as they're clearly
intended to be here.

This commit is best viewed with --color-moved git option.
2021-10-23 21:38:32 +02:00
Vadim Zeitlin
9e5c8eef24 Make wxDumpWindow() public and available in wxMSW too
This function was defined in wxGTK and wxOSX, but not in wxMSW or the
other ports, but it can be useful there too, so make it public and
define it in common code.
2021-10-20 23:35:37 +01:00
Vadim Zeitlin
b20552116c Allow wxBitmapBundle to specify its preferred bitmap size
Using bitmaps of preferred size avoids scaling and results in much
better appearance, so add methods allowing querying the bundle about the
bitmaps it supports and implement them in the various implementations.

This is not actually used anywhere yet, but will be soon.
2021-10-19 02:20:26 +01:00
Vadim Zeitlin
4e5d2d97e2 Allow using wxBitmapBundle for wxButton bitmaps
Take wxBitmapBundle in wxButton::SetBitmapLabel() and related functions
in order to be able to associate several bitmaps to be used in different
resolutions with the button, instead of just a single bitmap.
2021-10-18 11:50:10 +02:00
Vadim Zeitlin
630e6b898f Add conversion ctor from wxIcon to wxBitmapBundle too
Existing code may call functions taking wxBitmap with wxIcon, due to an
existing conversion from wxIcon to wxBitmap, so we need to provide a
similar conversion to wxBitmapBundle for compatibility.
2021-10-18 11:50:10 +02:00
Vadim Zeitlin
def2691fd2 Merge branch 'gtk-image-bundle'
Use wxBitmapBundle in wxGtkImage and select the appropriately-sized
bitmaps depending on DPI in wxGTK wxToolBar.

See https://github.com/wxWidgets/wxWidgets/pull/2547
2021-10-17 23:19:00 +02:00
Vadim Zeitlin
a66e5cdb38 Add wxImageList::Destroy()
This will be useful in wxMSW implementation and seems to make sense to
have as a public function, as long as we have Create().
2021-10-17 16:19:19 +02:00
Vadim Zeitlin
0f5c2851f4 Add wxToolBarTool::Get{Normal,Disabled}BitmapBundle() accessors
The existing variants returning wxBitmap are insufficient for non-MSW
ports where the toolbar bitmap size is unavailable otherwise, as
GetToolBitmapSize() value doesn't really correspond to it (which is a
problem on its own, but there is not much that can be done about it by
now).

Having these functions allows to retrieve the actually used bitmap size
by using wxBitmapBundle::GetDefaultSize().
2021-10-16 20:01:28 +02:00
Vadim Zeitlin
e8a15050d2 Add missing references to wxSize parameters in wxBitmapBundle
Pass wxSize by const reference instead of "const" value.

Note that passing wxSize by value might be not such a bad thing,
actually, but we use const reference for it everywhere else, so do it
here as well for consistency (and the original intention was to do it
like this, missing "&" was just a typo subsequently propagated through
copy-pasting).

No real changes.
2021-10-16 15:56:40 +02:00
Vadim Zeitlin
af1069374e Merge branch 'bitmap-bundle'
Add wxBitmapBundle and use it in wxToolBar.

See https://github.com/wxWidgets/wxWidgets/pull/2535
2021-10-05 18:58:18 +02:00
Vadim Zeitlin
fb4e188cea Add wxHAS_SVG feature test macro
This is more clear and future-proof than using wxHAS_RAW_BITMAP for
checking for SVG availability.
2021-10-05 16:12:01 +01:00
Vadim Zeitlin
0216654272 Make wxBitmapBundleImpl public and show how to use it
Show how a custom implementation of wxBitmapBundleImpl can be defined in
the toolbar sample.
2021-10-05 16:06:43 +01:00
Stefan Csomor
fe3e0c558e wxArtProvider with wxBitmapBundle 2021-10-05 16:06:43 +01:00
Vadim Zeitlin
ab619010bd Add FromSVG() overload taking const data
Passing non-const data is inconvenient and error-prone, as data can't be
used again after it was modified by Nano SVG, which resulted in the
button using SVG bitmap not working any longer in the toolbar sample
after recreating the toolbar.

So make it easier to do the right thing, while still keeping the
overload taking non-const data for the situations when avoiding an extra
copy is worth it.
2021-10-05 16:06:43 +01:00
Vadim Zeitlin
ac02ae877f Add simple wxBitmapBundle::FromSVG() implementation using NanoSVG
Add nanosvg submodule and use it in the generic implementation of this
function.

This is incomplete yet and, notably, doesn't cache the rasterized
images, but already shows that using SVG images works (at least in the
toolbar sample).
2021-10-05 16:06:43 +01:00
Vadim Zeitlin
15e35a5e7c Document that FromDIP() is not needed with SetToolBitmapSize()
wxMSW wxToolBar adjusts the bitmap size to DPI automatically.
2021-10-05 15:49:44 +01:00
Vadim Zeitlin
b33df7360a Implement loading resource bundle from Windows resources
This allows to use resources defined in the .rc files under MSW instead
of embedding them in the program text as arrays.
2021-10-05 15:49:43 +01:00
Vadim Zeitlin
97f6c85d9b Add first version of wxBitmapBundle and use it in wxToolBar
This first version provides only a generic implementation of
wxBitmapBundle using a collection of bitmaps and only supports using it
in wxToolBar in wxMSW and wxGTK.

More methods of creating wxBitmapBundle will be provided later and more
functions taking wxBitmap will be changed to take wxBitmapBundle later
too and, of course, all the other ports will be updated to use the new
API too.
2021-10-05 15:49:43 +01:00
Vadim Zeitlin
9b5a72bd1e Document Connect() limitations compared to Bind()
Instead of just saying that Bind() is better, provide some points
illustrating why is it better.

Notable mention that Connect() can only be used with methods of the
classes publicly inheriting from wxEvtHandler, unlike Bind().

Closes #19266.
2021-10-04 00:27:53 +02:00
Vadim Zeitlin
5a91ab92f7 Use high quality in wxBitmap::Rescale()
This function is currently used for relatively small icons in
wxArtProvider and wxSearchCtrl, so it shouldn't be a problem to use
wxIMAGE_QUALITY_HIGH from performance point of view and if it ever does
become a problem, the application could easily use wxImage::Rescale()
with a different option directly instead.
2021-09-24 00:30:02 +02:00
Vadim Zeitlin
024c231624 Replace multiple RescaleBitmap() with wxBitmap::Rescale()
Define a single function and use it in both wxArtProvider and (the
generic implementation of) wxSearchCtrl instead of repeating the same
code elsewhere.

Note that another, but slightly different, version of RescaleBitmap()
still remains in wxPropertyGrid.

Deprecate undocumented wxArtProvider::RescaleBitmap() which is
completely useless now.

No real changes, this is just a refactoring.
2021-09-24 00:30:02 +02:00
Vadim Zeitlin
ed19e5625b Fix wxFileName unit test under Unix after recent changes
Don't use GetVolumeSeparator() to combine UNC or GUID volumes with
paths, this doesn't work because this kind of paths doesn't contain
colons at all.

Update the documentation to mention this.
2021-09-15 13:10:25 +02:00
Vadim Zeitlin
549e0a59b1 Fix handling of single letter shares in UNC paths in wxFileName
This comes at the price of breaking compatibility and returning
"\\share" rather than just "share" from wxFileName::GetVolume() for the
UNC paths. This breakage seems justified because it is required in order
to allow application code to distinguish between paths "x:\foo" and
"\\x\foo", which was previously impossible as GetVolume() returned just
"x" in both cases.

Document this change, adjust the existing checks for the new GetVolume()
semantics and add a new test which passes now, but didn't pass before.

Closes #19255.

This commit is best viewed ignoring whitespace-only changes.
2021-09-15 01:51:35 +01:00
Vadim Zeitlin
8d13440d69 Fix wxPATH_RMDIR_FULL documentation
Explain what this flag really does in Rmdir() documentation itself, as
the old wording was confusing.

Closes #16682.
2021-09-13 21:05:21 +01:00
Vadim Zeitlin
3840b0b1c4 Merge branch 'combo-non-text'
Allow using non-text control as main window of wxComboCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/2515
2021-09-11 14:03:02 +02:00
Iwbnwif Yiw
5ba2461fd1 Switch to using GSpell for wxTextCtrl proof checker in wxGTK
Use GSpell rather than GtkSpell because GSpell also allows to check
single line text controls.

Closes https://github.com/wxWidgets/wxWidgets/pull/2516
2021-09-11 14:02:13 +02:00
Vadim Zeitlin
573e4fa0ec Allow using custom main window in wxComboCtrl
Add wxComboCtrl::SetMainControl() which can be used to use some other
window instead of the default wxTextCtrl as the main window of the
combo control.

Update the sample and the documentation to show the new function.
2021-09-08 20:44:34 +02:00
Vadim Zeitlin
8368914725 Merge branch 'compare-localized'
Allow creating wxUILocale for any locale and add
wxUILocale::CompareStrings().

See https://github.com/wxWidgets/wxWidgets/pull/2506
2021-09-05 23:16:10 +02:00
Vadim Zeitlin
2c580c9190 Add wxUILocale::FromTag() helper
This is exactly the same as wxUILocale(wxLocaleIdent::FromTag()) but
shorter.
2021-09-05 01:00:04 +02:00
Vadim Zeitlin
6b26deaddc Replace wxLocaleIdent ctor from language with FromTag()
This static function parses a subset of the language tags described in
BCP 47 (see https://www.rfc-editor.org/rfc/bcp/bcp47.txt).

Use the tag, as specified by this function, rather than the locale
identifiers components under MSW, where this should allow us to use even
locales that can't be described using just language-script-region.
2021-09-05 01:00:04 +02:00
Vadim Zeitlin
a47a885718 Check that locale ID argument of wxUILocale ctor is not empty
Disallow using empty wxLocaleIdent here, GetDefault() can, and should,
be used for the user default locale.
2021-09-05 01:00:04 +02:00