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
20 #include "forms_fwd.h"
22 #include "frontends/FileDialog.h"
24 #include <boost/signals/connection.hpp>
25 #include <boost/signals/trackable.hpp>
31 /// DirEntry internal structure definition
44 // void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
45 // void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
46 // int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
52 class FileDialog::Private : public boost::signals::trackable {
59 /// sets file selector user button action
60 void SetButton(int iIndex, string const & pszName = string(),
61 string const & pszPath = string());
62 /// gets last dialog directory
63 string const GetDirectory() const;
64 /// launches dialog and returns selected file
65 string const Select(string const & pszTitle = string(),
66 string const & pszPath = string(),
67 string const & pszMask = string(),
68 string const & pszSuggested = string());
69 /// launches dialog and returns selected directory
70 string const SelectDir(string const & pszTitle = string(),
71 string const & pszPath = string(),
72 string const & pszSuggested = string());
73 /// XForms objects callback (static)
74 static void FileDlgCB(FL_OBJECT *, long);
75 /// Callback for double click in list
76 static void DoubleClickCB(FL_OBJECT *, long);
77 /// Handle Cancel CB from WM close
78 static int CancelCB(FL_FORM *, void *);
82 static FD_filedialog * file_dlg_form_;
84 static FileDialog::Private * current_dlg_;
108 typedef std::vector<DirEntry> DirEntries;
110 DirEntries dir_entries_;
116 /** Redraw the form (on receipt of a Signal indicating, for example,
117 that the xform colors have been re-mapped).
120 /// updates dialog list to match class directory
122 /// sets dialog current directory
123 void SetDirectory(string const & pszPath);
124 /// sets dialog file mask
125 void SetMask(string const & pszNewMask);
126 /// sets dialog information line
127 void SetInfoLine(string const & pszLine);
128 /// handle dialog during file selection
130 /// Handle callback from list
131 void HandleListHit();
132 /// Handle double click from list
133 bool HandleDoubleClick();
134 /// Handle OK button call
136 /// Simulates a click on OK/Cancel
138 /// Redraw connection.
139 boost::signals::connection r_;
142 #endif // FORMFILEDIALOG_H