3 * \file FormFiledialog.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
10 * Full author contact details are available in file CREDITS.
13 #ifndef FORMFILEDIALOG_H
14 #define FORMFILEDIALOG_H
16 #include "forms_fwd.h"
18 #include "frontends/FileDialog.h"
20 #include <boost/signals/connection.hpp>
21 #include <boost/signals/trackable.hpp>
34 } // namespace support
39 /// DirEntry internal structure definition
45 std::string displayed_;
50 // void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
51 // void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
52 // int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
58 } // namespace frontend
62 class FileDialog::Private : public boost::signals::trackable {
69 /// sets file selector user button action
70 void SetButton(int iIndex, std::string const & pszName = std::string(),
71 std::string const & pszPath = std::string());
72 /// gets last dialog directory
73 std::string const GetDirectory() const;
74 /// launches dialog and returns selected file
75 std::string const Select(std::string const & pszTitle,
76 std::string const & pszPath,
77 lyx::support::FileFilterList const & filters,
78 std::string const & pszSuggested);
79 /// launches dialog and returns selected directory
80 std::string const SelectDir(std::string const & pszTitle = std::string(),
81 std::string const & pszPath = std::string(),
82 std::string const & pszSuggested = std::string());
83 /// XForms objects callback (static)
84 static void FileDlgCB(FL_OBJECT *, long);
85 /// Callback for double click in list
86 static void DoubleClickCB(FL_OBJECT *, long);
87 /// Handle Cancel CB from WM close
88 static int CancelCB(FL_FORM *, void *);
92 static lyx::frontend::FD_filedialog * file_dlg_form_;
94 static FileDialog::Private * current_dlg_;
100 std::string user_path1_;
102 std::string user_path2_;
104 std::string directory_;
108 std::string file_name_;
116 typedef std::vector<lyx::frontend::DirEntry> DirEntries;
118 DirEntries dir_entries_;
124 /** Redraw the form (on receipt of a Signal indicating, for example,
125 that the xform colors have been re-mapped).
128 /// updates dialog list to match class directory
130 /// sets dialog current directory
131 void SetDirectory(std::string const & pszPath);
132 /// sets dialog file mask
133 void SetFilters(std::string const & filters);
134 void SetFilters(lyx::support::FileFilterList const & filters);
135 /// handle dialog during file selection
137 /// Handle callback from list
138 void HandleListHit();
139 /// Handle double click from list
140 bool HandleDoubleClick();
141 /// Handle OK button call
143 /// Simulates a click on OK/Cancel
145 /// Redraw connection.
146 boost::signals::connection r_;
149 #endif // FORMFILEDIALOG_H