]> git.lyx.org Git - lyx.git/blobdiff - src/combox.h
More fixes to insettabular/text (and some missing features added).
[lyx.git] / src / combox.h
index 16c6cd056ad2ab6c6ba50033c0eae2965e34821f..c948c1895f84a423681b4a31c2383e97d47b41fa 100644 (file)
@@ -59,9 +59,15 @@ public:
        ~Combox();
 
        /** To add this object to a form. Note that there are two heights
-        for normal (button) and expanded (browser) mode each.
+           for normal (button) and expanded (browser) mode each.
+           The optional tabfolder arguments are needed to overcome an
+           xforms bug when repositioning a combox in a tab folder.
+           tabfolder1_ is the folder holding the combox.
+           If using nested tabfolders, tabfolder2_ is the "base" folder
+           holding tabfolder1_.
        */
-       void add(int x, int y, int w, int hmin, int hmax);
+       void add(int x, int y, int w, int hmin, int hmax,
+                FL_OBJECT * tabfolder1_ = 0, FL_OBJECT * tabfolder2_ = 0);
        
        /// Add lines. Same as for fl_browser object
        void addline(string const &);
@@ -69,10 +75,10 @@ public:
        void addto(string const &);
        
        /// Returns the selected item
-       int get();
+       int get() const;
    
        /// Returns a pointer to the selected line of text
-       string const getline();
+       string const getline() const;
    
        ///  Select an arbitrary item
        void select(int);
@@ -83,7 +89,7 @@ public:
        void clear();
 
        /// Is the combox cleared (empty)
-       bool empty() { return is_empty; }
+       bool empty() const { return is_empty; }
        
        /// Remove the objects from the form they are in. 
        void remove();
@@ -146,6 +152,10 @@ public:
        FL_OBJECT * label;
        ///
         FL_FORM* form;
+       ///
+       FL_OBJECT * tabfolder1;
+       ///
+       FL_OBJECT * tabfolder2;
 };
 
 
@@ -209,19 +219,20 @@ void Combox::setpost(FL_COMBO_PRE_POST cb)
 
 
 inline
-int Combox::get()
+int Combox::get() const
 {
    return sel;
 }
 
 
 inline
-string const Combox::getline()
+string const Combox::getline() const
 {
     if (type == FL_COMBOX_INPUT) 
       return fl_get_input(label);
     else
-      return browser ? fl_get_browser_line(browser, sel) : 0;
+      return (browser && sel > 0) ?
+             fl_get_browser_line(browser, sel) : string();
 }
 
 #endif