From 6af3eec22295e49c7f8d95efad9a9daf1376f162 Mon Sep 17 00:00:00 2001
From: Robert Roebling <robert@roebling.de>
Date: Sun, 16 Dec 2007 14:48:13 +0000
Subject: [PATCH] Add dataview context menu event definitions

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50745 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/dataviewctrl.tex  |  1 +
 docs/latex/wx/dataviewevent.tex |  7 +++++++
 include/wx/dataview.h           | 15 +++++++++++++--
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/docs/latex/wx/dataviewctrl.tex b/docs/latex/wx/dataviewctrl.tex
index e960313f5f..a363a7c721 100644
--- a/docs/latex/wx/dataviewctrl.tex
+++ b/docs/latex/wx/dataviewctrl.tex
@@ -61,6 +61,7 @@ macros to direct input to member functions that take a
 \twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_EXPANDING(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_EXPANDING event.}
 \twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_EXPANDED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_EXPANDED event.}
 \twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_VALUE\_CHANGED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_VALUE\_CHANGED event.}
+\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_CONTEXT\_MENU(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_CONTEXT\_MENU event.}
 \twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_CLICK(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_CLICKED event.}
 \twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICK(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICKED event.}
 \twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_SORTED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_SORTED event.}
diff --git a/docs/latex/wx/dataviewevent.tex b/docs/latex/wx/dataviewevent.tex
index 5a1973c844..49092a6970 100644
--- a/docs/latex/wx/dataviewevent.tex
+++ b/docs/latex/wx/dataviewevent.tex
@@ -61,6 +61,13 @@ the event was emitted or NULL.
 Returns the wxDataViewModel associated with the event.
 
 
+\membersection{wxDataViewEvent::GetPosition}\label{wxdatavieweventgetposition}
+
+\constfunc{wxPoint}{GetPosition}{\void}
+
+Returns a the position of a context menu event in screen coordinates.
+
+
 \membersection{wxDataViewEvent::GetValue}\label{wxdatavieweventgetvalue}
 
 \constfunc{const wxVariant\&}{GetValue}{\void}
diff --git a/include/wx/dataview.h b/include/wx/dataview.h
index 90d7a5e481..c4d5874937 100644
--- a/include/wx/dataview.h
+++ b/include/wx/dataview.h
@@ -677,7 +677,8 @@ public:
         m_col(-1),
         m_model(NULL),
         m_value(wxNullVariant),
-        m_column(NULL)
+        m_column(NULL),
+        m_pos(-1,-1)
         { }
 
     wxDataViewEvent(const wxDataViewEvent& event)
@@ -686,7 +687,8 @@ public:
         m_col(event.m_col),
         m_model(event.m_model),
         m_value(event.m_value),
-        m_column(event.m_column)
+        m_column(event.m_column),
+        m_pos(m_pos)
         { }
 
     wxDataViewItem GetItem() const { return m_item; }
@@ -704,6 +706,10 @@ public:
     // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
     void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; }
     wxDataViewColumn *GetDataViewColumn() const { return m_column; }
+    
+    // for wxEVT_DATAVIEW_CONTEXT_MENU only
+    wxPoint GetPosition() const;
+    void SetPosition( int x, int y ) { m_pos.x = x; m_pos.y = y; }
 
     virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); }
 
@@ -713,6 +719,7 @@ protected:
     wxDataViewModel    *m_model;
     wxVariant           m_value;
     wxDataViewColumn   *m_column;
+    wxPoint             m_pos;
 
 private:
     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent)
@@ -729,6 +736,8 @@ BEGIN_DECLARE_EVENT_TYPES()
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, -1)
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, -1)
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, -1)
+    
+    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, -1)
 
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, -1)
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, -1)
@@ -754,6 +763,8 @@ typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
 #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
 #define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
 
+#define EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_CONTEXT_MENU, id, fn)
+
 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
-- 
2.50.0

