Commit 28795de6 authored by Antoine Cellerier's avatar Antoine Cellerier

* keyboard (arrows) navigation

parent 2eda18dc
...@@ -235,13 +235,12 @@ void CtrlTree::onPositionChange() ...@@ -235,13 +235,12 @@ void CtrlTree::onPositionChange()
} }
void CtrlTree::handleEvent( EvtGeneric &rEvent ) void CtrlTree::handleEvent( EvtGeneric &rEvent )
{ {
// TODO TODO FIXME TODO TODO
if( rEvent.getAsString().find( "key:down" ) != string::npos ) if( rEvent.getAsString().find( "key:down" ) != string::npos )
{ {
int key = ((EvtKey&)rEvent).getKey(); int key = ((EvtKey&)rEvent).getKey();
VarTree::Iterator it = m_rTree.begin(); VarTree::Iterator it;
bool previousWasSelected = false; bool previousWasSelected = false;
while( it != m_rTree.end() ) for( it = m_rTree.begin(); it != m_rTree.end(); )
{ {
VarTree::Iterator next = it; VarTree::Iterator next = it;
IT_DISP_LOOP_END( next ); IT_DISP_LOOP_END( next );
...@@ -281,25 +280,47 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent ) ...@@ -281,25 +280,47 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
} }
else if( key == KEY_RIGHT ) else if( key == KEY_RIGHT )
{ {
// Go down one level // Go down one level (and expand node)
if( it->m_expanded ) if( &*it == m_pLastSelected )
{ {
if( it->size() ) if( it->m_expanded )
{ {
/* FIXME : finir */ if( it->size() )
m_pLastSelected = &*(it->begin()); {
it->m_selected = false;
it->begin()->m_selected = true;
m_pLastSelected = &*(it->begin());
}
else
{
m_rTree.action( &*it );
}
}
else
{
it->m_expanded = true;
} }
}
else
{
it->m_expanded = true;
} }
} }
else if( key == KEY_LEFT ) else if( key == KEY_LEFT )
{ {
// Go up one level (and close node) // Go up one level (and close node)
// TODO if( &*it == m_pLastSelected )
it->m_expanded = false; {
if( it->m_expanded && it->size() )
{
it->m_expanded = false;
}
else
{
if( it->parent() && it->parent() != &m_rTree)
{
it->m_selected = false;
m_pLastSelected = it->parent();
m_pLastSelected->m_selected = true;
}
}
}
} }
it = next; it = next;
} }
...@@ -520,7 +541,6 @@ void CtrlTree::autoScroll() ...@@ -520,7 +541,6 @@ void CtrlTree::autoScroll()
void CtrlTree::makeImage() void CtrlTree::makeImage()
{ {
fprintf( stderr, "CtrlTree::makeImage()\n");
if( m_pImage ) if( m_pImage )
{ {
delete m_pImage; delete m_pImage;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment