X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fcontrollers%2FButtonControllerBase.C;h=d35c4d6954bff5f4259becd32000f9ee6019548c;hb=b7c9ae49318e0167a46e7213c967280205db4cf6;hp=f446d785c55b7d9747e974cccfc913cd3b34c3fe;hpb=58d99b4a97b85a750704cf84c9639b408117271c;p=lyx.git diff --git a/src/frontends/controllers/ButtonControllerBase.C b/src/frontends/controllers/ButtonControllerBase.C index f446d785c5..d35c4d6954 100644 --- a/src/frontends/controllers/ButtonControllerBase.C +++ b/src/frontends/controllers/ButtonControllerBase.C @@ -1,24 +1,22 @@ -// -*- C++ -*- -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 2000-2001 The LyX Team. - * - * ====================================================== - * +/** * \file ButtonControllerBase.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * * \author Allan Rae + * + * Full author contact details are available in file CREDITS */ -#ifdef __GNUG__ -#pragma implementation -#endif #include #include "ButtonControllerBase.h" #include "support/LAssert.h" +#include "debug.h" + + +CheckedWidget::~CheckedWidget() +{} ButtonControllerBase::ButtonControllerBase(string const & cancel, @@ -35,7 +33,8 @@ void ButtonControllerBase::ok() void ButtonControllerBase::input(ButtonPolicy::SMInput in) { - if (ButtonPolicy::SMI_NOOP == in) return; + if (ButtonPolicy::SMI_NOOP == in) + return; bp().input(in); refresh(); } @@ -53,9 +52,9 @@ void ButtonControllerBase::cancel() } -void ButtonControllerBase::undoAll() +void ButtonControllerBase::restore() { - input(ButtonPolicy::SMI_UNDO_ALL); + input(ButtonPolicy::SMI_RESTORE); } @@ -83,11 +82,15 @@ void ButtonControllerBase::invalid() bool ButtonControllerBase::readOnly(bool ro) { + lyxerr[Debug::GUI] << "Setting controller ro: " << ro << std::endl; + if (ro) { - input(ButtonPolicy::SMI_READ_ONLY); + bp().input(ButtonPolicy::SMI_READ_ONLY); } else { - input(ButtonPolicy::SMI_READ_WRITE); + bp().input(ButtonPolicy::SMI_READ_WRITE); } + refreshReadOnly(); + refresh(); return ro; } @@ -96,3 +99,26 @@ void ButtonControllerBase::readWrite() { readOnly(false); } + + +void ButtonControllerBase::addCheckedWidget(CheckedWidget * ptr) +{ + if (ptr) + checked_widgets.push_back(checked_widget_ptr(ptr)); +} + + +bool ButtonControllerBase::checkWidgets() +{ + bool valid = true; + + checked_widget_list::const_iterator it = checked_widgets.begin(); + checked_widget_list::const_iterator end = checked_widgets.end(); + + for (; it != end; ++it) { + valid &= (*it)->check(); + } + + // return valid status after checking ALL widgets + return valid; +}