3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
6 * \author Allan Rae <rae@lyx.org>
7 * \author Angus Leeming <a.leeming@ic.ac.uk>
13 #pragma implementation
17 #include "ButtonController.tmpl"
21 #include <qlineedit.h>
23 Qt2BC::Qt2BC(string const & cancel, string const & close)
24 : GuiBC<QButton, QWidget>(cancel, close)
28 void Qt2BC::setButtonEnabled(QButton * obj, bool enabled)
30 obj->setEnabled(enabled);
34 void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled)
36 // yuck, rtti, but the user comes first
37 if (obj->inherits("QLineEdit")) {
38 QLineEdit * le(static_cast<QLineEdit*>(obj));
39 le->setReadOnly(!enabled);
41 obj->setEnabled(enabled);
44 QWidget::FocusPolicy const p =
45 (enabled) ? QWidget::StrongFocus : QWidget::NoFocus;
46 obj->setFocusPolicy(p);
50 void Qt2BC::setButtonLabel(QButton * obj, string const & label)
52 obj->setText(label.c_str());