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.
|
||||
//
|
||||
// This should also store the new value in its real type internally so that
|
||||
// it could be used by ApplyEdit().
|
||||
virtual bool EndEdit(const wxString& oldval, wxString *newval) = 0;
|
||||
// it could be used by ApplyEdit() but it must not modify the grid as the
|
||||
// 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
|
||||
// the previous call to EndEdit() in the grid
|
||||
|
@@ -63,7 +63,8 @@ public:
|
||||
|
||||
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
||||
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 Reset();
|
||||
@@ -109,7 +110,8 @@ public:
|
||||
|
||||
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
||||
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 Reset();
|
||||
@@ -164,7 +166,8 @@ public:
|
||||
|
||||
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
||||
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 Reset();
|
||||
@@ -207,7 +210,8 @@ public:
|
||||
|
||||
virtual bool IsAcceptedKey(wxKeyEvent& event);
|
||||
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 Reset();
|
||||
@@ -263,7 +267,8 @@ public:
|
||||
virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
|
||||
|
||||
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 Reset();
|
||||
@@ -299,7 +304,8 @@ public:
|
||||
virtual wxGridCellEditor* Clone() const;
|
||||
|
||||
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);
|
||||
|
||||
private:
|
||||
@@ -325,4 +331,5 @@ public:
|
||||
};
|
||||
|
||||
#endif // wxUSE_GRID
|
||||
|
||||
#endif // _WX_GENERIC_GRID_EDITORS_H_
|
||||
|
@@ -218,14 +218,21 @@ public:
|
||||
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
|
||||
its string form and possibly saved internally using its real type by
|
||||
BeginEdit()). If it isn't, it just returns @false, otherwise it fills
|
||||
@a newval with the representation of the new value in the string form,
|
||||
if necessary saves it using its real type internally, and returns @true.
|
||||
BeginEdit()). If it isn't, it just returns @false, otherwise it must do
|
||||
the following:
|
||||
# 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
|
||||
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.
|
||||
|
@@ -5976,7 +5976,7 @@ void wxGrid::SaveEditControlValue()
|
||||
wxGridCellEditor* editor = attr->GetEditor(this, row, col);
|
||||
|
||||
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 )
|
||||
{
|
||||
|
@@ -485,7 +485,10 @@ void wxGridCellTextEditor::DoBeginEdit(const wxString& startValue)
|
||||
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)
|
||||
{
|
||||
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;
|
||||
wxString text;
|
||||
@@ -886,7 +892,10 @@ void wxGridCellFloatEditor::BeginEdit(int row, int col, wxGrid* grid)
|
||||
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());
|
||||
|
||||
@@ -1182,7 +1191,10 @@ void wxGridCellBoolEditor::BeginEdit(int row, int col, wxGrid* grid)
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
long idx = Combo()->GetSelection();
|
||||
|
Reference in New Issue
Block a user