allow vetoing wxEVT_COMMAND_LIST_COL_BEGIN_DRAG (backported from HEAD)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-04-11 19:08:41 +00:00
parent 5c80bed5e7
commit ae8b9dcc4a

View File

@@ -495,7 +495,9 @@ private:
// common part of all ctors // common part of all ctors
void Init(); void Init();
void SendListEvent(wxEventType type, wxPoint pos); // generate and process the list event of the given type, return true if
// it wasn't vetoed, i.e. if we should proceed
bool SendListEvent(wxEventType type, wxPoint pos);
DECLARE_DYNAMIC_CLASS(wxListHeaderWindow) DECLARE_DYNAMIC_CLASS(wxListHeaderWindow)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
@@ -2150,13 +2152,16 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
if (event.LeftDown() || event.RightUp()) if (event.LeftDown() || event.RightUp())
{ {
if (hit_border && event.LeftDown()) if (hit_border && event.LeftDown())
{
if ( SendListEvent(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG,
event.GetPosition()) )
{ {
m_isDragging = TRUE; m_isDragging = TRUE;
m_currentX = x; m_currentX = x;
DrawCurrent(); DrawCurrent();
CaptureMouse(); CaptureMouse();
SendListEvent(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, }
event.GetPosition()); //else: column resizing was vetoed by the user code
} }
else // click on a column else // click on a column
{ {
@@ -2191,7 +2196,7 @@ void wxListHeaderWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
m_owner->SetFocus(); m_owner->SetFocus();
} }
void wxListHeaderWindow::SendListEvent(wxEventType type, wxPoint pos) bool wxListHeaderWindow::SendListEvent(wxEventType type, wxPoint pos)
{ {
wxWindow *parent = GetParent(); wxWindow *parent = GetParent();
wxListEvent le( type, parent->GetId() ); wxListEvent le( type, parent->GetId() );
@@ -2205,7 +2210,7 @@ void wxListHeaderWindow::SendListEvent(wxEventType type, wxPoint pos)
le.m_pointDrag.y -= GetSize().y; le.m_pointDrag.y -= GetSize().y;
le.m_col = m_column; le.m_col = m_column;
parent->GetEventHandler()->ProcessEvent( le ); return !parent->GetEventHandler()->ProcessEvent( le ) || le.IsAllowed();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------