]> git.lyx.org Git - lyx.git/blob - src/filedlg.h
Fixed various "missing features" in the tabular/textinset code.
[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 #include <sigc++/signal_system.h>
21
22 #include "LString.h"
23 #include FORMS_H_LOCATION
24 #include "form1.h"
25
26 #ifdef SIGC_CXX_NAMESPACES
27 using SigC::Object;
28 using SigC::Connection;
29 #endif
30
31 /// LyXDirEntry internal structure definition
32 class LyXDirEntry {
33 public:
34         ///
35         string pszName;
36         ///
37         string pszDisplayed;
38         ///
39         string pszLsEntry;
40 };
41
42
43 /// FileDlg class definition
44 class LyXFileDlg : public Object
45 {
46 public:
47         ///
48         LyXFileDlg();
49         ///
50         ~LyXFileDlg();
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 private:
69         /// data
70         static FD_FileDlg * pFileDlgForm;
71         ///
72         static LyXFileDlg * pCurrentDlg;
73         ///
74         string pszUserPath1;
75         ///
76         string pszUserPath2;
77         ///
78         string pszDirectory;
79         ///
80         string pszMask;
81         ///
82         string pszFileName;
83         ///
84         int iDepth;
85         ///
86         int iLastSel;
87         ///
88         long lLastTime;
89         ///
90         string pszInfoLine;
91         ///
92         typedef std::vector<LyXDirEntry> DirEntries;
93         ///
94         DirEntries direntries;
95         ///
96         bool force_cancel;
97         ///
98         bool force_ok;
99
100         /** Redraw the form (on receipt of a Signal indicating, for example,
101             that the xform colors have been re-mapped).
102         */
103         void redraw();
104         /// updates dialog list to match class directory
105         void Reread();
106         /// sets dialog current directory
107         void SetDirectory(string const & pszPath);
108         /// sets dialog file mask
109         void SetMask(string const & pszNewMask);
110         /// sets dialog information line
111         void SetInfoLine(string const & pszLine);
112         /// handle dialog during file selection
113         bool RunDialog();
114         /// Handle callback from list
115         void HandleListHit();
116         /// Handle double click from list
117         bool HandleDoubleClick();
118         /// Handle OK button call
119         bool HandleOK();
120         /// Simulates a click on OK/Cancel
121         void Force(bool);
122         /// Redraw connection.
123         Connection r_;
124 };
125
126 #endif