GWEN improvement: allow to navigate TreeControl and ComboBox using the cursor keys

This commit is contained in:
erwin coumans
2013-07-01 23:43:49 -07:00
parent 898f423f95
commit 0f78c696b5
14 changed files with 458 additions and 17 deletions

View File

@@ -176,11 +176,13 @@ bool ComboBox::OnKeyUp( bool bDown )
{
if ( bDown )
{
Base::List::reverse_iterator it = std::find( m_Menu->Children.rbegin(), m_Menu->Children.rend(), m_SelectedItem );
if ( it != m_Menu->Children.rend() && ( ++it != m_Menu->Children.rend() ) )
Base::List & children = m_Menu->GetChildren();
Base::List::reverse_iterator it = std::find( children.rbegin(), children.rend(), m_SelectedItem );
if ( it != children.rend() && ( ++it != children.rend() ) )
{
Base* pUpElement = *it;
OnItemSelected(pUpElement);
OnItemSelected( pUpElement );
}
}
return true;
@@ -189,11 +191,13 @@ bool ComboBox::OnKeyDown( bool bDown )
{
if ( bDown )
{
Base::List::iterator it = std::find( m_Menu->Children.begin(), m_Menu->Children.end(), m_SelectedItem );
if ( it != m_Menu->Children.end() && ( ++it != m_Menu->Children.end() ) )
Base::List & children = m_Menu->GetChildren();
Base::List::iterator it = std::find( children.begin(), children.end(), m_SelectedItem );
if ( it != children.end() && ( ++it != children.end() ) )
{
Base* pDownElement = *it;
OnItemSelected(pDownElement);
OnItemSelected( pDownElement );
}
}
return true;