From f210b1b521336232c87f77e03d312245b0e3673c Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sat, 1 Mar 2008 10:25:45 +0000 Subject: [PATCH] Patch for context menu event for generic/Windows code git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52212 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 9fcf58d70b..54baeb4de2 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -1148,7 +1148,7 @@ wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewRenderer *c SetFlags(flags); m_autosize = width < 0; // TODO - + Init(width < 0 ? wxDVC_DEFAULT_WIDTH : width); } @@ -3703,10 +3703,22 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) } // notify cell about right click - // cell->... + wxVariant value; + model->GetValue( value, item, col->GetModelColumn() ); + cell->SetValue( value ); + wxRect cell_rect( xpos, current * m_lineHeight, + col->GetWidth(), m_lineHeight ); + if (!cell->RightClick( event.GetPosition(), cell_rect, model, item, col->GetModelColumn())) + { + wxWindow *parent = GetParent(); + wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, parent->GetId()); + le.SetItem( item ); + le.SetEventObject(parent); + le.SetModel(GetOwner()->GetModel()); + le.SetValue(value); - // Allow generation of context menu event - event.Skip(); + parent->GetEventHandler()->ProcessEvent(le); + } } else if (event.MiddleDown()) {