2001-03-23 22:07:56 +00:00
|
|
|
/**
|
2001-04-03 14:30:58 +00:00
|
|
|
* \file qt2BC.C
|
2001-03-23 22:07:56 +00:00
|
|
|
* Copyright 2001 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author Allan Rae <rae@lyx.org>
|
|
|
|
* \author Angus Leeming <a.leeming@ic.ac.uk>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "qt2BC.h"
|
|
|
|
|
|
|
|
#include <qbutton.h>
|
|
|
|
|
|
|
|
qt2BC::qt2BC(string const & cancel, string const & close)
|
|
|
|
: ButtonControllerBase(cancel, close),
|
2001-04-03 14:30:58 +00:00
|
|
|
okay_(0), apply_(0), cancel_(0), restore_(0), read_only_()
|
2001-03-23 22:07:56 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void qt2BC::refresh()
|
|
|
|
{
|
|
|
|
if (okay_) {
|
|
|
|
if (bp().buttonStatus(ButtonPolicy::OKAY)) {
|
|
|
|
okay_->setEnabled( true );
|
|
|
|
} else {
|
|
|
|
okay_->setEnabled( false );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (apply_) {
|
|
|
|
if (bp().buttonStatus(ButtonPolicy::APPLY)) {
|
|
|
|
apply_->setEnabled( true );
|
|
|
|
} else {
|
|
|
|
apply_->setEnabled( false );
|
|
|
|
}
|
|
|
|
}
|
2001-04-03 14:30:58 +00:00
|
|
|
if (restore_) {
|
|
|
|
if (bp().buttonStatus(ButtonPolicy::RESTORE)) {
|
|
|
|
restore_->setEnabled( true );
|
2001-03-23 22:07:56 +00:00
|
|
|
} else {
|
2001-04-03 14:30:58 +00:00
|
|
|
restore_->setEnabled( false );
|
2001-03-23 22:07:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cancel_) {
|
|
|
|
if (bp().buttonStatus(ButtonPolicy::CANCEL)) {
|
2001-03-31 08:39:24 +00:00
|
|
|
cancel_->setText( cancel_label_.c_str() );
|
2001-03-23 22:07:56 +00:00
|
|
|
} else {
|
2001-03-31 08:39:24 +00:00
|
|
|
cancel_->setText( close_label_.c_str() );
|
2001-03-23 22:07:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!read_only_.empty()) {
|
|
|
|
bool enable = true;
|
|
|
|
if (bp().isReadOnly()) enable = false;
|
|
|
|
|
2001-03-29 18:58:47 +00:00
|
|
|
for (std::list<QWidget *>::iterator iter = read_only_.begin();
|
2001-03-23 22:07:56 +00:00
|
|
|
iter != read_only_.end(); ++iter) {
|
|
|
|
(*iter)->setEnabled( enable );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|