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
23 #include "forms_fwd.h"
25 #include "frontends/FileDialog.h"
27 #include <boost/signals/connection.hpp>
28 #include <boost/signals/trackable.hpp>
34 /// DirEntry internal structure definition
47 // void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
48 // void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
49 // int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
55 class FileDialog::Private : public boost::signals::trackable {
62 /// sets file selector user button action
63 void SetButton(int iIndex, string const & pszName = string(),
64 string const & pszPath = string());
65 /// gets last dialog directory
66 string const GetDirectory() const;
67 /// launches dialog and returns selected file
68 string const Select(string const & pszTitle = string(),
69 string const & pszPath = string(),
70 string const & pszMask = string(),
71 string const & pszSuggested = string());
72 /// XForms objects callback (static)
73 static void FileDlgCB(FL_OBJECT *, long);
74 /// Callback for double click in list
75 static void DoubleClickCB(FL_OBJECT *, long);
76 /// Handle Cancel CB from WM close
77 static int CancelCB(FL_FORM *, void *);
81 static FD_filedialog * file_dlg_form_;
83 static FileDialog::Private * current_dlg_;
103 typedef std::vector<DirEntry> DirEntries;
105 DirEntries dir_entries_;
111 /** Redraw the form (on receipt of a Signal indicating, for example,
112 that the xform colors have been re-mapped).
115 /// updates dialog list to match class directory
117 /// sets dialog current directory
118 void SetDirectory(string const & pszPath);
119 /// sets dialog file mask
120 void SetMask(string const & pszNewMask);
121 /// sets dialog information line
122 void SetInfoLine(string const & pszLine);
123 /// handle dialog during file selection
125 /// Handle callback from list
126 void HandleListHit();
127 /// Handle double click from list
128 bool HandleDoubleClick();
129 /// Handle OK button call
131 /// Simulates a click on OK/Cancel
133 /// Redraw connection.
134 boost::signals::connection r_;
137 #endif // FORMFILEDIALOG_H