-// -*- C++ -*-
-/* This file is part of
- * ======================================================
+/**
+ * \file Qt2Base.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * LyX, The Document Processor
+ * \author Angus Leeming
*
- * Copyright 2000 The LyX Team.
- *
- * ======================================================
- *
- * \author Angus Leeming <a.leeming@ic.ac.uk>
+ * Full author contact details are available in file CREDITS
*/
#include <config.h>
#endif
#include <qdialog.h>
-#undef emit
+#include <qapplication.h>
+#include "debug.h"
+#include "QtLyXView.h"
#include "Dialogs.h"
#include "Qt2Base.h"
-#include "qt2BC.h"
+#include "Qt2BC.h"
+#include "ControlButtons.h"
#include "support/LAssert.h"
-#include <stdio.h>
-
-Qt2Base::Qt2Base(ControlButtons & c, QString const & t)
- : ViewBC<qt2BC>(c), title_(t)
+Qt2Base::Qt2Base(QString const & t)
+ : ViewBase(), updating_(false), title_(t)
{}
+Qt2BC & Qt2Base::bc()
+{
+ return static_cast<Qt2BC &>(getController().bc());
+ // return dynamic_cast<Qt2BC &>(getController().bc());
+}
+
void Qt2Base::show()
{
- if (!form()) {
- build();
- }
-
- update(); // make sure its up-to-date
-
- if (form()->isVisible()) {
- form()->raise();
- } else {
- form()->setCaption( title_ );
- form()->show();
- }
+ if (!form()) {
+ build();
+ }
+
+ form()->setMinimumSize(form()->sizeHint());
+
+ update(); // make sure its up-to-date
+
+ if (form()->isVisible()) {
+ form()->raise();
+ } else {
+ form()->setCaption(title_);
+ form()->show();
+ }
}
void Qt2Base::hide()
{
- if (form() && form()->isVisible() )
- form()->hide();
+ if (form() && form()->isVisible())
+ form()->hide();
}
-// PENDING(kalle) Handle this with QValidator?
-// void Qt2Base::InputCB(FL_OBJECT * ob, long data)
-// {
-// bc().input(input(ob, data));
-// }
+bool Qt2Base::isValid()
+{
+ return true;
+}
-ButtonPolicy::SMInput Qt2Base::input(QWidget*, long)
+void Qt2Base::changed()
{
- return ButtonPolicy::SMI_VALID;
-}
+ if (updating_)
+ return;
+ if (isValid())
+ bc().valid();
+ else
+ bc().invalid();
+}
void Qt2Base::slotWMHide()
{
- CancelButton();
+ getController().CancelButton();
}
-
void Qt2Base::slotApply()
{
- ApplyButton();
+ getController().ApplyButton();
}
void Qt2Base::slotOK()
{
- OKButton();
+ getController().OKButton();
}
-void Qt2Base::slotCancel()
+void Qt2Base::slotClose()
{
- CancelButton();
+ getController().CancelButton();
}
void Qt2Base::slotRestore()
{
- RestoreButton();
+ getController().RestoreButton();
}
-
-
-// PENDING(kalle) How to handle this?
-// extern "C" void C_Qt2BaseInputCB(FL_OBJECT * ob, long d)
-// {
-// GetForm(ob)->InputCB(ob, d);
-// }