Plasma Engine
2.0
Loading...
Searching...
No Matches
Command.h
1
#pragma once
2
3
#include <Foundation/Reflection/Reflection.h>
4
#include <Foundation/Types/Status.h>
5
#include <ToolsFoundation/ToolsFoundationDLL.h>
6
7
class
plDocument
;
8
class
plCommandTransaction
;
9
14
class
PL_TOOLSFOUNDATION_DLL
plCommand
:
public
plReflectedClass
15
{
16
PL_ADD_DYNAMIC_REFLECTION(
plCommand
,
plReflectedClass
);
17
18
public
:
19
plCommand
();
20
~plCommand
();
21
22
bool
IsUndoable()
const
{
return
m_bUndoable; };
23
bool
HasChildActions()
const
{
return
!m_ChildActions.IsEmpty(); }
24
bool
HasModifiedDocument()
const
;
25
26
enum class
CommandState
27
{
28
WasDone,
29
WasUndone
30
};
31
32
protected
:
33
plStatus
Do(
bool
bRedo);
34
plStatus
Undo(
bool
bFireEvents);
35
void
Cleanup(CommandState state);
36
37
plStatus
AddSubCommand(
plCommand
& command);
38
plDocument
* GetDocument() {
return
m_pDocument; };
39
40
private
:
41
virtual
bool
HasReturnValues()
const
{
return
false
; }
42
virtual
plStatus
DoInternal(
bool
bRedo) = 0;
43
virtual
plStatus
UndoInternal(
bool
bFireEvents) = 0;
44
virtual
void
CleanupInternal(CommandState state) = 0;
45
46
protected
:
47
friend
class
plCommandHistory
;
48
friend
class
plCommandTransaction
;
49
50
plString
m_sDescription;
51
bool
m_bUndoable =
true
;
52
bool
m_bModifiedDocument =
true
;
53
plHybridArray<plCommand*, 8>
m_ChildActions;
54
plDocument
* m_pDocument =
nullptr
;
55
};
plCommandHistory
Stores the undo / redo stacks of transactions done on a document.
Definition
CommandHistory.h:52
plCommand
Interface for a command.
Definition
Command.h:15
plCommandTransaction
Definition
CommandHistory.h:11
plDocument
Definition
Document.h:57
plHybridArray
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition
HybridArray.h:12
plReflectedClass
All classes that should be dynamically reflectable, need to be derived from this base class.
Definition
DynamicRTTI.h:86
plHybridString< 32, plDefaultAllocatorWrapper >
plStatus
An plResult with an additional message for the reason of failure.
Definition
Status.h:12
Code
Tools
Libs
ToolsFoundation
Command
Command.h
Generated by
1.11.0