]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/xforms_helpers.h
* New xforms helper functions getVectorFromChoice, getVectorFromBrowser
[lyx.git] / src / frontends / xforms / xforms_helpers.h
1 // -*- C++ -*-
2
3 #ifndef XFORMSHELPERS_H
4 #define XFORMSHELPERS_H
5
6 #ifdef __GNUG_
7 #pragma interface
8 #endif
9
10 #include "Color.h"
11
12 /// Set an FL_OBJECT to activated or deactivated
13 void setEnabled(FL_OBJECT *, bool enable);
14
15 /// Take a string and add breaks so that it fits into a desired label width, w
16 string formatted(string const &label, int w,
17                  int=FL_NORMAL_SIZE, int=FL_NORMAL_STYLE);
18
19 /// Given an fl_choice, create a vector of its entries
20 std::vector<string> const getVectorFromChoice(FL_OBJECT *);
21
22 /// Given an fl_browser, create a vector of its entries
23 std::vector<string> const getVectorFromBrowser(FL_OBJECT *);
24
25 /// struct holding xform-specific colors
26 struct XformsColor : public NamedColor {
27         int colorID;
28         XformsColor() : NamedColor(), colorID(0) {}
29         static bool read(string const &);
30         static bool write(string const &);
31 };
32
33
34 /** Some functions that perform some quite detailed tests to ascertain whether
35     the directory or file is readable or writeable. If not, then an error
36     message is placed in error_message. */
37 class RWInfo {
38 public:
39         ///
40         static bool WriteableDir(string const & dir);
41         ///
42         static bool ReadableDir(string const & dir);
43         ///
44         static bool WriteableFile(string const & file);
45         ///
46         static bool ReadableFile(string const & file);
47         ///
48         static string const & ErrorMessage() { return error_message; }
49 private:
50         ///
51         static string error_message;
52 };
53 #endif // XFORMSHELPERS_H