]> git.lyx.org Git - lyx.git/blob - src/filedlg.h
fix some of the bugs reported, should hopefully be a bit better now.
[lyx.git] / src / filedlg.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-1999 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef FILEDLG_H
13 #define FILEDLG_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include <vector>
20
21 #include "LString.h"
22 #include FORMS_H_LOCATION
23 #include "form1.h"
24
25 using std::vector;
26
27
28 /// LyXDirEntry internal structure definition
29 class LyXDirEntry
30 {
31 public:
32         string pszName;
33         string pszDisplayed;
34         string pszLsEntry;
35 };
36
37
38 /// FileDlg class definition
39 class LyXFileDlg 
40 {
41 public:
42         ///
43         LyXFileDlg();
44
45         /// sets file selector user button action
46         void SetButton(int iIndex, string const & pszName = string(), 
47                        string const & pszPath = string());
48         /// gets last dialog directory
49         string GetDirectory() const;
50         /// launches dialog and returns selected file
51         string Select(string const & pszTitle = string(),
52                        string const & pszPath = string(),
53                        string const & pszMask = string(), 
54                        string const & pszSuggested = string());
55         /// XForms objects callback (static)
56         static void FileDlgCB(FL_OBJECT *, long);
57         /// Callback for double click in list
58         static void DoubleClickCB(FL_OBJECT *, long);
59         /// Handle Cancel CB from WM close
60         static int CancelCB(FL_FORM *, void *);
61 private:
62         /// data
63         static FD_FileDlg * pFileDlgForm;
64         ///
65         static LyXFileDlg * pCurrentDlg;
66         ///
67         string pszUserPath1;
68         ///
69         string pszUserPath2;
70         ///
71         string pszDirectory;
72         ///
73         string pszMask;
74         ///
75         string pszFileName;
76         ///
77         int iDepth;
78         ///
79         int iLastSel;
80         ///
81         long lLastTime;
82         ///
83         string pszInfoLine;
84         ///
85         typedef vector<LyXDirEntry> DirEntries;
86         ///
87         DirEntries direntries;
88         ///
89         bool force_cancel;
90         ///
91         bool force_ok;
92
93         /// updates dialog list to match class directory
94         void Reread();
95         /// sets dialog current directory
96         void SetDirectory(string const & pszPath);
97         /// sets dialog file mask
98         void SetMask(string const & pszNewMask);
99         /// sets dialog information line
100         void SetInfoLine(string const & pszLine);
101         /// handle dialog during file selection
102         bool RunDialog();
103         /// Handle callback from list
104         void HandleListHit();
105         /// Handle double click from list
106         bool HandleDoubleClick();
107         /// Handle OK button call
108         bool HandleOK();
109         /// Simulates a click on OK/Cancel
110         void Force(bool);
111 };
112
113 #endif