lyx_mirror/src/frontends/controllers/ControlDialog.tmpl
Angus Leeming 649e3fee9a Rob's patch, part 1: the checked widget stuff.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5467 a592a061-630c-0410-9148-cb99ea01b6c8
2002-10-22 12:39:05 +00:00

81 lines
1.4 KiB
C++

// -*- C++ -*-
/**
* \file ControlDialog.tmpl
* 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
*
* ControlDialog is a base class and so these templatised methods will be
* instantiated if this file is #included in the derived classes' .C file.
*/
#include "ControlDialog.h"
#include "ButtonControllerBase.h"
#include "ViewBase.h"
template <class Base>
ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
: Base(lv, d), dialog_built_(false)
{}
template <class Base>
void ControlDialog<Base>::show()
{
if (isBufferDependent() && !bufferIsAvailable())
return;
connect();
setParams();
if (emergency_exit_) {
hide();
return;
}
if (!dialog_built_) {
view().build();
dialog_built_ = true;
}
bc().readOnly(bufferIsReadonly());
view().show();
// The widgets may not be valid, so refresh the button controller
bc().refresh();
}
template <class Base>
void ControlDialog<Base>::update()
{
if (isBufferDependent() && !bufferIsAvailable())
return;
setParams();
if (emergency_exit_) {
hide();
return;
}
bc().readOnly(bufferIsReadonly());
view().update();
// The widgets may not be valid, so refresh the button controller
bc().refresh();
}
template <class Base>
void ControlDialog<Base>::hide()
{
emergency_exit_ = false;
clearParams();
disconnect();
view().hide();
}