- Optionally allow showing tooltips for disabled ribbon buttons (wxBen).
- Add wxTL_NO_HEADER style to wxTreeListCtrl (robboto).
- Add possibility to delay showing wxRichToolTip (John Roberts).
+- Add "rect" paramerer to wxRichToolTip::ShowFor() (John Roberts).
wxGTK:
virtual void SetTipKind(wxTipKind tipKind);
virtual void SetTitleFont(const wxFont& font);
- virtual void ShowFor(wxWindow* win);
+ virtual void ShowFor(wxWindow* win, wxRect* rect = NULL);
protected:
wxString m_title,
virtual void SetTipKind(wxTipKind tipKind) = 0;
virtual void SetTitleFont(const wxFont& font) = 0;
- virtual void ShowFor(wxWindow* win) = 0;
+ virtual void ShowFor(wxWindow* win, wxRect* rect = NULL) = 0;
virtual ~wxRichToolTipImpl() { }
// or colour appropriate for the current platform.
void SetTitleFont(const wxFont& font);
- // Show the tooltip for the given window.
- void ShowFor(wxWindow* win);
+ // Show the tooltip for the given window and optionally a specified area.
+ void ShowFor(wxWindow* win, wxRect* rect = NULL);
// Non-virtual dtor as this class is not supposed to be derived from.
~wxRichToolTip();
void SetTitleFont(const wxFont& font);
/**
- Show the tooltip for the given window.
+ Show the tooltip for the given window and optionally specify where to
+ show the tooltip.
- The tooltip tip points to the (middle of the) specified window which
- must be non-@NULL.
+ By default the tooltip tip points to the (middle of the) specified
+ window which must be non-@NULL or, if @a rect is non-@NULL, the middle
+ of the specified wxRect.
Currently the native MSW implementation is used only if @a win is a
- wxTextCtrl. This limitation may be removed in the future.
+ wxTextCtrl and @a rect is @NULL. This limitation may be removed in the
+ future.
+
+ Parameter @a rect is new since wxWidgets 2.9.5.
*/
- void ShowFor(wxWindow* win);
+ void ShowFor(wxWindow* win, wxRect* rect = NULL);
/**
Destructor.
m_impl->SetTitleFont(font);
}
-void wxRichToolTip::ShowFor(wxWindow* win)
+void wxRichToolTip::ShowFor(wxWindow* win, wxRect* rect = NULL);
{
wxCHECK_RET( win, wxS("Must have a valid window") );
- m_impl->ShowFor(win);
+ m_impl->ShowFor(win, rect);
}
wxRichToolTip::~wxRichToolTip()
}
}
- void SetPosition()
+ void SetPosition(wxRect* rect)
{
- wxPoint pos = GetTipPoint();
+ wxPoint pos;
+
+ if ( !rect || rect->IsEmpty() )
+ pos = GetTipPoint();
+ else
+ pos = wxPoint( rect->x + rect->width / 2, rect->y + rect->height / 2 );
// We want our anchor point to coincide with this position so offset
// the position of the top left corner passed to Move() accordingly.
m_titleFont = font;
}
-void wxRichToolTipGenericImpl::ShowFor(wxWindow* win)
+void wxRichToolTipGenericImpl::ShowFor(wxWindow* win, wxRect* rect = NULL);
{
// Set the focus to the window the tooltip refers to to make it look active.
win->SetFocus();
popup->SetBackgroundColours(m_colStart, m_colEnd);
- popup->SetPosition();
+ popup->SetPosition(rect);
// show or start the timer to delay showing the popup
popup->SetTimeoutAndShow( m_timeout, m_delay );
}
wxRichToolTipGenericImpl::SetTitleFont(font);
}
- virtual void ShowFor(wxWindow* win)
+ virtual void ShowFor(wxWindow* win, wxRect* rect = NULL);
{
// TODO: We could use native tooltip control to show native balloon
// tooltips for any window but right now we use the simple
// EM_SHOWBALLOONTIP API which can only be used with text
// controls.
- if ( m_canUseNative )
+ if ( m_canUseNative && !rect )
{
wxTextCtrl* const text = wxDynamicCast(win, wxTextCtrl);
if ( text )
// Don't set m_canUseNative to false here, we could be able to use the
// native tooltips if we're called for a different window the next
// time.
- wxRichToolTipGenericImpl::ShowFor(win);
+ wxRichToolTipGenericImpl::ShowFor(win, rect);
}
private: