Commit Graph

64238 Commits

Author SHA1 Message Date
Vadim Zeitlin
3825baf708 Remove wx/dcbuffer.h dependency from wx/generic/combo.h
This header doesn't really need to be included from here and it was done
solely in order to get the value of wxALWAYS_NATIVE_DOUBLE_BUFFER from
it.

Move the code using this macro in the .cpp file instead.
2018-01-30 19:45:32 +01:00
Vadim Zeitlin
f775501ba0 Don't eat TAB unconditionally in wxComboCtrl
This prevented TAB navigation from doing anything at all when the focus
was on wxComboCtrl in wxGTK and, probably, all the other non-MSW ports
(in wxMSW TAB navigation happens before normal key processing, so this
check was irrelevant there).
2018-01-30 19:40:59 +01:00
Stephen Smith
9f57b6ed20 Explicitly mention "cd" in install.txt configure instructions
Adds one extra shell command instruction (was missing but implied) to
assist newcomers with configure.

Closes https://github.com/wxWidgets/wxWidgets/pull/701
2018-01-30 18:44:16 +01:00
Stefan Csomor
5f21280130 Avoid duplicate wxEVT_SEARCHCTRL_CANCEL_BTN event under macOS
see https://github.com/wxWidgets/wxWidgets/pull/698 , along the idea by commit 1776f136f7d673c8e772c9ca6e1607089a071651, implemented a little bit more defensively
2018-01-30 17:17:47 +01:00
Vadim Zeitlin
ae8bc4e263 Merge branch 'search-events'
Harmonize the behaviour across platforms.

Also fix ChangeValue() for this control.

And finally rename the events to use simpler names.

See https://github.com/wxWidgets/wxWidgets/pull/699
2018-01-30 14:12:30 +01:00
Vadim Zeitlin
7a24cdb861 Merge branch 'cmake-options' of https://github.com/MaartenBent/wxWidgets
See https://github.com/wxWidgets/wxWidgets/pull/694
2018-01-30 13:58:52 +01:00
Vadim Zeitlin
4f9ae9e3e4 Merge branch 'travis-improvements' of https://github.com/MaartenBent/wxWidgets
See https://github.com/wxWidgets/wxWidgets/pull/687
2018-01-30 13:58:07 +01:00
Vadim Zeitlin
8565d8f2fc Set window field of wxEVT_SET_FOCUS events in wxGTK
It is often useful to know where is the focus coming from, for example
to determine if was in another window of the same composite control.

Remember the last focus in yet another global variable in wxGTK code to
allow setting wxFocusEvent::m_window correctly when generating
wxEVT_SET_FOCUS events.
2018-01-30 13:56:51 +01:00
Vadim Zeitlin
94620f6c59 Use simple wxEVT_SEARCH[_CANCEL] names for wxSearchCtrl events
The old wxEVT_SEARCHCTRL_{SEARCH,CANCEL}_BTN event names were unwieldy
and misleading because both of these events can be generated without
using the buttons, but by pressing Enter or Esc (the latter currently
works under macOS only, but this could change in the future).
2018-01-30 02:03:48 +01:00
Vadim Zeitlin
ce43f772a9 Don't erase background of wxSearchCtrl buttons twice
Set background style to indicate that wxSearchButton is painted entirely
by its wxEVT_PAINT handler.

This should eliminate potential flicker under MSW.
2018-01-30 02:03:47 +01:00
Vadim Zeitlin
784a397348 Remove wxEVT_TEXT_URL generation from wxSearchCtrl
This event doesn't make any sense for this control, was never generated
by the native macOS version and couldn't be generated under MSW neither
as it's only supported by the multiline control and not the single-line
version used here, so having this code in wxSearchCtrl just made no
sense at all.
2018-01-30 02:03:47 +01:00
Vadim Zeitlin
ea08b8539a Generate wxEVT_SEARCHCTRL_SEARCH_BTN when Enter is pressed
Make it possible to bind to just wxEVT_SEARCHCTRL_SEARCH_BTN under all
platforms: previously, it was also necessary to bind to wxEVT_TEXT_ENTER
when using the generic implementation, as pressing Enter in the text
control didn't generate the dedicated SEARCH event.

It does now, and, to avoid any confusion, the control does not generate
wxEVT_TEXT_ENTER events at all any more. This is not really
incompatible, as wxOSX never generated these events anyhow and the
generic version only did for a couple of days, since the changes of
9816970797 which were, finally, misguided
and so are undone by this commit.

Closes #17911.
2018-01-30 02:03:47 +01:00
Vadim Zeitlin
1119a44cdd Simplify and make more portable DWrite font weight translation
There doesn't seem to be any need for painstakingly translating STC font
weight to DWRITE_FONT_WEIGHT when they seem to use exactly the same
numeric values anyhow.

This also fixes compilation when using older SDK versions that don't
define DWRITE_FONT_WEIGHT_SEMI_LIGHT constant, which is relatively
recent (and presence of which can't be easily checked, as it's an enum
element and not a preprocessor constant).
2018-01-30 01:21:24 +01:00
Vadim Zeitlin
e5a1931b64 Log wxEVT_TEXT events for wxSearchCtrl in widgets sample
This is useful to check that these events are generated under all
platforms.
2018-01-29 23:14:44 +01:00
Vadim Zeitlin
f079f11736 Log EVT_TEXT_ENTER events for wxSearchCtrl in the widgets sample
This is convenient for checking that the behaviour is consistent among
different platforms.

See #17911.
2018-01-29 19:40:03 +01:00
Vadim Zeitlin
f24872f6f4 Add unit test for wxSearchCtrl::ChangeValue()
Verify that it actually does change the value.

See #16998.
2018-01-29 19:35:10 +01:00
Vadim Zeitlin
58ac3d3690 Fix wxSearchCtrl::ChangeValue() to actually change value
This was broken because wxSearchCtrl inherited the base class version of
ChangeValue() which didn't really work for it due to the poor way in
which wxTextEntry is designed (see #18071).

Closes #16998.
2018-01-29 19:35:09 +01:00
Vadim Zeitlin
05ebeb6bac Get rid of CppUnit compatibility macros in wxSearchCtrl unit test
No real changes, just remove all the CppUnit machinery not needed any
longer and replace it with a simple test function.
2018-01-29 19:08:12 +01:00
Paul Cornett
e1481385c5 Avoid use of uninitialized point size in wxFontInfo
See #18070
2018-01-29 09:49:51 -08:00
Vadim Zeitlin
99dea2e2e0 Remove unnecessary wxSearchCtrl::OnSetFocus()
This was useless as wxCompositeWindow, from which the generic
wxSearchCtrl derives, already sets focus to its first child and, since
the last commit, even harmful as it now resulted in calls to SetFocus()
from inside wxEVT_SET_FOCUS handler which is forbidden at least under
MSW.

See #15569.
2018-01-29 18:45:45 +01:00
Vadim Zeitlin
3b40ff0d41 Send wxEVT_SET_FOCUS for composite window when a child gets focus
wxCompositeWindow already connected to child wxEVT_KILL_FOCUS events and
generated the same event for the composite window itself, but didn't do
it for wxEVT_SET_FOCUS, resulting in not getting these events for the
main window as expected. E.g. this resulted in never getting any
wxEVT_SET_FOCUS events for wxSearchCtrl when using its generic version
(i.e. not under Mac).

Fix this by connecting to wxEVT_SET_FOCUS events for the children too.
Note that this relies on having a correct "previously focused window" in
these events, if this doesn't work reliably for some ports, we might
need to maintain a "bool m_hasFocus" field in wxCompositeWindow itself
instead.

Also note that we might avoid having all this code in wxCompositeWindow
if we translated the underlying native focus event to wxFocusEvents for
both the real window and its GetMainWindowOfCompositeControl() if it's
different. This could potentially be simpler and would definitely be
more efficient, but would require more changes.

Closes #15569.
2018-01-29 18:45:39 +01:00
Vadim Zeitlin
21823bd37a Log focus messages for the search control in the widgets sample
This makes it easier to test various issues related to focus events for
composite controls, such as wxSearchCtrl.
2018-01-29 18:29:34 +01:00
Vadim Zeitlin
72790218cb Fix wrongly restoring clipping region in wxDCClipper
The change of 2a8c290e0d was wrong as it
unconditionally restored m_oldClipRect in dtor, even when it was empty,
indicating that no clipping had been in effect when wxDCClipper was
constructed. This totally broke all the code using wxDCClipper, notably
generic wxListCtrl which wasn't repainted correctly at all.

Fix this by checking if the clipping rectangle is not empty before
restoring it, this should work as well as we can make it without having
GetClippingRegion() that could return an invalid region if no clipping
is in effect.

See #13834.

Closes #18066.
2018-01-29 15:36:21 +01:00
Paul Cornett
84c3bc123e Prevent widgets from drawing outside their allocation with GTK+3
See #18043
2018-01-28 22:19:46 -08:00
Vadim Zeitlin
a3f56e1869 Update libtiff to the latest version
This is more of a test as the security vulnerability (CVE-2017-9935)
fixed in the upstream doesn't affect our use of the library, but still
update it to check if we can do this as easily as by just merging the
new upstream version into our submodule.
2018-01-29 00:49:05 +01:00
Vadim Zeitlin
5bc208df3c Correct UTF-8 encoding of U+FFFF
Overlong (and hence invalid) 4-byte encoding was used for this character
instead of the correct 3-byte 0xEF 0xBF 0xBF sequence.

Fix this by using 3 bytes for the code points up to 0xFFFF included,
instead of excluding it as was done before.

Closes #17920.
2018-01-29 00:48:56 +01:00
Maarten Bent
6a2c4abcc1 Define missing GUIDs for Direct2D in MinGW
The GUIDs are copied from wincodec.h in Windows SDK 10.0.16299.0.
Fixed another build error in code that is normally disabled.
2018-01-29 00:45:29 +01:00
Maarten Bent
04b79788fc CMake: declare third-party libraries in options
So the wxUSE_[lib] variables can be used in init.cmake.
2018-01-29 00:45:28 +01:00
Maarten Bent
e6b9b571ab CMake: fix and add more options
Don't overwrite options in setup.cmake.
Align text in summary message.

Always set wxUSE_XRC to values of wxUSE_XRC, same as in setup.h.
Disable wxUSE_XRC when expat is disabled.
2018-01-28 23:52:11 +01:00
Vadim Zeitlin
26997607b6 Improve SetSizerAndFit() and Fit() documentation
Mention the difference between these two functions in Fit() description,
it could be expected to behave as SetSizerAndFit() but doesn't.

See #18003.
2018-01-28 19:04:42 +01:00
Vadim Zeitlin
4fcc6e15b0 Use all available size for the video in mediaplayer sample
wxMediaCtrl doesn't compute its best size correctly until a video is
available and this resulted in using the best size of (0, 0) for it and
nothing being shown at all on the screen, even after starting to play a
video.

This is almost certainly a problem on its own, as there is some existing
code for updating the best size and redoing the layout of the parent
sizer when a new video is loaded, but for now just make the control
visible in the sample again by always expanding it to fill up all the
available size, as this is the smallest possible fix and this is how it
used to behave before, until 9aaa38c7c8,
which allowed to meaningfully use wxALIGN_CENTER_HORIZONTAL and wxEXPAND
together: until then, this didn't work at all, but the sample still used
wxALIGN_CENTER_HORIZONTAL by mistake, so just remove it now to restore
the original behaviour.

Closes #17917.
2018-01-28 16:35:10 +01:00
Maarten Bent
c341d72a92 Remove downloading CppUnit and CMake in Travis CI
CppUnit has been replaced by Catch.
The Precise build environment is not used, so no need to download CMake for it.
2018-01-28 16:31:12 +01:00
Vadim Zeitlin
a184914242 Merge branch 'search-desctext'
wxSearchCtrl fixes for wxMSW and add "hint" property to its XRC handler.

See https://github.com/wxWidgets/wxWidgets/pull/691
2018-01-28 16:14:10 +01:00
Maarten Bent
4171f9b808 Use parallel builds in Travis CI
Don't use it when building samples. It randomly results in build errors with 'file not recognized: File truncated'.
2018-01-28 15:49:34 +01:00
Maarten Bent
90369e9632 CMake: fix building library with wxUSE_GUI 0
Actual toolkit should still be defined (e.g. WXMSW), before settings WXBASE.
Move Windows libraries outide toolkit so they are always linked to.
2018-01-27 21:47:01 +01:00
Maarten Bent
5017c6c8c2 CMake: expat code in separate file
Consistent with other external libraries.
2018-01-27 21:47:01 +01:00
Vadim Zeitlin
f063dde4f5 Merge branch 'gtk-dyn-autocomplete'
Implement dynamic wxTextEntry autocompletion for wxGTK.

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

Closes #18061.
2018-01-27 19:28:09 +01:00
Vadim Zeitlin
1d45a8e50a Merge branch 'gtk-dc-ppi'
Return display DPI from display-related wxDC classes in wxGTK3.

See https://github.com/wxWidgets/wxWidgets/pull/680
2018-01-27 19:25:30 +01:00
Vadim Zeitlin
160647aaf2 Fix processing of pending events in mixed MFC/wx applications
ProcessPendingEvents() was never called when using MFC event loop,
meaning that queued events were never processed, so that using
CallAfter() didn't work.

Fix this and also ensure that these events are processed soon enough by
also implementing WakeUpIdle() for such applications, as wxWakeUpIdle()
didn't do anything neither for them.
2018-01-27 18:58:13 +01:00
Vadim Zeitlin
44a089b295 Fix handling TAB in wxSearchCtrl in wxMSW
Check whether wxTextCtrl has focus using Win32 ::GetFocus() instead of
by comparing FindFocus() with "this" pointer, as the latter fails when
wxTextCtrl is part of a composite control, such as wxSearchCtrl.

This is enough to make pressing TAB in wxSearchCtrl correctly go to the
next control instead of just beeping.

Note that we could also use DoFindFocus() here, but this would be
needlessly less efficient as we don't really need to find wxWindow
corresponding to the focused HWND, as that function does. But we can't
use HasFocus() here as it wouldn't work correctly here when the focus is
on another sub-window of a composite control also containing this
wxTextCtrl.
2018-01-27 15:58:14 +01:00
Vadim Zeitlin
9816970797 Fix getting wxEVT_TEXT_ENTER from wxSearchCtrl
wxSearchCtrl never generated this event, at least under MSW, even though
the code to forward it from wxSearchTextCtrl was present in it, because
it was never generated in the first place without wxTE_PROCESS_ENTER.

Fix this by simply always using this style in wxSearchTextCtrl.
2018-01-27 14:01:58 +01:00
Vadim Zeitlin
652b4eb8ed Add "hint" property to wxSearchCtrl XRC handler
This is similar to wxTextCtrl property of the same name and maps
naturally to wxSearchCtrl descriptive text attribute.
2018-01-27 13:46:54 +01:00
Vadim Zeitlin
8ee3394e5e Declare wxSearchCtrl::{Set,Get}DescriptiveText() in the base class
Fix a trivial "TODO" remaining from 2.8 days and declare the functions
that are part of the public control API as pure virtuals in the base
class.

No real changes.
2018-01-27 13:38:47 +01:00
Vadim Zeitlin
264f93aad9 Fix harmless signed/unsigned comparison warning in wxSTC code
Cast int to size_t before comparing it with the wxString length.
2018-01-27 13:37:53 +01:00
Vadim Zeitlin
a6eb4c8e64 Fix Unix build when using precompiled headers
In a twist on the usual theme, the previous commits broke the Unix build
when _using_ PCH because wx/textcompleter.h was only included from
inside "#ifndef WX_PRECOMP" check, but it needs to be always included as
wx/wx.h doesn't include it.
2018-01-27 11:55:37 +01:00
Vadim Zeitlin
a14a3de5ce Refactor min autocomplete length handling in widgets sample
Call DoUseCustomAutoComplete() function instead of using an artificial
event.

Also move the menu item in the radio group with the other
autocomplete-related commands as it's exclusive with them.
2018-01-27 01:35:47 +01:00
Vadim Zeitlin
ec2bb385ef Remove platform limitations from AutoComplete() documentation
This method is now implemented for all major platforms.
2018-01-27 01:20:30 +01:00
Vadim Zeitlin
456fdd8f93 Always update dynamic completions when the text changes
Don't do it only when the text entry is (or becomes again) empty, this
breaks dynamic completers such as the one used in the widgets sample,
which determines its completions depending on the already entered text
(of course, the sample example is not particularly useful, as the
completions are always the same, but it's supposed to show that they
could dynamically depend on the already entered part of the string).
2018-01-27 01:18:21 +01:00
Vadim Zeitlin
02f2159aea Split wxTextAutoCompleteData in two subclasses
Doing two different things in the same class, using m_isDynamicCompleter
to determine which kind of completion is used, was not very clear, so
create two simple classes each of which does one and one thing only and
create the one we need in wxTextEntry methods.

Note that wxTextAutoCompleteDynamic can assume to always have a valid
wxTextCompleter as otherwise no wxTextAutoCompleteData is needed at all,
which results in more simplifications.

There should be no changes in behaviour.
2018-01-27 01:17:50 +01:00
Vadim Zeitlin
d4c84ce745 Remove special check for wxTextCompleterFixed
There should be no need to handle this class specially and it's supposed
to be just an implementation detail, so don't add any dependencies on it
(if it's really important to optimize for this case, the check should be
done for wxTextCompleterSimple and use wxRTTI as wxWidgets still
supports being built without standard C++ RTTI).
2018-01-27 00:27:21 +01:00