pass ApplyEdit() arguments to EndEdit() too for better backwards compatibility (closes #10544)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59365 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -218,8 +218,10 @@ public:
|
|||||||
// new value in its string form in the newval output parameter.
|
// new value in its string form in the newval output parameter.
|
||||||
//
|
//
|
||||||
// This should also store the new value in its real type internally so that
|
// This should also store the new value in its real type internally so that
|
||||||
// it could be used by ApplyEdit().
|
// it could be used by ApplyEdit() but it must not modify the grid as the
|
||||||
virtual bool EndEdit(const wxString& oldval, wxString *newval) = 0;
|
// change could still be vetoed.
|
||||||
|
virtual bool EndEdit(int row, int col, const wxGrid *grid,
|
||||||
|
const wxString& oldval, wxString *newval) = 0;
|
||||||
|
|
||||||
// Complete the editing of the current cell by storing the value saved by
|
// Complete the editing of the current cell by storing the value saved by
|
||||||
// the previous call to EndEdit() in the grid
|
// the previous call to EndEdit() in the grid
|
||||||
|
@@ -63,7 +63,8 @@ public:
|
|||||||
|
|
||||||
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
||||||
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
||||||
virtual bool EndEdit(const wxString& oldval, wxString *newval);
|
virtual bool EndEdit(int row, int col, const wxGrid* grid,
|
||||||
|
const wxString& oldval, wxString *newval);
|
||||||
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
||||||
|
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
@@ -109,7 +110,8 @@ public:
|
|||||||
|
|
||||||
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
||||||
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
||||||
virtual bool EndEdit(const wxString& oldval, wxString *newval);
|
virtual bool EndEdit(int row, int col, const wxGrid* grid,
|
||||||
|
const wxString& oldval, wxString *newval);
|
||||||
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
||||||
|
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
@@ -164,7 +166,8 @@ public:
|
|||||||
|
|
||||||
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
||||||
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
||||||
virtual bool EndEdit(const wxString& oldval, wxString *newval);
|
virtual bool EndEdit(int row, int col, const wxGrid* grid,
|
||||||
|
const wxString& oldval, wxString *newval);
|
||||||
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
||||||
|
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
@@ -207,7 +210,8 @@ public:
|
|||||||
|
|
||||||
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
||||||
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
||||||
virtual bool EndEdit(const wxString& oldval, wxString *newval);
|
virtual bool EndEdit(int row, int col, const wxGrid* grid,
|
||||||
|
const wxString& oldval, wxString *newval);
|
||||||
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
||||||
|
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
@@ -263,7 +267,8 @@ public:
|
|||||||
virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
|
virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
|
||||||
|
|
||||||
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
||||||
virtual bool EndEdit(const wxString& oldval, wxString *newval);
|
virtual bool EndEdit(int row, int col, const wxGrid* grid,
|
||||||
|
const wxString& oldval, wxString *newval);
|
||||||
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
||||||
|
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
@@ -299,7 +304,8 @@ public:
|
|||||||
virtual wxGridCellEditor* Clone() const;
|
virtual wxGridCellEditor* Clone() const;
|
||||||
|
|
||||||
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
||||||
virtual bool EndEdit(const wxString& oldval, wxString *newval);
|
virtual bool EndEdit(int row, int col, const wxGrid* grid,
|
||||||
|
const wxString& oldval, wxString *newval);
|
||||||
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
virtual void ApplyEdit(int row, int col, wxGrid* grid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -325,4 +331,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_GRID
|
#endif // wxUSE_GRID
|
||||||
|
|
||||||
#endif // _WX_GENERIC_GRID_EDITORS_H_
|
#endif // _WX_GENERIC_GRID_EDITORS_H_
|
||||||
|
@@ -218,14 +218,21 @@ public:
|
|||||||
This function must check if the current value of the editing control is
|
This function must check if the current value of the editing control is
|
||||||
valid and different from the original value (available as @a oldval in
|
valid and different from the original value (available as @a oldval in
|
||||||
its string form and possibly saved internally using its real type by
|
its string form and possibly saved internally using its real type by
|
||||||
BeginEdit()). If it isn't, it just returns @false, otherwise it fills
|
BeginEdit()). If it isn't, it just returns @false, otherwise it must do
|
||||||
@a newval with the representation of the new value in the string form,
|
the following:
|
||||||
if necessary saves it using its real type internally, and returns @true.
|
# Save the new value internally so that ApplyEdit() could apply it.
|
||||||
|
# Fill @a newval (which is never @NULL) with the string
|
||||||
|
representation of the new value.
|
||||||
|
# Return @true
|
||||||
|
|
||||||
|
Notice that it must @em not modify the grid as the change could still
|
||||||
|
be vetoed.
|
||||||
|
|
||||||
If the user-defined wxEVT_GRID_CELL_CHANGING event handler doesn't veto
|
If the user-defined wxEVT_GRID_CELL_CHANGING event handler doesn't veto
|
||||||
this change, ApplyEdit() will be called next.
|
this change, ApplyEdit() will be called next.
|
||||||
*/
|
*/
|
||||||
virtual bool EndEdit(const wxString& oldval, wxString* newval) = 0;
|
virtual bool EndEdit(int row, int col, const wxGrid* grid,
|
||||||
|
const wxString& oldval, wxString* newval) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Effectively save the changes in the grid.
|
Effectively save the changes in the grid.
|
||||||
|
@@ -5976,7 +5976,7 @@ void wxGrid::SaveEditControlValue()
|
|||||||
wxGridCellEditor* editor = attr->GetEditor(this, row, col);
|
wxGridCellEditor* editor = attr->GetEditor(this, row, col);
|
||||||
|
|
||||||
wxString newval;
|
wxString newval;
|
||||||
bool changed = editor->EndEdit(oldval, &newval);
|
bool changed = editor->EndEdit(row, col, this, oldval, &newval);
|
||||||
|
|
||||||
if ( changed && SendEvent(wxEVT_GRID_CELL_CHANGING, newval) != -1 )
|
if ( changed && SendEvent(wxEVT_GRID_CELL_CHANGING, newval) != -1 )
|
||||||
{
|
{
|
||||||
|
@@ -485,7 +485,10 @@ void wxGridCellTextEditor::DoBeginEdit(const wxString& startValue)
|
|||||||
Text()->SetFocus();
|
Text()->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGridCellTextEditor::EndEdit(const wxString& WXUNUSED(oldval),
|
bool wxGridCellTextEditor::EndEdit(int WXUNUSED(row),
|
||||||
|
int WXUNUSED(col),
|
||||||
|
const wxGrid* WXUNUSED(grid),
|
||||||
|
const wxString& WXUNUSED(oldval),
|
||||||
wxString *newval)
|
wxString *newval)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_control, false,
|
wxCHECK_MSG( m_control, false,
|
||||||
@@ -681,7 +684,10 @@ void wxGridCellNumberEditor::BeginEdit(int row, int col, wxGrid* grid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGridCellNumberEditor::EndEdit(const wxString& oldval, wxString *newval)
|
bool wxGridCellNumberEditor::EndEdit(int WXUNUSED(row),
|
||||||
|
int WXUNUSED(col),
|
||||||
|
const wxGrid* WXUNUSED(grid),
|
||||||
|
const wxString& oldval, wxString *newval)
|
||||||
{
|
{
|
||||||
long value = 0;
|
long value = 0;
|
||||||
wxString text;
|
wxString text;
|
||||||
@@ -886,7 +892,10 @@ void wxGridCellFloatEditor::BeginEdit(int row, int col, wxGrid* grid)
|
|||||||
DoBeginEdit(GetString());
|
DoBeginEdit(GetString());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGridCellFloatEditor::EndEdit(const wxString& oldval, wxString *newval)
|
bool wxGridCellFloatEditor::EndEdit(int WXUNUSED(row),
|
||||||
|
int WXUNUSED(col),
|
||||||
|
const wxGrid* WXUNUSED(grid),
|
||||||
|
const wxString& oldval, wxString *newval)
|
||||||
{
|
{
|
||||||
const wxString text(Text()->GetValue());
|
const wxString text(Text()->GetValue());
|
||||||
|
|
||||||
@@ -1182,7 +1191,10 @@ void wxGridCellBoolEditor::BeginEdit(int row, int col, wxGrid* grid)
|
|||||||
CBox()->SetFocus();
|
CBox()->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGridCellBoolEditor::EndEdit(const wxString& WXUNUSED(oldval),
|
bool wxGridCellBoolEditor::EndEdit(int WXUNUSED(row),
|
||||||
|
int WXUNUSED(col),
|
||||||
|
const wxGrid* WXUNUSED(grid),
|
||||||
|
const wxString& WXUNUSED(oldval),
|
||||||
wxString *newval)
|
wxString *newval)
|
||||||
{
|
{
|
||||||
bool value = CBox()->GetValue();
|
bool value = CBox()->GetValue();
|
||||||
@@ -1370,7 +1382,10 @@ void wxGridCellChoiceEditor::BeginEdit(int row, int col, wxGrid* grid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGridCellChoiceEditor::EndEdit(const wxString& WXUNUSED(oldval),
|
bool wxGridCellChoiceEditor::EndEdit(int WXUNUSED(row),
|
||||||
|
int WXUNUSED(col),
|
||||||
|
const wxGrid* WXUNUSED(grid),
|
||||||
|
const wxString& WXUNUSED(oldval),
|
||||||
wxString *newval)
|
wxString *newval)
|
||||||
{
|
{
|
||||||
const wxString value = Combo()->GetValue();
|
const wxString value = Combo()->GetValue();
|
||||||
@@ -1488,7 +1503,10 @@ void wxGridCellEnumEditor::BeginEdit(int row, int col, wxGrid* grid)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGridCellEnumEditor::EndEdit(const wxString& WXUNUSED(oldval),
|
bool wxGridCellEnumEditor::EndEdit(int WXUNUSED(row),
|
||||||
|
int WXUNUSED(col),
|
||||||
|
const wxGrid* WXUNUSED(grid),
|
||||||
|
const wxString& WXUNUSED(oldval),
|
||||||
wxString *newval)
|
wxString *newval)
|
||||||
{
|
{
|
||||||
long idx = Combo()->GetSelection();
|
long idx = Combo()->GetSelection();
|
||||||
|
Reference in New Issue
Block a user