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>
32 /// DirEntry internal structure definition
45 // void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
46 // void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
47 // int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
53 class FileDialog::Private : public boost::signals::trackable {
60 /// sets file selector user button action
61 void SetButton(int iIndex, string const & pszName = string(),
62 string const & pszPath = string());
63 /// gets last dialog directory
64 string const GetDirectory() const;
65 /// launches dialog and returns selected file
66 string const Select(string const & pszTitle = string(),
67 string const & pszPath = string(),
68 string const & pszMask = string(),
69 string const & pszSuggested = string());
70 /// XForms objects callback (static)
71 static void FileDlgCB(FL_OBJECT *, long);
72 /// Callback for double click in list
73 static void DoubleClickCB(FL_OBJECT *, long);
74 /// Handle Cancel CB from WM close
75 static int CancelCB(FL_FORM *, void *);
79 static FD_filedialog * pFileDlgForm;
81 static FileDialog::Private * pCurrentDlg;
101 typedef std::vector<DirEntry> DirEntries;
103 DirEntries direntries;
109 /** Redraw the form (on receipt of a Signal indicating, for example,
110 that the xform colors have been re-mapped).
113 /// updates dialog list to match class directory
115 /// sets dialog current directory
116 void SetDirectory(string const & pszPath);
117 /// sets dialog file mask
118 void SetMask(string const & pszNewMask);
119 /// sets dialog information line
120 void SetInfoLine(string const & pszLine);
121 /// handle dialog during file selection
123 /// Handle callback from list
124 void HandleListHit();
125 /// Handle double click from list
126 bool HandleDoubleClick();
127 /// Handle OK button call
129 /// Simulates a click on OK/Cancel
131 /// Redraw connection.
132 boost::signals::connection r_;
135 #endif // FORMFILEDIALOG_H