2001-03-23 22:07:56 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
|
|
|
*
|
|
|
|
* This file Copyright 2000
|
|
|
|
* Allan Rae
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* Author: Allan Rae <rae@lyx.org>
|
|
|
|
* Non-xforms-specific code stripped-out and placed in a base class by
|
|
|
|
* Angus Leeming <a.leeming@ic.ac.uk>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QT2BC_H
|
|
|
|
#define QT2BC_H
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-03-29 18:58:47 +00:00
|
|
|
class QWidget;
|
2001-03-23 22:07:56 +00:00
|
|
|
class QButton;
|
|
|
|
|
2001-03-31 08:39:24 +00:00
|
|
|
#include <boost/utility.hpp>
|
|
|
|
#include "ButtonControllerBase.h"
|
2001-03-23 22:07:56 +00:00
|
|
|
#include "ButtonController.h"
|
|
|
|
|
|
|
|
/** General purpose button controller for up to four buttons.
|
|
|
|
Controls the activation of the OK, Apply and Cancel buttons.
|
|
|
|
Actually supports 4 buttons in all and it's up to the user to decide on
|
|
|
|
the activation policy and which buttons correspond to which output of the
|
|
|
|
state machine.
|
|
|
|
*/
|
|
|
|
class qt2BC : public ButtonControllerBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
qt2BC(string const &, string const &);
|
|
|
|
|
|
|
|
/* Initialise Button Functions */
|
|
|
|
/// Call refresh() when finished setting the buttons.
|
|
|
|
void setOK(QButton * obj) {
|
|
|
|
okay_ = obj;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
void setApply(QButton * obj) {
|
|
|
|
apply_ = obj;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
void setCancel(QButton * obj) {
|
|
|
|
cancel_ = obj;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
void setUndoAll(QButton * obj) {
|
|
|
|
undo_all_ = obj;
|
|
|
|
}
|
|
|
|
///
|
2001-03-29 18:58:47 +00:00
|
|
|
void addReadOnly(QWidget * obj) {
|
2001-03-23 22:07:56 +00:00
|
|
|
read_only_.push_front(obj);
|
|
|
|
}
|
|
|
|
///
|
|
|
|
void eraseReadOnly() {
|
|
|
|
read_only_.erase(read_only_.begin(), read_only_.end());
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Action Functions */
|
|
|
|
/// force a refresh of the buttons
|
|
|
|
virtual void refresh();
|
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
QButton * okay_;
|
|
|
|
///
|
|
|
|
QButton * apply_;
|
|
|
|
///
|
|
|
|
QButton * cancel_;
|
|
|
|
///
|
|
|
|
QButton * undo_all_;
|
|
|
|
/// List of items to be deactivated when in one of the read-only states
|
2001-03-29 18:58:47 +00:00
|
|
|
std::list<QWidget *> read_only_;
|
2001-03-23 22:07:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // XFORMSBC_H
|