3 * \file FormFiledialog.h
4 * Copyright 2001 the LyX Team
5 * Read the file COPYING
8 * \author John Levon, moz@compsoc.man.ac.uk
11 #ifndef FORMFILEDIALOG_H
12 #define FORMFILEDIALOG_H
21 #include "forms_fwd.h"
23 #include "frontends/FileDialog.h"
25 #include <boost/signals/connection.hpp>
26 #include <boost/signals/trackable.hpp>
30 /// DirEntry internal structure definition
43 // void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
44 // void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
45 // int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
51 class FileDialog::Private : public boost::signals::trackable {
58 /// sets file selector user button action
59 void SetButton(int iIndex, string const & pszName = string(),
60 string const & pszPath = string());
61 /// gets last dialog directory
62 string const GetDirectory() const;
63 /// launches dialog and returns selected file
64 string const Select(string const & pszTitle = string(),
65 string const & pszPath = string(),
66 string const & pszMask = string(),
67 string const & pszSuggested = string());
68 /// XForms objects callback (static)
69 static void FileDlgCB(FL_OBJECT *, long);
70 /// Callback for double click in list
71 static void DoubleClickCB(FL_OBJECT *, long);
72 /// Handle Cancel CB from WM close
73 static int CancelCB(FL_FORM *, void *);
77 static FD_filedialog * pFileDlgForm;
79 static FileDialog::Private * pCurrentDlg;
99 typedef std::vector<DirEntry> DirEntries;
101 DirEntries direntries;
107 /** Redraw the form (on receipt of a Signal indicating, for example,
108 that the xform colors have been re-mapped).
111 /// updates dialog list to match class directory
113 /// sets dialog current directory
114 void SetDirectory(string const & pszPath);
115 /// sets dialog file mask
116 void SetMask(string const & pszNewMask);
117 /// sets dialog information line
118 void SetInfoLine(string const & pszLine);
119 /// handle dialog during file selection
121 /// Handle callback from list
122 void HandleListHit();
123 /// Handle double click from list
124 bool HandleDoubleClick();
125 /// Handle OK button call
127 /// Simulates a click on OK/Cancel
129 /// Redraw connection.
130 boost::signals::connection r_;
133 #endif // FORMFILEDIALOG_H