]> Shamusworld >> Repos - architektonas/blob - src/base/dialogfactoryinterface.h
Removed unnecessary RS_ prefix from classes and whatnot.
[architektonas] / src / base / dialogfactoryinterface.h
1 #ifndef __DIALOGFACTORYINTERFACE_H__
2 #define __DIALOGFACTORYINTERFACE_H__
3
4 #include <QtCore>
5 #include "enums.h"
6
7 class ActionInterface;
8 class ArcData;
9 class AttributesData;
10 class BevelData;
11 class Block;
12 class BlockData;
13 class BlockList;
14 class CircleData;
15 class DimLinearData;
16 class DimensionData;
17 class Document;
18 class Drawing;
19 class Entity;
20 class EventHandler;
21 class GraphicView;
22 class Grid;
23 class Hatch;
24 class Insert;
25 class Layer;
26 class LayerList;
27 class MirrorData;
28 class MoveData;
29 class MoveRotateData;
30 class Rotate2Data;
31 class RotateData;
32 class RoundData;
33 class ScaleData;
34 class Solid;
35 class Text;
36 class Vector;
37
38
39 /**
40  * Interface for objects that can create and show dialogs.
41  */
42 class DialogFactoryInterface
43 {
44 public:
45     DialogFactoryInterface() {}
46     virtual ~DialogFactoryInterface() {}
47
48     /**
49      * This virtual method must be overwritten and must show the previously
50      * shown menu in the cad toolbar.
51      */
52     virtual void requestPreviousMenu() = 0;
53
54     /**
55      * This virtual method must be overwritten and must provide
56      * a message dialog.
57      */
58     virtual void requestWarningDialog(const QString & warning) = 0;
59
60         /**
61          * This virtual method must be overwritten and must create a new
62          * window for the given document or for a new document if no document
63          * is given.
64          */
65     virtual GraphicView * requestNewDocument(const QString & fileName = QString::null,
66                 Document * doc = NULL) = 0;
67
68         /**
69          * This virtual method must be overwritten and must create or show
70          * a simulation control widget.
71          */
72     virtual void requestSimulationControls() = 0;
73
74     /**
75      * This virtual method must be overwritten and must provide
76      * a dialog for choosing the properties of a new layer to be
77      * created. The method must create the new layer but not add
78      * it to the layer list. The latter is up to the caller.
79      *
80      * @return The implementation is expected to return a pointer
81      *         to the newly created layer or NULL if the user
82      *         cancels the dialog.
83      */
84     virtual Layer * requestNewLayerDialog(LayerList * layerList = NULL) = 0;
85
86     /**
87      * This virtual method must be overwritten and must provide
88      * a dialog that asks for permission for removing the selected
89      * layer from the layer list. The method must not actually
90      * remove the layer. This is up to the caller.
91      *
92      * @return The implementation is expected to return a pointer
93      *         to the layer which can ne removed or NULL if the user
94      *         cancels the dialog.
95      */
96     virtual Layer * requestLayerRemovalDialog(LayerList * layerList = NULL) = 0;
97
98     /**
99      * This virtual method must be overwritten and must provide
100      * a dialog to edit the layers attributes. The method must
101      * not actually edit the layer. This is up to the caller.
102      *
103      * @return The implementation is expected to return a pointer
104      *         to the modified layer or NULL if the user
105      *         cancels the dialog.
106      */
107     virtual Layer * requestEditLayerDialog(LayerList * layerList = NULL) = 0;
108
109     /**
110      * This virtual method must be overwritten and must provide
111      * a dialog for choosing the properties of a new block to be
112      * created. The method must create the new block but not add
113      * it to the block list. The latter is up to the caller.
114     *
115     * @param block Pointer to the newly created block with default
116     *              attributes.
117      *
118      * @return The implementation is expected to return a pointer
119      *         to the newly created block or NULL if the user
120      *         cancels the dialog.
121      */
122     virtual BlockData requestNewBlockDialog(BlockList * blockList) = 0;
123
124     /**
125      * This virtual method must be overwritten and must provide
126      * a dialog that asks for permission for removing the selected
127      * block from the block list. The method must not actually
128      * remove the block. This is up to the caller.
129      *
130      * @return The implementation is expected to return a pointer
131      *         to the block which can be removed or NULL if the user
132      *         cancels the dialog.
133      */
134     virtual Block * requestBlockRemovalDialog(BlockList * blockList) = 0;
135
136     /**
137      * This virtual method must be overwritten and must provide
138      * a dialog that allows to change blocks attributes of the
139      * currently active block.
140      *
141      * @return The implementation is expected to return a pointer
142      *         to the block which was changed or NULL if the user
143      *         cancels the dialog.
144      */
145     virtual BlockData requestBlockAttributesDialog(BlockList * blockList) = 0;
146
147     /**
148      * This virtual method must be overwritten and should provide
149      * a way to edit a block.
150      */
151     virtual void requestEditBlockWindow(BlockList * blockList) = 0;
152
153         virtual void closeEditBlockWindow(Block * block) = 0;
154
155     /**
156      * This virtual method must be overwritten and must provide
157      * a dialog to get a filename for saving a file. The method must
158      * not actually save the file. This is up to the caller.
159      *
160      * @return The implementation is expected to return a string
161      *         which contains the file name or an empty string if
162      *         the user cancels the dialog.
163      */
164     //virtual QString requestFileSaveAsDialog() = 0;
165
166     /**
167      * This virtual method must be overwritten and must provide
168      * a dialog to get a filename for opening a file. The method must
169      * not actually open the file. This is up to the caller.
170      *
171      * @return The implementation is expected to return a string
172      *         which contains the file name or an empty string if
173      *         the user cancels the dialog.
174      */
175     //virtual QString requestFileOpenDialog() = 0;
176
177     /**
178      * This virtual method must be overwritten and must provide
179      * a dialog to get a filename for opening an image file. The method must
180      * not actually open the file. This is up to the caller.
181      *
182      * @return The implementation is expected to return a string
183      *         which contains the file name or an empty string if
184      *         the user cancels the dialog.
185      */
186     virtual QString requestImageOpenDialog() = 0;
187
188     /**
189      * This virtual method must be overwritten and must present
190      * a widget for options for the given action.
191      *
192          * @param action Pointer to the action which needs the options.
193      * @param on true: switch widget on, false: off
194          * @param update true: widget gets data from the action, false:
195          *   widget gets data from config file.
196      */
197     virtual void requestOptions(ActionInterface * action, bool on, bool update = false) = 0;
198
199     /**
200      * This virtual method must be overwritten and must present
201      * a widget for snap point with distance options.
202      *
203      * @param dist Distance which can be directly changed
204      *             by the presented widget.
205      * @param on true: switch widget on, false: off
206      */
207     virtual void requestSnapDistOptions(double & dist, bool on) = 0;
208
209     /**
210      * This virtual method must be overwritten and must present
211      * a widget for entity attributes.
212      *
213      * @param data Attribute data which can be directly changed
214      *             by the presented widget.
215      */
216     virtual bool requestAttributesDialog(AttributesData & data, LayerList & layerList) = 0;
217
218     /**
219      * This virtual method must be overwritten and must present
220      * a widget for move options (number of copies).
221      *
222      * @param data Move data which can be directly changed
223      *             by the presented widget.
224      */
225     virtual bool requestMoveDialog(MoveData & data) = 0;
226
227     /**
228      * This virtual method must be overwritten and must present
229      * a widget for rotate options (number of copies, angle).
230      *
231      * @param data Rotation data which can be directly changed
232      *             by the presented widget.
233      */
234     virtual bool requestRotateDialog(RotateData & data) = 0;
235
236     /**
237      * This virtual method must be overwritten and must present
238      * a widget for rotate options (number of copies, angle).
239      *
240      * @param data Scaling data which can be directly changed
241      *             by the presented widget.
242      */
243     virtual bool requestScaleDialog(ScaleData & data) = 0;
244
245     /**
246      * This virtual method must be overwritten and must present
247      * a widget for mirror options (number of copies).
248      *
249      * @param data Mirror data which can be directly changed
250      *             by the presented widget.
251      */
252     virtual bool requestMirrorDialog(MirrorData & data) = 0;
253
254     /**
255      * This virtual method must be overwritten and must present
256      * a widget for move/rotate options (number of copies, angle).
257      *
258      * @param data Move/rotate data which can be directly changed
259      *             by the presented widget.
260      */
261     virtual bool requestMoveRotateDialog(MoveRotateData & data) = 0;
262
263     /**
264      * This virtual method must be overwritten and must present
265      * a widget for rotate around two centers options (number of
266     * copies, angles).
267      *
268      * @param data Rotate data which can be directly changed
269      *             by the presented widget.
270      */
271     virtual bool requestRotate2Dialog(Rotate2Data & data) = 0;
272
273     /**
274      * This virtual method must be overwritten and must show
275      * the given toolbar.
276      *
277      * @param id Tool bar ID.
278      */
279     virtual void requestToolBar(RS2::ToolBarId id) = 0;
280
281     /**
282      * This virtual method must be overwritten and must show
283      * the tag toolbar with a button for launching the given
284      * action.
285      *
286      * @param nextAction ID of next action to create after selecting was done.
287      */
288     virtual void requestToolBarSelect(ActionInterface * selectAction, RS2::ActionType nextAction) = 0;
289
290     /**
291      * This virtual method must be overwritten and must present
292      * a dialog to edit the given entity.
293      *
294      * @param entity Pointer to the entity.
295      */
296     virtual bool requestModifyEntityDialog(Entity * entity) = 0;
297
298     /**
299      * This virtual method must be overwritten and must present
300      * a dialog to edit text entity attributes.
301      *
302      * @param entity Pointer to the text entity.
303      */
304     virtual bool requestTextDialog(Text * text) = 0;
305
306     /**
307      * This virtual method must be overwritten and must present
308      * a dialog to select pattern attributes.
309      *
310      * @param entity Pointer to the hatch entity.
311      */
312     virtual bool requestHatchDialog(Hatch * hatch) = 0;
313
314     /**
315      * This virtual method must be overwritten and must present
316      * a dialog for general application options.
317      */
318     virtual void requestOptionsGeneralDialog() = 0;
319
320     /**
321      * This virtual method must be overwritten and must present
322      * a dialog for drawing options.
323          *
324          * @param graphic Graphic document.
325      */
326     virtual void requestOptionsDrawingDialog(Drawing & graphic) = 0;
327
328 #ifdef RS_CAM
329     virtual bool requestCamOptionsDialog(Drawing & graphic) = 0;
330 #endif
331
332     /**
333      * This virtual method must be overwritten if the graphic view has
334      * a component that is interested in the current mouse position.
335      * The implementation will be called every time the mouse position
336      * changes.
337      *
338      * @param abs Absolute coordiante of the mouse cursor or the
339      *            point it snaps to.
340      * @param rel Relative coordiante.
341      */
342     virtual void updateCoordinateWidget(const Vector & abs, const Vector & rel, bool updateFormat = false) = 0;
343
344     /**
345      * This virtual method must be overwritten if the graphic view has
346      * a component that is interested in the current mouse button hints.
347      * The implementation will be called typically by actions to inform
348      * the user about the current functionalty of the mouse buttons.
349      *
350      * @param left Help text for the left mouse button.
351      * @param right Help text for the right mouse button.
352      */
353     virtual void updateMouseWidget(const QString & left, const QString & right) = 0;
354
355     /**
356      * This virtual method must be overwritten if the graphic view has
357      * a component that is interested in the current number of selected
358          * entities.
359      * The implementation will be called every time the selection
360      * changes.
361      *
362      * @param num Number of selected entities
363      */
364     virtual void updateSelectionWidget(int num) = 0;
365
366     /**
367      * This virtual method must be overwritten if the graphic view has
368      * a component that is interested in command messages (such as a
369     * command line history).
370      * The implementation will be called typically by actions to inform
371      * the user about current events and errors.
372      *
373      * @param message The message for the user.
374      */
375     virtual void commandMessage(const QString & message) = 0;
376
377         virtual bool isAdapter() = 0;
378 };
379
380 #endif  // __DIALOGFACTORYINTERFACE_H__