3 * \file FormFiledialog.h
4 * Read the file COPYING
9 * Full author contact details are available in file CREDITS
12 #ifndef FORMFILEDIALOG_H
13 #define FORMFILEDIALOG_H
22 #include "forms_fwd.h"
24 #include "frontends/FileDialog.h"
26 #include <boost/signals/connection.hpp>
27 #include <boost/signals/trackable.hpp>
33 /// DirEntry internal structure definition
46 // void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
47 // void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
48 // int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
54 class FileDialog::Private : public boost::signals::trackable {
61 /// sets file selector user button action
62 void SetButton(int iIndex, string const & pszName = string(),
63 string const & pszPath = string());
64 /// gets last dialog directory
65 string const GetDirectory() const;
66 /// launches dialog and returns selected file
67 string const Select(string const & pszTitle = string(),
68 string const & pszPath = string(),
69 string const & pszMask = string(),
70 string const & pszSuggested = string());
71 /// XForms objects callback (static)
72 static void FileDlgCB(FL_OBJECT *, long);
73 /// Callback for double click in list
74 static void DoubleClickCB(FL_OBJECT *, long);
75 /// Handle Cancel CB from WM close
76 static int CancelCB(FL_FORM *, void *);
80 static FD_filedialog * file_dlg_form_;
82 static FileDialog::Private * current_dlg_;
102 typedef std::vector<DirEntry> DirEntries;
104 DirEntries dir_entries_;
110 /** Redraw the form (on receipt of a Signal indicating, for example,
111 that the xform colors have been re-mapped).
114 /// updates dialog list to match class directory
116 /// sets dialog current directory
117 void SetDirectory(string const & pszPath);
118 /// sets dialog file mask
119 void SetMask(string const & pszNewMask);
120 /// sets dialog information line
121 void SetInfoLine(string const & pszLine);
122 /// handle dialog during file selection
124 /// Handle callback from list
125 void HandleListHit();
126 /// Handle double click from list
127 bool HandleDoubleClick();
128 /// Handle OK button call
130 /// Simulates a click on OK/Cancel
132 /// Redraw connection.
133 boost::signals::connection r_;
136 #endif // FORMFILEDIALOG_H