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>
27 /// DirEntry internal structure definition
33 std::string displayed_;
35 std::string ls_entry_;
40 // void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
41 // void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
42 // int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
53 } // namespace support
57 class FileDialog::Private : public boost::signals::trackable {
64 /// sets file selector user button action
65 void SetButton(int iIndex, std::string const & pszName = std::string(),
66 std::string const & pszPath = std::string());
67 /// gets last dialog directory
68 std::string const GetDirectory() const;
69 /// launches dialog and returns selected file
70 std::string const Select(std::string const & pszTitle,
71 std::string const & pszPath,
72 lyx::support::FileFilterList const & filters,
73 std::string const & pszSuggested);
74 /// launches dialog and returns selected directory
75 std::string const SelectDir(std::string const & pszTitle = std::string(),
76 std::string const & pszPath = std::string(),
77 std::string const & pszSuggested = std::string());
78 /// XForms objects callback (static)
79 static void FileDlgCB(FL_OBJECT *, long);
80 /// Callback for double click in list
81 static void DoubleClickCB(FL_OBJECT *, long);
82 /// Handle Cancel CB from WM close
83 static int CancelCB(FL_FORM *, void *);
87 static FD_filedialog * file_dlg_form_;
89 static FileDialog::Private * current_dlg_;
95 std::string user_path1_;
97 std::string user_path2_;
99 std::string directory_;
103 std::string file_name_;
111 std::string info_line_;
113 typedef std::vector<DirEntry> DirEntries;
115 DirEntries dir_entries_;
121 /** Redraw the form (on receipt of a Signal indicating, for example,
122 that the xform colors have been re-mapped).
125 /// updates dialog list to match class directory
127 /// sets dialog current directory
128 void SetDirectory(std::string const & pszPath);
129 /// sets dialog file mask
130 void SetFilters(std::string const & filters);
131 void SetFilters(lyx::support::FileFilterList const & filters);
132 /// sets dialog information line
133 void SetInfoLine(std::string const & pszLine);
134 /// handle dialog during file selection
136 /// Handle callback from list
137 void HandleListHit();
138 /// Handle double click from list
139 bool HandleDoubleClick();
140 /// Handle OK button call
142 /// Simulates a click on OK/Cancel
144 /// Redraw connection.
145 boost::signals::connection r_;
148 #endif // FORMFILEDIALOG_H