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_H_LOCATION
22 #include "form_filedialog.h"
24 #include "frontends/FileDialog.h"
26 #include <boost/signals/connection.hpp>
27 #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);
50 class FileDialog::Private : public boost::signals::trackable {
57 /// sets file selector user button action
58 void SetButton(int iIndex, string const & pszName = string(),
59 string const & pszPath = string());
60 /// gets last dialog directory
61 string const GetDirectory() const;
62 /// launches dialog and returns selected file
63 string const Select(string const & pszTitle = string(),
64 string const & pszPath = string(),
65 string const & pszMask = string(),
66 string const & pszSuggested = string());
67 /// XForms objects callback (static)
68 static void FileDlgCB(FL_OBJECT *, long);
69 /// Callback for double click in list
70 static void DoubleClickCB(FL_OBJECT *, long);
71 /// Handle Cancel CB from WM close
72 static int CancelCB(FL_FORM *, void *);
76 static FD_form_filedialog * pFileDlgForm;
78 static FileDialog::Private * pCurrentDlg;
98 typedef std::vector<DirEntry> DirEntries;
100 DirEntries direntries;
107 FD_form_filedialog * build_filedialog();
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