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

* keyboard (arrows) navigation

parent 2eda18dc
......@@ -235,13 +235,12 @@ void CtrlTree::onPositionChange()
}
void CtrlTree::handleEvent( EvtGeneric &rEvent )
{
// TODO TODO FIXME TODO TODO
if( rEvent.getAsString().find( "key:down" ) != string::npos )
{
int key = ((EvtKey&)rEvent).getKey();
VarTree::Iterator it = m_rTree.begin();
VarTree::Iterator it;
bool previousWasSelected = false;
while( it != m_rTree.end() )
for( it = m_rTree.begin(); it != m_rTree.end(); )
{
VarTree::Iterator next = it;
IT_DISP_LOOP_END( next );
......@@ -281,26 +280,48 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
}
else if( key == KEY_RIGHT )
{
// Go down one level
// Go down one level (and expand node)
if( &*it == m_pLastSelected )
{
if( it->m_expanded )
{
if( it->size() )
{
/* FIXME : finir */
it->m_selected = false;
it->begin()->m_selected = true;
m_pLastSelected = &*(it->begin());
}
else
{
m_rTree.action( &*it );
}
}
else
{
it->m_expanded = true;
}
}
}
else if( key == KEY_LEFT )
{
// Go up one level (and close node)
// TODO
if( &*it == m_pLastSelected )
{
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;
}
......@@ -520,7 +541,6 @@ void CtrlTree::autoScroll()
void CtrlTree::makeImage()
{
fprintf( stderr, "CtrlTree::makeImage()\n");
if( 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