]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Dialog.h
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / Dialog.h
index d54dd70f3807f17238a80edec2c44689e158723d..57e63c1022bd1588f935bfd4b47af6cd88ebe076 100644 (file)
 #ifndef DIALOG_H
 #define DIALOG_H
 
-#include "lfuns.h"
+#include "FuncCode.h"
 
-#include <QString.h>
-#include <string>
+#include "insets/InsetCode.h"
+
+#include "support/strfwd.h"
+
+#include <QString>
 
 class QWidget;
 
@@ -24,6 +27,7 @@ namespace lyx {
 class Buffer;
 class BufferView;
 class FuncRequest;
+class Inset;
 
 namespace frontend {
 
@@ -51,7 +55,7 @@ public:
        /// \param name is the identifier given to the dialog by its parent
        /// container.
        /// \param title is the window title used for decoration.
-       Dialog(GuiView & lv, std::string const & name, QString const & title);
+       Dialog(GuiView & lv, QString const & name, QString const & title);
 
        virtual ~Dialog();
 
@@ -86,9 +90,11 @@ public:
        /// \param data is a string encoding of the data to be displayed.
        /// It is passed to the Controller to be translated into a useable form.
        virtual void showData(std::string const & data);
-       virtual void updateData(std::string const & data);
        //@}
 
+       /// \return inset at current cursor location.
+       Inset const * inset(InsetCode code) const;
+
        /** Check whether we may apply our data.
         *
         *  The buttons are disabled if not and (re-)enabled if yes.
@@ -115,9 +121,17 @@ public:
        /// Hide the dialog from sight
        void hideView();
 
-       /// Create the dialog if necessary, update it and display it.
+       /// Prepare dialog and display it.
        void showView();
 
+       /// Prepare dialog before view.
+       void prepareView();
+
+       /// Decide wether the dialog should grab thekeyboard focus when shown.
+       /// This method defaults to true, override if a different behaviour
+       /// is wanted.
+       virtual bool wantInitialFocus() const { return true; }
+
        /// Update the display of the dialog whilst it is still visible.
        virtual void updateView() = 0;
 
@@ -130,10 +144,7 @@ public:
        //@}
 
        /// Dialog identifier.
-       /// FIXME for Andre': Now that Dialog is entirely within qt4/
-       /// We can use QString instead in order to avoid <string> inclusion
-       /// or we can pimpl name_.
-       std::string const & name() const;
+       QString name() const { return name_; }
 
        //@{
        /** Enable the controller to initialise its data structures.
@@ -167,7 +178,7 @@ public:
         * It should be used in dispatchParams(), too for consistency reasons.
         *  \returns the lfun that is sent for applying the data.
         */
-       virtual kb_action getLfun() const { return LFUN_INSET_APPLY; }
+       virtual FuncCode getLfun() const { return LFUN_INSET_APPLY; }
 
        /** Check whether we may apply our data.
         *
@@ -187,11 +198,6 @@ public:
         */
        virtual bool disconnectOnApply() const { return false; }
 
-       /** \return true if Dialog::View::show() should not display the dialog
-        *   after running update. Currently, only ControlSpellchecker
-        *   makes use of that.
-       */
-       virtual bool exitEarly() const { return false; }
        //@}
 
        /** \c Kernel part: a wrapper making the LyX kernel available to the dialog.
@@ -220,7 +226,6 @@ public:
         *  stored by the dialog are not applied to the inset currently
         *  connected to the dialog. Instead, they will be used to generate
         *  a new inset at the cursor position.
-        *  \param name is used to identify the dialog to the kernel.
         */
        void disconnect() const;
 
@@ -230,7 +235,7 @@ public:
        //@{
        bool isBufferAvailable() const;
        bool isBufferReadonly() const;
-       std::string const bufferFilepath() const;
+       QString bufferFilepath() const;
        //@}
 
        /// The type of the current buffer.
@@ -241,13 +246,8 @@ public:
         *  We should aim to reduce/remove these from the interface.
         */
        //@{
-       GuiView & lyxview() { return *lyxview_; }
        GuiView const & lyxview() const { return *lyxview_; }
-
-       Buffer & buffer();
        Buffer const & buffer() const;
-
-       BufferView * bufferview();
        BufferView const * bufferview() const;
        //@}
 
@@ -261,7 +261,7 @@ private:
        /** The Dialog's name is the means by which a dialog identifies
         *  itself to the LyXView.
         */
-       std::string const name_;
+       QString const name_;
        ///
        QString title_;
        ///