Commit Graph

67865 Commits

Author SHA1 Message Date
PB
33da780ecf Add sample code showing how to create a new wxEvent class
In the event sample, show how create and use a new
wxEvent-derived class.

Closes https://github.com/wxWidgets/wxWidgets/pull/1633
2019-11-16 00:56:23 +01:00
Vadim Zeitlin
785ad3b63b Merge branch 'ellipsize-fixes'
Fix ellipsization of strings containing mnemonics and TABs and also
improve handling of trailing spaces (by ignoring them).

See https://github.com/wxWidgets/wxWidgets/pull/1649
2019-11-16 00:51:56 +01:00
Vadim Zeitlin
db846f15ab Disable wxMediaCtrl and wxWebView when OLE is disabled in wxMSW
Avoid errors in wx/msw/chkconf.h during compilation by proactively
turning these options off in configure if wxUSE_OLE==0.
2019-11-15 17:09:43 +01:00
Vadim Zeitlin
37d8b6018c Remove test for ole2.h from configure
This is unnecessary, this header should always be available, so it was a
waste of time to check for it at best and, actually, this broke the
Cygwin build under AppVeyor as configure didn't find the header somehow,
even if compiling the code using it works perfectly well.
2019-11-15 17:06:17 +01:00
Vadim Zeitlin
428d47f534 Merge branch 'wxwebviewieimpl' of https://github.com/MaartenBent/wxWidgets
Actually allow using wxWebVieWIE-specific methods for setting the
emulation level.

Make it possible to include wx/msw/webvieW_ie.h by removing inclusion of
the private headers from it, which was in turn achieved by moving all
the implementation details into a private class.

See https://github.com/wxWidgets/wxWidgets/pull/1647
2019-11-14 17:26:00 +01:00
Vadim Zeitlin
2da8426ed6 Merge branch 'gtk-spin-width-from-text'
Fixes for wxSpinCtrl::GetSizeFromTextSize() and best size in wxGTK.

Closes #18568.

See https://github.com/wxWidgets/wxWidgets/pull/1645
2019-11-14 16:07:05 +01:00
Maarten Bent
e67c814765 Make webview_missing.h a private header 2019-11-14 00:04:56 +01:00
Maarten Bent
9455fe2d21 Move wxWebViewIE specific functions to correct interface class 2019-11-14 00:04:48 +01:00
Maarten Bent
67ace7b243 Move wxWebViewIE classes to private header
Cleanup includes.
2019-11-13 23:56:40 +01:00
Maarten Bent
7e682a09d6 Add wxWebViewIEImpl class for all private wxWebViewIE members and functions
Move wxWebViewIE::Find implementation to wxWebViewIEImpl because it has a lot
of member accesses.
2019-11-13 23:46:13 +01:00
Ian McInerney
e093199058 Fix parameter name in wxDir::HasSubDirs() documentation
Closes https://github.com/wxWidgets/wxWidgets/pull/1648
2019-11-13 19:18:06 +01:00
iwbnwif
5cf745611b Don't take trailing whitespace into account when ellipsizing
Trailing spaces and tabs are invisible, so the string shouldn't be
truncated (possibly losing some printable characters that could have
been displayed) just in order to show "..." instead of them.
2019-11-13 18:40:07 +01:00
Vadim Zeitlin
cbda47ff15 Tighten assert check in EllipsizeCalculator
Verify that we have exactly as many offsets as expected, both in the
case when the string terminates with a (lone) ampersand and when it
doesn't, instead of checking that it's one or the other without caring
in which case we're.

No real changes, but this seems slightly cleaner and avoids questions
about the expression "s.length() - 1" when the string is empty.
2019-11-13 18:38:05 +01:00
Vadim Zeitlin
aa1891e524 Remove unnecessary and unused EllipsizationTestCase class
No real changes, just don't use a text fixture which does nothing, this
is useless and confusing.
2019-11-13 18:25:42 +01:00
iwbnwif
315c5a1d6d Fix ellipsization of strings containing mnemonics
The old code didn't work correctly in the presence of TABs in the string
(without wxELLIPSIZE_FLAGS_EXPAND_TABS being used), as their width is
elastic and so simply subtracting the width of the ampersands didn't
work in this case and could result in ellipsized string being longer
than the maximum available width.

Fix this by using a different approach and computing the widths of the
actually shown string and then just inserting extra entries into the
array of widths to match the invisible ampersands positions.
2019-11-13 18:09:03 +01:00
iwbnwif
7155e82255 Show the used font in case of failure in Ellipsization unit test 2019-11-13 18:04:53 +01:00
Vadim Zeitlin
9b43bd8af2 Merge branch 'dpi-textctrl' of https://github.com/MaartenBent/wxWidgets
Improvements for wxTextCtrl, wxSearchCtrl, wxButton when using
non-default DPI.

See https://github.com/wxWidgets/wxWidgets/pull/1634
2019-11-13 15:47:59 +01:00
Vadim Zeitlin
34f26bd18f Don't change max number of digits in wxSpinCtrl code
This doesn't seem to affect anything, i.e. the function returns the same
results whether we do it or not, so just don't.
2019-11-13 15:46:16 +01:00
Vadim Zeitlin
b472a791c1 Return fitting size from wxSpinCtrl::GetSizeFromTextSize() in GTK
Previously we added the extent of the text to the preferred size of a
spin button with 0 digits, but this didn't account for the fact that the
control still reserved enough space for 3 digits in this case, and so
the returned size was always too big than the required size by the width
needed to show 3 digits.

Fix this by directly asking for the size required to show the number of
digits corresponding to the given text size.

Note that ideal would be to provide GTK API at wx level directly, i.e.
allow to just specify the number of digits instead of the text extent.
But we still need to fix the already existing GetSizeFromTextSize()
anyhow, so do this for now.

See #18568.
2019-11-13 15:46:16 +01:00
Vadim Zeitlin
7f368872d7 Adjust entry width of wxSpinCtrl in wxGTK to its range
Ensure that the entry is always (just) big enough to show any value
valid in this spin control.

This also ensures that GetBestSize() doesn't need to be overridden to
use GetSizeFromTextSize() any longer as the best size will be determined
correctly by GTK itself.
2019-11-13 15:46:16 +01:00
Vadim Zeitlin
b891ffe8d0 Factor out another wxSpinCtrl helper for getting its max length
This will be used in wxGTK implementation.

For now no real changes yet.
2019-11-13 15:46:16 +01:00
Vadim Zeitlin
eb3d8395c2 Rename wxSpinCtrl helper functions
Put them in wxSpinCtrlImpl namespace and remove "wxSpinCtrl" prefix from
the function names themselves, this was ugly.

No real changes.
2019-11-13 15:46:16 +01:00
Vadim Zeitlin
c8cb8756f0 Merge branch 'stattext-ellipsize-fix'
Fix static text ellipsization fix in presence of borders.

See https://github.com/wxWidgets/wxWidgets/pull/1646
2019-11-13 15:45:02 +01:00
Vadim Zeitlin
c26353f13f Add another workaround for failures in wxDateTime::UNow test
If current time doesn't have the milliseconds parts, we need to sleep
for a little before retrying.
2019-11-13 15:39:36 +01:00
Vadim Zeitlin
4444694043 Move private wxSpinCtrl helpers into a private header
Np real changes, just don't put these functions in the public
wx/spinctrl.h, they have nothing to do there.
2019-11-13 02:59:42 +01:00
Vadim Zeitlin
73eabe2f12 Remove redundant wxClientDC::SetFont() call
wxClientDC inherits the font used by the associated window anyhow, there
is no need to set it explicitly.

No real changes, just a micro optimization.
2019-11-12 23:21:51 +01:00
Vadim Zeitlin
6223f67ccc Use client size when ellipsizing wxStaticText label
The full size includes the borders and the return value of this function
might not actually be fully visible if we use it, as it can fit into the
full width but not the client width. And at least under MSW this
resulted in the ellipsized label being wrapped, which was completely
unexpected, especially if the second line of the control was not visible
at all as it seemed that the last word simply disappeared.

Closes #18573.
2019-11-12 23:18:35 +01:00
Stefan Csomor
f1aa3c1c9a add bridging info for apps using ARC
this is not wx building with -fobjc-arc but for apps using wx
2019-11-12 15:03:03 +01:00
Paul Cornett
df9f4af357 Improve our estimate of GtkEntry margins
For GTK2, get the "inner border" the same way GTK does it. And for GTK3,
provide an actual implementation. Also, don't return a wxPoint for a size.
See #18567
2019-11-11 08:29:28 -08:00
wangqr
46a94c2b48 Add support for GTK4 to CMake build too
Closes https://github.com/wxWidgets/wxWidgets/pull/1643
2019-11-11 14:52:43 +01:00
Vadim Zeitlin
c433d3d0fd Use wxALPHA_XXX constants instead of 0 and 255
No real changes, just try to improve the code clarity.
2019-11-10 17:56:44 +01:00
Vadim Zeitlin
d6d5375fe9 Try to simply alpha handling in wxCairoBitmapData a bit more
Don't use hasAlpha under platforms where it's always true.
2019-11-10 17:51:55 +01:00
Vadim Zeitlin
c81021e850 Simplify condition in wxCairoBitmapData ctor
Don't test for "bufferFormat == CAIRO_FORMAT_ARGB32" which will be
always true in this branch if hasAlpha is true anyhow.

No real changes.

See #18570.
2019-11-10 17:44:48 +01:00
Andreas Falkenhahn
5646ba7261 Fix problem with nested wxEVT_PAINT handlers in wxMSW
If wxEVT_PAINT handler did something that resulted in another window
being repainted, the state of the global wxDidCreatePaintDC flag got
out of sync with reality, resulting in refresh problems.

This notably happened with wxStyledTextCtrl, which generates
wxEVT_STC_UPDATEUI from its own paint handler, and so wxSTC itself
wasn't redrawn correctly if wxEVT_STC_UPDATEUI handler did anything
resulting in another repaint itself, such as calling
wxStatusBar::SetStatusText().

Fix this by replacing a single global bool with a stack of booleans,
with each window being repainted storing and removing its own flag
indicating whether a wxPaintDC was created for it in this stack.

This is sufficient for nested repaints and we really shouldn't have
any interleaved ones in any case, os it's not a problem not to support
those.

Closes #18451.
2019-11-10 17:15:39 +01:00
Artur Wieczorek
4f7dde18ca Fix creating wxCairoBitmapData from wxBitmap under wxOSX
Under wxOSX bitmap pixel values are already premultiplied so bitmap data
can be copied to the target surface directly.
Since 992b594c wxMask bitmap colours are no longer inverted and have
the same meaning as for another ports.
2019-11-10 15:55:07 +01:00
Artur Wieczorek
1b9f7fcd29 Fix creating wxCairoBitmapData from wxBitmap under wxGTK2
wxAlphaPixelData can be only used to access pixel data in 32 bpp bitmaps.
Also, because bitmaps can have both alpha values and mask, the mask should
be applied to the created surface even if alpha channel exists. Masked
pixels become fully transparent and unmasked pixels should retain original
alpha values.

Closes #18570.
2019-11-10 15:54:20 +01:00
Vadim Zeitlin
e3d2fd9def Fix paper size correctly for printouts under MSW and Mac
This was broken by 048b7f44ec which wasn't
supposed to change anything, but did because it effectively replaced the
call to wxDC::GetPaperRect() with wxDC::GetSize() when initializing
wxPrintout::m_paperRectPixels, and while GetPaperRect() is the same as
GetSize() in wxGTK, it returns the rectangle including non-printable
margins in wxMSW and wxOSX, and must be used here instead.

Closes #18565.

Closes https://github.com/wxWidgets/wxWidgets/pull/1640
2019-11-10 00:40:29 +01:00
Vadim Zeitlin
0b16b4f439 Merge branch 'primary-display'
Handle the situation when primary display is not the first one.

See https://github.com/wxWidgets/wxWidgets/pull/1641
2019-11-10 00:39:14 +01:00
Vadim Zeitlin
a2ff49eeeb Initialize wxWindowDCImpl::m_window for hidden windows too
Ensure that we set m_window in case of early return from wxWindowDCImpl
ctor, so that using e.g. wxDC::GetSize() works for wxClientDC created
for windows that hadn't been realized yet.

It might be possible to avoid this early return completely as the
comment explaining why we're doing it seems to be out of date: our
SetBackground() doesn't call wxWindow::SetBackground() (and it would be
exceedingly strange if it did), but for now just the bug without
changing anything else.

Closes #18569.
2019-11-10 00:35:07 +01:00
Paul Cornett
a5b03ea23c Suppress -Wdeprecated-declarations warnings from GTK2 headers
GLib has deprecated some things used by GTK2
2019-11-09 12:07:07 -08:00
Maarten Bent
57d054cf95 Fix font size of rich wxTextCtrl when created on display with non-system DPI
Apply a zoom factor based on the active DPI and the system DPI. On the first
DPI change, revert the scaling factor.
2019-11-08 20:46:47 +01:00
Artur Wieczorek
6eccec3ae7 Use empty() member function to determine if string is empty
Use this dedicated function instead of checking if length() function returns zero/non-zero value.
2019-11-08 18:53:03 +01:00
Artur Wieczorek
652e6fbadb Ignore focus events within composite editor control in wxPropertyGrid
Internal focused events of the subcontrols of the composite editor control should not be processed.

Closes #18555.
2019-11-08 18:52:27 +01:00
Artur Wieczorek
ab86e28484 Ignore focus events within composite editor control in wxDataViewRenderer
Internal focused state and focused events of the subcontrols of the composite editor control should not be taken into account.

Closes #18394.
2019-11-08 18:52:26 +01:00
Artur Wieczorek
6b00cc80f1 Revert making wxComboCtrl a wxCompositeWindow
Commit 70e9dbd756 has fixed #18394 but unfortunately it also caused several other issues observed e.g. in #18540. Apparently wxComboCtrl doesn't fit well to the wxCompositeWindow framework -  especially when wxCB_READONLY flag is set and there is no main editor control what is problematic for wxCompositeWindow implementation. At the moment it is more pragmatic to go back to the original wxComboCtrl concept as a plain compound control to fix the regression and try to fix #18394 in an alternative way.

Closes #18540.
See #18394.
2019-11-08 18:51:07 +01:00
wangqr
79794cd415 Fix the pkg-config name for gtk4
See https://developer.gnome.org/gtk4/stable/gtk-compiling.html

Closes https://github.com/wxWidgets/wxWidgets/pull/1642
2019-11-08 15:07:38 +01:00
Vadim Zeitlin
f0871418d0 Merge branch 'x11-layout-fix'
See https://github.com/wxWidgets/wxWidgets/pull/1638
2019-11-08 14:52:56 +01:00
Vadim Zeitlin
cdc6899924 Store MONITORINFOEX inside wxDisplayMSW
There is no reason to call ::GetMonitorInfo() all the time, e.g. just to
determine if the monitor is primary, as we can just store it entirely.

We already invalidate the information stored for all the displays
whenever anything changes, so the cached information doesn't risk
getting out of sync.
2019-11-08 00:34:40 +01:00
Vadim Zeitlin
d8cd02b480 Create primary monitor when using wxDisplay default ctor
Previously, the first monitor was created instead and while it was often
also the primary one, this wasn't always the case.

In particular, this makes wxGetDisplayPPI() always return something
reasonable instead of returning (0, 0) when the first monitor is not the
primary one, as expected by plenty of code, including our own printing
sample, which divides by the values returned from wxGetDisplayPPI()
without checking if they're zero.
2019-11-08 00:26:20 +01:00
Vadim Zeitlin
46cb23b030 Don't assume that the first monitor is always the primary one
This is not necessarily the case at least under MSW, so while it makes
sense to do this by default in wxDisplayImpl::IsPrimary()
implementation, MSW-specific version should override it instead of being
totally unused as it was until now.
2019-11-08 00:09:29 +01:00