BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
undostackinterface.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/model/mvvm/interfaces/undostackinterface.h
6 //! @brief Defines class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_MVVM_MODEL_MVVM_INTERFACES_UNDOSTACKINTERFACE_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_INTERFACES_UNDOSTACKINTERFACE_H
17 
18 #include <memory>
19 #include <string>
20 
21 class QUndoCommand;
22 
23 namespace ModelView {
24 
25 class AbstractItemCommand;
26 
27 //! Interface class for undo/redo stack.
28 
30 public:
31  virtual ~UndoStackInterface() = default;
32 
33  //! Executes the command, then pushes it in the stack for possible undo.
34  //! Current design relies on shared pointer. This is done
35  //! a) to retrieve result of the command from another place
36  //! b) to adapt the command for QUndoStack
37  //! c) to bypass QUndoStack behavior which wants to have an ownership
38  virtual void execute(std::shared_ptr<AbstractItemCommand> command) = 0;
39 
40  virtual bool isActive() const = 0;
41  virtual bool canUndo() const = 0;
42  virtual bool canRedo() const = 0;
43  virtual int index() const = 0;
44  virtual int count() const = 0;
45  virtual void undo() = 0;
46  virtual void redo() = 0;
47  virtual void clear() = 0;
48  virtual void setUndoLimit(int limit) = 0;
49 
50  virtual void beginMacro(const std::string& name) = 0;
51  virtual void endMacro() = 0;
52 };
53 
54 } // namespace ModelView
55 
56 #endif // BORNAGAIN_MVVM_MODEL_MVVM_INTERFACES_UNDOSTACKINTERFACE_H
Interface class for undo/redo stack.
virtual bool canUndo() const =0
virtual ~UndoStackInterface()=default
virtual int index() const =0
virtual bool isActive() const =0
virtual void beginMacro(const std::string &name)=0
virtual int count() const =0
virtual void setUndoLimit(int limit)=0
virtual bool canRedo() const =0
virtual void execute(std::shared_ptr< AbstractItemCommand > command)=0
Executes the command, then pushes it in the stack for possible undo.
materialitems.h Collection of materials to populate MaterialModel.
QString const & name(EShape k)
Definition: particles.cpp:21