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