4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
16 #include "ButtonController.h"
18 #include "insets/InsetCommandParams.h"
28 /// Base class for historical LyX dialogs.
30 * \warning New dialogs should use the leaner classes \c DialogView or
31 * \c DockView depending on the intent. Eventally, old dialog should be
32 * converted to \c DialogView too.
34 class GuiDialog : public QDialog, public Dialog
39 /// \param lv is the access point for the dialog to the LyX kernel.
40 /// \param name is the identifier given to the dialog by its parent
42 /// \param title is the window title used for decoration.
43 GuiDialog(GuiView & lv, std::string const & name, QString const & title);
45 virtual QWidget * asQWidget() { return this; }
46 virtual QWidget const * asQWidget() const { return this; }
50 * These methods are publicly accessible because they are invoked
51 * by the View when the user presses... guess what ;-)
53 // Restore button clicked
57 // Apply button clicked
59 // Close button clicked or closed from WindowManager
63 /** Check whether we may apply our data.
65 * The buttons are disabled if not and (re-)enabled if yes.
67 void setButtonsValid(bool valid);
69 /** \name Dialog Components
70 * Methods to access the various components making up a dialog.
73 ButtonController const & bc() const { return bc_; }
74 ButtonController & bc() { return bc_; }
77 /// the dialog has changed contents
78 virtual void changed();
80 virtual void enableView(bool enable);
82 /// default: do nothing
83 virtual void applyView() {}
84 /// default: do nothing
85 virtual void updateContents() {}
88 /// is the dialog currently valid ?
89 virtual bool isValid() { return true; }
93 /** When applying, it's useful to know whether the dialog is about
94 * to close or not (no point refreshing the display for example).
96 bool isClosing() const { return is_closing_; }
98 /// Update the display of the dialog whilst it is still visible.
99 virtual void updateView();
102 ButtonController bc_;
103 /// are we updating ?
110 class GuiCommand : public GuiDialog
113 /// We need to know with what sort of inset we're associated.
114 // FIXME This should probably be an InsetCode
115 GuiCommand(GuiView &, std::string const & name, QString const & title);
117 bool initialiseParams(std::string const & data);
118 /// clean-up on hide.
119 void clearParams() { params_.clear(); }
120 /// clean-up on hide.
121 void dispatchParams();
123 bool isBufferDependent() const { return true; }
127 InsetCommandParams params_;
128 //FIXME It should be possible to eliminate lfun_name_
129 //now and recover that information from params().insetType().
130 //But let's not do that quite yet.
131 /// Flags what action is taken by Kernel::dispatch()
132 std::string const lfun_name_;
135 } // namespace frontend
138 #endif // GUIDIALOG_H