2007-09-27 11:27:52 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file DialogView.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-12-09 22:35:04 +00:00
|
|
|
#ifndef DIALOGVIEW_H
|
|
|
|
#define DIALOGVIEW_H
|
2007-09-27 11:27:52 +00:00
|
|
|
|
2007-10-07 08:55:20 +00:00
|
|
|
#include "Dialog.h"
|
2008-03-05 20:11:47 +00:00
|
|
|
#include "GuiView.h"
|
2007-09-27 11:27:52 +00:00
|
|
|
|
2008-06-06 10:00:33 +00:00
|
|
|
#include <QCloseEvent>
|
2007-09-27 11:27:52 +00:00
|
|
|
#include <QDialog>
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-10-09 22:13:51 +00:00
|
|
|
class DialogView : public QDialog, public Dialog
|
2007-09-27 11:27:52 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-12-09 22:35:04 +00:00
|
|
|
/// \param lv is the access point for the dialog to the LyX kernel.
|
|
|
|
/// \param name is the identifier given to the dialog by its parent
|
|
|
|
/// container.
|
2008-02-05 12:43:19 +00:00
|
|
|
/// \param title is the window title used for decoration.
|
2008-03-05 20:11:47 +00:00
|
|
|
DialogView(GuiView & lv, QString const & name, QString const & title)
|
|
|
|
: QDialog(&lv), Dialog(lv, name, "LyX: " + title)
|
|
|
|
{}
|
2007-09-27 11:27:52 +00:00
|
|
|
|
2007-12-09 22:35:04 +00:00
|
|
|
virtual QWidget * asQWidget() { return this; }
|
|
|
|
virtual QWidget const * asQWidget() const { return this; }
|
2007-09-27 14:05:05 +00:00
|
|
|
|
2007-12-10 13:05:00 +00:00
|
|
|
protected:
|
2008-02-04 17:06:34 +00:00
|
|
|
/// Dialog inherited methods
|
|
|
|
//@{
|
|
|
|
void applyView() {}
|
|
|
|
bool initialiseParams(std::string const & /*data*/) { return true; }
|
|
|
|
void clearParams() {}
|
|
|
|
//@}
|
2008-06-06 15:53:02 +00:00
|
|
|
/// Any dialog that overrides this method should make sure to call it.
|
2008-06-06 10:00:33 +00:00
|
|
|
void closeEvent(QCloseEvent * ev)
|
|
|
|
{
|
|
|
|
clearParams();
|
|
|
|
Dialog::disconnect();
|
|
|
|
ev->accept();
|
|
|
|
}
|
2008-08-13 14:32:30 +00:00
|
|
|
/// Any dialog that overrides this method should make sure to call it.
|
|
|
|
void hideEvent(QHideEvent * ev)
|
|
|
|
{
|
|
|
|
if (!ev->spontaneous()) {
|
|
|
|
clearParams();
|
|
|
|
Dialog::disconnect();
|
|
|
|
ev->accept();
|
|
|
|
}
|
|
|
|
}
|
2007-09-27 11:27:52 +00:00
|
|
|
};
|
|
|
|
|
2007-12-09 22:35:04 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-09-27 11:27:52 +00:00
|
|
|
|
2007-12-09 22:35:04 +00:00
|
|
|
#endif // DIALOGVIEW_H
|