added nodes.
This commit is contained in:
56
nodes/services/ntxundostack.h
Normal file
56
nodes/services/ntxundostack.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef NTX_UNDO_STACK_H
|
||||
#define NTX_UNDO_STACK_H
|
||||
|
||||
#include <ntxicommand.h>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
namespace ntx
|
||||
{
|
||||
|
||||
class NtxUndoStack
|
||||
{
|
||||
public:
|
||||
|
||||
NtxUndoStack();
|
||||
~NtxUndoStack() = default;
|
||||
|
||||
NtxUndoStack(const NtxUndoStack&) = delete;
|
||||
NtxUndoStack& operator=(const NtxUndoStack&) = delete;
|
||||
|
||||
void push(NtxCommandUPtr command);
|
||||
|
||||
bool canUndo() const;
|
||||
bool canRedo() const;
|
||||
|
||||
void undo();
|
||||
void redo();
|
||||
|
||||
int index() const;
|
||||
int count() const;
|
||||
|
||||
NtxString undoText() const;
|
||||
NtxString redoText() const;
|
||||
|
||||
void clear();
|
||||
void setClean();
|
||||
bool isClean() const;
|
||||
|
||||
void setUndoLimit(int limit);
|
||||
int undoLimit() const;
|
||||
|
||||
const NtxICommand* command(int index) const;
|
||||
|
||||
private:
|
||||
|
||||
std::vector<NtxCommandUPtr> m_commands;
|
||||
int m_index;
|
||||
int m_cleanIndex;
|
||||
int m_undoLimit;
|
||||
|
||||
void checkUndoLimit();
|
||||
};
|
||||
|
||||
} // namespace ntx
|
||||
|
||||
#endif // NTX_UNDO_STACK_H
|
||||
Reference in New Issue
Block a user