added nodes.
This commit is contained in:
52
nodes/services/ntxicommand.h
Normal file
52
nodes/services/ntxicommand.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef NTX_ICOMMAND_H
|
||||
#define NTX_ICOMMAND_H
|
||||
|
||||
#include <ntxinode.h>
|
||||
#include <memory>
|
||||
|
||||
namespace ntx
|
||||
{
|
||||
|
||||
// Einfache Struct für Clipboard-Eintrag
|
||||
struct NtxNodeEntry
|
||||
{
|
||||
NtxNodePtr clone; // Elternloser Deep-Clone
|
||||
NtxNodeWeakPtr originalParent; // Schwache Referenz für Undo
|
||||
size_t originalPosition; // Position im Original-Parent
|
||||
};
|
||||
|
||||
using NtxNodeEntryList = std::vector<NtxNodeEntry>;
|
||||
|
||||
class NtxICommand
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~NtxICommand() = default;
|
||||
|
||||
virtual bool execute() = 0;
|
||||
virtual bool undo() = 0;
|
||||
|
||||
virtual bool canExecute() const = 0;
|
||||
virtual bool canUndo() const;
|
||||
|
||||
virtual NtxString getDescription() const;
|
||||
|
||||
protected:
|
||||
|
||||
NtxICommand() = default;
|
||||
NtxICommand(const NtxICommand&) = default;
|
||||
NtxICommand& operator=(const NtxICommand&) = default;
|
||||
|
||||
void setDescription(const NtxString& description);
|
||||
|
||||
private:
|
||||
|
||||
NtxString m_description;
|
||||
};
|
||||
|
||||
using NtxCommandPtr = std::shared_ptr<NtxICommand>;
|
||||
using NtxCommandUPtr = std::unique_ptr<NtxICommand>;
|
||||
|
||||
} // namespace ntx
|
||||
|
||||
#endif // NTX_ICOMMAND_H
|
||||
Reference in New Issue
Block a user