]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormFiledialog.h
Really dull and boring header shit
[lyx.git] / src / frontends / xforms / FormFiledialog.h
1 // -*- C++ -*-
2 /**
3  * \file FormFiledialog.h
4  * Read the file COPYING
5  *
6  * \author unknown
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #ifndef FORMFILEDIALOG_H
13 #define FORMFILEDIALOG_H
14
15
16 #ifdef __GNUG__
17 #pragma interface
18 #endif
19
20 #include "LString.h"
21
22 #include "forms_fwd.h"
23
24 #include "frontends/FileDialog.h"
25
26 #include <boost/signals/connection.hpp>
27 #include <boost/signals/trackable.hpp>
28
29 #include <vector>
30
31 class Dialogs;
32
33 /// DirEntry internal structure definition
34 class DirEntry {
35 public:
36         ///
37         string name_;
38         ///
39         string displayed_;
40         ///
41         string ls_entry_;
42 };
43
44
45 //extern "C" {
46 //      void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
47 //      void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
48 //      int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
49 //}
50
51
52 class FD_filedialog;
53
54 class FileDialog::Private : public boost::signals::trackable {
55 public:
56         ///
57         Private(Dialogs &);
58         ///
59         ~Private();
60
61         /// sets file selector user button action
62         void SetButton(int iIndex, string const & pszName = string(),
63                        string const & pszPath = string());
64         /// gets last dialog directory
65         string const GetDirectory() const;
66         /// launches dialog and returns selected file
67         string const Select(string const & pszTitle = string(),
68                        string const & pszPath = string(),
69                        string const & pszMask = string(),
70                        string const & pszSuggested = string());
71         /// XForms objects callback (static)
72         static void FileDlgCB(FL_OBJECT *, long);
73         /// Callback for double click in list
74         static void DoubleClickCB(FL_OBJECT *, long);
75         /// Handle Cancel CB from WM close
76         static int CancelCB(FL_FORM *, void *);
77
78 private:
79         /// data
80         static FD_filedialog * file_dlg_form_;
81         ///
82         static FileDialog::Private * current_dlg_;
83         ///
84         string user_path1_;
85         ///
86         string user_path2_;
87         ///
88         string directory_;
89         ///
90         string mask_;
91         ///
92         string file_name_;
93         ///
94         int depth_;
95         ///
96         int last_sel_;
97         ///
98         long last_time_;
99         ///
100         string info_line_;
101         ///
102         typedef std::vector<DirEntry> DirEntries;
103         ///
104         DirEntries dir_entries_;
105         ///
106         bool force_cancel_;
107         ///
108         bool force_ok_;
109
110         /** Redraw the form (on receipt of a Signal indicating, for example,
111             that the xform colors have been re-mapped).
112         */
113         void redraw();
114         /// updates dialog list to match class directory
115         void Reread();
116         /// sets dialog current directory
117         void SetDirectory(string const & pszPath);
118         /// sets dialog file mask
119         void SetMask(string const & pszNewMask);
120         /// sets dialog information line
121         void SetInfoLine(string const & pszLine);
122         /// handle dialog during file selection
123         bool RunDialog();
124         /// Handle callback from list
125         void HandleListHit();
126         /// Handle double click from list
127         bool HandleDoubleClick();
128         /// Handle OK button call
129         bool HandleOK();
130         /// Simulates a click on OK/Cancel
131         void Force(bool);
132         /// Redraw connection.
133         boost::signals::connection r_;
134 };
135
136 #endif // FORMFILEDIALOG_H