Undoable action for edits to a single Tile16. More...
#include <tile16_undo_actions.h>


Public Types | |
| using | RestoreFn = std::function<void(const Tile16Snapshot&)> |
Public Member Functions | |
| Tile16EditAction (Tile16Snapshot before, Tile16Snapshot after, RestoreFn restore) | |
| absl::Status | Undo () override |
| absl::Status | Redo () override |
| std::string | Description () const override |
| Human-readable description (e.g., "Paint 12 tiles on map 5") | |
| size_t | MemoryUsage () const override |
| Approximate memory footprint for budget enforcement. | |
| bool | CanMergeWith (const UndoAction &) const override |
Public Member Functions inherited from yaze::editor::UndoAction | |
| virtual | ~UndoAction ()=default |
| virtual void | MergeWith (UndoAction &) |
Private Attributes | |
| Tile16Snapshot | before_ |
| Tile16Snapshot | after_ |
| RestoreFn | restore_ |
Undoable action for edits to a single Tile16.
Stores before and after snapshots of the tile state and uses a restore callback to apply them back to the Tile16Editor. The callback is a std::function so the action doesn't need to know about the editor's internals directly.
Definition at line 45 of file tile16_undo_actions.h.
| using yaze::editor::Tile16EditAction::RestoreFn = std::function<void(const Tile16Snapshot&)> |
Definition at line 47 of file tile16_undo_actions.h.
|
inline |
Definition at line 49 of file tile16_undo_actions.h.
|
inlineoverridevirtual |
Implements yaze::editor::UndoAction.
Definition at line 55 of file tile16_undo_actions.h.
|
inlineoverridevirtual |
Implements yaze::editor::UndoAction.
Definition at line 60 of file tile16_undo_actions.h.
|
inlineoverridevirtual |
Human-readable description (e.g., "Paint 12 tiles on map 5")
Implements yaze::editor::UndoAction.
Definition at line 65 of file tile16_undo_actions.h.
References before_, and yaze::editor::Tile16Snapshot::tile_id.
|
inlineoverridevirtual |
Approximate memory footprint for budget enforcement.
Reimplemented from yaze::editor::UndoAction.
Definition at line 69 of file tile16_undo_actions.h.
References after_, before_, and yaze::editor::Tile16Snapshot::bitmap_data.
|
inlineoverridevirtual |
Whether this action can merge with the previous action on the stack. Called only when both actions have the same concrete type.
Reimplemented from yaze::editor::UndoAction.
Definition at line 73 of file tile16_undo_actions.h.
|
private |
Definition at line 78 of file tile16_undo_actions.h.
Referenced by Description(), MemoryUsage(), and Undo().
|
private |
Definition at line 79 of file tile16_undo_actions.h.
Referenced by MemoryUsage(), and Redo().
|
private |
Definition at line 80 of file tile16_undo_actions.h.