3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS.
13 #include "GuiDialog.h"
15 #include "qt_helpers.h"
17 #include "support/debug.h"
19 #include <QCloseEvent>
20 #include <QMainWindow>
29 GuiDialog::GuiDialog(GuiView & lv, std::string const & name)
30 : DialogView(lv, name), is_closing_(false)
34 void GuiDialog::setButtonsValid(bool valid)
40 void GuiDialog::slotApply()
47 void GuiDialog::slotOK()
57 void GuiDialog::slotClose()
64 void GuiDialog::slotRestore()
66 // Tell the controller that a request to refresh the dialog's contents
67 // has been received. It's up to the controller to supply the necessary
68 // info by calling GuiDialog::updateView().
74 void GuiDialog::changed()
78 bc().setValid(isValid());
82 void GuiDialog::enableView(bool enable)
84 bc().setReadOnly(!enable);
85 bc().setValid(enable);
86 DialogView::enableView(enable);
90 void GuiDialog::updateView()
92 setUpdatesEnabled(false);
94 bc().setReadOnly(isBufferReadonly());
95 // protect the BC from unwarranted state transitions
99 // The widgets may not be valid, so refresh the button controller
102 setUpdatesEnabled(true);
105 } // namespace frontend
109 /////////////////////////////////////////////////////////////////////
111 // Command based dialogs
113 /////////////////////////////////////////////////////////////////////
115 #include "FuncRequest.h"
116 #include "insets/InsetCommand.h"
123 GuiCommand::GuiCommand(GuiView & lv, string const & name)
124 : GuiDialog(lv, name), params_(insetCode(name)), lfun_name_(name)
129 bool GuiCommand::initialiseParams(string const & data)
131 // The name passed with LFUN_INSET_APPLY is also the name
132 // used to identify the mailer.
133 InsetCommandMailer::string2params(lfun_name_, data, params_);
138 void GuiCommand::dispatchParams()
140 if (lfun_name_.empty())
144 InsetCommandMailer::params2string(lfun_name_, params_);
145 dispatch(FuncRequest(getLfun(), lfun));
148 } // namespace frontend
151 #include "GuiDialog_moc.cpp"