1 #ifndef RS_DIALOGFACTORYINTERFACE_H
2 #define RS_DIALOGFACTORYINTERFACE_H
7 class RS_ActionInterface;
9 class RS_AttributesData;
15 class RS_DimLinearData;
16 class RS_DimensionData;
19 class RS_EventHandler;
29 class RS_MoveRotateData;
41 * Interface for objects that can create and show dialogs.
43 class RS_DialogFactoryInterface
46 RS_DialogFactoryInterface() {}
47 virtual ~RS_DialogFactoryInterface() {}
50 * This virtual method must be overwritten and must show the previously
51 * shown menu in the cad toolbar.
53 virtual void requestPreviousMenu() = 0;
56 * This virtual method must be overwritten and must provide
59 virtual void requestWarningDialog(const QString & warning) = 0;
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
66 virtual RS_GraphicView * requestNewDocument(const QString & fileName = QString::null,
67 RS_Document * doc = NULL) = 0;
70 * This virtual method must be overwritten and must create or show
71 * a simulation control widget.
73 virtual void requestSimulationControls() = 0;
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.
81 * @return The implementation is expected to return a pointer
82 * to the newly created layer or NULL if the user
85 virtual RS_Layer * requestNewLayerDialog(RS_LayerList * layerList = NULL) = 0;
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.
93 * @return The implementation is expected to return a pointer
94 * to the layer which can ne removed or NULL if the user
97 virtual RS_Layer * requestLayerRemovalDialog(RS_LayerList * layerList = NULL) = 0;
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.
104 * @return The implementation is expected to return a pointer
105 * to the modified layer or NULL if the user
106 * cancels the dialog.
108 virtual RS_Layer * requestEditLayerDialog(RS_LayerList * layerList = NULL) = 0;
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.
116 * @param block Pointer to the newly created block with default
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.
123 virtual RS_BlockData requestNewBlockDialog(RS_BlockList * blockList) = 0;
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.
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.
135 virtual RS_Block * requestBlockRemovalDialog(RS_BlockList * blockList) = 0;
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.
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.
146 virtual RS_BlockData requestBlockAttributesDialog(RS_BlockList * blockList) = 0;
149 * This virtual method must be overwritten and should provide
150 * a way to edit a block.
152 virtual void requestEditBlockWindow(RS_BlockList * blockList) = 0;
154 virtual void closeEditBlockWindow(RS_Block * block) = 0;
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.
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.
165 //virtual QString requestFileSaveAsDialog() = 0;
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.
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.
176 //virtual QString requestFileOpenDialog() = 0;
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.
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.
187 virtual QString requestImageOpenDialog() = 0;
190 * This virtual method must be overwritten and must present
191 * a widget for options for the given action.
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.
198 virtual void requestOptions(RS_ActionInterface * action, bool on, bool update = false) = 0;
201 * This virtual method must be overwritten and must present
202 * a widget for snap point with distance options.
204 * @param dist Distance which can be directly changed
205 * by the presented widget.
206 * @param on true: switch widget on, false: off
208 virtual void requestSnapDistOptions(double & dist, bool on) = 0;
211 * This virtual method must be overwritten and must present
212 * a widget for entity attributes.
214 * @param data Attribute data which can be directly changed
215 * by the presented widget.
217 virtual bool requestAttributesDialog(RS_AttributesData & data, RS_LayerList & layerList) = 0;
220 * This virtual method must be overwritten and must present
221 * a widget for move options (number of copies).
223 * @param data Move data which can be directly changed
224 * by the presented widget.
226 virtual bool requestMoveDialog(RS_MoveData & data) = 0;
229 * This virtual method must be overwritten and must present
230 * a widget for rotate options (number of copies, angle).
232 * @param data Rotation data which can be directly changed
233 * by the presented widget.
235 virtual bool requestRotateDialog(RS_RotateData & data) = 0;
238 * This virtual method must be overwritten and must present
239 * a widget for rotate options (number of copies, angle).
241 * @param data Scaling data which can be directly changed
242 * by the presented widget.
244 virtual bool requestScaleDialog(RS_ScaleData & data) = 0;
247 * This virtual method must be overwritten and must present
248 * a widget for mirror options (number of copies).
250 * @param data Mirror data which can be directly changed
251 * by the presented widget.
253 virtual bool requestMirrorDialog(RS_MirrorData & data) = 0;
256 * This virtual method must be overwritten and must present
257 * a widget for move/rotate options (number of copies, angle).
259 * @param data Move/rotate data which can be directly changed
260 * by the presented widget.
262 virtual bool requestMoveRotateDialog(RS_MoveRotateData & data) = 0;
265 * This virtual method must be overwritten and must present
266 * a widget for rotate around two centers options (number of
269 * @param data Rotate data which can be directly changed
270 * by the presented widget.
272 virtual bool requestRotate2Dialog(RS_Rotate2Data & data) = 0;
275 * This virtual method must be overwritten and must show
278 * @param id Tool bar ID.
280 virtual void requestToolBar(RS2::ToolBarId id) = 0;
283 * This virtual method must be overwritten and must show
284 * the tag toolbar with a button for launching the given
287 * @param nextAction ID of next action to create after selecting was done.
289 virtual void requestToolBarSelect(RS_ActionInterface * selectAction, RS2::ActionType nextAction) = 0;
292 * This virtual method must be overwritten and must present
293 * a dialog to edit the given entity.
295 * @param entity Pointer to the entity.
297 virtual bool requestModifyEntityDialog(RS_Entity * entity) = 0;
300 * This virtual method must be overwritten and must present
301 * a dialog to edit text entity attributes.
303 * @param entity Pointer to the text entity.
305 virtual bool requestTextDialog(RS_Text * text) = 0;
308 * This virtual method must be overwritten and must present
309 * a dialog to select pattern attributes.
311 * @param entity Pointer to the hatch entity.
313 virtual bool requestHatchDialog(RS_Hatch * hatch) = 0;
316 * This virtual method must be overwritten and must present
317 * a dialog for general application options.
319 virtual void requestOptionsGeneralDialog() = 0;
322 * This virtual method must be overwritten and must present
323 * a dialog for drawing options.
325 * @param graphic Graphic document.
327 virtual void requestOptionsDrawingDialog(Drawing & graphic) = 0;
330 virtual bool requestCamOptionsDialog(Drawing & graphic) = 0;
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
339 * @param abs Absolute coordiante of the mouse cursor or the
341 * @param rel Relative coordiante.
343 virtual void updateCoordinateWidget(const Vector & abs, const Vector & rel, bool updateFormat = false) = 0;
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.
351 * @param left Help text for the left mouse button.
352 * @param right Help text for the right mouse button.
354 virtual void updateMouseWidget(const QString & left, const QString & right) = 0;
357 * This virtual method must be overwritten if the graphic view has
358 * a component that is interested in the current number of selected
360 * The implementation will be called every time the selection
363 * @param num Number of selected entities
365 virtual void updateSelectionWidget(int num) = 0;
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.
374 * @param message The message for the user.
376 virtual void commandMessage(const QString & message) = 0;
378 virtual bool isAdapter() = 0;