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_;
47 std::string ls_entry_;
52 // void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
53 // void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
54 // int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
60 } // namespace frontend
64 class FileDialog::Private : public boost::signals::trackable {
71 /// sets file selector user button action
72 void SetButton(int iIndex, std::string const & pszName = std::string(),
73 std::string const & pszPath = std::string());
74 /// gets last dialog directory
75 std::string const GetDirectory() const;
76 /// launches dialog and returns selected file
77 std::string const Select(std::string const & pszTitle,
78 std::string const & pszPath,
79 lyx::support::FileFilterList const & filters,
80 std::string const & pszSuggested);
81 /// launches dialog and returns selected directory
82 std::string const SelectDir(std::string const & pszTitle = std::string(),
83 std::string const & pszPath = std::string(),
84 std::string const & pszSuggested = std::string());
85 /// XForms objects callback (static)
86 static void FileDlgCB(FL_OBJECT *, long);
87 /// Callback for double click in list
88 static void DoubleClickCB(FL_OBJECT *, long);
89 /// Handle Cancel CB from WM close
90 static int CancelCB(FL_FORM *, void *);
94 static lyx::frontend::FD_filedialog * file_dlg_form_;
96 static FileDialog::Private * current_dlg_;
102 std::string user_path1_;
104 std::string user_path2_;
106 std::string directory_;
110 std::string file_name_;
118 std::string info_line_;
120 typedef std::vector<lyx::frontend::DirEntry> DirEntries;
122 DirEntries dir_entries_;
128 /** Redraw the form (on receipt of a Signal indicating, for example,
129 that the xform colors have been re-mapped).
132 /// updates dialog list to match class directory
134 /// sets dialog current directory
135 void SetDirectory(std::string const & pszPath);
136 /// sets dialog file mask
137 void SetFilters(std::string const & filters);
138 void SetFilters(lyx::support::FileFilterList const & filters);
139 /// sets dialog information line
140 void SetInfoLine(std::string const & pszLine);
141 /// handle dialog during file selection
143 /// Handle callback from list
144 void HandleListHit();
145 /// Handle double click from list
146 bool HandleDoubleClick();
147 /// Handle OK button call
149 /// Simulates a click on OK/Cancel
151 /// Redraw connection.
152 boost::signals::connection r_;
155 #endif // FORMFILEDIALOG_H