]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/Qt2Base.h
Get rid of the static_casts.
[lyx.git] / src / frontends / qt2 / Qt2Base.h
index 71f8fb6242ea5ac68ebec807da5af10919b58edc..027911319f1485e35a55388626eaaa2055a9b2ed 100644 (file)
@@ -1,31 +1,19 @@
 // -*- C++ -*-
-/* This file is part of
- * ======================================================
+/**
+ * \file Qt2Base.h
+ * 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
  */
 
 #ifndef QT2BASE_H
 #define QT2BASE_H
 
-#include <config.h>
-
-#ifdef __GNUG__
-#pragma interface
-#endif
 
 #include "ViewBase.h"
-#include "LString.h"
-#include "debug.h"
-#include "ButtonPolicies.h"
-#include "ControlButtons.h"
-
 #include <boost/scoped_ptr.hpp>
 
 #include <qfont.h>
@@ -37,15 +25,13 @@ class Qt2BC;
 
 /** This class is an Qt2 GUI base class.
  */
-class Qt2Base : public QObject, public ViewBC<Qt2BC>
-{
+class Qt2Base : public QObject, public ViewBase {
        Q_OBJECT
 public:
        ///
-       Qt2Base(ControlButtons &, QString const &);
+       Qt2Base(string const &);
        ///
        virtual ~Qt2Base() {}
-
 protected:
        /// build the actual dialog
        virtual void build_dialog() = 0;
@@ -55,6 +41,8 @@ protected:
        virtual void show();
        /// update the dialog's contents
        virtual void update_contents() = 0;
+       ///
+       virtual bool isVisible() const;
 
        /// the dialog has changed contents
        virtual void changed();
@@ -62,9 +50,11 @@ protected:
        /// is the dialog currently valid ?
        virtual bool isValid();
 
+       ///
+       Qt2BC & bcview();
+
        /// are we updating ?
        bool updating_;
-
 protected slots:
        // dialog closed from WM
        void slotWMHide();
@@ -80,22 +70,16 @@ protected slots:
 
        // Close button clicked
        void slotClose();
-
 private:
-       /// Pointer to the actual instantiation of xform's form
+       /// Pointer to the actual instantiation of the Qt dialog
        virtual QDialog * form() const = 0;
-
-private:
-       /// dialog title, displayed by WM.
-       QString title_;
 };
 
 
 template <class Dialog>
-class Qt2DB: public Qt2Base
-{
+class Qt2DB: public Qt2Base {
 protected:
-       Qt2DB(ControlButtons &, QString const &);
+       Qt2DB(string const &);
 
        /// update the dialog
        virtual void update();
@@ -113,8 +97,8 @@ protected:
 
 
 template <class Dialog>
-Qt2DB<Dialog>::Qt2DB(ControlButtons & c, QString const & t)
-       : Qt2Base(c, t)
+Qt2DB<Dialog>::Qt2DB(string const & t)
+       : Qt2Base(t)
 {}
 
 
@@ -161,28 +145,37 @@ class Qt2CB: public Base
 {
 public:
        bool readOnly() const {
-               return controller().isReadonly();
+               return controller().bufferIsReadonly();
        }
 
+       /// The parent controller
+       Controller & controller();
+       /// The parent controller
+       Controller const & controller() const;
+
 protected:
        ///
-       Qt2CB(ControlButtons &, QString const &);
-       /// The parent controller
-       Controller & controller() const;
+       Qt2CB(string const &);
 };
 
 
 template <class Controller, class Base>
-Qt2CB<Controller, Base>::Qt2CB(ControlButtons & c, QString const & t)
-       : Base(c, t)
+Qt2CB<Controller, Base>::Qt2CB(string const & t)
+       : Base(t)
 {}
 
 
 template <class Controller, class Base>
-Controller & Qt2CB<Controller, Base>::controller() const
+Controller & Qt2CB<Controller, Base>::controller()
+{
+       return static_cast<Controller &>(getController());
+}
+
+
+template <class Controller, class Base>
+Controller const & Qt2CB<Controller, Base>::controller() const
 {
-       return static_cast<Controller &>(controller_);
-       //return dynamic_cast<Controller &>(controller_);
+       return static_cast<Controller const &>(getController());
 }