Commit Graph

4313 Commits

Author SHA1 Message Date
Vadim Zeitlin
1f401475f3 Merge branch 'art-scalefactor'
Fix confusion between different kinds of coordinates in wxAUI code,
restoring correct behaviour in high DPI on all platforms.

See #2620.

Closes #19331.
2022-01-13 17:51:00 +00:00
Vadim Zeitlin
7c7ff3cd42 Add wxBitmap::GetDIPSize() and use it in wxBitmapBundleImplArt
This fixes the problem with wrong standard bitmaps size when using high
DPI for the main monitor with wxMSW, as GetScaledSize() used here since
31f2892200 (Avoid bitmap scaling in wxArtProvider::GetBitmapBundle(),
2021-12-17) was not the right function to use there.

Closes #19331.
2022-01-13 17:34:49 +00:00
Vadim Zeitlin
03cf1f4359 Remove wxHAS_BITMAP_SCALE_FACTOR
Now wxMSW also stores the scale factor, even if it doesn't use it in its
GetScaledXXX(), so it doesn't seem useful to have this symbol for
distinguishing the platforms with and without bitmap scale factor
support, when we can just use wxHAS_DPI_INDEPENDENT_PIXELS instead in
the only place where this was used.

And as this symbol was added quite recently, in 2c1f4c002d (Add
wxBitmap::SetScaleFactor(), 2021-10-23), we can hopefully just remove it
without breaking any existing code, if we do it right now.
2022-01-13 17:34:49 +00:00
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
Serghei Amelian
16d096b7ef Add wxWebRequestEvent::GetRequest()
It is more convenient to be able to retrieve the request object (which
is needed at least for authentication) from the event than to have to
store it separately.

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

Closes #19360.
2022-01-11 18:16:09 +01:00
Vadim Zeitlin
916df1a1d1 Fix recurring typo in validator parameter description
It can be used for "data checks", not "date checks" (the latter might
work for wxDatePickerCtrl, but use "data" for it too for consistency).
2022-01-11 18:08:25 +01:00
Paul Cornett
ef779835b4 Document when GetItemParent() was added 2022-01-07 22:00:00 -08:00
Paul Cornett
3cd791de21 Add GetItemParent() to wxDataViewTreeCtrl
Makes it a little easier to convert from using wxTreeCtrl to wxDataViewTreeCtrl
2022-01-07 14:48:36 -08:00
Vadim Zeitlin
27d5306bdd Make wxToolBar::SetToolBitmapSize() work again
It didn't do anything since wxBitmapBundle-related changes, as could be
seen by toggling the bitmap size in the toolbar sample -- the bitmaps
size didn't actually change.

Make it work again by only using the best bitmap size if it's greater
than the currently set bitmap size, but not shrinking the bitmaps to it
if it's smaller. This doesn't seem especially useful, but this is how
the code behaved with single bitmaps before and there doesn't seem to be
any good reason to change this.

At least document that calling SetToolBitmapSize() is unnecessary and
normally shouldn't be done.
2022-01-07 00:13:52 +01:00
Vadim Zeitlin
af641ba7b8 Merge branch 'skip-dpichange-events'
Fix wxGenericColourButton after recent bitmap changes and, more
generally, always skip wxDPIChangedEvent and document that this should
be done.

See https://github.com/wxWidgets/wxWidgets/pull/2637
2022-01-06 23:46:35 +01:00
Vadim Zeitlin
f5e0076f04 Advise to skip wxDPIChangedEvent when handling them in the manual
Not skipping them is almost invariably a bug, as shown by the
grandparent commit.
2022-01-06 23:45:28 +01:00
Vadim Zeitlin
c864c9119b Document wxIMPLEMENT_{APP,WXWIN_MAIN}_CONSOLE macros too
Even though they're less useful than their non-CONSOLE counterparts,
they still should be documented.

Closes #19358.
2022-01-04 22:51:06 +01:00
Vadim Zeitlin
3bc0f44163 Update copyright years to 2021
Just run misc/scripts/inc_year and commit the results.

Closes #18690.
2022-01-02 13:32:23 +01:00
Vadim Zeitlin
ffe73b4353 Merge branch 'fs-mem-string-data'
Use UTF-8 for memory FS data if it's not in Latin-1.

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

See #19314.
2022-01-02 12:46:05 +01:00
Scott Talbert
44997466fb Undocument SetClippingRegion overload in wxSVGFileDC
Documentation of the other overloads was removed in 6a442d2 and there is
nothing special about the wxCoord variant in wxSVGFileDC, so remove it so
all the overloads are consistently documented in just wxDC.

Closes https://github.com/wxWidgets/wxWidgets/pull/2627
2022-01-02 12:30:53 +01:00
Paul Cornett
aacada0ea2 wxEVT_DATAVIEW_ITEM_CONTEXT_MENU position should be in client coordinates
For consistency with wxTreeCtrl and wxListCtrl. See #19188
2021-12-22 17:12:45 -08:00
Vadim Zeitlin
f84c3a7968 Fall back to using UTF-8 in wxMemoryFSHandler::AddFile()
This seems to be better than just losing the data completely if
converting it to Latin-1 fails.
2021-12-16 21:54:43 +01:00
Vadim Zeitlin
673593f911 Document that wxString passed to AddFile() must use Latin-1
Otherwise To8BitData() would return an empty buffer for it.
2021-12-16 21:48:49 +01:00
Vadim Zeitlin
3c7b40e999 Merge branch 'clang-13-no-depr-copy'
Fix clang 13 -Wdeprecated-copy warnings and ensure that we test for them
in the allheaders test.

See https://github.com/wxWidgets/wxWidgets/pull/2619
2021-12-16 21:13:55 +01:00
Vadim Zeitlin
6f8bc1018b Avoid -Wdeprecated-copy for many event classes from clang 13
Add new macros wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY() and
wxDECLARE_NO_ASSIGN_DEF_COPY() and use them instead of
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN() and wxDECLARE_NO_ASSIGN_CLASS()
respectively to ensure that we declare a (default, if possible) copy
ctor in the classes declaring an assignment operator to avoid clang
warnings about not doing it.
2021-12-15 17:50:55 +01: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