diff --git a/common/widgets/lib_tree.cpp b/common/widgets/lib_tree.cpp index eff979f6d1..bd0dceba51 100644 --- a/common/widgets/lib_tree.cpp +++ b/common/widgets/lib_tree.cpp @@ -77,6 +77,7 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable, m_query_ctrl->Bind( wxEVT_SEARCHCTRL_CANCEL_BTN, &LIB_TREE::onQueryText, this ); #endif m_query_ctrl->Bind( wxEVT_CHAR_HOOK, &LIB_TREE::onQueryCharHook, this ); + m_query_ctrl->Bind( wxEVT_MOTION, &LIB_TREE::onQueryMouseMoved, this ); Bind( wxEVT_TIMER, &LIB_TREE::onDebounceTimer, this, m_debounceTimer->GetId() ); @@ -434,6 +435,21 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke ) } +void LIB_TREE::onQueryMouseMoved( wxMouseEvent& aEvent ) +{ + wxPoint pos = aEvent.GetPosition(); + wxRect ctrlRect = m_query_ctrl->GetScreenRect(); + int buttonWidth = ctrlRect.GetHeight(); // Presume buttons are square + + if( m_query_ctrl->IsSearchButtonVisible() && pos.x < buttonWidth ) + SetCursor( wxCURSOR_ARROW ); + else if( m_query_ctrl->IsCancelButtonVisible() && pos.x > ctrlRect.GetWidth() - buttonWidth ) + SetCursor( wxCURSOR_ARROW ); + else + SetCursor( wxCURSOR_IBEAM ); +} + + void LIB_TREE::onTreeSelect( wxDataViewEvent& aEvent ) { if( !m_tree_ctrl->IsFrozen() ) diff --git a/include/widgets/lib_tree.h b/include/widgets/lib_tree.h index 91e04cbb11..8b415399de 100644 --- a/include/widgets/lib_tree.h +++ b/include/widgets/lib_tree.h @@ -161,6 +161,7 @@ protected: void onQueryText( wxCommandEvent& aEvent ); void onQueryEnter( wxCommandEvent& aEvent ); void onQueryCharHook( wxKeyEvent& aEvent ); + void onQueryMouseMoved( wxMouseEvent& aEvent ); void onTreeSelect( wxDataViewEvent& aEvent ); void onTreeActivate( wxDataViewEvent& aEvent );