Added sending of column dragging events to the generic wxListCtrl.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14932 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2002-04-03 20:26:29 +00:00
parent 8f69665389
commit a77ec46ddc

View File

@ -473,6 +473,8 @@ private:
// common part of all ctors // common part of all ctors
void Init(); void Init();
void SendListEvent(wxEventType type, wxPoint pos);
DECLARE_DYNAMIC_CLASS(wxListHeaderWindow) DECLARE_DYNAMIC_CLASS(wxListHeaderWindow)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@ -1983,6 +1985,9 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
if (m_isDragging) if (m_isDragging)
{ {
SendListEvent(wxEVT_COMMAND_LIST_COL_DRAGGING,
event.GetPosition());
// we don't draw the line beyond our window, but we allow dragging it // we don't draw the line beyond our window, but we allow dragging it
// there // there
int w = 0; int w = 0;
@ -2000,6 +2005,8 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
m_isDragging = FALSE; m_isDragging = FALSE;
m_dirty = TRUE; m_dirty = TRUE;
m_owner->SetColumnWidth( m_column, m_currentX - m_minX ); m_owner->SetColumnWidth( m_column, m_currentX - m_minX );
SendListEvent(wxEVT_COMMAND_LIST_COL_END_DRAG,
event.GetPosition());
} }
else else
{ {
@ -2056,25 +2063,15 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
m_currentX = x; m_currentX = x;
DrawCurrent(); DrawCurrent();
CaptureMouse(); CaptureMouse();
SendListEvent(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG,
event.GetPosition());
} }
else // click on a column else // click on a column
{ {
wxWindow *parent = GetParent(); SendListEvent( event.LeftDown()
wxListEvent le( event.LeftDown()
? wxEVT_COMMAND_LIST_COL_CLICK ? wxEVT_COMMAND_LIST_COL_CLICK
: wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, : wxEVT_COMMAND_LIST_COL_RIGHT_CLICK,
parent->GetId() ); event.GetPosition());
le.SetEventObject( parent );
le.m_pointDrag = event.GetPosition();
// the position should be relative to the parent window, not
// this one for compatibility with MSW and common sense: the
// user code doesn't know anything at all about this header
// window, so why should it get positions relative to it?
le.m_pointDrag.y -= GetSize().y;
le.m_col = m_column;
parent->GetEventHandler()->ProcessEvent( le );
} }
} }
else if (event.Moving()) else if (event.Moving())
@ -2102,6 +2099,23 @@ void wxListHeaderWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
m_owner->SetFocus(); m_owner->SetFocus();
} }
void wxListHeaderWindow::SendListEvent(wxEventType type, wxPoint pos)
{
wxWindow *parent = GetParent();
wxListEvent le( type, parent->GetId() );
le.SetEventObject( parent );
le.m_pointDrag = pos;
// the position should be relative to the parent window, not
// this one for compatibility with MSW and common sense: the
// user code doesn't know anything at all about this header
// window, so why should it get positions relative to it?
le.m_pointDrag.y -= GetSize().y;
le.m_col = m_column;
parent->GetEventHandler()->ProcessEvent( le );
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxListRenameTimer (internal) // wxListRenameTimer (internal)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------