X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f029f1d15b04dd70522008cdf105be87140fabc6..ad20c567c2cd1a315bd1b5b35180d0f43c682c75:/src/generic/datavgen.cpp diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 9fcf58d70b..b509ac317d 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -63,7 +63,10 @@ static const int EXPANDER_MARGIN = 4; // wxDataViewHeaderWindow //----------------------------------------------------------------------------- -#define USE_NATIVE_HEADER_WINDOW 1 +// on wxMSW the header window (only that part however) can be made native! +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #define USE_NATIVE_HEADER_WINDOW +#endif //Below is the compare stuff //For the generic implements, both the leaf nodes and the nodes are sorted for fast search when needed @@ -109,8 +112,7 @@ protected: void SendEvent(wxEventType type, unsigned int n); }; -// on wxMSW the header window (only that part however) can be made native! -#if defined(__WXMSW__) && USE_NATIVE_HEADER_WINDOW +#ifdef USE_NATIVE_HEADER_WINDOW #define COLUMN_WIDTH_OFFSET 2 #define wxDataViewHeaderWindowMSW wxDataViewHeaderWindow @@ -1148,7 +1150,7 @@ wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewRenderer *c SetFlags(flags); m_autosize = width < 0; // TODO - + Init(width < 0 ? wxDVC_DEFAULT_WIDTH : width); } @@ -1265,7 +1267,7 @@ void wxDataViewHeaderWindowBase::SendEvent(wxEventType type, unsigned int n) parent->GetEventHandler()->ProcessEvent(le); } -#if defined(__WXMSW__) && USE_NATIVE_HEADER_WINDOW +#ifdef USE_NATIVE_HEADER_WINDOW #ifndef HDS_DRAGDROP #define HDS_DRAGDROP 0x0040 @@ -1968,10 +1970,10 @@ wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID i SetBackgroundStyle(wxBG_STYLE_CUSTOM); - m_penRule = wxPen(GetRuleColour(), 1, wxSOLID); + m_penRule = wxPen(GetRuleColour()); //Here I compose a pen can draw black lines, maybe there are something system colour to use - m_penExpander = wxPen( wxColour(0,0,0), 1, wxSOLID ); + m_penExpander = wxPen(wxColour(0,0,0)); //Some new added code to deal with the tree structure m_root = new wxDataViewTreeNode( NULL ); m_root->SetHasChildren(true); @@ -3703,10 +3705,22 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) } // notify cell about right click - // cell->... - - // Allow generation of context menu event - event.Skip(); + 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); + + parent->GetEventHandler()->ProcessEvent(le); + } } else if (event.MiddleDown()) {