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);
48 class FileDialog::Private : public boost::signals::trackable {
55 /// sets file selector user button action
56 void SetButton(int iIndex, std::string const & pszName = std::string(),
57 std::string const & pszPath = std::string());
58 /// gets last dialog directory
59 std::string const GetDirectory() const;
60 /// launches dialog and returns selected file
61 std::string const Select(std::string const & pszTitle = std::string(),
62 std::string const & pszPath = std::string(),
63 std::string const & pszMask = std::string(),
64 std::string const & pszSuggested = std::string());
65 /// launches dialog and returns selected directory
66 std::string const SelectDir(std::string const & pszTitle = std::string(),
67 std::string const & pszPath = std::string(),
68 std::string const & pszSuggested = std::string());
69 /// XForms objects callback (static)
70 static void FileDlgCB(FL_OBJECT *, long);
71 /// Callback for double click in list
72 static void DoubleClickCB(FL_OBJECT *, long);
73 /// Handle Cancel CB from WM close
74 static int CancelCB(FL_FORM *, void *);
78 static FD_filedialog * file_dlg_form_;
80 static FileDialog::Private * current_dlg_;
86 std::string user_path1_;
88 std::string user_path2_;
90 std::string directory_;
94 std::string file_name_;
102 std::string info_line_;
104 typedef std::vector<DirEntry> DirEntries;
106 DirEntries dir_entries_;
112 /** Redraw the form (on receipt of a Signal indicating, for example,
113 that the xform colors have been re-mapped).
116 /// updates dialog list to match class directory
118 /// sets dialog current directory
119 void SetDirectory(std::string const & pszPath);
120 /// sets dialog file mask
121 void SetMask(std::string const & pszNewMask);
122 /// sets dialog information line
123 void SetInfoLine(std::string const & pszLine);
124 /// handle dialog during file selection
126 /// Handle callback from list
127 void HandleListHit();
128 /// Handle double click from list
129 bool HandleDoubleClick();
130 /// Handle OK button call
132 /// Simulates a click on OK/Cancel
134 /// Redraw connection.
135 boost::signals::connection r_;
138 #endif // FORMFILEDIALOG_H