]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/xforms_helpers.h
Yet another tweak from J�rgen.
[lyx.git] / src / frontends / xforms / xforms_helpers.h
index f17fdd07585b03a98a51b9a38a1e7204bb6cbdc5..c4325d88012c236db156e51d5d180609d1f1a749 100644 (file)
@@ -7,15 +7,21 @@
 #pragma interface
 #endif
 
-#include <config.h>
 #include FORMS_H_LOCATION
  
 #include "Color.h"
-#include "support/lstrings.h"
+#include "LString.h"
  
 #include <vector>
 
+class LyXLength;
+
+// what we always need for lengths
+string const choice_Length_All =
+    "cm|mm|in|%%|c%%|p%%|l%%|ex|em|pt|sp|bp|dd|pc|cc|mu";
+string const choice_Length_WithUnit =
+    "cm|mm|in|ex|em|pt|sp|bp|dd|pc|cc|mu";     // all with a Unit
+
 /// Extract shortcut from <ident>|<shortcut> string
 char const * flyx_shortcut_extract(char const * sc);
 /// Shortcut for flyx_shortcut_extract
@@ -31,7 +37,7 @@ void setEnabled(FL_OBJECT *, bool enable);
 
 /// Take a string and add breaks so that it fits into a desired label width, w
 string formatted(string const &label, int w,
-                int=FL_NORMAL_SIZE, int=FL_NORMAL_STYLE);
+                int = FL_NORMAL_SIZE, int = FL_NORMAL_STYLE);
 
 /// Given an fl_choice, create a vector of its entries
 std::vector<string> const getVectorFromChoice(FL_OBJECT *);
@@ -39,6 +45,21 @@ std::vector<string> const getVectorFromChoice(FL_OBJECT *);
 /// Given an fl_browser, create a vector of its entries
 std::vector<string> const getVectorFromBrowser(FL_OBJECT *);
 
+/// Given an fl_input, return its contents.
+string const getStringFromInput(FL_OBJECT * ob);
+
+/** Given an fl_browser, return the contents of the currently
+    highlighted line.
+*/
+/** Given an fl_browser, return the contents of line
+    (xforms numbering convention; starts at 1).
+*/
+string const getStringFromBrowser(FL_OBJECT * ob, int line);
+/** Given an fl_browser, return the contents of the currently
+    highlighted line.
+*/
+string const getSelectedStringFromBrowser(FL_OBJECT * ob);
+
 /// Given input and choice widgets, create a string such as "1cm"
 string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice);
 
@@ -49,6 +70,13 @@ void updateWidgetsFromLengthString(FL_OBJECT * input, FL_OBJECT * choice,
                                   string const & str,
                                   string const & default_unit);
 
+/** Given a LyXLength, set the input and choice widgets.
+    If the length is null, the choice will be set to default_unit.
+ */
+void updateWidgetsFromLength(FL_OBJECT * input, FL_OBJECT * choice,
+                            LyXLength const & len,
+                            string const & default_unit);
+
 /// struct holding xform-specific colors
 struct XformsColor : public NamedColor {
        int colorID;