]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/xforms_helpers.h
d7d2bd2240445948586e1eec90064e62824d1109
[lyx.git] / src / frontends / xforms / xforms_helpers.h
1 #ifndef XFORMSHELPERS_H
2 #define XFORMSHELPERS_H
3
4 #ifdef __GNUG_
5 #pragma interface
6 #endif
7
8 #include <utility> // pair
9 //#include <config.h>
10 #include "LString.h"
11 #include "Color.h"
12
13 // Set an FL_OBJECT to activated or deactivated
14 void setEnabled(FL_OBJECT *, bool enable);
15
16 // Take a string and add breaks so that it fits into a desired label width, w
17 string formatted(string const &label, int w,
18                  int=FL_NORMAL_SIZE, int=FL_NORMAL_STYLE);
19
20 class LyXView;
21  
22 /** Launch a file dialog and return the chosen file.
23     filename: a suggested filename.
24     title: the title of the dialog.
25     pattern: *.ps etc.
26     dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
27 */
28 string const browseFile(LyXView *lv, string const & filename,
29                         string const & title,
30                         string const & pattern, 
31                         std::pair<string,string> const & dir1,
32                         std::pair<string,string> const & dir2);
33
34 /// struct holding xform-specific colors
35 struct XformsColor : public NamedColor {
36         int colorID;
37         XformsColor() : NamedColor(), colorID(0) {}
38         static bool read(string const &);
39         static bool write(string const &);
40 };
41
42
43 /** Some functions that perform some quite detailed tests to ascertain whether
44     the directory or file is readable or writeable. If not, then an error
45     message is placed in error_message. */
46 class RWInfo {
47 public:
48         ///
49         static bool WriteableDir(string const & dir);
50         ///
51         static bool ReadableDir(string const & dir);
52         ///
53         static bool WriteableFile(string const & file);
54         ///
55         static bool ReadableFile(string const & file);
56         ///
57         static string const & ErrorMessage() { return error_message; }
58 private:
59         ///
60         static string error_message;
61 };
62 #endif // XFORMSHELPERS_H