]> git.lyx.org Git - lyx.git/blob - src/filedlg.h
Small fix.
[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-2000 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 /// LyXDirEntry internal structure definition
26 class LyXDirEntry
27 {
28 public:
29         string pszName;
30         string pszDisplayed;
31         string pszLsEntry;
32 };
33
34
35 /// FileDlg class definition
36 class LyXFileDlg 
37 {
38 public:
39         ///
40         LyXFileDlg();
41
42         /// sets file selector user button action
43         void SetButton(int iIndex, string const & pszName = string(), 
44                        string const & pszPath = string());
45         /// gets last dialog directory
46         string GetDirectory() const;
47         /// launches dialog and returns selected file
48         string Select(string const & pszTitle = string(),
49                        string const & pszPath = string(),
50                        string const & pszMask = string(), 
51                        string const & pszSuggested = string());
52         /// XForms objects callback (static)
53         static void FileDlgCB(FL_OBJECT *, long);
54         /// Callback for double click in list
55         static void DoubleClickCB(FL_OBJECT *, long);
56         /// Handle Cancel CB from WM close
57         static int CancelCB(FL_FORM *, void *);
58 private:
59         /// data
60         static FD_FileDlg * pFileDlgForm;
61         ///
62         static LyXFileDlg * pCurrentDlg;
63         ///
64         string pszUserPath1;
65         ///
66         string pszUserPath2;
67         ///
68         string pszDirectory;
69         ///
70         string pszMask;
71         ///
72         string pszFileName;
73         ///
74         int iDepth;
75         ///
76         int iLastSel;
77         ///
78         long lLastTime;
79         ///
80         string pszInfoLine;
81         ///
82         typedef std::vector<LyXDirEntry> DirEntries;
83         ///
84         DirEntries direntries;
85         ///
86         bool force_cancel;
87         ///
88         bool force_ok;
89
90         /// updates dialog list to match class directory
91         void Reread();
92         /// sets dialog current directory
93         void SetDirectory(string const & pszPath);
94         /// sets dialog file mask
95         void SetMask(string const & pszNewMask);
96         /// sets dialog information line
97         void SetInfoLine(string const & pszLine);
98         /// handle dialog during file selection
99         bool RunDialog();
100         /// Handle callback from list
101         void HandleListHit();
102         /// Handle double click from list
103         bool HandleDoubleClick();
104         /// Handle OK button call
105         bool HandleOK();
106         /// Simulates a click on OK/Cancel
107         void Force(bool);
108 };
109
110 #endif