Add wxTextCtrl::EmptyUndoBuffer()
This is implemented for multi-line controls under macOS only currently.
This commit is contained in:
@@ -140,6 +140,7 @@ public:
|
||||
virtual void Undo() wxOVERRIDE;
|
||||
virtual bool CanRedo() const wxOVERRIDE;
|
||||
virtual void Redo() wxOVERRIDE;
|
||||
virtual void EmptyUndoBuffer() wxOVERRIDE;
|
||||
|
||||
protected:
|
||||
void DoUpdateTextStyle();
|
||||
|
@@ -730,6 +730,7 @@ public :
|
||||
virtual void Undo() ;
|
||||
virtual bool CanRedo() const;
|
||||
virtual void Redo() ;
|
||||
virtual void EmptyUndoBuffer() ;
|
||||
virtual int GetNumberOfLines() const ;
|
||||
virtual long XYToPosition(long x, long y) const;
|
||||
virtual bool PositionToXY(long pos, long *x, long *y) const ;
|
||||
|
@@ -72,6 +72,8 @@ public:
|
||||
virtual bool CanUndo() const wxOVERRIDE;
|
||||
virtual bool CanRedo() const wxOVERRIDE;
|
||||
|
||||
virtual void EmptyUndoBuffer() wxOVERRIDE;
|
||||
|
||||
// Insertion point
|
||||
virtual void SetInsertionPoint(long pos) wxOVERRIDE;
|
||||
virtual void SetInsertionPointEnd() wxOVERRIDE;
|
||||
|
@@ -3642,7 +3642,7 @@ public:
|
||||
bool CanUndo() const wxOVERRIDE;
|
||||
|
||||
// Delete the undo history.
|
||||
void EmptyUndoBuffer();
|
||||
void EmptyUndoBuffer() wxOVERRIDE;
|
||||
|
||||
// Undo one action in the undo history.
|
||||
void Undo() wxOVERRIDE;
|
||||
|
@@ -81,6 +81,8 @@ public:
|
||||
virtual bool CanUndo() const = 0;
|
||||
virtual bool CanRedo() const = 0;
|
||||
|
||||
virtual void EmptyUndoBuffer() { }
|
||||
|
||||
|
||||
// insertion point
|
||||
// ---------------
|
||||
|
@@ -165,6 +165,16 @@ public:
|
||||
*/
|
||||
virtual bool CanUndo() const;
|
||||
|
||||
/**
|
||||
Delete the undo history.
|
||||
|
||||
Currently only implemented under macOS and only for multiline text
|
||||
controls, does nothing in the other ports.
|
||||
|
||||
@since 3.1.6
|
||||
*/
|
||||
virtual void EmptyUndoBuffer();
|
||||
|
||||
/**
|
||||
Sets the new text control value.
|
||||
|
||||
|
@@ -1070,6 +1070,14 @@ void wxNSTextViewControl::Redo()
|
||||
[m_undoManager redo];
|
||||
}
|
||||
|
||||
void wxNSTextViewControl::EmptyUndoBuffer()
|
||||
{
|
||||
if ( !m_undoManager )
|
||||
return;
|
||||
|
||||
[m_undoManager removeAllActions];
|
||||
}
|
||||
|
||||
void wxNSTextViewControl::DoUpdateTextStyle()
|
||||
{
|
||||
if ( m_useCharWrapping )
|
||||
|
@@ -700,6 +700,10 @@ void wxTextWidgetImpl::Redo()
|
||||
{
|
||||
}
|
||||
|
||||
void wxTextWidgetImpl::EmptyUndoBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
long wxTextWidgetImpl::XYToPosition(long WXUNUSED(x), long WXUNUSED(y)) const
|
||||
{
|
||||
return 0 ;
|
||||
|
@@ -293,6 +293,13 @@ bool wxTextEntry::CanRedo() const
|
||||
return GetTextPeer()->CanRedo() ;
|
||||
}
|
||||
|
||||
void wxTextEntry::EmptyUndoBuffer()
|
||||
{
|
||||
wxCHECK_RET( GetTextPeer(), "Must create the control first" );
|
||||
|
||||
return GetTextPeer()->EmptyUndoBuffer() ;
|
||||
}
|
||||
|
||||
wxTextWidgetImpl * wxTextEntry::GetTextPeer() const
|
||||
{
|
||||
wxWindow * const win = const_cast<wxTextEntry *>(this)->GetEditableWindow();
|
||||
|
@@ -1094,6 +1094,7 @@ overrideNeeded = (
|
||||
'CanPaste',
|
||||
'CanRedo',
|
||||
'CanUndo',
|
||||
'EmptyUndoBuffer',
|
||||
'Clear',
|
||||
'AppendText',
|
||||
)
|
||||
|
Reference in New Issue
Block a user