From 24d705907ddcbe8e701867be2fb6f457a3dfab6f Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Sun, 13 Jun 2004 23:17:00 +0000
Subject: [PATCH] Added event table macros to wxGrid that take window
 identifiers

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27777 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/changes.txt          |  2 ++
 docs/latex/wx/grid.tex    |  7 +++++++
 docs/latex/wx/gridevt.inc | 13 +++++++++++++
 docs/latex/wx/gridevt.tex |  7 +++++++
 include/wx/generic/grid.h | 17 +++++++++++++++++
 5 files changed, 46 insertions(+)

diff --git a/docs/changes.txt b/docs/changes.txt
index e6a0a034f2..f8978bcd3d 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -109,6 +109,8 @@ All (GUI):
 - added wxTaskBarIcon::CreatePopupMenu which is now recommended way
   of showing popup menu; calling wxTaskBarIcon::PopupMenu directly
   is discouraged
+- Added ..._CMD_... variants for wxGrid event table entry macros
+  taking window identifiers
 
 Unix:
 
diff --git a/docs/latex/wx/grid.tex b/docs/latex/wx/grid.tex
index 5e71f9d45c..98789a2df3 100644
--- a/docs/latex/wx/grid.tex
+++ b/docs/latex/wx/grid.tex
@@ -40,27 +40,34 @@ There are presently no specific window styles for wxGrid.
 
 The event handler for the following functions takes a 
  \helpref{wxGridSizeEvent}{wxgridsizeevent} parameter.
+The ...\_CMD\_... variants also take a window identifier.
 
 \twocolwidtha{7cm}
 \begin{twocollist}\itemsep=0pt
 \twocolitem{{\bf EVT\_GRID\_COL\_SIZE(func)}}{The user resized a column by dragging it. Processes a wxEVT\_GRID\_COL\_SIZE.}
 \twocolitem{{\bf EVT\_GRID\_ROW\_SIZE(func)}}{The user resized a row by dragging it. Processes a wxEVT\_GRID\_ROW\_SIZE.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_COL\_SIZE(func)}}{The user resized a column by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_COL\_SIZE.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_ROW\_SIZE(func)}}{The user resized a row by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_ROW\_SIZE.}
 \end{twocollist}%
 
 The event handler for the following functions takes a 
  \helpref{wxGridRangeSelectEvent}{wxgridrangeselectevent} parameter.
+The ...\_CMD\_... variant also takes a window identifier.
 
 \twocolwidtha{7cm}
 \begin{twocollist}\itemsep=0pt
 \twocolitem{{\bf EVT\_GRID\_RANGE\_SELECT(func)}}{The user selected a group of contiguous cells. Processes a wxEVT\_GRID\_RANGE\_SELECT.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_RANGE\_SELECT(id, func)}}{The user selected a group of contiguous cells; variant taking a window identifier. Processes a wxEVT\_GRID\_RANGE\_SELECT.}
 \end{twocollist}%
 
 The event handler for the following functions takes a 
  \helpref{wxGridEditorCreatedEvent}{wxgrideditorcreatedevent} parameter.
+The ...\_CMD\_... variant also takes a window identifier.
 
 \twocolwidtha{7cm}
 \begin{twocollist}\itemsep=0pt
 \twocolitem{{\bf EVT\_GRID\_EDITOR\_CREATED(func)}}{The editor for a cell was created. Processes a wxEVT\_GRID\_EDITOR\_CREATED.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_EDITOR\_CREATED(id, func)}}{The editor for a cell was created; variant taking a window identifier. Processes a wxEVT\_GRID\_EDITOR\_CREATED.}
 \end{twocollist}%
 
 \wxheading{See also}
diff --git a/docs/latex/wx/gridevt.inc b/docs/latex/wx/gridevt.inc
index b5121b20c2..25c9ff1e0b 100644
--- a/docs/latex/wx/gridevt.inc
+++ b/docs/latex/wx/gridevt.inc
@@ -1,4 +1,5 @@
 The event handler for the following functions takes a \helpref{wxGridEvent}{wxgridevent} parameter.
+The ...\_CMD\_... variants also take a window identifier.
 
 \twocolwidtha{7cm}
 \begin{twocollist}\itemsep=0pt
@@ -14,5 +15,17 @@ The event handler for the following functions takes a \helpref{wxGridEvent}{wxgr
 \twocolitem{{\bf EVT\_GRID\_SELECT\_CELL(func)}}{The user moved to, and selected a cell. Processes a wxEVT\_GRID\_SELECT\_CELL.}
 \twocolitem{{\bf EVT\_GRID\_EDITOR\_HIDDEN(func)}}{The editor for a cell was hidden. Processes a wxEVT\_GRID\_EDITOR\_HIDDEN.}
 \twocolitem{{\bf EVT\_GRID\_EDITOR\_SHOWN(func)}}{The editor for a cell was shown. Processes a wxEVT\_GRID\_EDITOR\_SHOWN.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_CELL\_LEFT\_CLICK(id, func)}}{The user clicked a cell with the left mouse button; variant taking a window identifier. Processes a wxEVT\_GRID\_CELL\_LEFT\_CLICK.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_CELL\_RIGHT\_CLICK(id, func)}}{The user clicked a cell with the right mouse button; variant taking a window identifier. Processes a wxEVT\_GRID\_CELL\_RIGHT\_CLICK.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_CELL\_LEFT\_DCLICK(id, func)}}{The user double-clicked a cell with the left mouse button; variant taking a window identifier. Processes a wxEVT\_GRID\_CELL\_LEFT\_DCLICK.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_CELL\_RIGHT\_DCLICK(id, func)}}{The user double-clicked a cell with the right mouse button; variant taking a window identifier. Processes a wxEVT\_GRID\_CELL\_RIGHT\_DCLICK.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_LABEL\_LEFT\_CLICK(id, func)}}{The user clicked a label with the left mouse button; variant taking a window identifier. Processes a wxEVT\_GRID\_LABEL\_LEFT\_CLICK.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_LABEL\_RIGHT\_CLICK(id, func)}}{The user clicked a label with the right mouse button; variant taking a window identifier. Processes a wxEVT\_GRID\_LABEL\_RIGHT\_CLICK.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_LABEL\_LEFT\_DCLICK(id, func)}}{The user double-clicked a label with the left mouse button; variant taking a window identifier. Processes a wxEVT\_GRID\_LABEL\_LEFT\_DCLICK.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_LABEL\_RIGHT\_DCLICK(id, func)}}{The user double-clicked a label with the right mouse button; variant taking a window identifier. Processes a wxEVT\_GRID\_LABEL\_RIGHT\_DCLICK.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_CELL\_CHANGE(id, func)}}{The user changed the data in a cell; variant taking a window identifier. Processes a wxEVT\_GRID\_CELL\_CHANGE.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_SELECT\_CELL(id, func)}}{The user moved to, and selected a cell; variant taking a window identifier. Processes a wxEVT\_GRID\_SELECT\_CELL.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_EDITOR\_HIDDEN(id, func)}}{The editor for a cell was hidden; variant taking a window identifier. Processes a wxEVT\_GRID\_EDITOR\_HIDDEN.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_EDITOR\_SHOWN(id, func)}}{The editor for a cell was shown; variant taking a window identifier. Processes a wxEVT\_GRID\_EDITOR\_SHOWN.}
 \end{twocollist}%
 
diff --git a/docs/latex/wx/gridevt.tex b/docs/latex/wx/gridevt.tex
index bbab71e4ed..0215e80977 100644
--- a/docs/latex/wx/gridevt.tex
+++ b/docs/latex/wx/gridevt.tex
@@ -10,10 +10,12 @@
 
 The event handler for the following functions takes a 
  \helpref{wxGridEditorCreatedEvent}{wxgrideditorcreatedevent} parameter.
+The ...\_CMD\_... variants also take a window identifier.
 
 \twocolwidtha{7cm}
 \begin{twocollist}\itemsep=0pt
 \twocolitem{{\bf EVT\_GRID\_EDITOR\_CREATED(func)}}{The editor for a cell was created. Processes a wxEVT\_GRID\_EDITOR\_CREATED.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_EDITOR\_CREATED(id, func)}}{The editor for a cell was created; variant taking a window identifier. Processes a wxEVT\_GRID\_EDITOR\_CREATED.}
 \end{twocollist}%
 
 \latexignore{\rtfignore{\wxheading{Members}}}
@@ -159,10 +161,12 @@ Returns true if the Shift key was down at the time of the event.
 
 The event handler for the following functions takes a 
  \helpref{wxGridRangeSelectEvent}{wxgridrangeselectevent} parameter.
+The ...\_CMD\_... variants also take a window identifier.
 
 \twocolwidtha{7cm}
 \begin{twocollist}\itemsep=0pt
 \twocolitem{{\bf EVT\_GRID\_RANGE\_SELECT(func)}}{The user selected a group of contiguous cells. Processes a wxEVT\_GRID\_RANGE\_SELECT.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_RANGE\_SELECT(func)}}{The user selected a group of contiguous cells; variant taking a window identifier. Processes a wxEVT\_GRID\_RANGE\_SELECT.}
 \end{twocollist}%
 
 \latexignore{\rtfignore{\wxheading{Members}}}
@@ -264,11 +268,14 @@ This event class contains information about a row/column resize event.
 
 The event handler for the following functions takes a 
  \helpref{wxGridSizeEvent}{wxgridsizeevent} parameter.
+The ...\_CMD\_... variants also take a window identifier.
 
 \twocolwidtha{7cm}
 \begin{twocollist}\itemsep=0pt
 \twocolitem{{\bf EVT\_GRID\_COL\_SIZE(func)}}{The user resized a column by dragging it. Processes a wxEVT\_GRID\_COL\_SIZE.}
 \twocolitem{{\bf EVT\_GRID\_ROW\_SIZE(func)}}{The user resized a row by dragging it. Processes a wxEVT\_GRID\_ROW\_SIZE.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_COL\_SIZE(func)}}{The user resized a column by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_COL\_SIZE.}
+\twocolitem{{\bf EVT\_GRID\_CMD\_ROW\_SIZE(func)}}{The user resized a row by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_ROW\_SIZE.}
 \end{twocollist}%
 
 \latexignore{\rtfignore{\wxheading{Members}}}
diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h
index 0f458be803..312c437467 100644
--- a/include/wx/generic/grid.h
+++ b/include/wx/generic/grid.h
@@ -2109,6 +2109,23 @@ typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreat
 #define EVT_GRID_EDITOR_HIDDEN(fn)       DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_HIDDEN,      -1, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
 #define EVT_GRID_EDITOR_CREATED(fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_CREATED,     -1, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEditorCreatedEventFunction, &fn ), NULL ),
 
+// The same as above but with the ability to specify an identifier
+#define EVT_GRID_CMD_CELL_LEFT_CLICK(id, fn)     DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_CLICK,    id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_CELL_RIGHT_CLICK(id, fn)    DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_CLICK,   id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_CELL_LEFT_DCLICK(id, fn)    DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_DCLICK,   id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_CELL_RIGHT_DCLICK(id, fn)   DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_DCLICK,  id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_LABEL_LEFT_CLICK(id, fn)    DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_CLICK,   id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_LABEL_RIGHT_CLICK(id, fn)   DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_CLICK,  id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_LABEL_LEFT_DCLICK(id, fn)   DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_DCLICK,  id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_LABEL_RIGHT_DCLICK(id, fn)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_ROW_SIZE(id, fn)            DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_ROW_SIZE,           id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridSizeEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_COL_SIZE(id, fn)            DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_COL_SIZE,           id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridSizeEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_RANGE_SELECT(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_RANGE_SELECT,       id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridRangeSelectEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_CELL_CHANGE(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_CHANGE,        id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_SELECT_CELL(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_SELECT_CELL,        id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_EDITOR_SHOWN(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_SHOWN,       id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_EDITOR_HIDDEN(id, fn)       DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_HIDDEN,      id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_EDITOR_CREATED(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_CREATED,     id, -1, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxGridEditorCreatedEventFunction, &fn ), NULL ),
 
 #if 0  // TODO: implement these ?  others ?
 
-- 
2.50.0

