~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/dialogs/filedialog.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef __FILE_DIALOG_H__
2
 
#define __FILE_DIALOG_H__
3
 
 
4
 
/** \file Defines classes FileOpenDialog, FileSaveDialog,
5
 
 *    and enums FileDialogType, FileDialogSelectionType. */
6
 
 
7
 
#include <glib/gtypes.h>
8
 
#include <glibmm/slisthandle.h>
9
 
 
10
 
namespace Inkscape {
11
 
 
12
 
namespace Extension {
13
 
class Extension;
14
 
}
15
 
 
16
 
namespace UI {
17
 
namespace Dialogs {
18
 
 
19
 
 
20
 
/**
21
 
 * Used for setting filters and options, and
22
 
 * reading them back from user selections.
23
 
 */
24
 
typedef enum {
25
 
    SVG_TYPES,
26
 
    IMPORT_TYPES,
27
 
    EXPORT_TYPES
28
 
    } FileDialogType;
29
 
 
30
 
/**
31
 
 * Used for returning the type selected in a SaveAs
32
 
 */
33
 
typedef enum {
34
 
    SVG_NAMESPACE,
35
 
    SVG_NAMESPACE_WITH_EXTENSIONS
36
 
    } FileDialogSelectionType;
37
 
 
38
 
/**
39
 
 * Architecture-specific data
40
 
 */
41
 
typedef struct FileOpenNativeData_def FileOpenNativeData;
42
 
 
43
 
 
44
 
/**
45
 
 * This class provides an implementation-independent API for
46
 
 * file "Open" dialogs.  Using a standard interface obviates the need
47
 
 * for ugly #ifdefs in file open code
48
 
 */
49
 
class FileOpenDialog
50
 
{
51
 
public:
52
 
 
53
 
 
54
 
    /**
55
 
     * Constructor ..  do not call directly
56
 
     * @param path the directory where to start searching
57
 
     * @param fileTypes one of FileDialogTypes
58
 
     * @param title the title of the dialog
59
 
     */
60
 
    FileOpenDialog()
61
 
        {};
62
 
 
63
 
    /**
64
 
     * Factory.
65
 
     * @param path the directory where to start searching
66
 
     * @param fileTypes one of FileDialogTypes
67
 
     * @param title the title of the dialog
68
 
     */
69
 
    static FileOpenDialog *create(const char *path, FileDialogType fileTypes, const char *title);
70
 
 
71
 
 
72
 
    /**
73
 
     * Destructor.
74
 
     * Perform any necessary cleanups.
75
 
     */
76
 
    virtual ~FileOpenDialog() {};
77
 
 
78
 
    /**
79
 
     * Show an OpenFile file selector.
80
 
     * @return the selected path if user selected one, else NULL
81
 
     */
82
 
    virtual bool show() =0;
83
 
 
84
 
    /**
85
 
     * Return the 'key' (filetype) of the selection, if any
86
 
     * @return a pointer to a string if successful (which must
87
 
     * be later freed with g_free(), else NULL.
88
 
     */
89
 
    virtual Inkscape::Extension::Extension * getSelectionType() = 0;
90
 
 
91
 
    virtual gchar * getFilename () =0;
92
 
 
93
 
    virtual Glib::SListHandle<Glib::ustring> getFilenames () = 0;
94
 
 
95
 
}; //FileOpenDialog
96
 
 
97
 
 
98
 
 
99
 
 
100
 
 
101
 
 
102
 
/**
103
 
 * This class provides an implementation-independent API for
104
 
 * file "Save" dialogs.
105
 
 */
106
 
class FileSaveDialog
107
 
{
108
 
public:
109
 
 
110
 
    /**
111
 
     * Constructor.  Do not call directly .   Use the factory.
112
 
     * @param path the directory where to start searching
113
 
     * @param fileTypes one of FileDialogTypes
114
 
     * @param title the title of the dialog
115
 
     * @param key a list of file types from which the user can select
116
 
     */
117
 
    FileSaveDialog ()
118
 
        {};
119
 
 
120
 
    /**
121
 
     * Factory.
122
 
     * @param path the directory where to start searching
123
 
     * @param fileTypes one of FileDialogTypes
124
 
     * @param title the title of the dialog
125
 
     * @param key a list of file types from which the user can select
126
 
     */
127
 
    static FileSaveDialog *create(const char *path, FileDialogType fileTypes, const char *title, const char * default_key);
128
 
 
129
 
 
130
 
    /**
131
 
     * Destructor.
132
 
     * Perform any necessary cleanups.
133
 
     */
134
 
    virtual ~FileSaveDialog() {};
135
 
 
136
 
 
137
 
    /**
138
 
     * Show an SaveAs file selector.
139
 
     * @return the selected path if user selected one, else NULL
140
 
     */
141
 
    virtual bool show() =0;
142
 
 
143
 
    /**
144
 
     * Return the 'key' (filetype) of the selection, if any
145
 
     * @return a pointer to a string if successful (which must
146
 
     * be later freed with g_free(), else NULL.
147
 
     */
148
 
    virtual Inkscape::Extension::Extension * getSelectionType() = 0;
149
 
 
150
 
    virtual gchar * getFilename () =0;
151
 
 
152
 
 
153
 
}; //FileSaveDialog
154
 
 
155
 
 
156
 
} //namespace Dialogs
157
 
} //namespace UI
158
 
} //namespace Inkscape
159
 
 
160
 
 
161
 
#endif /* __FILE_DIALOG_H__ */
162
 
 
163
 
/*
164
 
  Local Variables:
165
 
  mode:c++
166
 
  c-file-style:"stroustrup"
167
 
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
168
 
  indent-tabs-mode:nil
169
 
  fill-column:99
170
 
  End:
171
 
*/
172
 
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :