Commit Graph

72393 Commits

Author SHA1 Message Date
Alexander Koshelev
8f43e103e9 Use wxBitmapBundle in wxHeaderColumn in samples 2022-03-04 03:37:20 +01:00
Alexander Koshelev
33d8510d41 Use wxBitmapBundle in wxHeaderColumn 2022-03-04 03:37:20 +01:00
Vadim Zeitlin
31adb7d55b Merge branch 'bookctrl-bmp-bundle'
Use wxBitmapBundle in XRC handlers of wxBookCtrl-related controls and
refactor these handlers to avoid code duplication.

See #22151.
2022-02-27 22:45:25 +00:00
Vadim Zeitlin
9a3d3156ab Merge branch 'better-bitmap-resize'
Use "nearest" algorithm for resizing bitmaps.

See #22152.
2022-02-27 22:44:50 +00:00
Vadim Zeitlin
6db5ad0410 Merge branch 'msw-button-best-size-margins'
Compute MSW button best size ourselves correctly.

See #22149.

Closes #22125.
2022-02-27 22:44:03 +00:00
Vadim Zeitlin
5fa9e9ada1 Inherit wxTreebookXmlHandler from wxBookCtrlXmlHandlerBase too
Use the same logic for creating the pages of this book control as for
all the other ones and keep only wxTreebook-specific "depth" and
"expanded" nodes handling in this class.
2022-02-27 22:42:01 +00:00
Vadim Zeitlin
2e27c12e56 Add virtual wxBookCtrlXmlHandlerBase::DoAddPage()
This will allow customizing the way pages are added to the book control
and will also be used in wxTreebookXmlHandler soon.
2022-02-27 22:42:01 +00:00
Vadim Zeitlin
d3c0d0c064 Move wxBookCtrlXmlHandlerBase::PageWithAttrs into the header
This struct is finally going to have to be declared in the header as it
will be needed by wxTreebookXmlHandler when it's modified to derive from
wxBookCtrlXmlHandlerBase too.

Also add GetImageId() function to the struct while moving it.
2022-02-27 22:42:00 +00:00
Vadim Zeitlin
1549aafdc9 Factor out common code from most wxBookCtrl-related XRC handlers
Add new wxBookCtrlXmlHandlerBase and inherit the XRC handlers of all the
wxBookCtrlBase-derived classes except for wxTreebookXmlHandler, which
will require special handling, from it to avoid duplicating the same
code in all of them.

This commit is best viewed with --color-moved git option.
2022-02-27 22:42:00 +00:00
Vadim Zeitlin
1d3149292c Don't declare wxPropertySheetDialogXmlHandler if !wxUSE_BOOKCTRL
This class is only implemented when wxUSE_BOOKCTRL==1 as its code uses
it, so it shouldn't be declared when wxUSE_BOOKCTRL==0 neither.

This fixes wxiOS build problem after the latest changes.
2022-02-27 22:40:52 +00:00
Alexander Koshelev
b70856089b XRC: use wxBitmapBundle in wxTreebook 2022-02-27 22:40:52 +00:00
Alexander Koshelev
93b4478992 XRC: use wxBitmapBundle in wxBookCtrl-related controls. 2022-02-27 22:40:52 +00:00
Alexander Koshelev
ca1eefdba2 Fix usage of wxWithImages::Images in wxTreebook 2022-02-27 22:40:52 +00:00
Vadim Zeitlin
8e367994d7 Fix wxWebViewEdge build with standard-conforming compilers
Convert wxCoTaskMemPtr<wchar_t> to wxString explicitly as doing it
implicitly required 2 user-defined conversions which is not allowed in
standard C++ (but works with MSVC).

Also get rid of a not really necessary temporary wxString variable and
just perform this case when constructing wxStringTokenizer.

Closes #22170.
2022-02-27 02:55:01 +01:00
Jouk
e7096e85d2 Fix combo sample build without wxHAS_SVG
Just don't use bitmaps at all if SVG support is unavailable.

Closes #22161.
2022-02-25 18:32:24 +01:00
Jouk
6c9d1291f6 Fix build under OpenVMS where mkdtemp() is unavailable
Just skip the part of the test using this function under OpenVMS.

Closes #22158.
2022-02-25 18:23:32 +01:00
Kvaz1r
1d585eef05 Fix scrollbar position in wxGrid and wxDataViewCtrl in wxUniv
Skip the event in wxEVT_SIZE handler in wxGrid and wxDataViewCtrl as it
was already done for wxListCtrl in 98c2eef619 (Fix scrollbar position in
wxListCtrl in wxUniv, 2021-09-05).

Closes #22145.
2022-02-25 18:23:12 +01:00
Jouk
6d0f5ec591 correction on the merged pull #22157 2022-02-25 08:12:44 +01:00
Lauri Nurmi
1ad25bdd5c Demonstrate how to interrupt closing an application
Add a menu item to the dialogs sample for simulating having unsaved
documents in the application. Then demonstrate how to do something
when the user attempts to close the application, e.g. show a dialog,
and possibly cancel closing.

This code was originally written for debugging some issue related to
closing an application, but besides that it serves as an example of a
very common pattern a lot of real world applications need in some form.

Mention the example in samples/dialogs in wxCloseEvent documentation
2022-02-25 00:37:58 +01:00
Lauri Nurmi
d8ddf1307a Fix compilation on recent FreeBSDs by ignoring <sys/epoll.h>
On recent FreeBSDs, the "Linux-only" <sys/epoll.h> exists in the default
include path, and is thus detected by configure. However, the header belongs
to the epoll-shim emulation library, and it is doubtful whether using it
on FreeBSD is a good idea. Therefore check that the operating system
is actually Linux before enabling wxEpollDispatcher.

Closes #22146.
2022-02-25 00:36:53 +01:00
Jouk
9129254574 wxGTK1 build fixes after the recent changes
Update wxMenuItem to use wxBitmapBundle and wxSpinCtrl use
DoSetIncrement() in wxGTK1 just as it was done in wxGTK.

Closes #22157.
2022-02-25 00:24:47 +01:00
Vadim Zeitlin
e77d5f3094 Log the exit code of run_apt shell function
It seems like this function sometimes doesn't return non-zero exit code
even though it fails to fetch some packages (e.g. due to a network
error), so log its status code to check if this is really the case.
2022-02-25 00:16:10 +01:00
Vadim Zeitlin
ef22f4c3db Add wxSuffixDebug to MSVS properties file
This property expands to either (just) "d" (even in Unicode builds) or
nothing depending on whether we're building in debug or release and can
be used to construct the configuration-independent names for the third
party libraries, most of which use just this suffix and not wxSuffix,
which expands to "ud" in (Unicode) debug build.

This allows to use exactly the same link dependencies for both debug and
release configurations, as demonstrated by the updated minimal MSVS
project file, which is convenient when creating new projects not using
wxwidgets.props, as it allows to enter the dependencies just once and
use them for all build configurations instead of having to enter them
separately for the debug and the release ones.
2022-02-23 22:12:57 +00:00
Vadim Zeitlin
84cb293e71 Make wxBitmap::Rescale() less horrible for commonly used icons
Make the results look somewhat better by using wxIMAGE_QUALITY_NEAREST
which preserves sharp horizontal and vertical edges in the images which
are common in the icons, with which this function is often used, instead
of blurring them as wxIMAGE_QUALITY_HIGH does.

This is also much (factor of ~40) faster, which shouldn't hurt neither.
2022-02-23 00:04:02 +00:00
Vadim Zeitlin
4e05ee9c5a Benchmark wxIMAGE_QUALITY_BOX_AVERAGE too for completeness
Check the speed of wxImage::Scale() using this algorithm too.

As expected, it's between normal and high quality when upscaling and
exactly the same as high quality when shrinking (because it is actually
the algorithm used for shrinking for wxIMAGE_QUALITY_HIGH).
2022-02-23 00:01:52 +00:00
Vadim Zeitlin
e25b47ee32 Allow tweaking parameters of wxImage::Scale() benchmarks
Use the string parameter as the name of the file containing the image to
resize and the numeric parameter as the scale factor in percents (so
that fractional factors could also be specified using this integer
parameter).
2022-02-22 23:59:36 +00:00
Vadim Zeitlin
a8ec7eec0b Allow passing default value to Bench::GetXXXParameter()
Just an extra convenience for the benchmark functions.
2022-02-22 23:58:38 +00:00
Vadim Zeitlin
5847b302be Make it possible to run a benchmark for the given amount of time
This is more practical than running it a given number of times, which
may result in very long running times for slow functions, such as
wxImage resizing tests using wxIMAGE_QUALITY_HIGH.

Also show the standard deviation in addition to the average and min/max
values.
2022-02-22 23:58:19 +00:00
Paul Cornett
c3b232dcfd Fix a scrolling issue with GTK3
With overlay scrollbars disabled, it was not possible to move the scrollbar
slider all the way to the end, and there would be some flickering when trying
to do so. Fixed by always setting the preferred size to the virtual size, and
returning the proper value for GtkScrollable policy. GtkScrolledWindow uses
the child's preferred size as the virtual size, so the preferred size must
be set for the scrollbars to be managed correctly. Additionally, there was
some confusion during the initial GTK3 port over the difference between
GtkScrolledWindow policy and GtkScrollable policy, resulting in using the
minimum size rather than the natural size.
See #22093
2022-02-21 21:18:37 -08:00
Vadim Zeitlin
ce8bf736fa Allow using wxImage::Scale() for zooming in image sample
By default, continue to use wxDC::SetUserScale(), but allow also using
wxImage::Scale() with various parameters to compare how the results look
like.
2022-02-22 02:26:06 +00:00
Vadim Zeitlin
c227d10728 Add "Double zoom" command to the image sample image view window
Just a convenient way to go to 200% zoom instead of having to use "Zoom
in" command several times to get close to it.
2022-02-22 02:18:33 +00:00
Vadim Zeitlin
5d3a544db1 Decrease the margin used for wxBU_EXACTFIT in wxMSW
This should achieve the same result as de10f054c4 (Improve calculating
wxButton best size under wxMSW, 2021-04-08) but in a much simpler way.
2022-02-21 23:34:36 +00:00
Vadim Zeitlin
73e23a4fd2 Revert "Improve calculating wxButton best size under wxMSW"
This reverts commit de10f054c4 and a bunch
of commits improving it done since then:

6f888df474 (Restore button size calculation when not using manifest in wxMSW, 2021-04-24)
de10f054c4 (Improve calculating wxButton best size under wxMSW, 2021-04-08)
6f888df474 (Restore button size calculation when not using manifest in wxMSW, 2021-04-24)
75d508b6e6 (Fix regression in sizes of buttons with bitmaps in wxMSW, 2021-07-08)
051418ac00 (Fix recent wxMSW buttons with bitmaps appearance regression, 2021-08-26)
fbc6462375 (Fix a gcc warning introduced by the previous commit, 2021-08-26)

The reason for reverting is that using BCM_GETIDEALSIZE doesn't seem to
have any advantages compared to using our old code, as it doesn't take
the margins into account neither and we still have to add them ourselves
and so it's simpler to just always do it without using this message.
2022-02-21 23:28:30 +00:00
Vadim Zeitlin
4fbd0d650f Merge branch 'xrc-use-bmpbundle'
Use wxBitmapBundle in more XRC handlers and other minor XRC-related
improvements.

See #22144.
2022-02-21 23:09:57 +00:00
Vadim Zeitlin
45e43b4527 Stop using deprecated libtiff uintNN types
They are deprecated by libtiff in favour of C99 standard types, but
replace them with wxUintNN for now, as those are definitely available on
all platforms, while we support some platforms without C99 stdint.h
(notably ancient MSVC versions).
2022-02-20 18:09:18 +01:00
Vadim Zeitlin
652d37ea61 Add "pressed" and "current" wxBitmapButton XRC properties
New names are consistent with the names of the preferred SetBitmapXXX()
functions.

Document them and show using one of them in the sample.
2022-02-20 18:06:09 +01:00
Vadim Zeitlin
f4e3b69dd2 Use wxBitmapBundle in wxBitmapButtonXmlHandler
Allow specifying bundles and not just individual bitmaps in XRC for this
control.
2022-02-20 18:06:09 +01:00
Vadim Zeitlin
34facd225a Add wxXmlResourceHandler::GetBitmapBundle(wxXmlNode) overload
Do it for consistency with the existing GetBitmap() overload and also
because this can be useful when we need to test for the bitmap bundle
presence before using it.

Also document both the new overload and the original one, which was
mistakenly left undocumented when it was added.
2022-02-20 18:06:09 +01:00
Vadim Zeitlin
f077169c86 Refactor wxBitmapButtonXmlHandler before using wxBitmapBundle
This replaces 4 calls to GetBitmap() with a single one.

Note that we now use SetBitmapPressed() and SetBitmapCurrent(), which
take wxBitmapBundle, instead of deprecated SetBitmapSelected() and
SetBitmapFocus(), which do not.

We also search for the parameter node only once instead of doing it
twice in a row if it was found, so the new code is slightly more
efficient.
2022-02-20 18:06:09 +01:00
Vadim Zeitlin
38ad817163 Use GetBitmapBundle() whenever possible in XRC handlers
This allows specifying multiple bitmaps and/or SVG in the XRC for the
controls which support them.
2022-02-20 18:06:09 +01:00
Vadim Zeitlin
5fcea04d71 Take wxBitmapBundle in wxMenuItem::SetBitmap() in all ports
Update the remaining ports to take wxBitmapBundle rather than wxBitmap
as well to make their API consistent with the tier 1 ports -- even if
there is no actual support for choosing the resolution-appropriate
bitmap in them yet.
2022-02-20 18:06:09 +01:00
Lauri Nurmi
8b3e0acf75 Fix compilation on 64-bit OpenIndiana (SunOS)
src/unix/mediactrl.cpp failed to compile due to a precision-losing cast
(from 'gpointer' {aka 'void*'} to 'window_id_type' {aka 'unsigned int'}).

Tell pkg-config to use 64-bit configs if building for 64-bit on SunOS.

PKG_CONFIG_PATH is set to /usr/lib/64/pkgconfig in that case.

Documented at:
https://docs.oracle.com/cd/E37838_01/html/E66175/gplhi.html

Closes #22143.
2022-02-20 18:04:38 +01:00
Vadim Zeitlin
dec0c1b5b6 Don't return wxNullBitmap from XRC GetBitmapBundle()
Return an empty bundle directly instead of relying on conversion from
invalid bitmap.
2022-02-20 17:55:59 +01:00
Vadim Zeitlin
cc54b767d3 Define NIIF_USER if it's not defined too
This fixes compilation after the changes of 148f56085f (Define
NIIF_LARGE_ICON ourselves if it's not defined, 2022-02-19) for the
compilers using headers so old that they don't even define NIIF_USER
which exists since XP SP2 -- which includes MinGW 5.3 used for our
AppVeyor CI builds.
2022-02-20 17:06:43 +01:00
Vadim Zeitlin
4a63bae1c8 Use wxRecursionGuard to set and reset wxGTK g_inSizeAllocate
This is a bit shorter and more robust, as it ensures that the flag will
be reset even if we return earlier.

No real changes.
2022-02-20 00:00:33 +01:00
Vadim Zeitlin
5cc8e34dfb Fix completely broken code in the parent commit
This was accidentally committed without being tested, correct it now.

See #22138.
2022-02-19 23:13:40 +01:00
Vadim Zeitlin
6168e1625d Get the icon of requested size directly in X11 wxTaskBarIcon code
Instead of getting the bitmap of the default size and then possibly
rescaling it, get the icon of the correct size directly from the bitmap
bundle, which could yield better results (and at worst would do the same
thing as before, but with less code).

See #22138.
2022-02-19 21:50:57 +00:00
Vadim Zeitlin
148f56085f Define NIIF_LARGE_ICON ourselves if it's not defined
It should actually always be defined when using any of the currently
supported compilers, but define it ourselves just in case it isn't.

At least get rid of #ifdef checking for it in the code.

See #22138.
2022-02-19 21:47:16 +00:00
Alexander Koshelev
1278aae752 Use wxBitmapBundle in wxTaskBarIcon
Update the sample to use wxBitmapBundle too.

Closes #22138.
2022-02-19 21:44:27 +00:00
Vadim Zeitlin
66723b671f Ask whether X11 or Wayland is used in the bug report template
This is rather important, as many wxGTK bugs only manifest themselves
under one or the other, so ask to specify which one is used.
2022-02-19 22:36:50 +01:00