Commit Graph

4294 Commits

Author SHA1 Message Date
Vadim Zeitlin
f6fbc97c7b Only return really scaled bitmap size under platforms using DIPs
wxBitmap::GetScaledXXX() functions are useful for obtaining the
coordinates in logical pixels, so they should only divide by the scaling
factor on the platforms where logical pixels are actually different from
the physical ones, i.e. those using DPI-independent pixels.

This ensures that their behaviour under MSW remains unchanged even after
a1e4dca067 (Store scale factor in wxMSW bitmaps too, 2021-12-16), which
is the correct way to avoid breaking wxAUI (and other) drawing.
2022-01-13 17:34:49 +00:00
Vadim Zeitlin
2945278334 Rename wxHAVE_DPI_INDEPENDENT_PIXELS to wxHAS_XXX and document it
Using wxHAS_ prefix is more consistent with all the other similar
symbols, using wxHAVE_ was a mistake, that we have to pay for by
preserving the old name now (as it is actually already used in some code
outside of the library).

The fact that it's used also shows that it's better to document this
symbol, even if just to explain that it normally shouldn't be used, as
we can't really hide it anyhow.
2022-01-13 17:34:49 +00:00
Vadim Zeitlin
10977b0eb6 Don't make wxBitmap::GetScaledXXX() virtual
There should be never any need to override them, their behaviour is
fixed.

No real changes.
2022-01-13 17:34:49 +00:00
Vadim Zeitlin
f78db92462 Avoid bitmap scaling in wxArtProvider::GetBitmapBundle()
Instead of immediately constructing the bitmap with the requested size,
possibly by downscaling a higher-resolution bitmap, and then potentially
having to upscale it if we actually need a bitmap of a bigger size, just
retrieve the bitmap in the actually needed size from wxArtProvider when
needed.

This makes bitmaps obtained from wxArtProvider::GetBitmapBundle() look
good, rather than fuzzy and ugly, in high DPI if they're actually
available in the appropriate size.
2022-01-13 17:34:49 +00:00
Vadim Zeitlin
0a8f7233cc Merge branch 'virtual-list-sort-indicator'
Simplify recently added wxListCtrl sort indicators support and allow
using it with virtual list controls too.

See https://github.com/wxWidgets/wxWidgets/pull/2618
2021-12-14 19:28:20 +00:00
Vadim Zeitlin
e3ec9fb124 Fix using wxMemoryDC without a GUI wxApp instance
This used to work, at least in wxMSW, but stopped working after the
(perfectly valid, on their own) changes of 2508efdd6e (Initialize
wxMemoryDC with a default font, 2019-08-13), as this resulted in calling
wxApp::GetTopWindow() that can only be called from the GUI code.

Fix this by adding wxApp::GetGUIInstance() and using it in
GetMainTopWindow(), so that we only call GetTopWindow() if we actually
have a GUI wxApp object on which to call it.

Implement this in terms of a new virtual IsGUI() which seems slightly
better than, although roughly equivalent to, using wxDynamicCast().

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

Closes #19343.
2021-12-14 19:28:02 +00:00
Vadim Zeitlin
c834c0b8b7 Add GetUpdatedAscendingSortIndicator() helper function
It seems like this function will need to be used in every implementation
of EVT_LIST_COL_CLICK handler when using sorting, so it makes sense to
provide it in the library itself.
2021-12-14 14:22:08 +00:00
Vadim Zeitlin
0a8e82b010 Rename formal parameter of ShowSortIndicator() to "col"
No real changes, just use a more appropriate parameter name, as it's a
column index and not just "index".
2021-12-14 14:19:10 +00:00
Vadim Zeitlin
52649cc566 Remove wxListCtrl::EnableSortIndicator()
The old API seems unnecessarily complex, it is simpler to just let the
application call ShowSortIndicator() itself from its
wxEVT_LIST_COL_CLICK handler, which needs to be defined anyhow in order
to actually sort the items, rather than require it to enable sort
indicator, explicitly set it initially and then remember to not set it
any longer in response to the column clicks.

Also make RemoveSortIndicator() non-virtual and implement it simply as
ShowSortIndicator(-1) because this actually simplifies the code too.
2021-12-14 14:09:23 +00:00
Vadim Zeitlin
30ce892ed5 Let wxListCtrl::ShowSortIndicator() implicitly enable indicators
It doesn't seem right for ShowSortIndicator() to silently do nothing if
EnableSortIndicator() hadn't been called before, so make it enable the
sort indicators if they hadn't been enabled yet.

The alternative would be to assert in this function, but this seems less
useful.

Also add some comments to wxMSW version.
2021-12-13 14:31:49 +00:00
Vadim Zeitlin
58290168e5 Remove top level "const" from {Enable,Show}SortIndicator()
Don't use "const int" or "const bool" for parameter types, the "const"
here is ignored and using it is inconsistent with all the rest of the
library.

No real changes.
2021-12-13 14:18:18 +00:00
Vadim Zeitlin
6156bb1b84 Merge branch 'wxlistctrl-sort' of https://github.com/MaartenBent/wxWidgets
Add sort indicators support to wxListCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/2598
2021-12-09 21:29:39 +01:00
Vadim Zeitlin
933ac7afbb Merge branch 'dvc-null-values'
Improve handling of null values in wxDataViewCtrl to be more compatible
with the earlier versions.

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

See #18934.

Closes #19333.
2021-12-09 20:00:50 +01:00
Simon Stone
0fc936ca41 Add wxIntegerValidatorctor ctor taking minimum and maximum value
Using this ctor is more convenient than using the default ctor and then
calling SetMin() and SetMax().

Document the new ctor and add tests showing that minimum and maximum
values are actually respected.

Closes https://github.com/wxWidgets/wxWidgets/pull/2610
2021-12-09 19:55:44 +01:00
Marco DeFreitas
a2389fc512 Add wxApp::GTKSuppressDiagnostics()
This allows to avoid GTK messages that are often more annoying and
confusing than useful.

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

Closes #19347.
2021-12-09 19:52:07 +01:00
Scott Talbert
a0eb355e12 Add wxDF_UNICODETEXT to wxDataFormat standard format docs
Closes https://github.com/wxWidgets/wxWidgets/pull/2608
2021-12-09 19:51:07 +01:00
Maarten Bent
d8ec0aa001 Support sort indicators in wxListCtrl header 2021-12-09 17:32:05 +01:00
Tobias Taschner
bbca67df67 Implement wxFSVolume for macOS
Implement with NSFileManager and NSURL to provide basic functionality
like on MSW. Icons are not implemented for macOS.
2021-12-01 23:35:19 +01:00
Vadim Zeitlin
419a97a791 Merge branch 'svg-file'
Add wxBitmapBundle::FromSVGFile() helper.

See https://github.com/wxWidgets/wxWidgets/pull/2600
2021-12-01 23:27:33 +01:00
Vadim Zeitlin
26efd904ec Improve wxDataViewModel::GetValue() documentation
Document that this function can leave the provided wxVariant null and
not return anything, but that if it does return some value, it must be
of the appropriate type.
2021-12-01 01:48:53 +00:00
Paul Cornett
1c752e24f1 doc typo 2021-11-29 08:54:41 -08:00
Vadim Zeitlin
8adfaa37f7 Add wxBitmapBundle::FromSVGFile() helper
This is just a trivial wrapper for wxBitmapBundle::FromSVG(), but it can
still be convenient to have.
2021-11-29 12:55:22 +00:00
utelle
deef116a09 Update language database and move support for it to wxUILocale
Update the language database from the canonical sources:

- It now includes most locales supported by Windows 10.
- It now also has the following attributes for each entry:
 - BCP 47-like locale tag.
 - Reference to canonical name for generic language entries.
 - Language name in this language itself.
- Also add data file with list of language script identifiers and
  aliases based on ISO 15924.
- And update genlang.py to handle all the new attributes and data.

Also move database-related methods of wxLocale to wxUILocale and
just redirect wxLocale methods to the new wxUILocale ones (they are
still preserved for compatibility).

Closes https://github.com/wxWidgets/wxWidgets/pull/2594
2021-11-27 17:44:20 +01:00
Vadim Zeitlin
2bbe126dca Add operator/(wxSize, double)
For some reason, while both operator*(wxSize, double) and
wxSize::operator/=(double) existed, this one did not, which was
unexpected, so add it too.
2021-11-20 22:06:28 +01:00
Vadim Zeitlin
7a03d5fe9b Merge branch 'mediaplayer_sample'
Add wxMC_NO_AUTORESIZE and use it in mediaplayer sample to fix it
layout.

See https://github.com/wxWidgets/wxWidgets/pull/2562
2021-11-20 21:46:29 +01:00
Vadim Zeitlin
cffb866edf Minor additions to wxMC_NO_AUTORESIZE documentation
Mention that this flag is new in 3.1.6 and also point to it in ctor and
Create() documentation.
2021-11-20 21:41:28 +01:00
Artur Wieczorek
87394856f5 Use wxBitmapBundle in wxPropertyGrid 2021-11-19 17:52:56 +01:00
Vadim Zeitlin
94f10eba4e Merge branch 'extra_accels' of https://github.com/vadz/wxWidgets
Allow defining additional accelerators for the menu items.

See https://github.com/wxWidgets/wxWidgets/pull/2588
2021-11-18 15:29:56 +01:00
Artur Wieczorek
f989b1b875 Rephrase descriptions of some parameters of wxPGManager functions 2021-11-17 23:06:23 +01:00
Vadim Zeitlin
a7803a752d Merge branch 'imagelist-bundle'
Allow using vectors of bitmap bundles instead of wxImageList in the most
common controls using the latter: wxBookCtrl-derived classes (including
wxNotebook), wxListCtrl and wxTreeCtrl.

Also update more parts of wxAUI to use wxBitmapBundle.

See https://github.com/wxWidgets/wxWidgets/pull/2574
2021-11-16 17:32:47 +01:00
Vadim Zeitlin
63f83c096c Merge branch 'webview_runscript_improvements' of https://github.com/TcT2k/wxWidgets
Add WebView::RunScriptAsync() for running scripts asynchronously.

See https://github.com/wxWidgets/wxWidgets/pull/2316
2021-11-16 17:30:55 +01:00
Alexander Koshelev
0cd898975c Allow to add extra accelerators to wxMenuItem
These accelerators are not shown in wxMenuItem label, but still will
work.

Implement support for them in all major ports and XRC.

Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>
2021-11-16 17:26:39 +01:00
Scott Talbert
149f3804a8 Add style for manually resizing wxMediaCtrl
Previously, wxMediaCtrl would always automatically resize itself
whenever a video was loaded.  If a wide video was loaded, this could
cause wxMediaCtrl to take up the entire space, hiding any other
widget(s) that might exist within the same sizer.  Allow avoiding this
behavior by adding a new style, wxMC_NO_AUTORESIZE, which disables this
automatic resize behavior and allows handling the resize behavior
manually.
2021-11-15 20:00:17 -05:00
Vadim Zeitlin
9a5123afed Use wxBitmapBundle in wxAuiToolBar and wxAuiPaneInfo too
Allow specifying bitmap bundles instead of single bitmaps for the AUI
toolbar images and pane icons.
2021-11-14 18:55:42 +00: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
Vadim Zeitlin
391080e77d Use wxBitmapBundle for AUI tab pages bitmaps
Take wxBitmapBundle instead of just wxBitmap in various public functions
and select the bitmap appropriate for the current DPI scaling when we
need to use it.

Note that this removes wxAuiScaleBitmap() which used custom scaling
logic that might be better than the generic approach used by
wxBitmapBundle, and so could result in a temporary regression in the
icons appearance in high DPI, but they will hopefully be replaced with
SVG versions soon, so that this shouldn't matter.
2021-11-14 00:50:24 +01:00
Vadim Zeitlin
8dcedf56d7 Add wxWindow parameter to wxAuiTabArt::SetSizingInfo()
We need a valid window pointer to use the correct DPI scaling factor for
anything sizing-related, but this function didn't have any, so add one
to it now.

Unfortunately we need to have a default value for the new parameter for
backwards-compatibility purposes, but document that this parameter is
not really optional and must always be specified.

Also add wxWindow parameter to wxAuiTabContainer::SetRect(), which needs
it in order to pass it to this function.

Currently this window is only used for converting logical pixels to
physical ones, but it will also be used for selecting the correct bitmap
size in the upcoming commits.
2021-11-13 23:20:21 +00: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
e58612661c Document wxWithImages::GetUpdatedImageListFor()
This function is sufficiently useful to be made public and it needs to
be documented in order to recommend using it instead of GetImageList().
2021-11-11 21:59:45 +00: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
aca0c74e60 Add wxListCtrl::Set{Normal,Small}Images()
These new functions allow to use wxBitmapBundle for the images in this
control instead of wxImageList.

Update the sample to use the new API.
2021-11-11 01:20:35 +00: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
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