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