propagate key event from listctrl to its parent
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1191,7 +1191,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
||||
long x = dc.DeviceToLogicalX( (long)event.GetX() );
|
||||
long y = dc.DeviceToLogicalY( (long)event.GetY() );
|
||||
|
||||
// Did we actually hit an item ?
|
||||
/* Did we actually hit an item ? */
|
||||
long hitResult = 0;
|
||||
wxNode *node = m_lines.First();
|
||||
wxListLineData *line = (wxListLineData *) NULL;
|
||||
@@ -1383,28 +1383,28 @@ void wxListMainWindow::OnArrowChar( wxListLineData *newCurrent, bool shiftDown )
|
||||
|
||||
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 = event.KeyCode();
|
||||
|
||||
wxWindow *parent = GetParent();
|
||||
le.SetEventObject( parent );
|
||||
wxEvtHandler *handler = parent->GetEventHandler();
|
||||
handler->ProcessEvent( le );
|
||||
parent->GetEventHandler()->ProcessEvent( le );
|
||||
|
||||
// pass the original CHAR event to the ctrl too
|
||||
handler->ProcessEvent( event );
|
||||
/* 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;
|
||||
|
||||
/*
|
||||
if (event.KeyCode() == WXK_TAB)
|
||||
{
|
||||
if (event.ShiftDown())
|
||||
TravPrev( &event );
|
||||
else
|
||||
TravNext( &event );
|
||||
return;
|
||||
}
|
||||
*/
|
||||
if ( !m_current )
|
||||
/* no item -> nothing to do */
|
||||
if (!m_current)
|
||||
{
|
||||
event.Skip();
|
||||
return;
|
||||
@@ -1439,7 +1439,10 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
||||
case WXK_PRIOR:
|
||||
{
|
||||
int steps = 0;
|
||||
if (m_mode & wxLC_REPORT) { steps = m_visibleLines-1; }
|
||||
if (m_mode & wxLC_REPORT)
|
||||
{
|
||||
steps = m_visibleLines-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int pos = 0;
|
||||
@@ -1455,7 +1458,10 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
||||
case WXK_NEXT:
|
||||
{
|
||||
int steps = 0;
|
||||
if (m_mode & wxLC_REPORT) { steps = m_visibleLines-1; }
|
||||
if (m_mode & wxLC_REPORT)
|
||||
{
|
||||
steps = m_visibleLines-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int pos = 0; wxNode *node = m_lines.First();
|
||||
@@ -1491,8 +1497,8 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
||||
{
|
||||
m_current->ReverseHilight();
|
||||
RefreshLine( m_current );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WXK_INSERT:
|
||||
{
|
||||
if (!(m_mode & wxLC_SINGLE_SEL))
|
||||
@@ -1507,8 +1513,8 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
||||
UnfocusLine( oldCurrent );
|
||||
FocusLine( m_current );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WXK_RETURN:
|
||||
case WXK_EXECUTE:
|
||||
{
|
||||
@@ -1517,8 +1523,8 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
||||
le.m_itemIndex = GetIndexOfLine( m_current );
|
||||
m_current->GetItem( 0, le.m_item );
|
||||
GetParent()->GetEventHandler()->ProcessEvent( le );
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
event.Skip();
|
||||
@@ -2721,7 +2727,6 @@ long wxListCtrl::InsertColumn( long col, const wxString &heading,
|
||||
item.m_mask |= wxLIST_MASK_WIDTH;
|
||||
item.m_width = width;
|
||||
}
|
||||
;
|
||||
item.m_format = format;
|
||||
|
||||
return InsertColumn( col, item );
|
||||
@@ -2794,8 +2799,11 @@ void wxListCtrl::SetBackgroundColour( const wxColour &colour )
|
||||
m_mainWin->SetBackgroundColour( colour );
|
||||
m_mainWin->m_dirty = TRUE;
|
||||
}
|
||||
|
||||
if (m_headerWin)
|
||||
{
|
||||
m_headerWin->SetBackgroundColour( colour );
|
||||
}
|
||||
}
|
||||
|
||||
void wxListCtrl::SetForegroundColour( const wxColour &colour )
|
||||
@@ -2805,8 +2813,11 @@ void wxListCtrl::SetForegroundColour( const wxColour &colour )
|
||||
m_mainWin->SetForegroundColour( colour );
|
||||
m_mainWin->m_dirty = TRUE;
|
||||
}
|
||||
|
||||
if (m_headerWin)
|
||||
{
|
||||
m_headerWin->SetForegroundColour( colour );
|
||||
}
|
||||
}
|
||||
|
||||
void wxListCtrl::SetFont( const wxFont &font )
|
||||
@@ -2816,7 +2827,10 @@ void wxListCtrl::SetFont( const wxFont &font )
|
||||
m_mainWin->SetFont( font );
|
||||
m_mainWin->m_dirty = TRUE;
|
||||
}
|
||||
|
||||
if (m_headerWin)
|
||||
{
|
||||
m_headerWin->SetFont( font );
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user