Converted the virtual-methods-callbacks into real events, leaving the
original virtuals intact so as to not break any existing code. Needed for wxPython. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
#include "wx/panel.h"
|
#include "wx/panel.h"
|
||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
#include "wx/scrolbar.h"
|
#include "wx/scrolbar.h"
|
||||||
|
#include "wx/event.h"
|
||||||
|
|
||||||
#define wxGRID_DEFAULT_EDIT_WIDTH 300
|
#define wxGRID_DEFAULT_EDIT_WIDTH 300
|
||||||
#define wxGRID_DEFAULT_EDIT_HEIGHT 27
|
#define wxGRID_DEFAULT_EDIT_HEIGHT 27
|
||||||
@@ -40,8 +41,9 @@
|
|||||||
#define wxRIGHT 0x0800
|
#define wxRIGHT 0x0800
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define WXGENERIC_GRID_VERSION 0.4
|
#define WXGENERIC_GRID_VERSION 0.5
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxGridEvent;
|
||||||
class WXDLLEXPORT wxGridCell;
|
class WXDLLEXPORT wxGridCell;
|
||||||
class WXDLLEXPORT wxGenericGrid: public wxPanel
|
class WXDLLEXPORT wxGenericGrid: public wxPanel
|
||||||
{
|
{
|
||||||
@@ -148,17 +150,21 @@ class WXDLLEXPORT wxGenericGrid: public wxPanel
|
|||||||
virtual void OnSelectCellImplementation(wxDC *dc, int row, int col);
|
virtual void OnSelectCellImplementation(wxDC *dc, int row, int col);
|
||||||
|
|
||||||
virtual void OnSelectCell(int WXUNUSED(row), int WXUNUSED(col)) {};
|
virtual void OnSelectCell(int WXUNUSED(row), int WXUNUSED(col)) {};
|
||||||
|
virtual void _OnSelectCell(wxGridEvent& event);
|
||||||
|
|
||||||
// Override to create your own class of grid cell
|
// Override to create your own class of grid cell
|
||||||
virtual wxGridCell *OnCreateCell(void);
|
virtual wxGridCell *OnCreateCell(void);
|
||||||
|
virtual void _OnCreateCell(wxGridEvent& event);
|
||||||
|
|
||||||
// Override to change labels e.g. creation of grid, inserting/deleting a row/col.
|
// Override to change labels e.g. creation of grid, inserting/deleting a row/col.
|
||||||
// By default, auto-labels the grid.
|
// By default, auto-labels the grid.
|
||||||
virtual void OnChangeLabels(void);
|
virtual void OnChangeLabels(void);
|
||||||
|
virtual void _OnChangeLabels(wxGridEvent& event);
|
||||||
|
|
||||||
// Override to change the label of the edit field when selecting a cell
|
// Override to change the label of the edit field when selecting a cell
|
||||||
// By default, sets it to e.g. A12
|
// By default, sets it to e.g. A12
|
||||||
virtual void OnChangeSelectionLabel(void);
|
virtual void OnChangeSelectionLabel(void);
|
||||||
|
virtual void _OnChangeSelectionLabel(wxGridEvent& event);
|
||||||
|
|
||||||
// Override for event processing
|
// Override for event processing
|
||||||
virtual void OnCellChange(int WXUNUSED(row), int WXUNUSED(col)) {};
|
virtual void OnCellChange(int WXUNUSED(row), int WXUNUSED(col)) {};
|
||||||
@@ -167,6 +173,13 @@ class WXDLLEXPORT wxGenericGrid: public wxPanel
|
|||||||
virtual void OnLabelLeftClick(int WXUNUSED(row), int WXUNUSED(col), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(control), bool WXUNUSED(shift)) {};
|
virtual void OnLabelLeftClick(int WXUNUSED(row), int WXUNUSED(col), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(control), bool WXUNUSED(shift)) {};
|
||||||
virtual void OnLabelRightClick(int WXUNUSED(row), int WXUNUSED(col), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(control), bool WXUNUSED(shift)) {};
|
virtual void OnLabelRightClick(int WXUNUSED(row), int WXUNUSED(col), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(control), bool WXUNUSED(shift)) {};
|
||||||
|
|
||||||
|
virtual void _OnCellChange(wxGridEvent& event);
|
||||||
|
virtual void _OnCellLeftClick(wxGridEvent& event);
|
||||||
|
virtual void _OnCellRightClick(wxGridEvent& event);
|
||||||
|
virtual void _OnLabelLeftClick(wxGridEvent& event);
|
||||||
|
virtual void _OnLabelRightClick(wxGridEvent& event);
|
||||||
|
|
||||||
|
|
||||||
// Activation: call from wxFrame::OnActivate
|
// Activation: call from wxFrame::OnActivate
|
||||||
void OnActivate(bool active);
|
void OnActivate(bool active);
|
||||||
|
|
||||||
@@ -320,5 +333,58 @@ class WXDLLEXPORT wxGrid: public wxGenericGrid
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxGridEvent : public wxCommandEvent {
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxGridEvent)
|
||||||
|
public:
|
||||||
|
wxGridEvent()
|
||||||
|
: wxCommandEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1),
|
||||||
|
m_control(0), m_shift(0), m_cell(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
wxGridEvent(int id, wxEventType type, wxObject* obj,
|
||||||
|
int row=-1, int col=-1, int x=-1, int y=-1,
|
||||||
|
bool control=FALSE, bool shift=FALSE)
|
||||||
|
: wxCommandEvent(type, id), m_row(row), m_col(col), m_x(x), m_y(y),
|
||||||
|
m_control(control), m_shift(shift), m_cell(0)
|
||||||
|
{
|
||||||
|
SetEventObject(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int m_row;
|
||||||
|
int m_col;
|
||||||
|
int m_x;
|
||||||
|
int m_y;
|
||||||
|
bool m_control;
|
||||||
|
bool m_shift;
|
||||||
|
wxGridCell* m_cell;
|
||||||
|
};
|
||||||
|
|
||||||
|
const wxEventType wxEVT_GRID_SELECT_CELL = wxEVT_FIRST + 1575;
|
||||||
|
const wxEventType wxEVT_GRID_CREATE_CELL = wxEVT_FIRST + 1576;
|
||||||
|
const wxEventType wxEVT_GRID_CHANGE_LABELS = wxEVT_FIRST + 1577;
|
||||||
|
const wxEventType wxEVT_GRID_CHANGE_SEL_LABEL = wxEVT_FIRST + 1578;
|
||||||
|
const wxEventType wxEVT_GRID_CELL_CHANGE = wxEVT_FIRST + 1579;
|
||||||
|
const wxEventType wxEVT_GRID_CELL_LCLICK = wxEVT_FIRST + 1580;
|
||||||
|
const wxEventType wxEVT_GRID_CELL_RCLICK = wxEVT_FIRST + 1581;
|
||||||
|
const wxEventType wxEVT_GRID_LABEL_LCLICK = wxEVT_FIRST + 1582;
|
||||||
|
const wxEventType wxEVT_GRID_LABEL_RCLICK = wxEVT_FIRST + 1583;
|
||||||
|
|
||||||
|
|
||||||
|
typedef void (wxEvtHandler::*wxGridEventFunction)(wxGridEvent&);
|
||||||
|
|
||||||
|
#define EVT_GRID_SELECT_CELL(fn) { wxEVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||||
|
#define EVT_GRID_CREATE_CELL(fn) { wxEVT_GRID_CREATE_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||||
|
#define EVT_GRID_CHANGE_LABELS(fn) { wxEVT_GRID_CHANGE_LABELS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||||
|
#define EVT_GRID_CHANGE_SEL_LABEL(fn) { wxEVT_GRID_CHANGE_SEL_LABEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||||
|
#define EVT_GRID_CELL_CHANGE(fn) { wxEVT_GRID_CELL_CHANGE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||||
|
#define EVT_GRID_CELL_LCLICK(fn) { wxEVT_GRID_CELL_LCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||||
|
#define EVT_GRID_CELL_RCLICK(fn) { wxEVT_GRID_CELL_RCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||||
|
#define EVT_GRID_LABEL_LCLICK(fn) { wxEVT_GRID_LABEL_LCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||||
|
#define EVT_GRID_LABEL_RCLICK(fn) { wxEVT_GRID_LABEL_RCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
#define wxGRID_DRAG_UP_DOWN 2
|
#define wxGRID_DRAG_UP_DOWN 2
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel)
|
IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel)
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxGridEvent, wxEvent)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
|
BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
|
||||||
EVT_SIZE(wxGenericGrid::OnSize)
|
EVT_SIZE(wxGenericGrid::OnSize)
|
||||||
@@ -52,8 +53,23 @@ BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
|
|||||||
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
|
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
|
||||||
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
|
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
|
||||||
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
|
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
|
||||||
|
|
||||||
|
// default wxGridEvent handlers
|
||||||
|
EVT_GRID_SELECT_CELL(wxGenericGrid::_OnSelectCell)
|
||||||
|
EVT_GRID_CREATE_CELL(wxGenericGrid::_OnCreateCell)
|
||||||
|
EVT_GRID_CHANGE_LABELS(wxGenericGrid::_OnChangeLabels)
|
||||||
|
EVT_GRID_CHANGE_SEL_LABEL(wxGenericGrid::_OnChangeSelectionLabel)
|
||||||
|
EVT_GRID_CELL_CHANGE(wxGenericGrid::_OnCellChange)
|
||||||
|
EVT_GRID_CELL_LCLICK(wxGenericGrid::_OnCellLeftClick)
|
||||||
|
EVT_GRID_CELL_RCLICK(wxGenericGrid::_OnCellRightClick)
|
||||||
|
EVT_GRID_LABEL_LCLICK(wxGenericGrid::_OnLabelLeftClick)
|
||||||
|
EVT_GRID_LABEL_RCLICK(wxGenericGrid::_OnLabelRightClick)
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wxGenericGrid::wxGenericGrid(void)
|
wxGenericGrid::wxGenericGrid(void)
|
||||||
{
|
{
|
||||||
m_batchCount = 0;
|
m_batchCount = 0;
|
||||||
@@ -283,7 +299,10 @@ bool wxGenericGrid::CreateGrid(int nRows, int nCols, wxString **cellValues, shor
|
|||||||
for (j = 0; j < nCols; j++)
|
for (j = 0; j < nCols; j++)
|
||||||
if (cellValues)
|
if (cellValues)
|
||||||
{
|
{
|
||||||
m_gridCells[i][j] = OnCreateCell();
|
//m_gridCells[i][j] = OnCreateCell();
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CREATE_CELL, this, i, j);
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
m_gridCells[i][j] = g_evt.m_cell;
|
||||||
m_gridCells[i][j]->SetTextValue(cellValues[i][j]);
|
m_gridCells[i][j]->SetTextValue(cellValues[i][j]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -328,8 +347,13 @@ bool wxGenericGrid::CreateGrid(int nRows, int nCols, wxString **cellValues, shor
|
|||||||
|
|
||||||
AdjustScrollbars();
|
AdjustScrollbars();
|
||||||
|
|
||||||
OnChangeLabels();
|
//OnChangeLabels();
|
||||||
OnChangeSelectionLabel();
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CHANGE_LABELS, this);
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
|
||||||
|
//OnChangeSelectionLabel();
|
||||||
|
wxGridEvent g_evt2(GetId(), wxEVT_GRID_CHANGE_SEL_LABEL, this);
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt2);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -389,7 +413,10 @@ wxGridCell *wxGenericGrid::GetCell(int row, int col)
|
|||||||
wxGridCell *cell = m_gridCells[row][col];
|
wxGridCell *cell = m_gridCells[row][col];
|
||||||
if (!cell)
|
if (!cell)
|
||||||
{
|
{
|
||||||
m_gridCells[row][col] = OnCreateCell();
|
// m_gridCells[row][col] = OnCreateCell();
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CREATE_CELL, this, row, col);
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
m_gridCells[row][col] = g_evt.m_cell;
|
||||||
return m_gridCells[row][col];
|
return m_gridCells[row][col];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1181,11 +1208,22 @@ void wxGenericGrid::OnMouseEvent(wxMouseEvent& ev)
|
|||||||
if (CellHitTest((int)ev.GetX(), (int)ev.GetY(), &row, &col))
|
if (CellHitTest((int)ev.GetX(), (int)ev.GetY(), &row, &col))
|
||||||
{
|
{
|
||||||
OnSelectCellImplementation(& dc, row, col);
|
OnSelectCellImplementation(& dc, row, col);
|
||||||
OnCellLeftClick(row, col, (int)ev.GetX(), (int)ev.GetY(), ev.ControlDown(), ev.ShiftDown());
|
|
||||||
|
//OnCellLeftClick(row, col, (int)ev.GetX(), (int)ev.GetY(), ev.ControlDown(), ev.ShiftDown());
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CELL_LCLICK, this,
|
||||||
|
row, col, (int)ev.GetX(), (int)ev.GetY(),
|
||||||
|
ev.ControlDown(), ev.ShiftDown());
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (LabelHitTest((int)ev.GetX(), (int)ev.GetY(), &row, &col))
|
if (LabelHitTest((int)ev.GetX(), (int)ev.GetY(), &row, &col))
|
||||||
{
|
{
|
||||||
OnLabelLeftClick(row, col, (int)ev.GetX(), (int)ev.GetY(), ev.ControlDown(), ev.ShiftDown());
|
//OnLabelLeftClick(row, col, (int)ev.GetX(), (int)ev.GetY(), ev.ControlDown(), ev.ShiftDown());
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_LABEL_LCLICK, this,
|
||||||
|
row, col, (int)ev.GetX(), (int)ev.GetY(),
|
||||||
|
ev.ControlDown(), ev.ShiftDown());
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
|
||||||
}
|
}
|
||||||
dc.EndDrawing();
|
dc.EndDrawing();
|
||||||
}
|
}
|
||||||
@@ -1322,11 +1360,20 @@ void wxGenericGrid::OnMouseEvent(wxMouseEvent& ev)
|
|||||||
int row, col;
|
int row, col;
|
||||||
if (CellHitTest((int)ev.GetX(), (int)ev.GetY(), &row, &col))
|
if (CellHitTest((int)ev.GetX(), (int)ev.GetY(), &row, &col))
|
||||||
{
|
{
|
||||||
OnCellRightClick(row, col, (int)ev.GetX(), (int)ev.GetY(), ev.ControlDown(), ev.ShiftDown());
|
//OnCellRightClick(row, col, (int)ev.GetX(), (int)ev.GetY(), ev.ControlDown(), ev.ShiftDown());
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CELL_RCLICK, this,
|
||||||
|
row, col, (int)ev.GetX(), (int)ev.GetY(),
|
||||||
|
ev.ControlDown(), ev.ShiftDown());
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (LabelHitTest((int)ev.GetX(), (int)ev.GetY(), &row, &col))
|
if (LabelHitTest((int)ev.GetX(), (int)ev.GetY(), &row, &col))
|
||||||
{
|
{
|
||||||
OnLabelRightClick(row, col, (int)ev.GetX(), (int)ev.GetY(), ev.ControlDown(), ev.ShiftDown());
|
//OnLabelRightClick(row, col, (int)ev.GetX(), (int)ev.GetY(), ev.ControlDown(), ev.ShiftDown());
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_LABEL_RCLICK, this,
|
||||||
|
row, col, (int)ev.GetX(), (int)ev.GetY(),
|
||||||
|
ev.ControlDown(), ev.ShiftDown());
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1336,7 +1383,9 @@ void wxGenericGrid::OnSelectCellImplementation(wxDC *dc, int row, int col)
|
|||||||
m_wCursorColumn = col;
|
m_wCursorColumn = col;
|
||||||
m_wCursorRow = row;
|
m_wCursorRow = row;
|
||||||
|
|
||||||
OnChangeSelectionLabel();
|
//OnChangeSelectionLabel();
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CHANGE_SEL_LABEL, this);
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
|
||||||
SetGridClippingRegion(dc);
|
SetGridClippingRegion(dc);
|
||||||
|
|
||||||
@@ -1365,7 +1414,9 @@ void wxGenericGrid::OnSelectCellImplementation(wxDC *dc, int row, int col)
|
|||||||
#endif
|
#endif
|
||||||
dc->DestroyClippingRegion();
|
dc->DestroyClippingRegion();
|
||||||
|
|
||||||
OnSelectCell(row, col);
|
//OnSelectCell(row, col);
|
||||||
|
wxGridEvent g_evt2(GetId(), wxEVT_GRID_SELECT_CELL, this, row, col);
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt2);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridCell *wxGenericGrid::OnCreateCell(void)
|
wxGridCell *wxGenericGrid::OnCreateCell(void)
|
||||||
@@ -2120,8 +2171,12 @@ bool wxGenericGrid::InsertCols(int pos, int n, bool updateLabels)
|
|||||||
|
|
||||||
m_totalCols += n;
|
m_totalCols += n;
|
||||||
|
|
||||||
if (updateLabels)
|
if (updateLabels) {
|
||||||
OnChangeLabels();
|
//OnChangeLabels();
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CHANGE_LABELS, this);
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
}
|
||||||
|
|
||||||
UpdateDimensions();
|
UpdateDimensions();
|
||||||
AdjustScrollbars();
|
AdjustScrollbars();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -2183,8 +2238,12 @@ bool wxGenericGrid::InsertRows(int pos, int n, bool updateLabels)
|
|||||||
|
|
||||||
m_totalRows += n;
|
m_totalRows += n;
|
||||||
|
|
||||||
if (updateLabels)
|
if (updateLabels) {
|
||||||
OnChangeLabels();
|
//OnChangeLabels();
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CHANGE_LABELS, this);
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
}
|
||||||
|
|
||||||
UpdateDimensions();
|
UpdateDimensions();
|
||||||
AdjustScrollbars();
|
AdjustScrollbars();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -2243,8 +2302,11 @@ bool wxGenericGrid::DeleteRows(int pos, int n, bool updateLabels)
|
|||||||
|
|
||||||
m_totalRows -= n;
|
m_totalRows -= n;
|
||||||
|
|
||||||
if (updateLabels)
|
if (updateLabels){
|
||||||
OnChangeLabels();
|
//OnChangeLabels();
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CHANGE_LABELS, this);
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
}
|
||||||
UpdateDimensions();
|
UpdateDimensions();
|
||||||
AdjustScrollbars();
|
AdjustScrollbars();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -2296,8 +2358,11 @@ bool wxGenericGrid::DeleteCols(int pos, int n, bool updateLabels)
|
|||||||
|
|
||||||
m_totalCols -= n;
|
m_totalCols -= n;
|
||||||
|
|
||||||
if (updateLabels)
|
if (updateLabels) {
|
||||||
OnChangeLabels();
|
//OnChangeLabels();
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CHANGE_LABELS, this);
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
}
|
||||||
UpdateDimensions();
|
UpdateDimensions();
|
||||||
AdjustScrollbars();
|
AdjustScrollbars();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -2392,7 +2457,10 @@ void wxGenericGrid::OnText(wxCommandEvent& WXUNUSED(ev) )
|
|||||||
dc.DestroyClippingRegion();
|
dc.DestroyClippingRegion();
|
||||||
dc.EndDrawing();
|
dc.EndDrawing();
|
||||||
|
|
||||||
grid->OnCellChange(grid->GetCursorRow(), grid->GetCursorColumn());
|
//grid->OnCellChange(grid->GetCursorRow(), grid->GetCursorColumn());
|
||||||
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CELL_CHANGE, grid,
|
||||||
|
grid->GetCursorRow(), grid->GetCursorColumn());
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
|
||||||
// grid->DrawCellText();
|
// grid->DrawCellText();
|
||||||
}
|
}
|
||||||
@@ -2434,3 +2502,55 @@ void wxGenericGrid::OnGridScroll(wxScrollEvent& ev)
|
|||||||
inScroll = FALSE;
|
inScroll = FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// Default wxGridEvent handlers
|
||||||
|
// (just redirect to the pre-existing virtual methods)
|
||||||
|
|
||||||
|
void wxGenericGrid::_OnSelectCell(wxGridEvent& ev)
|
||||||
|
{
|
||||||
|
OnSelectCell(ev.m_row, ev.m_col);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGenericGrid::_OnCreateCell(wxGridEvent& ev)
|
||||||
|
{
|
||||||
|
ev.m_cell = OnCreateCell();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGenericGrid::_OnChangeLabels(wxGridEvent& ev)
|
||||||
|
{
|
||||||
|
OnChangeLabels();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGenericGrid::_OnChangeSelectionLabel(wxGridEvent& ev)
|
||||||
|
{
|
||||||
|
OnChangeSelectionLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGenericGrid::_OnCellChange(wxGridEvent& ev)
|
||||||
|
{
|
||||||
|
OnCellChange(ev.m_row, ev.m_col);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGenericGrid::_OnCellLeftClick(wxGridEvent& ev)
|
||||||
|
{
|
||||||
|
OnCellLeftClick(ev.m_row, ev.m_col, ev.m_x, ev.m_y, ev.m_control, ev.m_shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGenericGrid::_OnCellRightClick(wxGridEvent& ev)
|
||||||
|
{
|
||||||
|
OnCellRightClick(ev.m_row, ev.m_col, ev.m_x, ev.m_y, ev.m_control, ev.m_shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGenericGrid::_OnLabelLeftClick(wxGridEvent& ev)
|
||||||
|
{
|
||||||
|
OnLabelLeftClick(ev.m_row, ev.m_col, ev.m_x, ev.m_y, ev.m_control, ev.m_shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGenericGrid::_OnLabelRightClick(wxGridEvent& ev)
|
||||||
|
{
|
||||||
|
OnLabelRightClick(ev.m_row, ev.m_col, ev.m_x, ev.m_y, ev.m_control, ev.m_shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user