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