mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-23 08:39:07 +00:00
59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
|
#include <config.h>
|
||
|
|
||
|
#include FORMS_H_LOCATION
|
||
|
|
||
|
#ifdef __GNUG__
|
||
|
#pragma implementation
|
||
|
#endif
|
||
|
|
||
|
#include "xformsBC.h"
|
||
|
#include "xforms_helpers.h"
|
||
|
|
||
|
|
||
|
xformsBC::xformsBC(string const & cancel, string const & close)
|
||
|
: ButtonControllerBase(cancel, close),
|
||
|
okay_(0), apply_(0), cancel_(0), undo_all_(0), read_only_()
|
||
|
{}
|
||
|
|
||
|
|
||
|
void xformsBC::refresh()
|
||
|
{
|
||
|
if (okay_) {
|
||
|
if (bp().buttonStatus(ButtonPolicy::OKAY)) {
|
||
|
setEnabled(okay_, true);
|
||
|
} else {
|
||
|
setEnabled(okay_, false);
|
||
|
}
|
||
|
}
|
||
|
if (apply_) {
|
||
|
if (bp().buttonStatus(ButtonPolicy::APPLY)) {
|
||
|
setEnabled(apply_, true);
|
||
|
} else {
|
||
|
setEnabled(apply_, false);
|
||
|
}
|
||
|
}
|
||
|
if (undo_all_) {
|
||
|
if (bp().buttonStatus(ButtonPolicy::UNDO_ALL)) {
|
||
|
setEnabled(undo_all_, true);
|
||
|
} else {
|
||
|
setEnabled(undo_all_, false);
|
||
|
}
|
||
|
}
|
||
|
if (cancel_) {
|
||
|
if (bp().buttonStatus(ButtonPolicy::CANCEL)) {
|
||
|
fl_set_object_label(cancel_, cancel_label.c_str());
|
||
|
} else {
|
||
|
fl_set_object_label(cancel_, close_label.c_str());
|
||
|
}
|
||
|
}
|
||
|
if (!read_only_.empty()) {
|
||
|
bool enable = true;
|
||
|
if (bp().isReadOnly()) enable = false;
|
||
|
|
||
|
for (std::list<FL_OBJECT *>::iterator iter = read_only_.begin();
|
||
|
iter != read_only_.end(); ++iter) {
|
||
|
setEnabled(*iter, enable);
|
||
|
}
|
||
|
}
|
||
|
}
|