QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RMainWindow.h
Go to the documentation of this file.
1 #ifndef RMAINWINDOW_H
2 #define RMAINWINDOW_H
3 
4 #include <QMutex>
5 
6 #include "RTransactionListener.h"
7 #include "RPropertyEvent.h"
8 #include "RMessageHandler.h"
9 #include "RProgressHandler.h"
10 #include "RS.h"
11 
12 class RBlockListener;
14 class RDocument;
15 class RDocumentInterface;
16 class REntity;
17 class RFocusListener;
18 class RLayerListener;
19 class RPenListener;
20 class RPropertyListener;
21 class RSelectionListener;
22 class RSnapListener;
23 class RUcsListener;
24 class RVector;
25 class RViewListener;
26 
27 #ifndef RDEFAULT_MINUS_ONE
28 #define RDEFAULT_MINUS_ONE -1
29 #endif
30 
38 
39 public:
40  RMainWindow();
41  virtual ~RMainWindow();
42 
43  static RMainWindow* getMainWindow();
44 
45  static bool hasMainWindow();
46 
47  static void installMessageHandler();
48 
53  virtual RDocument* getDocument() = 0;
54 
61 
62  void notifyListeners(bool withNull = false);
63 
65  void notifyCoordinateListeners(RDocumentInterface* documentInterface);
66 
68  void notifySelectionListeners(RDocumentInterface* documentInterface);
69 
70  virtual void postSelectionChangedEvent() = 0;
71  virtual void postTransactionEvent(
72  bool onlyChanges=false,
73  RS::EntityType entityTypeFilter = RS::EntityAll
74  ) = 0;
75  virtual void postCloseEvent() = 0;
76 // virtual void postPropertyEvent(RPropertyTypeId propertyTypeId,
77 // const QVariant& value,
78 // RS::EntityType entityTypeFilter = RS::EntityAll
79 // ) = 0;
80 
83  RDocument* document,
84  bool onlyChanges=false,
85  RS::EntityType entityTypeFilter = RS::EntityAll
86  );
87  void notifyPropertyListeners(RDocument& document, REntity& entity);
89 
91  void notifyTransactionListeners(RDocument* document);
92 
94  void notifySnapListeners(RDocumentInterface* documentInterface);
95 
97  void notifyFocusListeners(RDocumentInterface* documentInterface);
98 
100 
101  void addUcsListener(RUcsListener* l);
102  void notifyUcsListeners(RDocumentInterface* documentInterface);
103 
105  void notifyLayerListeners(RDocumentInterface* documentInterface);
106 
108  void notifyBlockListeners(RDocumentInterface* documentInterface);
109 
111  void notifyViewListeners(RDocumentInterface* documentInterface);
112 
113  void addPenListener(RPenListener* l);
114  void notifyPenListeners(RDocumentInterface* documentInterface);
115 
116  void ucsSetEvent(const QString& ucsName);
117 
118  //void commandEvent(const QString& command);
119 
120  virtual void escapeEvent() = 0;
121 
127  virtual void setGraphicsViewCursor(const QCursor& cursor) = 0;
128 
132  virtual int getWidth() = 0;
136  virtual int getHeight() = 0;
141  virtual int getPositionX() = 0;
146  virtual int getPositionY() = 0;
147 
151  virtual void resize(int width, int height) = 0;
155  virtual void move(int x, int y) = 0;
159  virtual void close() = 0;
160 
164  static void messageHandler(QtMsgType type, const char* msg);
165 
166  virtual void setCommandPrompt(const QString& text = "") = 0;
167  virtual void setLeftMouseTip(const QString& text = "") = 0;
168  virtual void setRightMouseTip(const QString& text = "") = 0;
169 
170  //bool tryLock(const QString& msg, int timeout=RDEFAULT_MINUS_ONE);
171  //void unlock(const QString& msg);
172 
173 // bool blockEvents();
174 // void unblockEvents();
175 
176 protected:
177  virtual bool readSettings();
178  virtual void writeSettings();
179 
180 protected:
182 
183  QList<RCoordinateListener*> coordinateListeners;
184  QList<RSelectionListener*> selectionListeners;
185  QList<RPropertyListener*> propertyListeners;
186  QList<RUcsListener*> ucsListeners;
187  QList<RLayerListener*> layerListeners;
188  QList<RBlockListener*> blockListeners;
189  QList<RViewListener*> viewListeners;
190  QList<RPenListener*> penListeners;
191  QList<RTransactionListener*> transactionListeners;
192  QList<RSnapListener*> snapListeners;
193  QList<RFocusListener*> focusListeners;
194 
195  QMutex mutex;
196  //QMutex mutexEvents;
197  //QThread* mutexEventsLocker;
198 };
199 
201 
202 #endif