Commit Graph

71567 Commits

Author SHA1 Message Date
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
85503d1dcd Get rid of CppUnit boilerplate in MiscGUIFuncsTestCase
Simplify code by not defining an unnecessary test case class and using
CATCH macros directly.

No real changes.
2021-10-20 23:35:37 +01:00
Vadim Zeitlin
87b394a555 Use wxScopedPtr in MiscGUIFuncsTestCase for automatic cleanup
Replace manual calls to Destroy() to ensure that the objects created in
this test will be destroyed even if a check fails.
2021-10-20 23:35:37 +01:00
Vadim Zeitlin
5341bf5b60 Remove unnecessary win32-res tags from samples bakefiles
Don't specify sample.rc as the resource file for the samples, it is used
by default anyhow, so this is unnecessary.
2021-10-20 17:47:47 +02:00
Vadim Zeitlin
16f2c7bb89 Remove unused samples resource files
These resource files didn't appear in the .bkl ones and so were not used
at all and were not worth being used anyhow, as they didn't differ
significantly from sample.rc.
2021-10-20 16:34:38 +01:00
Vadim Zeitlin
aa2780b472 Set wxUSE_DPI_AWARE_MANIFEST=2 for all samples, not just toolbar
This is required for high resolution bitmaps support and it will be
needed in other samples too, so use it for all of them.

This probably will result in some problems due to remaining bugs with
high DPI support, but it should make them more noticeable and so should
help with finding and fixing them.
2021-10-20 16:19:41 +01:00
Vadim Zeitlin
ec975c70cc Merge branch 'bmp-bundle-pref-size'
Allow wxBitmapBundle specify its preferred size and use it in wxMSW.

See https://github.com/wxWidgets/wxWidgets/pull/2554
2021-10-20 16:17:51 +01:00
David Costanzo
07670667d9 Fix gcc 11 -Wzero-as-null-pointer-constant in wxMSW wxImageList
This warning was introduced by the recent 999340f288 (Check that
wxImageList::Create() is not called more than once, 2021-10-17), fix it
by using NULL for HIMAGELIST which is a pointer internally.

Closes #19298.
2021-10-20 15:23:52 +02:00
Vadim Zeitlin
ae5bc69d9f Use preferred bundle bitmaps size in wxMSW wxToolBar
This avoids resizing the bitmaps in some common use cases and is similar
to the previous commit doing the same thing for wxButton.

Notice that this introduces a slight change of behaviour, as
AdjustToolBitmapSize() now can reduce, as well as increase, the size of
bitmaps used, which is necessary in order to shrink the bitmaps when
moving from a higher DPI resolution display to a lower-resolution one.
This is not 100% backwards-compatible, but should only have not very bad
cosmetic effects.
2021-10-19 02:20:26 +01:00
Vadim Zeitlin
1f8af4d5a2 Use preferred size for the button bitmaps in wxMSW
Avoid scaling the bitmaps by using the preferred size for them.

This results in significantly better appearance without any real
drawbacks in practice at 125% and 175% DPI scaling in the common case
when just a single and double-sized bitmaps are available, and still
seems to be acceptable at 150% scaling in this case.
2021-10-19 02:20:26 +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
1cda648206 Merge branch 'button-bmp-bundle'
Add support for wxBitmapBundle to wxButton and related classes to make
it possible to use high resolution images in them in high DPI.

See https://github.com/wxWidgets/wxWidgets/pull/2552
2021-10-19 03:09:03 +02:00
Vadim Zeitlin
7dbbe60d82 Give better error message if Nano SVG is unavailable, if possible
Getting errors due to "missing" Nano SVG headers can be confusing, as
it's not immediately clear why are they missing, so try to make things
more explicit by using __has_include(), if available, to test for the
header before including it and giving a better error message if it
fails.

It still won't help people not using C++17 or those not reading error
messages, but should be better than nothing.
2021-10-19 02:33:39 +02:00
Vadim Zeitlin
5bb6046ca9 Document remaining problems when changing DPI of wxMSW toolbar
Unfortunately even using CallAfter() doesn't allow to completely repair
the toolbar display after moving it to a display with a different
fractional scaling, e.g. from 125% to 175%. There are still some minor
but visible display artefacts in this case that we can't get rid of even
by resizing the window containing the toolbar programmatically -- even
though doing it interactively does help.
2021-10-18 11:50:10 +02:00
Vadim Zeitlin
04a8e0e5bd Use bitmap bundle rather than scaled bitmap size in wxToolBar
Get the minimum size needed for the bitmaps from wxBitmapBundle.
2021-10-18 11:50:10 +02:00
Vadim Zeitlin
62b6539eea Select the button size appropriate for the current DPI initially
Don't just update the bitmaps size when we receive the DPI changed
event, but also use size appropriate for the current DPI initially.
2021-10-18 11:50:10 +02:00
Vadim Zeitlin
2a0719818a Update bitmap shown by the buttons in wxMSW on DPI change
Recreate wxImageList used for the bitmaps internally with the bitmaps of
the size corresponding to the new DPI.

This commit is best viewed with --color-moved git option.
2021-10-18 11:50:10 +02: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
2910327ef3 Don't crash in wxOSXGetImageFromBundle() if the bundle is invalid
Just return a null image instead, as this function can be called when we
don't have any bitmaps too -- as it happens in the Button::Bitmap unit
test, for example.
2021-10-18 11:50:10 +02:00
Vadim Zeitlin
5965bc1910 Remove unused parts of wxMSW wxBitmapButton implementation
Nothing here, including the event table for this class using
non-existing wxBitmapButton::OnSysColourChanged (which is just the same
as wxWindow::OnSysColourChanged, in fact), was needed any longer ever
since the changes of a6fd73d33a (implement wxBitmapButton as just a
wrapper for wxButton under MSW, 2009-06-15), so simply remove all the
unused stuff.
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
d4bc1daf19 Revert "Remove unused code in wxGTK wxAnyButton"
This reverts commit 4e366b2cfb as it the
code removed by it is still needed and removing it results in unit test
failures in wxBitmapToggleButton unit tests with both GTK 2 and 3.

See https://github.com/wxWidgets/wxWidgets/pull/2548
2021-10-17 23:56:28 +02:00
Vadim Zeitlin
411cad6cd9 Merge branch 'gtk-always-use-wxgtkimage'
Ensure all buttons with images have associated wxGtkImage as this is
required for showing high resolution bitmaps in them in high DPI.

See https://github.com/wxWidgets/wxWidgets/pull/2548
2021-10-17 23:27:49 +02:00
Vadim Zeitlin
4e366b2cfb Remove unused code in wxGTK wxAnyButton
The GtkImage can always be retrieved using the appropriate GTK function,
there is no need to get the button child directly any longer.
2021-10-17 23:25:45 +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
efb82320c6 Merge branch 'imaglist-destroy'
Add wxImageList::Destroy() and other minor improvements to this class.

See https://github.com/wxWidgets/wxWidgets/pull/2551
2021-10-17 19:38:54 +02:00
Vadim Zeitlin
271926fde0 Fix description of wxUSE_SPELLCHECK option in configure and CMake
Don't say that it's only for MSW and GTK 3, as it's also available under
Mac. Also don't use "spellchecking" non-word in the description of a
spell-checking option.

No real changes.
2021-10-17 19:36:56 +02:00
Vadim Zeitlin
da79145101 Merge branch 'cmake-spellcheck' of https://github.com/MaartenBent/wxWidgets
Add wxUSE_SPELLCHECK option to CMake build too.

See https://github.com/wxWidgets/wxWidgets/pull/2550
2021-10-17 19:35:08 +02:00
Vadim Zeitlin
999340f288 Check that wxImageList::Create() is not called more than once
Or at least not until Destroy() is called.
2021-10-17 16:19:19 +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
6b3fd04e24 Initialize wxGenericImageList members in default ctor
Don't leave m_useMask and m_scaleFactor uninitialized -- even if this
probably doesn't matter, call Create() to make sure they have
well-defined values for the default-constructed objects.
2021-10-17 16:19:19 +02:00
Maarten Bent
d2642b4c07 CMake: Enable wxUSE_SPELLCHECK
Find gspell-1 when using GTK3. Also need to find enchant.h.
2021-10-17 14:55:46 +02:00
Maarten Bent
fef2d7d05b Fix wxListCtrl checkbox style when reapplying extended styles
Fixes #19263
2021-10-17 13:41:56 +02:00
Maarten Bent
b102afc316 CMake: Don't include generator expression in wxPLATFORM_LIB_DIR
So wxPLATFORM_LIB_DIR can be used in locations where generator expressions are not supported.
2021-10-17 11:52:30 +02:00
Maarten Bent
6d6567d41c CMake: remove duplicate install for builtin libraries 2021-10-17 11:50:34 +02:00
Vadim Zeitlin
10b7659acd Ensure all buttons with images have associated wxGtkImage
Replace GtkImage with wxGtkImage if necessary, to ensure that we can
always use our own class, to profit from its support for high DPI
images, even for the buttons using stock IDs and so creating GtkImage by
default.

See #19288.
2021-10-17 00:58:26 +02:00
Vadim Zeitlin
3333356624 Really support wxBitmapBundle in wxGTK wxToolBar
Use the appropriately sized bitmap instead of always using the (scaled
version of the) default one, as was the case since 97f6c85d9b (Add first
version of wxBitmapBundle and use it in wxToolBar, 2021-09-24).

With this change, toolbar bitmaps work correctly in 100% and 200% DPI
scaling.
2021-10-16 20:05:51 +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
399b0ff9ae Use wxBitmapBundle instead of bitmap scale factor in wxGtkImage
Minimal changes to the code to allow using bigger bitmaps from
wxBitmapBundle in high DPI instead of having to create individual
bitmaps with scale factor greater than 1.

Notice that this is not actually used anywhere in wxGTK yet, but will be
soon.
2021-10-16 19:58:55 +02:00
Vadim Zeitlin
77e3983091 Create disabled bitmap in BitmapProviderDefault on demand
There is no need to always do it in advance when we might never actually
need it.
2021-10-16 17:46:20 +02:00
Vadim Zeitlin
8f1be368e9 Add some comments to wxGtkImage
Document which pointers can, and can't, be null and when exactly is the
stored bitmap valid, as this is far from being immediately obvious.

No real changes.
2021-10-16 17:01:48 +02:00
Vadim Zeitlin
eb54c65e24 Separate GTK 2/3 version of BitmapProviderDefault
No real changes, just move the trivial GTK 2 stab out of the way.
2021-10-16 16:56:31 +02:00
Vadim Zeitlin
fbb2ec85ef Install 32-bit version of xvfb in 32-bit wxMSW cross-build
libgl1:i386 conflicts with 64-bit version of xvfb in the latest Sid, so
try using 32-bit version of the latter.
2021-10-16 16:44:44 +02:00
Cătălin Răceanu
6fb64da922 Fix selection when wxOwnerDrawnComboBox contains identical items
Ensure that the drop-down selection is correct even if there are
multiple items with the same label in wxOwnerDrawnComboBox.

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

Closes #19289.
2021-10-16 15:56:40 +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
Paul Cornett
e9bf514976 Fix creating wxButton using stock id with GTK
Broken by 85d63c3150 (Add a class derived from GtkImage to support HiDPI bitmaps, 2020-09-15)
See #19288
2021-10-13 22:37:11 -07:00
Mehmet Soyturk
c1250bc0e7 Replaced assert by wxASSERT 2021-10-12 16:35:33 +03:00
Vadim Zeitlin
700dd3e905 Merge branch 'cmake_glu' of https://github.com/swt2c/wxWidgets
Link with GLU when using EGL too in CMake build.

Also build all samples in the CMake CI builds.

See https://github.com/wxWidgets/wxWidgets/pull/2543
2021-10-12 00:39:54 +02:00
Scott Talbert
769e24bae0 cmake: build all samples under Linux CI 2021-10-11 13:03:15 -04:00
Scott Talbert
28f59e8900 cmake: also link with GLU when using EGL
Fixes #19282
2021-10-11 12:43:52 -04:00