Commit Graph

67527 Commits

Author SHA1 Message Date
Vadim Zeitlin
91dc325ca9 Don't disable wxGraphicsContext if Cairo not available under Mac
This breaks Mac build by default and shouldn't be done. In fact, Cairo
should be used only optionally under MSW and Mac, where it's not always
needed, so add a new configure option to request it.
2019-11-17 23:49:21 +01:00
Artur Wieczorek
bdee154c96 Fix build with wxUSE_CAIRO==1 under wxMSW/wxOSX
'bmpSource' is declared later but we can check
original bitmap 'bmp' for 'alpha flag' instead
because 'bmpSource' is just a non-const copy
of 'bmp'.
2019-11-17 22:17:27 +01:00
Artur Wieczorek
3ca6e04d61 Allow building library with Cairo under wxOSX
Enable checking for Cairo in the configure script.
2019-11-17 22:14:38 +01:00
Vadim Zeitlin
8cba51978e Add a check for using wxString::Format() with a very long string
This used to fail until it was fixed in the previous commit.

See #18586.
2019-11-17 18:30:33 +01:00
Vadim Zeitlin
8005c59615 Stop truncating all wxString::Printf() arguments to 65535 chars
There is absolutely no good reason to do it and it resulted in
silently truncating all the string formatted using "%s" to their first
65535 characters when using our wxPrintf() implementation.

Closes #18586.
2019-11-17 18:30:33 +01:00
PB
8cf8c918b9 Correct and update code in new event class example
The code in the example showing how to create a new event class
confusingly used several names for the event type.

Fix this and also prefix the name of the new event type with "EVT_" to
match wxWidgets convention for naming event types.

Also explicitly mark the parts that are not needed if only Bind() is
used for event handling.

Closes https://github.com/wxWidgets/wxWidgets/pull/1586
2019-11-17 17:11:52 +01:00
Igor Korot
68de1b2acf Fix initial value returned from wxRichTextCtrl::IsModified()
A just created control shouldn't be considered modified, so reset its
modified state in Create().

And add a unit test checking that IsModified() really behaves as
expected.

Closes https://github.com/wxWidgets/wxWidgets/pull/1652
2019-11-17 17:04:15 +01:00
Vadim Zeitlin
b690caba84 Replace CPPUNIT_XXX macros with CHECKs
This results in better error messages and also allows the test to
continue executing even if a check fails.
2019-11-16 17:05:06 +01:00
Vadim Zeitlin
505e694347 Get rid of useless VarArgTestCase test fixture
We don't need it any more, just define individual tests as independent
test cases.

This required using some other pointer instead of "this" in one of the
tests, but it doesn't really matter which pointer we use there anyhow.

No real changes.
2019-11-16 17:01:57 +01:00
Vadim Zeitlin
ac14c3ffbc Only use font scaling code with GTK 3 or later
It's useless to do it for GTK 2 which doesn't support font scaling
anyhow.
2019-11-16 12:00:40 +01:00
Vadim Zeitlin
4d4e3e71a5 Use helper function for applying scaled font to PangoLayout
Don't scale, or even copy, the font object unnecessarily in the common
case when the font scaling factor is 1.0 anyhow.

No real changes, just make the code slightly more efficient and also a
bit more concise after the changes of the previous commit.
2019-11-16 12:00:40 +01:00
iwbnwif
fbc75ec8e0 Add support for fractional font scaling to wxGTK3
Respect the system font scaling parameter (e.g. "Fonts->Scaling Factor"
in Gnome Tweaks, "Force font DPI" in KDE System Settings or
GDK_DPI_SCALE environment variable) when drawing text using wxFont.

This ensures that generic widgets have their text scaled appropriately
to be consistent with native widgets.

Closes https://github.com/wxWidgets/wxWidgets/pull/1635
2019-11-16 12:00:40 +01:00
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