BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Command for unddo/redo to insert new item. More...
Classes | |
struct | InsertNewItemCommandImpl |
Public Member Functions | |
InsertNewItemCommand (item_factory_func_t func, SessionItem *parent, const TagRow &tagrow) | |
~InsertNewItemCommand () override | |
std::string | description () const |
Returns command description. More... | |
void | execute () |
Execute command. More... | |
bool | isObsolete () const |
Returns whether the command is obsolete (which means that it shouldn't be kept in the stack). More... | |
CommandResult | result () const |
void | undo () |
Undo command as it was before execution. More... | |
Protected Member Functions | |
SessionItem * | itemFromPath (const Path &path) const |
SessionModel * | model () const |
Path | pathFromItem (SessionItem *item) const |
void | setDescription (const std::string &text) |
Sets command description. More... | |
void | setObsolete (bool flag) |
Sets command obsolete flag. More... | |
void | setResult (const CommandResult &command_result) |
Private Member Functions | |
void | execute_command () override |
void | undo_command () override |
Private Attributes | |
std::unique_ptr< InsertNewItemCommandImpl > | p_impl |
Command for unddo/redo to insert new item.
Definition at line 28 of file insertnewitemcommand.h.
InsertNewItemCommand::InsertNewItemCommand | ( | item_factory_func_t | func, |
SessionItem * | parent, | ||
const TagRow & | tagrow | ||
) |
Definition at line 37 of file insertnewitemcommand.cpp.
References p_impl, ModelView::AbstractItemCommand::pathFromItem(), and ModelView::AbstractItemCommand::setResult().
|
overridedefault |
|
inherited |
Returns command description.
Definition at line 87 of file abstractitemcommand.cpp.
References ModelView::AbstractItemCommand::p_impl.
|
inherited |
Execute command.
Definition at line 56 of file abstractitemcommand.cpp.
References ModelView::AbstractItemCommand::execute_command(), and ModelView::AbstractItemCommand::p_impl.
Referenced by TEST_F().
|
overrideprivatevirtual |
Implements ModelView::AbstractItemCommand.
Definition at line 58 of file insertnewitemcommand.cpp.
References ModelView::ItemDataRole::IDENTIFIER, ModelView::AbstractItemCommand::itemFromPath(), p_impl, ModelView::AbstractItemCommand::setDescription(), ModelView::AbstractItemCommand::setObsolete(), and ModelView::AbstractItemCommand::setResult().
|
inherited |
Returns whether the command is obsolete (which means that it shouldn't be kept in the stack).
Definition at line 80 of file abstractitemcommand.cpp.
References ModelView::AbstractItemCommand::p_impl.
Referenced by ModelView::AbstractItemCommand::AbstractItemCommandImpl::can_undo(), and TEST_F().
|
protectedinherited |
Definition at line 116 of file abstractitemcommand.cpp.
References ModelView::Utils::ItemFromPath(), and ModelView::AbstractItemCommand::p_impl.
Referenced by ModelView::CopyItemCommand::execute_command(), execute_command(), ModelView::MoveItemCommand::execute_command(), ModelView::RemoveItemCommand::execute_command(), ModelView::SetValueCommand::swap_values(), ModelView::CopyItemCommand::undo_command(), undo_command(), ModelView::MoveItemCommand::undo_command(), and ModelView::RemoveItemCommand::undo_command().
|
protectedinherited |
Definition at line 121 of file abstractitemcommand.cpp.
References ModelView::AbstractItemCommand::p_impl.
|
protectedinherited |
Definition at line 111 of file abstractitemcommand.cpp.
References ModelView::Utils::PathFromItem().
Referenced by ModelView::CopyItemCommand::CopyItemCommand(), InsertNewItemCommand(), ModelView::MoveItemCommand::MoveItemCommand(), ModelView::RemoveItemCommand::RemoveItemCommand(), ModelView::SetValueCommand::SetValueCommand(), ModelView::MoveItemCommand::execute_command(), and ModelView::MoveItemCommand::undo_command().
|
inherited |
Definition at line 92 of file abstractitemcommand.cpp.
References ModelView::AbstractItemCommand::p_impl.
Referenced by ModelView::CopyItemCommand::execute_command(), ModelView::SetValueCommand::swap_values(), and TEST_F().
|
protectedinherited |
Sets command description.
Definition at line 106 of file abstractitemcommand.cpp.
References ModelView::AbstractItemCommand::p_impl.
Referenced by ModelView::CopyItemCommand::CopyItemCommand(), ModelView::MoveItemCommand::MoveItemCommand(), ModelView::RemoveItemCommand::RemoveItemCommand(), ModelView::SetValueCommand::SetValueCommand(), and execute_command().
|
protectedinherited |
Sets command obsolete flag.
Definition at line 99 of file abstractitemcommand.cpp.
References ModelView::AbstractItemCommand::p_impl.
Referenced by ModelView::CopyItemCommand::execute_command(), execute_command(), ModelView::RemoveItemCommand::execute_command(), and ModelView::SetValueCommand::swap_values().
|
protectedinherited |
Definition at line 126 of file abstractitemcommand.cpp.
References ModelView::AbstractItemCommand::p_impl.
Referenced by ModelView::CopyItemCommand::CopyItemCommand(), InsertNewItemCommand(), ModelView::MoveItemCommand::MoveItemCommand(), ModelView::RemoveItemCommand::RemoveItemCommand(), ModelView::SetValueCommand::SetValueCommand(), ModelView::CopyItemCommand::execute_command(), execute_command(), ModelView::RemoveItemCommand::execute_command(), ModelView::SetValueCommand::swap_values(), ModelView::CopyItemCommand::undo_command(), and undo_command().
|
inherited |
Undo command as it was before execution.
Definition at line 68 of file abstractitemcommand.cpp.
References ModelView::AbstractItemCommand::p_impl, and ModelView::AbstractItemCommand::undo_command().
Referenced by TEST_F().
|
overrideprivatevirtual |
Implements ModelView::AbstractItemCommand.
Definition at line 47 of file insertnewitemcommand.cpp.
References ModelView::AbstractItemCommand::itemFromPath(), p_impl, and ModelView::AbstractItemCommand::setResult().
|
private |
Definition at line 38 of file insertnewitemcommand.h.
Referenced by InsertNewItemCommand(), execute_command(), and undo_command().