]> git.lyx.org Git - lyx.git/commitdiff
Add a couple of new functions.
authorAngus Leeming <leeming@lyx.org>
Thu, 28 Aug 2003 08:48:03 +0000 (08:48 +0000)
committerAngus Leeming <leeming@lyx.org>
Thu, 28 Aug 2003 08:48:03 +0000 (08:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7625 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/ChangeLog
src/frontends/xforms/RadioButtonGroup.C
src/frontends/xforms/RadioButtonGroup.h

index e4f1184eda9423c610309544d7cd68d94ddadc57..2b7da9fd7a4cef24b2d0bc7d2d3abeb3949f6cfd 100644 (file)
@@ -1,3 +1,8 @@
+2003-08-28  Angus Leeming  <leeming@lyx.org>
+
+       * RadioButtonGroup.[Ch] (unset, setEnabled): new functions extending
+       the class' functionality.
+
 2003-08-23  Rob Lahaye  <lahaye@snu.ac.kr>
 
        * FormShowFile.C (build): Remove redundant "LyX:" string from title.
index c22917fc4d211858a36ed6eac85a8e50ba087c64..a12937aca054de2e4e536ba3c6e8d01a08d6174f 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "RadioButtonGroup.h"
 #include "lyx_forms.h"
+#include "xforms_helpers.h"
 
 #include "support/LAssert.h"
 #include "debug.h" // for lyxerr
@@ -83,6 +84,21 @@ struct is_set_button {
 };
 
 
+void RadioButtonGroup::unset() const
+{
+       // Find the active button.
+       ButtonValueMap::const_iterator it =
+               find_if(map.begin(), map.end(),
+                       is_set_button<ButtonValuePair> ());
+
+       if (it == map.end())
+               // Nothing to do. No button is set.
+               return;
+
+       fl_set_button(it->first, 0);
+}
+
+
 RadioButtonGroup::size_type RadioButtonGroup::get() const
 {
        // Find the active button.
@@ -97,3 +113,13 @@ RadioButtonGroup::size_type RadioButtonGroup::get() const
        lyxerr << "BUG: No active radio button found." << endl;
        return 0;
 }
+
+
+void RadioButtonGroup::setEnabled(bool enable)
+{
+       ButtonValueMap::iterator it  = map.begin();
+       ButtonValueMap::iterator end = map.end();
+       for (; it != end; ++it) {
+               ::setEnabled(it->first, enable);
+       }
+}
index b05cc063e8fb159f95cce27a68b27458998e3b9c..5fc6b1ed4d6704a6b081da7aa5c1777f76592166 100644 (file)
@@ -41,9 +41,14 @@ public:
        void set(size_type value) const;
        void set(FL_OBJECT * ob) const;
 
+       // None of the radiobuttons are set.
+       void unset() const;
+
        // Get the active button's value.
        size_type get() const;
 
+       void setEnabled(bool enabled);
+
 private:
        ///
        typedef std::pair<FL_OBJECT *, size_type> ButtonValuePair;