Commit Graph

63909 Commits

Author SHA1 Message Date
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
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
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
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
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
Vadim Zeitlin
96308f0534 Use wxGtkObject RAII wrapper for GtkListStore
Prefer RAII wrapper class to manual g_object_unref() calls.
2018-01-27 00:24:58 +01:00
Vadim Zeitlin
f354b0a1b5 Remove almost unused GetEntryCompletion() function
This function was now used only once and it's not really useful to have
a trivial wrapper around the corresponding GTK+ function, just use it
directly.
2018-01-27 00:23:59 +01:00
Vadim Zeitlin
6f229cdcde Replace DoRefresh() with UseModel() helper function
The new function both sets the new model and calls
gtk_entry_completion_complete() instead of always doing first the one
and then the other: if both calls needs to always be done together, it
makes sense to have a function doing both of them.
2018-01-27 00:22:25 +01:00
Vadim Zeitlin
9b9d138077 Factor out helper AppendToStore() function
Simple refactoring to avoid repeating the same not quite obvious code
for appending an item to GtkListStore twice.
2018-01-27 00:20:33 +01:00
Vadim Zeitlin
8030bd727a Refactor wxTextAutoCompleteData creation
Use factory function instead of ctor and IsOk() check, as this
simplifies the code using this class: if factory function fails, it can
just return NULL, which is what the caller used to do explicitly after
freeing the new object before.

Also don't assert if there is no associated GtkEntry, AutoComplete() is
supposed to just return false if using it with the given control is not
implemented under the current platform.
2018-01-27 00:16:53 +01:00
Vadim Zeitlin
a8c19c7bd2 Just improve some comments
Fix typos/wording in GTK autocompletion code comments.

No real changes.
2018-01-27 00:15:24 +01:00
AliKet
18983cf538 Implement dynamic auto-completion for wxGTK
Make completion using custom wxTextCompleter work in wxGTK too.

Closes #18061.
2018-01-26 23:43:34 +01:00
Vadim Zeitlin
7d6b44687f Fix monolithic build with USE_STC=0
Don't add STC-related sources to MONOLIB_GUI_SRC unconditionally, as
this broke linking when specifying USE_STC=0 on make command line.

Closes #17895.
2018-01-26 23:38:01 +01:00
VZ
9554f878b2 Add support for using Direct2D in wxStyledTextCtrl
Use D2D if available, notably for better ligatures support.

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

Closes #17804.
2018-01-26 15:09:35 +01:00
Vadim Zeitlin
aaabe1cb17 Improve validate sample UI a bit
Provide an accelerator for the menu command which contains all of the
test functionality to make it simpler to test it.

Also use CreateButtonSizer() instead of creating wxStdDialogButtonSizer
manually to make the code shorter and to also ensure that the "OK"
button is correctly set up as the default one, allowing to press "Enter"
in this dialog to accept the entry on any control, which didn't work
before.
2018-01-26 14:39:57 +01:00
Vadim Zeitlin
b1e59a6d60 Add wxFloatingPointValidator::SetFactor()
This allows displaying values in percents (or also currency units and
subunits, for example) without changing the actually stored value.
2018-01-26 14:39:57 +01:00
Vadim Zeitlin
4e6763ccc2 Fix harmless unused parameter warning in wxSTC code
The recently added "technology" parameter is unused when Direct2D is not
used, avoid compiler complains about this.
2018-01-25 17:21:15 -06:00
Vadim Zeitlin
8d75368a30 Minor formatting and style fixes to the previous commit
Fix indentation and spacing.

Also declare some variables when initializing them and make them const
if they don't change later.
2018-01-25 17:18:27 -06:00
New Pagodi
df1456e4e2 Apply erans patch to allow building with MinGW 2018-01-25 16:08:33 -06:00
New Pagodi
b936bfe85e Add Direct2D support to wxSTC 2018-01-25 16:07:54 -06:00
Vadim Zeitlin
f836d430e9 Merge branch 'dvc-delete-all'
Fix crashes when deleting all items from wxTreeListCtrl in wxGTK3.

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

Closes #18045.
2018-01-25 19:39:55 +01:00
Vadim Zeitlin
ee0dd4edb1 Replace wxGTKCairoDCImpl::m_{width,height} with m_size
This allows to avoid initializing the variables to 0 in all the
overloaded ctors: wxSize default ctor already does it.

It's also more convenient to use GetScaledSize() rather than assigning
m_width and m_height separately, even if the rest of the code is broadly
unchanged.
2018-01-25 14:56:43 +01:00
Vadim Zeitlin
4c8e701d84 Remove wxGTKCairoDCImpl ctor taking dummy int
We can reuse another ctor taking wxWindow* instead. Although this does
require an ugly cast, it's more explicit than just passing 0 which
could, in principle, match both the ctor taking wxWindow* and another
one taking double, and so is still preferable.
2018-01-25 14:56:43 +01:00
Vadim Zeitlin
0be81cb34b Add wxGTKCairoDCImpl::SetSize() helper
Avoid repeating gdk_window_get_{width,height}() calls in several places.
2018-01-25 14:56:43 +01:00
Vadim Zeitlin
a1cb2eb12a Also return display DPI from wxScreenDC in wxGTK3
This is similar to the previous commit and is done for the same reasons:
screen DC needs to use the same DPI as the screen itself, instead of the
default Cairo 72 DPI.
2018-01-25 14:56:43 +01:00
Vadim Zeitlin
4ad1a3d969 Return display PPI from wxDC::GetPPI() in wxGTK3
For wxDC associated with a window, such as wx{Window,Client,Paint}DC,
this method should return the window PPI, not the hard coded 72 DPI of
Cairo graphics context.

This still doesn't work correctly when using multiple monitors with
different DPI settings, but is still a (modest) improvement.
2018-01-25 14:35:11 +01:00
Vadim Zeitlin
afe0e776b9 Remove confusing "base_type" typedef from wxGTK3 wxDC code
This typedef isn't really useful in base class initializer lists and it
wasn't really used anywhere else.
2018-01-25 14:32:49 +01:00
Lauri Nurmi
8bad0d4d58 Fix attribution in docs/changes.txt
Fix wrong attribution for the changes of
https://github.com/wxWidgets/wxWidgets/pull/552

A fix for 56323b5aba

See https://github.com/wxWidgets/wxWidgets/pull/684
2018-01-25 14:27:07 +01:00
Vadim Zeitlin
56511118d9 Merge branch 'cxx11-abi-fix'
Avoid ABI issues when building the library in C++98 mode and the
application using C++11 due to using different unordered containers.

Closes #18034.
2018-01-25 13:50:21 +01:00
Vadim Zeitlin
a9b44af251 Fix crash with wxDataViewVirtualListModel in generic wxDataViewCtrl
Recent sorting-related changes resulted in calling FindNode(), which
can only be used with the non-"virtual list" models, unconditionally,
after the items values was changed by user, resulting in a crash.

Add the missing IsVirtualList() check and also add a comment explicitly
stating that all code involving wxDataViewTreeNode can only be used
after checking that IsVirtualList() returns false.

Closes #18057.
2018-01-25 13:02:14 +01:00
Vadim Zeitlin
bdcf21a5bd Explicitly use libc++ in C++11 CMake macOS builds on Travis CI
Just using -DCMAKE_CXX_STANDARD=11 isn't enough, as it doesn't seem to
use C++11 for configuration checks, so set CMAKE_CXX_FLAGS explicitly
too.
2018-01-25 12:22:34 +01:00
Vadim Zeitlin
c7599c8ec0 Merge branch 'collpane-best-size'
Fix resizing of nested wxCollapsiblePanes in wxGTK.

See https://github.com/wxWidgets/wxWidgets/pull/681
2018-01-24 23:57:37 +01:00
Daniel Kulp
d8b3fc84c2 Fix sorting in generic wxDataViewCtrl broken by recent changes
The comparator used with std::sort() must return true only if the first
item is strictly less than the second one, this is a requirement of the
sorting algorithm and not respecting it results in wrong final order.

See https://github.com/wxWidgets/wxWidgets/pull/642
2018-01-24 23:40:37 +01:00
Vadim Zeitlin
ad03c8475d Revert "Fix crash when deleting all wxTreeListCtrl items with wxGTK3"
This reverts commit 1dd102d741 as it
introduced a crash in the same method when using generic wxDataViewCtrl
implementation, e.g. under MSW, and is not necessary to avoid the crash
with wxGTK3 any longer after the few previous commits.
2018-01-24 23:09:30 +01:00