lyx_mirror/src/frontends/controllers/ControlButtons.C
Angus Leeming ba9cdda813 Flatten the ButtonController tree by splitting it into a Controller and
a View.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6410 a592a061-630c-0410-9148-cb99ea01b6c8
2003-03-10 03:13:28 +00:00

87 lines
1.2 KiB
C

/**
* \file ControlButtons.C
* 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
*/
#include <config.h>
#include "ControlButtons.h"
#include "ButtonController.h"
#include "BCView.h"
#include "ViewBase.h"
#include "lyxrc.h"
#include "support/LAssert.h"
ControlButtons::ControlButtons()
: emergency_exit_(false), is_closing_(false),
bc_ptr_(new ButtonController), view_ptr_(0)
{}
ControlButtons::~ControlButtons()
{}
void ControlButtons::ApplyButton()
{
apply();
bc().apply();
}
void ControlButtons::OKButton()
{
is_closing_ = true;
apply();
is_closing_ = false;
hide();
bc().ok();
}
void ControlButtons::CancelButton()
{
hide();
bc().cancel();
}
void ControlButtons::RestoreButton()
{
update();
bc().restore();
}
bool ControlButtons::IconifyWithMain() const
{
return lyxrc.dialogs_iconify_with_main;
}
ButtonController & ControlButtons::bc()
{
lyx::Assert(bc_ptr_.get());
return *bc_ptr_.get();
}
ViewBase & ControlButtons::view()
{
lyx::Assert(view_ptr_);
return *view_ptr_;
}
void ControlButtons::setView(ViewBase & v)
{
view_ptr_ = &v;
}