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
This commit is contained in:
@@ -472,6 +472,7 @@ All (GUI):
|
|||||||
- Added wxPersistentSplitter.
|
- Added wxPersistentSplitter.
|
||||||
- Added wxWebView library (Steven Lamerton & Auria, GSoC 2011 project).
|
- Added wxWebView library (Steven Lamerton & Auria, GSoC 2011 project).
|
||||||
- Derive wxAuiNotebook from wxBookCtrlBase (Steven Lamerton)
|
- Derive wxAuiNotebook from wxBookCtrlBase (Steven Lamerton)
|
||||||
|
- Fix tooltips in wxSearchCtrl and other composite controls (Catalin Raceanu).
|
||||||
|
|
||||||
OSX:
|
OSX:
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
// Purpose: wxCompositeWindow<> declaration
|
// Purpose: wxCompositeWindow<> declaration
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Created: 2011-01-02
|
// Created: 2011-01-02
|
||||||
// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
|
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include "wx/window.h"
|
#include "wx/window.h"
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_FWD_CORE wxToolTip;
|
||||||
|
|
||||||
// NB: This is an experimental and, as for now, undocumented class used only by
|
// NB: This is an experimental and, as for now, undocumented class used only by
|
||||||
// wxWidgets itself internally. Don't use it in your code until its API is
|
// wxWidgets itself internally. Don't use it in your code until its API is
|
||||||
// officially stabilized unless you are ready to change it with the next
|
// officially stabilized unless you are ready to change it with the next
|
||||||
@@ -59,7 +61,7 @@ public:
|
|||||||
if ( !BaseWindowClass::SetForegroundColour(colour) )
|
if ( !BaseWindowClass::SetForegroundColour(colour) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DoSetForAllParts(&wxWindowBase::SetForegroundColour, colour);
|
SetForAllParts(&wxWindowBase::SetForegroundColour, colour);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -69,7 +71,7 @@ public:
|
|||||||
if ( !BaseWindowClass::SetBackgroundColour(colour) )
|
if ( !BaseWindowClass::SetBackgroundColour(colour) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DoSetForAllParts(&wxWindowBase::SetBackgroundColour, colour);
|
SetForAllParts(&wxWindowBase::SetBackgroundColour, colour);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -79,7 +81,7 @@ public:
|
|||||||
if ( !BaseWindowClass::SetFont(font) )
|
if ( !BaseWindowClass::SetFont(font) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DoSetForAllParts(&wxWindowBase::SetFont, font);
|
SetForAllParts(&wxWindowBase::SetFont, font);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -89,18 +91,39 @@ public:
|
|||||||
if ( !BaseWindowClass::SetCursor(cursor) )
|
if ( !BaseWindowClass::SetCursor(cursor) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DoSetForAllParts(&wxWindowBase::SetCursor, cursor);
|
SetForAllParts(&wxWindowBase::SetCursor, cursor);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_TOOLTIPS
|
||||||
|
virtual void DoSetToolTip(wxToolTip *tip)
|
||||||
|
{
|
||||||
|
BaseWindowClass::DoSetToolTip(tip);
|
||||||
|
|
||||||
|
SetForAllParts(&wxWindowBase::CopyToolTip, tip);
|
||||||
|
}
|
||||||
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Must be implemented by the derived class to return all children to which
|
// Must be implemented by the derived class to return all children to which
|
||||||
// the public methods we override should forward to.
|
// the public methods we override should forward to.
|
||||||
virtual wxWindowList GetCompositeWindowParts() const = 0;
|
virtual wxWindowList GetCompositeWindowParts() const = 0;
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void DoSetForAllParts(bool (wxWindowBase::*func)(const T&), const T& arg)
|
void SetForAllParts(bool (wxWindowBase::*func)(const T&), const T& arg)
|
||||||
|
{
|
||||||
|
DoSetForAllParts<const T&>(func, arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void SetForAllParts(bool (wxWindowBase::*func)(T*), T* arg)
|
||||||
|
{
|
||||||
|
DoSetForAllParts<T*>(func, arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void DoSetForAllParts(bool (wxWindowBase::*func)(T), T arg)
|
||||||
{
|
{
|
||||||
// Simply call the setters for all parts of this composite window.
|
// Simply call the setters for all parts of this composite window.
|
||||||
const wxWindowList parts = GetCompositeWindowParts();
|
const wxWindowList parts = GetCompositeWindowParts();
|
||||||
|
Reference in New Issue
Block a user