mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
Add a couple of new functions.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7625 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
82218a5424
commit
92c3fca0bb
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user