wxTreeFindTimer( wxGenericTreeCtrl *owner ) { m_owner = owner; }
- virtual void Notify() { m_owner->m_findPrefix.clear(); }
+ virtual void Notify() { m_owner->ResetFindState(); }
private:
wxGenericTreeCtrl *m_owner;
m_renameTimer = NULL;
m_findTimer = NULL;
+ m_findBell = 0; // default is to not ring bell at all
m_dropEffectAboveItem = false;
delete m_imageListButtons;
}
+void wxGenericTreeCtrl::EnableBellOnNoMatch( bool on )
+{
+ m_findBell = on;
+}
+
// -----------------------------------------------------------------------------
// accessors
// -----------------------------------------------------------------------------
m_textCtrl = NULL;
}
+void wxGenericTreeCtrl::ResetFindState()
+{
+ m_findPrefix.clear();
+ if ( m_findBell )
+ m_findBell = 1;
+}
+
// find the first item starting with the given prefix after the given item
wxTreeItemId wxGenericTreeCtrl::FindItem(const wxTreeItemId& idParent,
const wxString& prefixOrig) const
{
itemid = GetNext(itemid);
}
- // If we haven't found the item, id.IsOk() will be false, as per
- // documentation
+ // If we haven't found the item but wrapped back to the one we started
+ // from, id.IsOk() must be false
+ if ( itemid == idParent )
+ {
+ itemid = wxTreeItemId();
+ }
}
return itemid;
if ( id.IsOk() )
{
SelectItem(id);
+
+ // Reset the bell flag if it had been temporarily disabled
+ // before.
+ if ( m_findBell )
+ m_findBell = 1;
+ }
+ else // No such item
+ {
+ // Signal it with a bell if enabled.
+ if ( m_findBell == 1 )
+ {
+ ::wxBell();
+
+ // Disable it for the next unsuccessful match, we only
+ // beep once, this is usually enough and continuing to
+ // do it would be annoying.
+ m_findBell = -1;
+ }
}
}
else
// question might just have been added and no screen
// update taken place.
if ( m_dirty )
-#if defined( __WXMSW__ ) || defined(__WXMAC__)
- Update();
-#else
DoDirtyProcessing();
-#endif
// TODO: use textCtrlClass here to create the control of correct class
m_textCtrl = new wxTreeTextCtrl(this, itemEdit);
wxTreeEvent
hevent(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, this, hoverItem);
+ // setting a tooltip upon leaving a view is getting the tooltip displayed
+ // on the neighbouring view ...
+#ifdef __WXOSX__
+ if ( event.Leaving() )
+ SetToolTip(NULL);
+ else
+#endif
if ( GetEventHandler()->ProcessEvent(hevent) )
{
// If the user permitted the tooltip change, update it, otherwise