]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormFiledialog.h
some mods I had in my local tree, mostly small stuff, perhaps minus the the Makefile...
[lyx.git] / src / frontends / xforms / FormFiledialog.h
1 // -*- C++ -*-
2 /**
3  * \file FormFiledialog.h
4  * Copyright 2001 the LyX Team
5  * Read the file COPYING
6  *
7  * \author unknown
8  * \author John Levon
9  */
10
11 #ifndef FORMFILEDIALOG_H
12 #define FORMFILEDIALOG_H
13
14 #include <vector>
15 #include <sigc++/signal_system.h>
16
17 #ifdef __GNUG__
18 #pragma interface
19 #endif
20
21 #include <config.h>
22
23 #include "LString.h"
24 #include FORMS_H_LOCATION
25 #include "form_filedialog.h"
26
27 #include "frontends/FileDialog.h"
28
29 /// DirEntry internal structure definition
30 class DirEntry {
31 public:
32         ///
33         string pszName;
34         ///
35         string pszDisplayed;
36         ///
37         string pszLsEntry;
38 };
39
40
41 //extern "C" {
42 //      void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
43 //      void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
44 //      int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
45 //}
46
47
48 class FileDialog::Private : public SigC::Object {
49 public:
50         ///
51         Private();
52         ///
53         ~Private();
54
55         /// sets file selector user button action
56         void SetButton(int iIndex, string const & pszName = string(),
57                        string const & pszPath = string());
58         /// gets last dialog directory
59         string const GetDirectory() const;
60         /// launches dialog and returns selected file
61         string const Select(string const & pszTitle = string(),
62                        string const & pszPath = string(),
63                        string const & pszMask = string(),
64                        string const & pszSuggested = string());
65         /// XForms objects callback (static)
66         static void FileDlgCB(FL_OBJECT *, long);
67         /// Callback for double click in list
68         static void DoubleClickCB(FL_OBJECT *, long);
69         /// Handle Cancel CB from WM close
70         static int CancelCB(FL_FORM *, void *);
71
72 private:
73         /// data
74         static FD_form_filedialog * pFileDlgForm;
75         ///
76         static FileDialog::Private * pCurrentDlg;
77         ///
78         string pszUserPath1;
79         ///
80         string pszUserPath2;
81         ///
82         string pszDirectory;
83         ///
84         string pszMask;
85         ///
86         string pszFileName;
87         ///
88         int iDepth;
89         ///
90         int iLastSel;
91         ///
92         long lLastTime;
93         ///
94         string pszInfoLine;
95         ///
96         typedef std::vector<DirEntry> DirEntries;
97         ///
98         DirEntries direntries;
99         ///
100         bool force_cancel;
101         ///
102         bool force_ok;
103
104         /// build the dialog
105         FD_form_filedialog * build_filedialog();
106
107         /** Redraw the form (on receipt of a Signal indicating, for example,
108             that the xform colors have been re-mapped).
109         */
110         void redraw();
111         /// updates dialog list to match class directory
112         void Reread();
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
120         bool RunDialog();
121         /// Handle callback from list
122         void HandleListHit();
123         /// Handle double click from list
124         bool HandleDoubleClick();
125         /// Handle OK button call
126         bool HandleOK();
127         /// Simulates a click on OK/Cancel
128         void Force(bool);
129         /// Redraw connection.
130         SigC::Connection r_;
131 };
132
133 #endif // FORMFILEDIALOG_H