/* This file is part of * ====================================================== * * LyX, The Document Processor * * Copyright 2001 The LyX Team. * * ====================================================== * * \file ControlDialogs.h * \author Angus Leeming * * ControlDialog is to be used as a parent class for dialogs that are not * views onto parameters of insets. (An ugly description I know, but I hope * the meaning is clear! * Can anyone do any better?) Examples would be the * Document and Paragraph dialogs. */ #ifndef CONTROLDIALOGS_H #define CONTROLDIALOGS_H #include "ControlConnections.h" /** Base class to control connection/disconnection of signals with the LyX kernel for dialogs NOT used with insets. The Base class will be either ControlConnectBI or ControlConnectBD. */ template class ControlDialog : public Base { public: /// ControlDialog(LyXView &, Dialogs &); protected: /// Show the dialog. virtual void show(); /// Hide the dialog. virtual void hide(); /// Update the dialog. virtual void update(); /// clean-up on hide. virtual void clearParams() {} /// set the params before show or update virtual void setParams() {} }; #include "LyXView.h" template ControlDialog::ControlDialog(LyXView & lv, Dialogs & d) : Base(lv, d) {} template void ControlDialog::show() { if (isBufferDependent() && !lv_.view()->available()) return; setParams(); bc().readOnly(isReadonly()); view().show(); } template void ControlDialog::update() { if (isBufferDependent() && !lv_.view()->available()) return; setParams(); bc().readOnly(isReadonly()); view().update(); } template void ControlDialog::hide() { clearParams(); disconnect(); view().hide(); } #endif // CONTROLDIALOGS_H