+ if (m_mode & wxLC_SINGLE_SEL)
+ {
+ m_current = line;
+ HilightAll( FALSE );
+ m_current->ReverseHilight();
+ RefreshLine( m_current );
+ }
+ else
+ {
+ if (event.ShiftDown())
+ {
+ m_current = line;
+ m_current->ReverseHilight();
+ RefreshLine( m_current );
+ }
+ else if (event.ControlDown())
+ {
+ m_current = line;
+
+ int numOfCurrent = -1;
+ node = m_lines.First();
+ while (node)
+ {
+ wxListLineData *test_line = (wxListLineData*)node->Data();
+ numOfCurrent++;
+ if (test_line == oldCurrent) break;
+ node = node->Next();
+ }
+
+ int numOfLine = -1;
+ node = m_lines.First();
+ while (node)
+ {
+ wxListLineData *test_line = (wxListLineData*)node->Data();
+ numOfLine++;
+ if (test_line == line) break;
+ node = node->Next();
+ }
+
+ if (numOfLine < numOfCurrent)
+ {
+ int i = numOfLine;
+ numOfLine = numOfCurrent;
+ numOfCurrent = i;
+ }
+
+ wxNode *node = m_lines.Nth( numOfCurrent );
+ for (int i = 0; i <= numOfLine-numOfCurrent; i++)
+ {
+ wxListLineData *test_line= (wxListLineData*)node->Data();
+ test_line->Hilight(TRUE);
+ RefreshLine( test_line );
+ node = node->Next();
+ }
+ }
+ else
+ {
+ m_current = line;
+ HilightAll( FALSE );
+ m_current->ReverseHilight();
+ RefreshLine( m_current );
+ }
+ }
+ if (m_current != oldCurrent)
+ {
+ RefreshLine( oldCurrent );
+ UnfocusLine( oldCurrent );
+ FocusLine( m_current );
+ }
+ m_lastOnSame = (m_current == oldCurrent);
+ return;
+ }
+}
+
+void wxListMainWindow::MoveToFocus()
+{
+ if (!m_current) return;
+
+ int item_x = 0;
+ int item_y = 0;
+ int item_w = 0;
+ int item_h = 0;
+ m_current->GetExtent( item_x, item_y, item_w, item_h );
+
+ int client_w = 0;
+ int client_h = 0;
+ GetClientSize( &client_w, &client_h );
+
+ int view_x = m_xScroll*GetScrollPos( wxHORIZONTAL );
+ int view_y = m_yScroll*GetScrollPos( wxVERTICAL );
+
+ if (m_mode & wxLC_REPORT)
+ {
+ if (item_y-5 < view_y )
+ Scroll( -1, (item_y-5)/m_yScroll );
+ if (item_y+item_h+5 > view_y+client_h)
+ Scroll( -1, (item_y+item_h-client_h+15)/m_yScroll );
+ }
+ else
+ {
+ if (item_x-view_x < 5)
+ Scroll( (item_x-5)/m_xScroll, -1 );
+ if (item_x+item_w-5 > view_x+client_w)
+ Scroll( (item_x+item_w-client_w+15)/m_xScroll, -1 );
+ }
+}
+
+void wxListMainWindow::OnArrowChar( wxListLineData *newCurrent, bool shiftDown )
+{
+ if ((m_mode & wxLC_SINGLE_SEL) || (m_usedKeys == FALSE)) m_current->Hilight( FALSE );
+ wxListLineData *oldCurrent = m_current;
+ m_current = newCurrent;
+ if (shiftDown || (m_mode & wxLC_SINGLE_SEL)) m_current->Hilight( TRUE );
+ RefreshLine( m_current );
+ RefreshLine( oldCurrent );
+ FocusLine( m_current );
+ UnfocusLine( oldCurrent );
+ MoveToFocus();
+}
+
+void wxListMainWindow::OnKeyDown( wxKeyEvent &event )
+{
+ wxWindow *parent = GetParent();
+
+ /* we propagate the key event up */
+ wxKeyEvent ke( wxEVT_KEY_DOWN );
+ ke.m_shiftDown = event.m_shiftDown;
+ ke.m_controlDown = event.m_controlDown;
+ ke.m_altDown = event.m_altDown;
+ ke.m_metaDown = event.m_metaDown;
+ ke.m_keyCode = event.m_keyCode;
+ ke.m_x = event.m_x;
+ ke.m_y = event.m_y;
+ ke.SetEventObject( parent );
+ if (parent->GetEventHandler()->ProcessEvent( ke )) return;
+
+ event.Skip();
+}
+
+void wxListMainWindow::OnChar( wxKeyEvent &event )
+{
+ wxWindow *parent = GetParent();
+
+ /* we send a list_key event up */
+ wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
+ le.m_code = (int)event.KeyCode();
+ le.SetEventObject( parent );
+ parent->GetEventHandler()->ProcessEvent( le );
+
+ /* we propagate the char event up */
+ wxKeyEvent ke( wxEVT_CHAR );
+ ke.m_shiftDown = event.m_shiftDown;
+ ke.m_controlDown = event.m_controlDown;
+ ke.m_altDown = event.m_altDown;
+ ke.m_metaDown = event.m_metaDown;
+ ke.m_keyCode = event.m_keyCode;
+ ke.m_x = event.m_x;
+ ke.m_y = event.m_y;
+ ke.SetEventObject( parent );
+ if (parent->GetEventHandler()->ProcessEvent( ke )) return;
+
+ if (event.KeyCode() == WXK_TAB)
+ {
+ wxNavigationKeyEvent nevent;
+ nevent.SetDirection( !event.ShiftDown() );
+ nevent.SetEventObject( GetParent()->GetParent() );
+ nevent.SetCurrentFocus( m_parent );
+ if (GetParent()->GetParent()->GetEventHandler()->ProcessEvent( nevent )) return;