2001-03-15 13:37:04 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 2000-2001 The LyX Team.
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FORMBASEDEPRECATED_H
|
|
|
|
#define FORMBASEDEPRECATED_H
|
|
|
|
|
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
#include <sigc++/signal_system.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
#include "DialogBase.h"
|
|
|
|
#include "LString.h"
|
|
|
|
#include "xformsBC.h"
|
|
|
|
|
|
|
|
class Buffer;
|
|
|
|
class Dialogs;
|
|
|
|
class LyXView;
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
/** This class is an XForms GUI base class.
|
|
|
|
It is meant to be used solely as the parent class to FormBaseBI
|
|
|
|
and FormBaseBD.
|
|
|
|
It has now been superceeded by the Controller/View split.
|
|
|
|
See FormBase.[Ch] for the way to go!
|
|
|
|
@author Angus Leeming
|
|
|
|
*/
|
|
|
|
|
|
|
|
class FormBaseDeprecated : public DialogBase {
|
|
|
|
public:
|
|
|
|
/// Callback functions
|
|
|
|
static int WMHideCB(FL_FORM *, void *);
|
|
|
|
///
|
|
|
|
static void ApplyCB(FL_OBJECT *, long);
|
|
|
|
///
|
|
|
|
static void OKCB(FL_OBJECT *, long);
|
|
|
|
///
|
|
|
|
static void CancelCB(FL_OBJECT *, long);
|
|
|
|
///
|
|
|
|
static void InputCB(FL_OBJECT *, long);
|
|
|
|
///
|
|
|
|
static void RestoreCB(FL_OBJECT *, long);
|
|
|
|
|
|
|
|
protected: // methods
|
|
|
|
///
|
2001-09-07 17:55:37 +00:00
|
|
|
FormBaseDeprecated(LyXView *, Dialogs *, string const &, bool);
|
2001-03-15 13:37:04 +00:00
|
|
|
///
|
|
|
|
virtual ~FormBaseDeprecated() {}
|
|
|
|
|
|
|
|
/// Pointer to the actual instantiation of the ButtonController.
|
|
|
|
virtual xformsBC & bc() = 0;
|
|
|
|
|
|
|
|
/** Redraw the form (on receipt of a Signal indicating, for example,
|
|
|
|
that the xform colors have been re-mapped).
|
|
|
|
Must be virtual because dialogs with tabbed folders will need to
|
|
|
|
redraw the form for each tab.
|
|
|
|
*/
|
|
|
|
virtual void redraw();
|
|
|
|
|
|
|
|
/// Create the dialog if necessary, update it and display it.
|
|
|
|
virtual void show();
|
|
|
|
/// Hide the dialog.
|
|
|
|
virtual void hide();
|
|
|
|
/// Update the dialog.
|
|
|
|
virtual void update() {}
|
|
|
|
/// Connect signals. Also perform any necessary initialisation.
|
|
|
|
virtual void connect();
|
|
|
|
/// Disconnect signals. Also perform any necessary housekeeping.
|
|
|
|
virtual void disconnect();
|
|
|
|
/// Build the dialog
|
|
|
|
virtual void build() = 0;
|
|
|
|
/** Filter the inputs on callback from xforms
|
|
|
|
Return true if inputs are valid.
|
|
|
|
*/
|
|
|
|
virtual bool input( FL_OBJECT *, long) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
/// Apply from dialog (modify or create inset)
|
|
|
|
virtual void apply() {}
|
|
|
|
/// OK from dialog
|
|
|
|
virtual void ok() {
|
|
|
|
apply();
|
|
|
|
hide();
|
|
|
|
}
|
|
|
|
/// Cancel from dialog
|
|
|
|
virtual void cancel() {
|
|
|
|
hide();
|
|
|
|
}
|
|
|
|
/// Restore from dialog
|
|
|
|
virtual void restore() {
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
/// Pointer to the actual instantiation of xform's form
|
|
|
|
virtual FL_FORM * form() const = 0;
|
|
|
|
|
|
|
|
/** Which LyXFunc do we use?
|
|
|
|
We could modify Dialogs to have a visible LyXFunc* instead and
|
|
|
|
save a couple of bytes per dialog.
|
|
|
|
*/
|
|
|
|
LyXView * lv_;
|
|
|
|
/// Used so we can get at the signals we have to connect to.
|
|
|
|
Dialogs * d_;
|
|
|
|
/// Hide connection.
|
2001-03-15 18:21:56 +00:00
|
|
|
SigC::Connection h_;
|
2001-03-15 13:37:04 +00:00
|
|
|
/// Redraw connection.
|
2001-03-15 18:21:56 +00:00
|
|
|
SigC::Connection r_;
|
2001-03-15 13:37:04 +00:00
|
|
|
/// dialog title, displayed by WM.
|
2001-03-19 15:38:22 +00:00
|
|
|
string title_;
|
2001-09-07 17:55:37 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// The dialog's minimum allowable dimensions.
|
|
|
|
int minw_;
|
2001-03-15 13:37:04 +00:00
|
|
|
///
|
2001-09-07 17:55:37 +00:00
|
|
|
int minh_;
|
|
|
|
/// Can the dialog be resized after it has been created?
|
|
|
|
bool allow_resize_;
|
2001-03-15 13:37:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** This class is an XForms GUI base class for Buffer Independent dialogs.
|
|
|
|
Such dialogs do not require an update Connection although they may use
|
|
|
|
an update() function which is also supported by restore().
|
|
|
|
*/
|
|
|
|
class FormBaseBI : public FormBaseDeprecated {
|
|
|
|
protected:
|
|
|
|
/// Constructor
|
2001-09-07 17:55:37 +00:00
|
|
|
FormBaseBI(LyXView *, Dialogs *, string const &, bool allowResize=true);
|
2001-03-15 13:37:04 +00:00
|
|
|
|
|
|
|
/// Connect signals
|
|
|
|
virtual void connect();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** This class is an XForms GUI base class for Buffer Dependent dialogs
|
|
|
|
*/
|
|
|
|
class FormBaseBD : public FormBaseDeprecated {
|
|
|
|
protected:
|
|
|
|
/// Constructor
|
2001-09-07 17:55:37 +00:00
|
|
|
FormBaseBD(LyXView *, Dialogs *, string const &, bool allowResize=true);
|
2001-03-15 13:37:04 +00:00
|
|
|
|
|
|
|
/// Connect signals
|
|
|
|
virtual void connect();
|
|
|
|
/// Disconnect signals
|
|
|
|
virtual void disconnect();
|
|
|
|
/// bool indicates if a buffer switch took place
|
|
|
|
virtual void updateSlot(bool) { update(); }
|
|
|
|
|
|
|
|
/// Update connection.
|
2001-03-15 18:21:56 +00:00
|
|
|
SigC::Connection u_;
|
2001-03-15 13:37:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // FORMBASEDEPRECATED_H
|