X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fcontrollers%2FButtonController.h;h=43f7b041a6f13e1cc3abbead0e597366d3277208;hb=a61a18e2a0d7b91dd364b2d7c4a91800a4c1cec9;hp=8b4725976c471b0dd5ed0ede6ffb7936bb049f11;hpb=9b7b1a17fc8ae34e68f1ba5fc855f366c6725c32;p=lyx.git diff --git a/src/frontends/controllers/ButtonController.h b/src/frontends/controllers/ButtonController.h index 8b4725976c..43f7b041a6 100644 --- a/src/frontends/controllers/ButtonController.h +++ b/src/frontends/controllers/ButtonController.h @@ -1,14 +1,9 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 2000-2001 The LyX Team. - * - * ====================================================== - * +/* * \file ButtonController.h + * Copyright 2002 the LyX Team + * Read the file COPYING + * * \author Allan Rae, rae@lyx.org * \author Angus Leeming, a.leeming@ic.ac.uk * \author Baruch Even, baruch.even@writeme.com @@ -17,8 +12,16 @@ #ifndef BUTTONCONTROLLER_H #define BUTTONCONTROLLER_H + +#include "ButtonControllerBase.h" +#include "gettext.h" #include +/** A templatised instantiation of the ButtonController requiring the + * gui-frontend widgets. + * The template declarations are in ButtonController.tmpl, which should + * be #included in the gui-frontend BC class, see e.g. xforms/xformsBC.C + */ template class GuiBC : public ButtonControllerBase { @@ -62,53 +65,6 @@ private: }; -template -GuiBC::GuiBC(string const & cancel, string const & close) - : ButtonControllerBase(cancel, close), - okay_(0), apply_(0), cancel_(0), restore_(0) -{} - - -template -void GuiBC::refresh() -{ - if (okay_) { - bool const enabled = bp().buttonStatus(ButtonPolicy::OKAY); - setButtonEnabled(okay_, enabled); - } - if (apply_) { - bool const enabled = bp().buttonStatus(ButtonPolicy::APPLY); - setButtonEnabled(apply_, enabled); - } - if (restore_) { - bool const enabled = bp().buttonStatus(ButtonPolicy::RESTORE); - setButtonEnabled(restore_, enabled); - } - if (cancel_) { - bool const enabled = bp().buttonStatus(ButtonPolicy::CANCEL); - if (enabled) - setButtonLabel(cancel_, cancel_label_); - else - setButtonLabel(cancel_, close_label_); - } -} - - -template -void GuiBC::refreshReadOnly() -{ - if (read_only_.empty()) return; - - bool const enable = !bp().isReadOnly(); - - Widgets::const_iterator end = read_only_.end(); - Widgets::const_iterator iter = read_only_.begin(); - for (; iter != end; ++iter) { - setWidgetEnabled(*iter, enable); - } -} - - template class ButtonController: public GUIBC { @@ -125,10 +81,4 @@ protected: }; -template -ButtonController::ButtonController(string const & cancel, - string const & close) - : GUIBC(cancel, close) -{} - #endif // BUTTONCONTROLLER_H