]> git.lyx.org Git - lyx.git/blob - src/frontends/FileDialog.h
Switch from SigC signals to boost::signals
[lyx.git] / src / frontends / FileDialog.h
1 // -*- C++ -*-
2 /**
3  * \file FileDialog.h
4  * Copyright 2001 the LyX Team
5  * Read the file COPYING
6  *
7  * \author unknown
8  * \author John Levon
9  */
10
11 #ifndef FILEDIALOG_H
12 #define FILEDIALOG_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include <utility>
19
20 #include "commandtags.h"
21
22 #include "LString.h"
23
24 class LyXView;
25
26 /**
27  * \class FileDialog
28  * \brief GUI-I definition of file dialog interface
29  */
30 class FileDialog
31 {
32 public:
33         /// label, directory path button
34         typedef std::pair<string, string> Button;
35
36         /// result type
37         enum ResultType {
38                 Later, /**< modeless chooser, no result */
39                 Chosen /**< string contains filename */
40         };
41
42         /// result return
43         typedef std::pair<FileDialog::ResultType, string> Result;
44
45         /**
46          * Constructs a file dialog attached to LyXView \param lv, with
47          * title \param title. If \param a is \const LFUN_SELECT_FILE_SYNC
48          * then a value will be returned immediately upon performing a Select(),
49          * otherwise a callback Dispatch() will be invoked with the filename as
50          * argument, of action \param a.
51          *
52          * Up to two optional extra buttons are allowed for specifying
53          * additional directories in the navigation (an empty
54          * directory is interpreted as getcwd())
55          */
56         FileDialog(LyXView * lv, string const & title,
57                    kb_action a = LFUN_SELECT_FILE_SYNC,
58                    Button b1 = Button(string(), string()),
59                    Button b2 = Button(string(), string()));
60
61
62         ~FileDialog();
63
64         /**
65          * Choose a file for selection, starting in directory \param
66          * path, with the file selection \param mask. The \param mask
67          * string is of the form :
68          *
69          * <regular expression to match> | <description>
70          *
71          * for example, "*.ps | PostScript files (*.ps)".
72          *
73          * FIXME: should support multiple lines of these for different file types.
74          */
75         Result const Select(string const & path = string(),
76                 string const & mask = string(),
77                 string const & suggested = string());
78
79
80         /* This *has* to be public because there is no way to specify extern "C" functions
81          * as friends of Private implementation for the xforms implementation ... grr
82          */
83         class Private;
84         friend class Private;
85         Private * private_;
86
87 private:
88         /// our LyXView
89         LyXView * lv_;
90
91         /// the dialog title
92         string title_;
93
94         /// success action to perform if not synchronous
95         kb_action success_;
96
97 };
98
99 #endif // FILEDIALOG_H