OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
creator.hpp
Go to the documentation of this file.
1 #ifndef CSV_WORLD_CREATOR_H
2 #define CSV_WORLD_CREATOR_H
3 
4 #include <memory>
5 
6 #include <QWidget>
7 
8 #include "../../model/doc/document.hpp"
9 
10 #include "../../model/world/scope.hpp"
11 #include "../../model/world/universalid.hpp"
12 
13 namespace CSMDoc
14 {
15  class Document;
16 }
17 
18 namespace CSVWorld
19 {
21  class Creator : public QWidget
22  {
23  Q_OBJECT
24 
25  public:
26 
27  virtual ~Creator();
28 
29  virtual void reset() = 0;
30 
31  virtual void cloneMode(const std::string& originId,
32  const CSMWorld::UniversalId::Type type) = 0;
33 
34  virtual void setEditLock (bool locked) = 0;
35 
36  virtual void toggleWidgets(bool active = true) = 0;
37 
39  virtual void setScope (unsigned int scope);
40 
42  virtual void focus() = 0;
43 
44  signals:
45 
46  void done();
47 
48  void requestFocus (const std::string& id);
51  };
52 
55  {
56  public:
57 
58  virtual ~CreatorFactoryBase();
59 
60  virtual Creator *makeCreator (CSMDoc::Document& document, const CSMWorld::UniversalId& id) const = 0;
65  };
66 
69  {
70  public:
71 
72  virtual Creator *makeCreator (CSMDoc::Document& document, const CSMWorld::UniversalId& id) const;
76  };
77 
78  template<class CreatorT, unsigned int scope = CSMWorld::Scope_Content>
80  {
81  public:
82 
83  virtual Creator *makeCreator (CSMDoc::Document& document, const CSMWorld::UniversalId& id) const;
88  };
89 
90  template<class CreatorT, unsigned int scope>
92  const CSMWorld::UniversalId& id) const
93  {
94  std::auto_ptr<CreatorT> creator (new CreatorT (document.getData(), document.getUndoStack(), id));
95 
96  creator->setScope (scope);
97 
98  return creator.release();
99  }
100 }
101 
102 #endif
Record creator UI base class.
Definition: creator.hpp:21
virtual Creator * makeCreator(CSMDoc::Document &document, const CSMWorld::UniversalId &id) const =0
static const struct @2 signals[]
virtual Creator * makeCreator(CSMDoc::Document &document, const CSMWorld::UniversalId &id) const
Definition: creator.cpp:17
virtual void reset()=0
Type
Definition: universalid.hpp:40
virtual ~Creator()
Definition: creator.cpp:5
void requestFocus(const std::string &id)
virtual ~CreatorFactoryBase()
Definition: creator.cpp:14
virtual void cloneMode(const std::string &originId, const CSMWorld::UniversalId::Type type)=0
Base class for Creator factory.
Definition: creator.hpp:54
virtual void setScope(unsigned int scope)
Default implementation: Throw an exception if scope!=Scope_Content.
Definition: creator.cpp:7
Definition: creator.hpp:79
Definition: document.hpp:57
const CSMWorld::Data & getData() const
Definition: document.cpp:451
QUndoStack & getUndoStack()
Definition: document.cpp:344
virtual Creator * makeCreator(CSMDoc::Document &document, const CSMWorld::UniversalId &id) const
Definition: creator.hpp:91
virtual void focus()=0
Focus main input widget.
virtual void toggleWidgets(bool active=true)=0
virtual void setEditLock(bool locked)=0
Creator factory that does not produces any creator.
Definition: creator.hpp:68
Definition: universalid.hpp:12