2007-09-03 05:59:32 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file GuiDialog.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Angus Leeming
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GUIDIALOG_H
|
|
|
|
#define GUIDIALOG_H
|
|
|
|
|
|
|
|
#include "Dialog.h"
|
|
|
|
#include "ButtonController.h"
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
#include <QDialog>
|
|
|
|
#include <QObject>
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
/** \c Dialog collects the different parts of a Model-Controller-View
|
|
|
|
* split of a generic dialog together.
|
|
|
|
*/
|
2007-09-05 20:33:29 +00:00
|
|
|
class GuiDialog : public QDialog, public Dialog
|
2007-09-03 05:59:32 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
public:
|
|
|
|
/// \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.
|
|
|
|
GuiDialog(LyXView & lv, std::string const & name);
|
2007-09-05 20:33:29 +00:00
|
|
|
//GuiDialog(GuiDialog &, docstring const &);
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
// dialog closed from WM
|
|
|
|
void slotWMHide();
|
|
|
|
// Restore button clicked
|
|
|
|
void slotRestore();
|
|
|
|
// OK button clicked
|
|
|
|
void slotOK();
|
|
|
|
// Apply button clicked
|
|
|
|
void slotApply();
|
|
|
|
// Close button clicked
|
|
|
|
void slotClose();
|
2007-09-03 05:59:32 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
public:
|
2007-09-03 05:59:32 +00:00
|
|
|
/** \name Buttons
|
|
|
|
* These methods are publicly accessible because they are invoked
|
|
|
|
* by the View when the user presses... guess what ;-)
|
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
void ApplyButton();
|
|
|
|
void OKButton();
|
|
|
|
void CancelButton();
|
|
|
|
void RestoreButton();
|
|
|
|
//@}
|
|
|
|
|
|
|
|
/** Check whether we may apply our data.
|
|
|
|
*
|
|
|
|
* The buttons are disabled if not and (re-)enabled if yes.
|
|
|
|
*/
|
|
|
|
void checkStatus();
|
|
|
|
void setButtonsValid(bool valid);
|
|
|
|
|
|
|
|
/** \name Dialog Components
|
|
|
|
* Methods to access the various components making up a dialog.
|
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
ButtonController const & bc() const { return bc_; }
|
|
|
|
ButtonController & bc() { return bc_; }
|
|
|
|
//@}
|
|
|
|
|
|
|
|
void preShow();
|
|
|
|
void postShow();
|
|
|
|
void preUpdate();
|
|
|
|
void postUpdate();
|
|
|
|
|
2007-09-10 19:02:11 +00:00
|
|
|
void setViewTitle(docstring const & title);
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
///
|
|
|
|
bool readOnly() const;
|
|
|
|
|
|
|
|
/// the dialog has changed contents
|
|
|
|
virtual void changed();
|
|
|
|
|
|
|
|
/// default: do nothing
|
|
|
|
virtual void applyView() {}
|
|
|
|
/// default: do nothing
|
|
|
|
virtual void update_contents() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/// Hide the dialog.
|
|
|
|
virtual void hideView();
|
|
|
|
/// Create the dialog if necessary, update it and display it.
|
|
|
|
virtual void showView();
|
|
|
|
///
|
|
|
|
virtual bool isVisibleView() const;
|
|
|
|
/// is the dialog currently valid ?
|
|
|
|
virtual bool isValid();
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
private:
|
2007-09-05 20:33:29 +00:00
|
|
|
/// update the dialog
|
|
|
|
virtual void updateView();
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
ButtonController bc_;
|
2007-09-05 20:33:29 +00:00
|
|
|
/// are we updating ?
|
|
|
|
bool updating_;
|
2007-09-03 05:59:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
|
|
#endif // GUIDIALOG_H
|