Allow expanding/collapsing items from keyboard in generic wxDVC

Add the usual handlers for '-', '+' and '*' keys. The last one is
especially convenient, as it does something that couldn't be easily done
at all interactively before.
This commit is contained in:
Vadim Zeitlin
2020-12-05 14:42:56 +01:00
parent d47fa718cd
commit a53e69beb0

View File

@@ -4612,7 +4612,27 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event )
case WXK_DOWN:
OnVerticalNavigation(event, +1);
break;
// Add the process for tree expanding/collapsing
case '+':
case WXK_ADD:
Expand(m_currentRow);
break;
case '*':
case WXK_MULTIPLY:
if ( !IsExpanded(m_currentRow) )
{
Expand(m_currentRow, true /* recursively */);
break;
}
//else: fall through to Collapse()
wxFALLTHROUGH;
case '-':
case WXK_SUBTRACT:
Collapse(m_currentRow);
break;
case WXK_LEFT:
OnLeftKey(event);
break;