Code

Filter effects dialog:
[inkscape.git] / src / ui / dialog / filedialog.h
1 #ifndef __FILE_DIALOG_H__
2 #define __FILE_DIALOG_H__
3 /**
4  * Defines the FileOpenDialog, FileSaveDialog, and FileExportDialog
5  * and their supporting classes.
6  *
7  * Authors:
8  *   Bob Jamison <rwjj@earthlink.net>
9  *   Inkscape Guys
10  *
11  * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
12  * Copyright (C) 2004-2006, Inkscape Authors
13  *
14  * Released under GNU GPL, read the file 'COPYING' for more information
15  */
17 #include <glibmm.h>
18 #include <vector>
22 class Inkscape::Extension::Extension;
25 namespace Inkscape
26 {
27 namespace UI
28 {
29 namespace Dialog
30 {
33 /**
34  * Used for setting filters and options, and
35  * reading them back from user selections.
36  */
37 typedef enum {
38     SVG_TYPES,
39     IMPORT_TYPES,
40     EXPORT_TYPES
41     } FileDialogType;
43 /**
44  * Used for returning the type selected in a SaveAs
45  */
46 typedef enum {
47     SVG_NAMESPACE,
48     SVG_NAMESPACE_WITH_EXTENSIONS
49     } FileDialogSelectionType;
51 /**
52  * Architecture-specific data
53  */
54 typedef struct FileOpenNativeData_def FileOpenNativeData;
57 /**
58  * This class provides an implementation-independent API for
59  * file "Open" dialogs.  Using a standard interface obviates the need
60  * for ugly #ifdefs in file open code
61  */
62 class FileOpenDialog
63 {
64 public:
67     /**
68      * Constructor ..  do not call directly
69      * @param path the directory where to start searching
70      * @param fileTypes one of FileDialogTypes
71      * @param title the title of the dialog
72      */
73     FileOpenDialog()
74         {};
76     /**
77      * Factory.
78      * @param path the directory where to start searching
79      * @param fileTypes one of FileDialogTypes
80      * @param title the title of the dialog
81      */
82     static FileOpenDialog *create(const Glib::ustring &path,
83                                   FileDialogType fileTypes,
84                                   const Glib::ustring &title);
87     /**
88      * Destructor.
89      * Perform any necessary cleanups.
90      */
91     virtual ~FileOpenDialog() {};
93     /**
94      * Show an OpenFile file selector.
95      * @return the selected path if user selected one, else NULL
96      */
97     virtual bool show() =0;
99     /**
100      * Return the 'key' (filetype) of the selection, if any
101      * @return a pointer to a string if successful (which must
102      * be later freed with g_free(), else NULL.
103      */
104     virtual Inkscape::Extension::Extension * getSelectionType() = 0;
106     virtual Glib::ustring getFilename () =0;
108     virtual std::vector<Glib::ustring> getFilenames () = 0;
110 }; //FileOpenDialog
117 /**
118  * This class provides an implementation-independent API for
119  * file "Save" dialogs.
120  */
121 class FileSaveDialog
123 public:
125     /**
126      * Constructor.  Do not call directly .   Use the factory.
127      * @param path the directory where to start searching
128      * @param fileTypes one of FileDialogTypes
129      * @param title the title of the dialog
130      * @param key a list of file types from which the user can select
131      */
132     FileSaveDialog ()
133         {};
135     /**
136      * Factory.
137      * @param path the directory where to start searching
138      * @param fileTypes one of FileDialogTypes
139      * @param title the title of the dialog
140      * @param key a list of file types from which the user can select
141      */
142     static FileSaveDialog *create(const Glib::ustring &path,
143                                   FileDialogType fileTypes,
144                                   const Glib::ustring &title,
145                                   const Glib::ustring &default_key);
148     /**
149      * Destructor.
150      * Perform any necessary cleanups.
151      */
152     virtual ~FileSaveDialog() {};
155     /**
156      * Show an SaveAs file selector.
157      * @return the selected path if user selected one, else NULL
158      */
159     virtual bool show() =0;
161     /**
162      * Return the 'key' (filetype) of the selection, if any
163      * @return a pointer to a string if successful (which must
164      * be later freed with g_free(), else NULL.
165      */
166     virtual Inkscape::Extension::Extension * getSelectionType() = 0;
168     virtual void setSelectionType( Inkscape::Extension::Extension * key ) = 0;
170     virtual Glib::ustring getFilename () =0;
172     /**
173      * Change the window title.
174      */
175     virtual void change_title(const Glib::ustring& title) =0;
177     /**
178      * Change the default save path location.
179      */
180     virtual void change_path(const Glib::ustring& path) =0;
182 }; //FileSaveDialog
187 /**
188  * This class provides an implementation-independent API for
189  * file "Export" dialogs.  Saving as these types will not affect
190  * the original file.
191  */
192 class FileExportDialog
194 public:
196     typedef enum
197         {
198         SCOPE_DOCUMENT,
199         SCOPE_PAGE,
200         SCOPE_SELECTION,
201         SCOPE_CUSTOM
202         } ScopeType;
204     /**
205      * Constructor.  Do not call directly .   Use the factory.
206      * @param path the directory where to start searching
207      * @param fileTypes one of FileDialogTypes
208      * @param title the title of the dialog
209      * @param key a list of file types from which the user can select
210      */
211     FileExportDialog()
212         {}
214     /**
215      * Factory.
216      * @param path the directory where to start searching
217      * @param fileTypes one of FileDialogTypes
218      * @param title the title of the dialog
219      * @param key a list of file types from which the user can select
220      */
221     static FileExportDialog *create(const Glib::ustring &path,
222                                     FileDialogType fileTypes,
223                                     const Glib::ustring &title,
224                                     const Glib::ustring &default_key);
227     /**
228      * Destructor.
229      * Perform any necessary cleanups.
230      */
231     virtual ~FileExportDialog () {};
234     /**
235      * Show an SaveAs file selector.
236      * @return the selected path if user selected one, else NULL
237      */
238     virtual bool show() =0;
240     /**
241      * Return the 'key' (filetype) of the selection, if any
242      * @return a pointer to a string if successful (which must
243      * be later freed with g_free(), else NULL.
244      */
245     virtual Inkscape::Extension::Extension * getSelectionType() = 0;
247     /**
248      * Return the selected filename, if any.  If not, return ""
249      */
250     virtual Glib::ustring getFilename () =0;
251     
252     /**
253      * Return the scope of the export.  One of the enumerated types
254      * in ScopeType     
255      */
256     virtual ScopeType getScope() = 0;
257     
258     /**
259      * Return left side of the exported region
260      */
261     virtual double getSourceX() = 0;
262     
263     /**
264      * Return the top of the exported region
265      */
266     virtual double getSourceY() = 0;
267     
268     /**
269      * Return the width of the exported region
270      */
271     virtual double getSourceWidth() = 0;
272     
273     /**
274      * Return the height of the exported region
275      */
276     virtual double getSourceHeight() = 0;
278     /**
279      * Return the units of the coordinates of exported region
280      */
281     virtual Glib::ustring getSourceUnits() = 0;
283     /**
284      * Return the width of the destination document
285      */
286     virtual double getDestinationWidth() = 0;
288     /**
289      * Return the height of the destination document
290      */
291     virtual double getDestinationHeight() = 0;
293     /**
294      * Return the height of the exported region
295      */
296     virtual Glib::ustring getDestinationUnits() = 0;
298     /**
299      * Return the destination DPI image resulution, if bitmap
300      */
301     virtual double getDestinationDPI() = 0;
303     /**
304      * Return whether we should use Cairo for rendering
305      */
306     virtual bool getUseCairo() = 0;
308     /**
309      * Return whether we should use antialiasing
310      */
311     virtual bool getUseAntialias() = 0;
313     /**
314      * Return the background color for exporting
315      */
316     virtual unsigned long getBackground() = 0;
318     
320 }; //FileExportDialog
323 } //namespace Dialog
324 } //namespace UI
325 } //namespace Inkscape
328 #endif /* __FILE_DIALOG_H__ */
330 /*
331   Local Variables:
332   mode:c++
333   c-file-style:"stroustrup"
334   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
335   indent-tabs-mode:nil
336   fill-column:99
337   End:
338 */
339 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :