]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormFiledialog.h
Bugfixes: checkboxes to radiobuttons (from J�rgen S) and remove a little
[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 "LString.h"
22 #include FORMS_H_LOCATION
23 #include "form_filedialog.h"
24
25 #include "frontends/FileDialog.h"
26
27 /// DirEntry internal structure definition
28 class DirEntry {
29 public:
30         ///
31         string pszName;
32         ///
33         string pszDisplayed;
34         ///
35         string pszLsEntry;
36 };
37
38
39 //extern "C" {
40 //      void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data);
41 //      void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data);
42 //      int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev);
43 //}
44
45
46 class FileDialog::Private : public SigC::Object {
47 public:
48         ///
49         Private();
50         ///
51         ~Private();
52
53         /// sets file selector user button action
54         void SetButton(int iIndex, string const & pszName = string(),
55                        string const & pszPath = string());
56         /// gets last dialog directory
57         string const GetDirectory() const;
58         /// launches dialog and returns selected file
59         string const Select(string const & pszTitle = string(),
60                        string const & pszPath = string(),
61                        string const & pszMask = string(),
62                        string const & pszSuggested = string());
63         /// XForms objects callback (static)
64         static void FileDlgCB(FL_OBJECT *, long);
65         /// Callback for double click in list
66         static void DoubleClickCB(FL_OBJECT *, long);
67         /// Handle Cancel CB from WM close
68         static int CancelCB(FL_FORM *, void *);
69
70 private:
71         /// data
72         static FD_form_filedialog * pFileDlgForm;
73         ///
74         static FileDialog::Private * pCurrentDlg;
75         ///
76         string pszUserPath1;
77         ///
78         string pszUserPath2;
79         ///
80         string pszDirectory;
81         ///
82         string pszMask;
83         ///
84         string pszFileName;
85         ///
86         int iDepth;
87         ///
88         int iLastSel;
89         ///
90         long lLastTime;
91         ///
92         string pszInfoLine;
93         ///
94         typedef std::vector<DirEntry> DirEntries;
95         ///
96         DirEntries direntries;
97         ///
98         bool force_cancel;
99         ///
100         bool force_ok;
101
102         /// build the dialog
103         FD_form_filedialog * build_filedialog();
104
105         /** Redraw the form (on receipt of a Signal indicating, for example,
106             that the xform colors have been re-mapped).
107         */
108         void redraw();
109         /// updates dialog list to match class directory
110         void Reread();
111         /// sets dialog current directory
112         void SetDirectory(string const & pszPath);
113         /// sets dialog file mask
114         void SetMask(string const & pszNewMask);
115         /// sets dialog information line
116         void SetInfoLine(string const & pszLine);
117         /// handle dialog during file selection
118         bool RunDialog();
119         /// Handle callback from list
120         void HandleListHit();
121         /// Handle double click from list
122         bool HandleDoubleClick();
123         /// Handle OK button call
124         bool HandleOK();
125         /// Simulates a click on OK/Cancel
126         void Force(bool);
127         /// Redraw connection.
128         SigC::Connection r_;
129 };
130
131 #endif // FORMFILEDIALOG_H