Commit Graph

71161 Commits

Author SHA1 Message Date
Vadim Zeitlin
fbedac8fa6 Merge branch 'dpi-scale'
Add wxDPIChangedEvent::Scale() and use it in our own code.

See https://github.com/wxWidgets/wxWidgets/pull/2429
2021-07-13 23:06:34 +01:00
Vadim Zeitlin
b9a2469ace Use wxRescaleCoord() in wxMSW DPI update code too
Use the same scaling function as elsewhere instead of using
ceil/floor().

Provide wxRescaleCoordWithFrom specialization for int to allow using it
with just single coordinates too.
2021-07-13 23:05:17 +01:00
Vadim Zeitlin
035c29e6a2 Make wxRescaleCoord() safer by requiring explicitly using From/To
This should help with accidentally exchanging the order of parameters
and makes the code using this function more readable.

No real changes.
2021-07-13 23:05:17 +01:00
Vadim Zeitlin
7843c99d5b Make wxRescaleCoord() private functions
They're probably not that useful in application code, which should just
use wxDPIChangedEvent::Scale() instead, so move them to a private
header instead of making them part of the public API.
2021-07-13 23:05:16 +01:00
Vadim Zeitlin
3787f55a6b Add wxDPIChangedEvent::Scale() and use it in this event handlers
This is more concise and less error-prone than multiplying/dividing DPI
values manually.

No real changes except, maybe, in wxSlider code where the rounding was
done differently before for some reason.
2021-07-13 23:05:16 +01:00
Vadim Zeitlin
453468f2f9 Add wxRescaleCoord() helper and use it
No real changes, just make the code a bit shorter and more clear by
using a dedicated function rather than wxMulDivInt32() directly.
2021-07-13 23:05:16 +01:00
Vadim Zeitlin
7c6f290995 Document wxMulDivInt32() and add a test for it
This function exists since always and is probably already used outside
wx, so make it officially public and add at least a trivial unit test
for it.
2021-07-13 23:05:16 +01:00
Vadim Zeitlin
760f327c24 Update MinGW build instructions
Don't mention Cygwin any more, except as a build environment.

Do mention MSYS2 and WSL.
2021-07-13 14:59:07 +02:00
Vadim Zeitlin
39b6e9ffd1 Link to the section describing makefile parameters
Also rename it to "Make Parameters" to make it more clear that it only
applies when using make.
2021-07-13 14:59:07 +02:00
Vadim Zeitlin
10e8c4404a Move vcpkg instructions under MSVC section
It seems more logical to have it here rather than in its own top-level
section.
2021-07-13 14:59:07 +02:00
Vadim Zeitlin
d4c95abe4c More formatting fixes in wxMSW build instructions
Use `%WXWIN%` instead of \%WXWIN\% and other similar fixes.
2021-07-13 14:59:07 +02:00
Vadim Zeitlin
e999dc46c8 Remove obsolete note about having to use -std=gnu++11
This shouldn't be true any longer, i.e. wxWidgets should (and does)
build with just -std=c++NN.
2021-07-13 14:52:23 +02:00
Vadim Zeitlin
74c51eaff2 Fix formatting of wxMSW build instructions
Using numbered lists with multiline items doesn't work in Markdown, so
remove it.

Also put the "IDE" part of the instructions before the "command line"
one, as it is probably use much more commonly.

No real changes to contents.
2021-07-13 14:30:54 +02:00
Kvaz1r
0a241d2dfc Don't send events for non-item 2021-07-13 11:38:39 +03:00
Kvaz1r
c345205396 Fix wxListBox HitTest in wxUniv 2021-07-13 11:11:39 +03:00
Kvaz1r
9028ae74fc Fix and simplify wxRadioButton handling in wxUniv
Reuse common functions that work correctly, while wxUniv-specific
version of the code didn't pass RadioButton::Single unit test.

Closes https://github.com/wxWidgets/wxWidgets/pull/2430
2021-07-11 21:57:46 +02:00
Vadim Zeitlin
b39cf5da32 Don't build for Cygwin in AppVeyor CI builds
This platform is not really supported and building for it takes the
longest, so don't waste time on it.
2021-07-11 17:27:55 +02:00
Vadim Zeitlin
f37d449208 Add convenient wxFileName::GetAbsolutePath() wrapper and use it
This wrapper simply combines the calls to MakeAbsolute() and
GetFullPath(), but using it results in shorter and more clear code, so
it seems to be worth having.
2021-07-11 14:51:31 +01:00
Vadim Zeitlin
3539a81a8a Define a helper variable to reduce #ifdefs in wxFileName test
No real changes, just avoid repeating "#ifdef __WINDOWS__" multiple
times.
2021-07-11 14:51:31 +01:00
Vadim Zeitlin
702c221901 Deprecate wxPATH_NORM_ALL and Normalize() with default flags
Using wxFileName::Normalize() with default flags could be surprising and
result in bugs in the code, as shown by our own wrong use of it in
wxFileSystemWatcher corrected in the previous commit.

Deprecate using it without any flags and recommend using MakeAbsolute()
instead.

Also improve the related parts of the documentation.
2021-07-11 14:51:31 +01:00
Vadim Zeitlin
2cd7025d7b Replace more uses of wxFileName::Normalize() with MakeAbsolute()
Unlike the parent commit, this one does change the behaviour by not
applying some normalizations any more, but these changes are correct,
i.e. we really don't need to call Normalize(), which expands environment
variables in the file names by default, here and just want to make the
file paths absolute.

In particular, this fixes the problem of mangling file names containing
dollar signs in wxFileSystemWatcher.

Closes #19214.
2021-07-11 14:51:31 +01:00
Vadim Zeitlin
6d2af9e7a1 Use wxFileName::MakeAbsolute() instead of Normalize()
Make the code more clear by being more explicit about what it does.

No real changes and no changes in behaviour at all.
2021-07-11 14:51:31 +01:00
Vadim Zeitlin
1f2413c461 Improve wxPATH_NORM_LONG documentation
Notably mention that this flag is obsolete.
2021-07-11 14:51:31 +01:00
Vadim Zeitlin
7a1530e20a Merge branch 'std-deprecated-attr'
Add wxDEPRECATED_ATTR expanding to the standard C++14 [[deprecated]]
attribute.
2021-07-11 15:50:27 +02:00
Vadim Zeitlin
f6da66debc Disable use of [[deprecated]] with gcc 5
This gcc version claims support for this attribute, but actually doesn't
support it and returns unclear errors when it is used, e.g.

	$ echo '[[deprecated]] int x;' | g++-5 -fsyntax-only -x c++ -
	<stdin>:1:1: error: expected unqualified-id before ‘[’ token

so disable its use with gcc < 6.
2021-07-11 15:02:41 +02:00
Vadim Zeitlin
7a8f2dffbd Use standard [[deprecated]] attribute if available
Add yet another wxDEPRECATED_XXX macro, this one simply expanding to
C++14 [[deprecated]] attribute if it's available and nothing otherwise.

It's a bit ridiculous to have so many different macros for deprecating
things, but the new one is useful because the standard attribute can be
used to deprecated enum elements, which is impossible with MSVC-specific
__declspec(deprecated).
2021-07-11 14:47:47 +02:00
Kvaz1r
4f7f7a9ce1 Don't send event when adding first page to wxNotebook in wxUniv
Make behaviour consistent with the other ports and fix failure in
wxNotebook::AddPageEvents unit test with wxUniv.

Closes https://github.com/wxWidgets/wxWidgets/pull/2426
2021-07-11 12:56:20 +02:00
Vadim Zeitlin
c0c183ac17 Merge branch 'ci-install-setuptools'
Fixes for CI after apparent changes to GitHub Actions Ubuntu 16.04
images.
2021-07-11 00:06:50 +02:00
Vadim Zeitlin
49d799fcd3 Merge branch 'renderer-fix'
Miscellaneous wxRenderer-related fixes, notably fixing regressions
introduced by 0112a2dd1b (Merge branch 'renderer', 2021-07-06).

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

Closes https://github.com/wxWidgets/wxWidgets/pull/2420
2021-07-10 23:59:09 +02:00
Vadim Zeitlin
3a587cee19 Use DPI-independent positions and sizes in render sample
Don't hardcode physical pixel values, use GetCharWidth() or FromDIP() to
make the sample appear correctly in high DPI too.
2021-07-10 22:57:18 +01:00
Vadim Zeitlin
c95a04310d Use more appropriate size for DrawChoice() in the render sample
The drawn combobox was so huge that it looked wrong, use a more
reasonable size for it.
2021-07-10 22:53:46 +01:00
Vadim Zeitlin
f1eeeb02af Rename variable in render sample to a more generic name
This will be used for things other than the header button too, so don't
use "Hdr" in its name.

No real changes, this is just a refactoring.
2021-07-10 22:53:01 +01:00
Vadim Zeitlin
0f91a4bb1f Get setuptools in httpbin installation script too if necessary
This module is not always available, e.g. it's missing in GitHub Actions
Ubuntu 16.04 image currently.
2021-07-10 23:45:27 +02:00
Vadim Zeitlin
525fb911d6 Remove special case for macOS in httpbin installation script
This is not necessary any longer since the changes of 1b76ff4887
(Disable wxWebRequest tests on CI platforms without Python 3,
2021-05-16) as we require Python 3 for httpbin anyhow.
2021-07-10 23:42:58 +02:00
Maarten Bent
75d508b6e6 Fix regression in sizes of buttons with bitmaps in wxMSW
After changes in 53eff92ea7 (Call AdjustForBitmapMargins() only once in
wxAnyButton, 2021-04-24) only the margin was accounted for, not the
image size.

Closes https://github.com/wxWidgets/wxWidgets/pull/2421
2021-07-10 23:35:10 +02:00
Vadim Zeitlin
e631e7da62 Avoid using wxDynamicCast() with wxComboCtrl-derived object
In wxUniv wxComboBox does derive from wxComboCtrl, but its wxRTTI
doesn't use wxComboCtrl as the base class for consistency with the other
ports, meaning that wxDynamicCast() to wxComboCtrl fails.

Avoid this problem by storing wxComboCtrl in wxComboPopupWindow, as then
we can just use it later without any casts -- at the price of storing an
extra pointer in a transient object, i.e. without any real cost.

See https://github.com/wxWidgets/wxWidgets/pull/2418
2021-07-10 22:32:24 +01:00
Vadim Zeitlin
aa42d9c805 Use wxPopupTransientWindow in wxComboCtrl in wxMSW too
This seems to work fine with current version of wxPopupTransientWindow
and wxPU_CONTAINS_CONTROLS style and allows to drastically simplify the
whole mess of preprocessor checks in wxComboCtrl code, reducing the
logic to just 2 cases: either wxUSE_POPUPWIN == 1 under any of the major
platforms and then we use wxPopupTransientWindow or wxUSE_POPUPWIN == 0
or we use some other platform and then a TLW-based fallback is used
instead.

In spite of the amount of changes, this should only modify behaviour
under MSW where wxPopupTransientWindow is used now instead of whatever
was used before.
2021-07-10 19:35:53 +01:00
Vadim Zeitlin
272b1009cc Define default FOCUS_RING value just once
Mac is the only platform which needs, so just define it as 0 for all the
other ones.

No real changes.
2021-07-10 19:35:33 +01:00
Vadim Zeitlin
67f27f1b89 Always center text control in wxComboCtrl vertically
Simplify the code by removing TEXTCTRL_TEXT_CENTERED, it was only set to
1 for "other" (i.e. not one of the main ones) platforms and if it's
really a problem for them, which is not even certain, the solution is to
fix them rather than to uglify common code.
2021-07-10 19:35:33 +01:00
Vadim Zeitlin
d7d5231e96 Replace wxComboPopupEvtHandler with calls to Bind() as well
This is not as much of a simplification as the previous two commits
because there is no simple replacement of EVT_MOUSE_EVENTS() using
Bind() and a loop over all mouse event types has to be written
explicitly, but it still avoids the need to allocate and delete a
separate object, so is still worth it.
2021-07-10 19:35:31 +01:00
Vadim Zeitlin
f3fb6dc833 Get rid of wxComboPopupWindowEvtHandler in wxComboCtrlBase too
Use Bind() calls instead of another event handler too, for the same
reasons as in the previous commit.
2021-07-10 18:04:38 +01:00
Vadim Zeitlin
d6426168a3 Remove wxComboBoxExtraInputHandler and use Bind() instead
There is no need to use a separate wxEvtHandler here when we can just
use Bind() to directly handle the child text control events in
wxComboCtrlBase itself, this code was a left over from pre-wx3 days.

No real changes, just make the code simpler and smaller (and also
marginally more efficient at run-time).
2021-07-10 18:04:38 +01:00
Vadim Zeitlin
cf3ebcea1a Merge wxComboCtrl::InstallInputHandlers() into CreateTextCtrl()
This function was always called after calling CreateTextCtrl() and
couldn't be called at any other moment, so it didn't make much sense to
have it as a separate function, just install the custom input handler
when (re)creating the text control.

This simplifies the derived classes code.
2021-07-10 18:04:38 +01:00
Vadim Zeitlin
f3f3b00c6b Actually show messages in the combo sample
Messages from wxLogDebug() didn't appear in wxLogTextCtrl log target, so
use wxLogMessage() to actually see the messages logged by the sample.
2021-07-10 18:04:38 +01:00
Vadim Zeitlin
cd8fea8056 Fix infinite recursion when resizing a TLW in wxUniv/MSW
Don't use wxClientDC in WM_NCCALCSIZE handler as creating it results in
another WM_NCCALCSIZE in wxUniv due to the call to DoSetClippingRegion()
in its wxClientDCImpl::InitDC().

Using simple WindowHDC is also a small performance gain and is all that
we need as we just need some HDC for this window and should have
probably been done like this even back in a047aff270 (Added
wxBORDER_THEME..., 2007-08-07) in which handling WM_NCCALCSIZE was
added.

Closes #19221.
2021-07-10 13:03:46 +01:00
Maarten Bent
170631ff93 Renderer theme with EXPLORER::LISTVIEW is not always available
It works in the render sample, but not in the dataview sample.
Fallback to using LISTVIEW if EXPLORER::LISTVIEW results in an invalid hTheme.
2021-07-08 20:46:52 +02:00
Maarten Bent
75c4735016 Fix using wxDCTextBgModeChanger
Correctly initialize the old background mode.
2021-07-08 20:46:36 +02:00
Vadim Zeitlin
07e80803da Merge branch 'grid-resize-fixes'
Fix spurious asserts about invalid drag row/column index in wxGrid.

See https://github.com/wxWidgets/wxWidgets/pull/2413
2021-07-06 14:28:53 +02:00
Vadim Zeitlin
0685086a7b Merge branch 'univmenucapture19208' of https://github.com/Kvaz1r/wxWidgets
Fix handling mouse capture in wxUniv menus.

Avoid crashing on losing it unexpectedly.

See https://github.com/wxWidgets/wxWidgets/pull/2407
2021-07-06 14:23:36 +02:00
Vadim Zeitlin
e663d9af2b Stop using shared-ld wrapper script under Mac
We don't need to cater for gcc < 3.1 any longer and can just use
-single_module option unconditionally.

This is simpler and avoids spurious errors about "unknown option" when
using -fsanitize=xxx in LDFLAGS from the script.
2021-07-06 14:14:17 +02:00