X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/121a3581d3545e8eadcb3c8bec31dd507132e83f..72195a0fd23def9b31434ca8de4805b4a6db730f:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 2ed58de9aa..c64f7e4229 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -685,7 +685,7 @@ wxListHeaderWindow::wxListHeaderWindow( void ) m_owner = (wxListMainWindow *) NULL; m_currentCursor = (wxCursor *) NULL; m_resizeCursor = (wxCursor *) NULL; - m_isDraging = FALSE; + m_isDragging = FALSE; } wxListHeaderWindow::wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner, @@ -697,7 +697,8 @@ wxListHeaderWindow::wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMain // m_currentCursor = wxSTANDARD_CURSOR; m_currentCursor = (wxCursor *) NULL; m_resizeCursor = new wxCursor( wxCURSOR_SIZEWE ); - m_isDraging = FALSE; + m_isDragging = FALSE; + SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) ); } wxListHeaderWindow::~wxListHeaderWindow( void ) @@ -780,7 +781,7 @@ void wxListHeaderWindow::DrawCurrent() m_owner->ClientToScreen( &x2, &y2 ); wxScreenDC dc; - dc.SetLogicalFunction( wxXOR ); + dc.SetLogicalFunction( wxINVERT ); dc.SetPen( wxPen( *wxBLACK, 2, wxSOLID ) ); dc.SetBrush( *wxTRANSPARENT_BRUSH ); @@ -796,13 +797,13 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event ) { int x = event.GetX(); int y = event.GetY(); - if (m_isDraging) + if (m_isDragging) { DrawCurrent(); if (event.ButtonUp()) { ReleaseMouse(); - m_isDraging = FALSE; + m_isDragging = FALSE; m_owner->SetColumnWidth( m_column, m_currentX-m_minX ); } else @@ -837,7 +838,7 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event ) if (event.LeftDown() && hit_border) { - m_isDraging = TRUE; + m_isDragging = TRUE; m_currentX = x; DrawCurrent(); CaptureMouse(); @@ -942,6 +943,7 @@ BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledWindow) EVT_SIZE (wxListMainWindow::OnSize) EVT_MOUSE_EVENTS (wxListMainWindow::OnMouse) EVT_CHAR (wxListMainWindow::OnChar) + EVT_KEY_DOWN (wxListMainWindow::OnKeyDown) EVT_SET_FOCUS (wxListMainWindow::OnSetFocus) EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus) END_EVENT_TABLE() @@ -1381,6 +1383,25 @@ void wxListMainWindow::OnArrowChar( wxListLineData *newCurrent, bool shiftDown ) UnfocusLine( oldCurrent ); } +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(); @@ -1391,8 +1412,8 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) le.SetEventObject( parent ); parent->GetEventHandler()->ProcessEvent( le ); - /* we propagate the key event up */ - wxKeyEvent ke( wxEVT_KEY_DOWN ); + /* 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; @@ -1403,6 +1424,14 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) ke.SetEventObject( parent ); if (parent->GetEventHandler()->ProcessEvent( ke )) return; + if (event.KeyCode() == WXK_TAB) + { + wxNavigationKeyEvent nevent; + nevent.SetDirection( !event.ShiftDown() ); + nevent.SetCurrentFocus( m_parent ); + if (m_parent->GetEventHandler()->ProcessEvent( nevent )) return; + } + /* no item -> nothing to do */ if (!m_current) { @@ -1760,7 +1789,7 @@ void wxListMainWindow::SetItemState( long item, long state, long stateMask ) m_current = line; FocusLine( m_current ); RefreshLine( m_current ); - RefreshLine( oldCurrent ); + if (oldCurrent) RefreshLine( oldCurrent ); } } @@ -1778,9 +1807,9 @@ void wxListMainWindow::SetItemState( long item, long state, long stateMask ) UnfocusLine( m_current ); m_current = line; FocusLine( m_current ); - oldCurrent->Hilight( FALSE ); + if (oldCurrent) oldCurrent->Hilight( FALSE ); RefreshLine( m_current ); - RefreshLine( oldCurrent ); + if (oldCurrent) RefreshLine( oldCurrent ); } bool on = state & wxLIST_STATE_SELECTED; if (on != line->IsHilighted()) @@ -2809,7 +2838,7 @@ bool wxListCtrl::SetBackgroundColour( const wxColour &colour ) if (m_headerWin) { - m_headerWin->SetBackgroundColour( colour ); +// m_headerWin->SetBackgroundColour( colour ); } return TRUE;