2001-03-15 13:37:04 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2001-03-21 13:27:03 +00:00
|
|
|
* Copyright 2000-2001 The LyX Team.
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*
|
2001-03-30 09:51:46 +00:00
|
|
|
* \file ButtonControllerBase.C
|
2001-03-15 13:37:04 +00:00
|
|
|
* \author Allan Rae
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <config.h>
|
2001-03-30 09:51:46 +00:00
|
|
|
#include "ButtonControllerBase.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
#include "support/LAssert.h"
|
2001-08-28 12:24:03 +00:00
|
|
|
#include "debug.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
ButtonControllerBase::ButtonControllerBase(string const & cancel,
|
|
|
|
string const & close)
|
2001-03-30 09:51:46 +00:00
|
|
|
: cancel_label_(cancel), close_label_(close)
|
2001-03-15 13:37:04 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void ButtonControllerBase::ok()
|
|
|
|
{
|
|
|
|
input(ButtonPolicy::SMI_OKAY);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ButtonControllerBase::input(ButtonPolicy::SMInput in)
|
|
|
|
{
|
|
|
|
if (ButtonPolicy::SMI_NOOP == in) return;
|
|
|
|
bp().input(in);
|
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ButtonControllerBase::apply()
|
|
|
|
{
|
|
|
|
input(ButtonPolicy::SMI_APPLY);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ButtonControllerBase::cancel()
|
|
|
|
{
|
|
|
|
input(ButtonPolicy::SMI_CANCEL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-04-03 14:30:58 +00:00
|
|
|
void ButtonControllerBase::restore()
|
2001-03-15 13:37:04 +00:00
|
|
|
{
|
2001-04-03 14:30:58 +00:00
|
|
|
input(ButtonPolicy::SMI_RESTORE);
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ButtonControllerBase::hide()
|
|
|
|
{
|
|
|
|
input(ButtonPolicy::SMI_HIDE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ButtonControllerBase::valid(bool v)
|
|
|
|
{
|
|
|
|
if (v) {
|
|
|
|
input(ButtonPolicy::SMI_VALID);
|
|
|
|
} else {
|
|
|
|
input(ButtonPolicy::SMI_INVALID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ButtonControllerBase::invalid()
|
|
|
|
{
|
|
|
|
input(ButtonPolicy::SMI_INVALID);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ButtonControllerBase::readOnly(bool ro)
|
|
|
|
{
|
2001-08-28 12:24:03 +00:00
|
|
|
lyxerr[Debug::GUI] << "Setting controller ro: " << ro << std::endl;
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
if (ro) {
|
2001-06-02 14:53:35 +00:00
|
|
|
bp().input(ButtonPolicy::SMI_READ_ONLY);
|
2001-03-15 13:37:04 +00:00
|
|
|
} else {
|
2001-06-02 14:53:35 +00:00
|
|
|
bp().input(ButtonPolicy::SMI_READ_WRITE);
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|
2001-06-02 14:53:35 +00:00
|
|
|
refreshReadOnly();
|
2001-08-28 12:24:03 +00:00
|
|
|
refresh();
|
2001-03-15 13:37:04 +00:00
|
|
|
return ro;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ButtonControllerBase::readWrite()
|
|
|
|
{
|
|
|
|
readOnly(false);
|
|
|
|
}
|