Commit Graph

21 Commits

Author SHA1 Message Date
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
329af399eb Factor out wxCompositeWindowSettersOnly class
Extract this class from wxCompositeWindow, as sometimes it can be
convenient to just define the setter functions to do the right thing for
a window containing sub-windows, but without dealing with focus too.

This will be used in wxMSW wxStaticBox in the next commit.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
59ca9b93a0 Make wxCompositeWindow ctor protected
As this class is only supposed to be used as a base class, its ctor
doesn't need to be, and hence ought not to be, public.

Also update an outdated comment stating that the ctor didn't do anything
when it, in fact, does perform an important task.
2017-12-24 22:38:10 +01:00
Vadim Zeitlin
598c62a267 Don't change wxCompositeWindow size from SetLayoutDirection()
Remove wxSIZE_AUTO from the SetSize() call, this was completely
unnecessary and unexpectedly (and wrongly) resized composite windows
managed by sizers as SetLayoutDirection() side-effect.
2017-12-24 22:38:10 +01:00
Maarten
977a826639 use more wxOVERRIDE (#329) 2016-09-25 13:21:28 -07:00
Vadim Zeitlin
a2b0b8dbaa Handle updating tooltip text in wxCompositeWindow correctly.
While calling SetToolTip(wxToolTip*) overload already worked correctly for
wxCompositeWindow, using SetToolTip(wxString) did not if a tooltip already
existed, as it didn't use the virtual DoSetToolTip() in this case, resulting
in e.g. impossibility to update wxSpinCtrlDouble tooltip using this method.

Fix this by introducing DoSetToolTipText() virtual which is used by that
overload now and overriding it in wxCompositeWindow.

Also don't override DoSetToolTip() in wxSpinCtrlGenericBase any more, it is
not necessary as it's already done by its base class wxCompositeWindow.

Closes #16595.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-12-05 22:19:10 +00:00
Vadim Zeitlin
0465215157 Avoid calling SetSize() from wxCompositeWindow::Create() under wxGTK.
This was unexpected and resulted in a crash in the case of wxDatePickerCtrl.
And while this particular crash could be fixed just by checking for the
pointers validity in the overridden wxDatePickerCtrl::SetSize(), it seems
better to avoid such unexpected calls to SetSize(), especially as they only
happen under wxGTK, which calls SetLayoutDirection(wxLayout_Default) from its
wxWindow::Create(), and so wouldn't be found by any amount of testing under
other platforms.

Closes #16589.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77890 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-27 16:12:29 +00:00
Vadim Zeitlin
7172fdc01b Fix wxCompositeWindow compilation after the latest change.
SetSize() doesn't have any dependent parameters so call it via an explicit
"this->" to make it work with standard conforming compilers (and not MSVC).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-21 11:51:10 +00:00
Vadim Zeitlin
f24d204984 Update layout of wxCompositeWindow on layout direction change.
The children layout will almost always depend on the layout direction, so redo
it when the latter changes.

In particular, this fixes changing the layout of wxSpinCtrlDouble under MSW.

See #11583.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77756 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-21 01:41:27 +00:00
Vadim Zeitlin
0e722a20e7 Set layout direction for all wxCompositeWindow parts.
Forward SetLayoutDirection() to both the base class and all the children, just
as we already do for the other setters.

See #11583.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-10 16:51:51 +00:00
Vadim Zeitlin
dfb9976cc3 Simplify and make more flexible wxCompositeWindow::SetForAllParts().
Allow calling any function compatible with the argument type instead of
requiring "bool" return type and the exact match of the parameter type, which
forced us to define a separate DoSetForAllParts() helper.

See #11583.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-10 16:51:46 +00:00
Vadim Zeitlin
f4b80e5337 Remove MSVC6 support.
Don't support this compiler any more, this allows to get rid of tons of
MSVC6-specific workarounds, in particular we can now use Bind() and natural
template functions calls in the library code.

Also remove MSVC6 project and solution files and don't generate them when
bakefile_gen is ran any more (removing the remaining occurrences of msvc6prj
from the bakefiles results in weird bake-time errors, so it's simpler to just
leave them there).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-05-15 22:32:17 +00:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Václav Slavík
31af22fa2d Allow using wxCompositeWindow<T> as wxDataViewCtrl inline editor.
wxDVC inline editing code attaches some event handlers to the editor
control; most importantly, it watches for Enter key and for focus
changes. If the editor control is a composite window, these events occur
in a sub control and never reach wxDVC code.

Fix this by forwarding events to the main window of the composite
control. Only events required by wxDVC are implemented for now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69470 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-10-19 16:20:01 +00:00
Vadim Zeitlin
84ba6659ad Fix setting tooltips for wxSearchCtrl and other composite controls.
Propagate SetToolTip() call on wxCompositeWindow to all subwindows to ensure
that the tooltip is shown for all parts of the window.

Notice that this is still not ideal as the tooltip temporarily disappears when
mouse moves from one subwindow to another, instead of staying in place as it
does with "monolithic" windows and ideally we should find a way to avoid it
(should be possible at least under MSW with TTM_RELAYEVENT) but for now this
is already much better than nothing.

Closes #13523.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69286 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-10-02 11:28:54 +00:00
Vadim Zeitlin
162e221f76 Allow returning NULL windows from GetCompositeWindowParts().
wxCompositeWindow::GetCompositeWindowParts() becomes simpler to implement in
the derived classes with optionally shown elements if NULL windows are allowed
(and ignored) in the list returned by it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-08-27 12:13:18 +00:00
Vadim Zeitlin
00a73a8de6 Remove WXDLLIMPEXP_CORE from VC6 wxCompositeWindow declaration.
Hopefully not using WXDLLIMPEXP_CORE here should fix VC6 warnings about using
non dll-interface class as a base class for a dll-interface one.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66931 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-02-16 23:45:04 +00:00
Vadim Zeitlin
72f1a5d605 Disable wxCompositeWindow<> code for VC6.
Revert the attempt to work around VC6 bug from the last commit and simply
disable this code completely for VC6, it's not worth the trouble to try to fix
it for this compiler.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66582 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-01-04 21:33:16 +00:00
Vadim Zeitlin
5ed8e4e2e4 Attempt to make wxCompositeWindow<> compile with MSVC6.
Blind attempt to work around VC6 error about ambiguity between "const T&" and
"T" in DoSetForAllParts() template function.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66580 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-01-04 17:08:57 +00:00
Vadim Zeitlin
a1061906dd wxMSW compilation fix for wxCompositeWindow.
Not all ports override SetXXX() methods in their wxWindow class so use the
versions from wxWindowBase which are definitely known to exist. Notice that
the call itself is still virtual so it doesn't matter which base class do we
use.

Closes #12840.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-01-04 11:33:19 +00:00
Vadim Zeitlin
a9e41db760 Add wxCompositeWindow<> and use it in wxDatePickerCtrlGeneric.
wxCompositeWindow<> is a convenient base class for composite windows, i.e.
windows consisting of several other wxWindows. Currently it just automatically
forwards various attributes setters calls to all of the composite window parts
but it could become more useful in the future.

Similarly, for now it is only used in wxDatePickerCtrlGeneric but it could
(and should) be used for other composite controls later and we probably should
even make this class public to allow its use in the client code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-01-03 11:24:13 +00:00