Consider the case where there is not any layout name.
[lyx.git] / src / frontends / FileDialog.h
blob47949dba81dcb75b117d52cacd2fd59ae8d31794
1 // -*- C++ -*-
2 /**
3 * \file FileDialog.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author unknown
8 * \author John Levon
10 * Full author contact details are available in file CREDITS.
13 #ifndef FILEDIALOG_H
14 #define FILEDIALOG_H
16 #include "lfuns.h"
18 #include <utility>
19 #include <string>
22 namespace lyx {
23 namespace support {
25 class FileFilterList;
27 } // namespace support
28 } // namespace lyx
32 /**
33 * \class FileDialog
34 * \brief GUI-I definition of file dialog interface
36 class FileDialog
38 public:
39 /// label, directory path button
40 typedef std::pair<std::string, std::string> Button;
42 /// result type
43 enum ResultType {
44 Later, /**< modeless chooser, no result */
45 Chosen /**< string contains filename */
48 /// result return
49 typedef std::pair<FileDialog::ResultType, std::string> Result;
51 /**
52 * Constructs a file dialog with title \param title.
53 * If \param a is \const LFUN_SELECT_FILE_SYNC then a value
54 * will be returned immediately upon performing a open(),
55 * otherwise a callback Dispatch() will be invoked with the filename as
56 * argument, of action \param a.
58 * Up to two optional extra buttons are allowed for specifying
59 * additional directories in the navigation (an empty
60 * directory is interpreted as getcwd())
62 FileDialog(std::string const & title,
63 kb_action a = LFUN_SELECT_FILE_SYNC,
64 Button b1 = Button(std::string(), std::string()),
65 Button b2 = Button(std::string(), std::string()));
68 ~FileDialog();
70 /// Choose a file for opening, starting in directory \c path.
71 Result const open(std::string const & path,
72 lyx::support::FileFilterList const & filters,
73 std::string const & suggested);
75 /// Choose a directory, starting in directory \c path.
76 Result const opendir(std::string const & path = std::string(),
77 std::string const & suggested = std::string());
79 /// Choose a file for saving, starting in directory \c path.
80 Result const save(std::string const & path,
81 lyx::support::FileFilterList const & filters,
82 std::string const & suggested);
84 /* This *has* to be public because there is no way to specify
85 * extern "C" functions as friends of Private implementation for
86 * the xforms implementation ... grr
88 class Private;
89 friend class Private;
90 Private * private_;
92 private:
93 /// the dialog title
94 std::string title_;
96 /// success action to perform if not synchronous
97 kb_action success_;
101 #endif // FILEDIALOG_H