]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/Qt2Base.C
Get rid of the static_casts.
[lyx.git] / src / frontends / qt2 / Qt2Base.C
index 5d23347d99ea57dccad19c01505ffcc4740df473..704ac24ba6bd6b6fbd9162542b53b8642dc36968 100644 (file)
@@ -1,36 +1,46 @@
-/* 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>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include <qdialog.h>
-#include <qapplication.h> 
+#include <qapplication.h>
 
-#include "debug.h" 
-#include "QtLyXView.h" 
-#include "Dialogs.h"
+#include "debug.h"
+#include "qt_helpers.h"
+#include "QtLyXView.h"
 #include "Qt2Base.h"
 #include "Qt2BC.h"
+#include "ButtonController.h"
+#include "ControlButtons.h"
 #include "support/LAssert.h"
 
-Qt2Base::Qt2Base(ControlButtons & c, QString const & t)
-       : ViewBC<Qt2BC>(c), updating_(false), title_(t)
+
+Qt2Base::Qt2Base(string const & t)
+       : ViewBase(t), updating_(false)
 {}
 
 
+Qt2BC & Qt2Base::bcview()
+{
+       return static_cast<Qt2BC &>(bc().view());
+       // return dynamic_cast<Qt2BC &>(bc());
+}
+
+
+bool Qt2Base::isVisible() const
+{
+       return form() && form()->isVisible();
+}
+
+
 void Qt2Base::show()
 {
        if (!form()) {
@@ -41,10 +51,11 @@ void Qt2Base::show()
 
        update();  // make sure its up-to-date
 
+       form()->setCaption(toqstr(getTitle()));
+
        if (form()->isVisible()) {
                form()->raise();
        } else {
-               form()->setCaption(title_);
                form()->show();
        }
 }
@@ -62,44 +73,40 @@ bool Qt2Base::isValid()
        return true;
 }
 
+
 void Qt2Base::changed()
 {
        if (updating_)
                return;
-       if (isValid())
-               bc().valid(); 
-       else
-               bc().invalid();
+       bc().valid(isValid());
 }
 
 
 void Qt2Base::slotWMHide()
 {
-       CancelButton();
+       getController().CancelButton();
 }
 
 
 void Qt2Base::slotApply()
 {
-       ApplyButton();
+       getController().ApplyButton();
 }
 
 
 void Qt2Base::slotOK()
 {
-       OKButton();
+       getController().OKButton();
 }
 
 
 void Qt2Base::slotClose()
 {
-       CancelButton();
+       getController().CancelButton();
 }
 
 
 void Qt2Base::slotRestore()
 {
-       RestoreButton();
+       getController().RestoreButton();
 }