]> git.lyx.org Git - lyx.git/blob - src/filedlg.h
white-space changes, removed definitions.h several enum changes because of this,...
[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 "LString.h"
20
21 // necessary for xForms related stuff
22 #include FORMS_H_LOCATION
23 #include "form1.h"
24
25
26 /// User cache class definition
27 class UserCache
28 {
29 public:
30         ///
31         UserCache(string const & pszName = string(), uid_t ID = 0, 
32                   UserCache *pRoot = 0);
33         ///
34         ~UserCache();
35         // interface
36         /// seeks user name from user ID
37         string Find(uid_t ID);
38 private:
39         ///
40         uid_t ID;
41         ///
42         string pszName;
43         ///
44         UserCache *pNext, *pRoot;
45         // internal methods
46         /// creates a new user entry
47         UserCache *Add(uid_t ID);
48 };
49 extern UserCache lyxUserCache;
50
51
52 /// Group cache class definition
53 class GroupCache
54 {
55 public:
56         ///
57         GroupCache(string const & pszName = string(), gid_t ID = 0,
58                    GroupCache *pRoot = 0);
59         ///
60         ~GroupCache();
61         // interface
62         /// seeks group name from group ID
63         string Find(gid_t ID);
64
65 private:
66         ///
67         gid_t ID;
68         ///
69         string pszName;
70         ///
71         GroupCache *pNext, *pRoot;
72         // internal methods
73         /// creates a new group entry
74         GroupCache *Add(gid_t ID);
75 };
76 extern GroupCache lyxGroupCache;
77
78
79 /// LyXDirEntry internal structure definition
80 class LyXDirEntry
81 {
82 private:
83         friend class LyXFileDlg;    
84         string pszName;
85         string pszDisplayed;
86         string pszLsEntry;
87         LyXDirEntry() {};
88 public:
89         /// compares two LyXDirEntry objects content (used by qsort)
90         static int ldeCompProc(const LyXDirEntry *r1, const LyXDirEntry *r2);
91 };
92
93
94 /// FileDlg class definition
95 class LyXFileDlg 
96 {
97 public:
98         ///
99         LyXFileDlg();
100         ///
101         ~LyXFileDlg();
102         /// sets file selector user button action
103         void SetButton(int iIndex, string const & pszName = string(), 
104                        string const & pszPath = string());
105         /// gets last dialog directory
106         string GetDirectory();
107         /// launches dialog and returns selected file
108         string Select(string const & pszTitle = string(),
109                        string const & pszPath = string(),
110                        string const & pszMask = string(), 
111                        string const & pszSuggested = string());
112         /// XForms objects callback (static)
113         static void FileDlgCB(FL_OBJECT *, long);
114         /// Callback for double click in list
115         static void DoubleClickCB(FL_OBJECT *, long);
116         /// Handle Cancel CB from WM close
117         static int CancelCB(FL_FORM *, void *);
118 private:
119         // data
120         static FD_FileDlg *pFileDlgForm;
121         static LyXFileDlg *pCurrentDlg;
122         string pszUserPath1;
123         string pszUserPath2;
124         string pszDirectory;
125         string pszMask;
126         string pszFileName;
127         int iDepth;
128         int iLastSel;
129         long lLastTime;
130         string pszInfoLine;
131         LyXDirEntry *pCurrentNames;
132         int iNumNames;
133
134         bool force_cancel;
135         bool force_ok;
136
137         // internal functions
138         /// updates dialog list to match class directory
139         void Reread();
140         /// sets dialog current directory
141         void SetDirectory(string const & pszPath);
142         /// sets dialog file mask
143         void SetMask(string const & pszNewMask);
144         /// sets dialog information line
145         void SetInfoLine(string const & pszLine);
146         /// handle dialog during file selection
147         bool RunDialog();
148         /// Handle callback from list
149         void HandleListHit();
150         /// Handle double click from list
151         bool HandleDoubleClick();
152         /// Handle OK button call
153         bool HandleOK();
154         /// Simulates a click on OK/Cancel
155         void Force(bool);
156 };
157
158 #endif