3 * \file FormBaseDeprecated.h
4 * Copyright 2000-2002 the LyX Team
5 * Read the file COPYING
7 * \author Angus Leeming <leeming@lyx.org>
10 /* A base class for those remaining xforms dialogs that haven't yet undergone
11 * the controller-view split.
12 * It is meant to be used solely as the parent class to FormBaseBI
16 #ifndef FORMBASEDEPRECATED_H
17 #define FORMBASEDEPRECATED_H
25 #include "FeedbackController.h"
27 #include "forms_fwd.h"
29 #include <boost/utility.hpp>
30 #include <boost/signals/connection.hpp>
37 class FormBaseDeprecated : boost::noncopyable, public FeedbackController
41 FormBaseDeprecated(LyXView &, Dialogs &, string const &, bool);
43 virtual ~FormBaseDeprecated();
45 /// Callback functions
54 void InputCB(FL_OBJECT *, long);
58 Tooltips & tooltips();
60 /// Create the dialog if necessary, update it and display it.
65 /// Pointer to the actual instantiation of the ButtonController.
66 virtual xformsBC & bc() = 0;
68 /** Redraw the form (on receipt of a Signal indicating, for example,
69 * that the xform colors have been re-mapped).
70 * Must be virtual because dialogs with tabbed folders will need to
71 * redraw the form for each tab.
73 virtual void redraw();
77 /// Update the dialog.
78 virtual void update() {}
79 /// Connect signals. Also perform any necessary initialisation.
80 virtual void connect();
81 /// Disconnect signals. Also perform any necessary housekeeping.
82 virtual void disconnect();
84 virtual void build() = 0;
85 /** Filter the inputs on callback from xforms
86 * Return true if inputs are valid.
88 virtual bool input(FL_OBJECT *, long) {
91 /// Apply from dialog (modify or create inset)
92 virtual void apply() {}
98 /// Cancel from dialog
99 virtual void cancel() {
102 /// Restore from dialog
103 virtual void restore() {
106 /// Pointer to the actual instantiation of xform's form
107 virtual FL_FORM * form() const = 0;
109 /** Prepare the way to:
110 * 1. display feedback as the mouse moves over ob. This feedback will
111 * typically be rather more verbose than just a tooltip.
112 * 2. activate the button controller after a paste with the middle
115 static void setPrehandler(FL_OBJECT * ob);
117 /** Which LyXFunc do we use?
118 * We could modify Dialogs to have a visible LyXFunc* instead and
119 * save a couple of bytes per dialog.
122 /// Used so we can get at the signals we have to connect to.
125 boost::signals::connection h_;
126 /// Redraw connection.
127 boost::signals::connection r_;
128 /// dialog title, displayed by WM.
132 /// The dialog's minimum allowable dimensions.
136 /// Can the dialog be resized after it has been created?
139 Tooltips * tooltips_;
143 /** This class is an XForms GUI base class for Buffer Independent dialogs.
144 * Such dialogs do not require an update Connection although they may use
145 * an update() function which is also supported by restore().
147 class FormBaseBI : public FormBaseDeprecated {
150 FormBaseBI(LyXView &, Dialogs &, string const &,
151 bool allowResize = true);
154 virtual void connect();
158 /** This class is an XForms GUI base class for Buffer Dependent dialogs
160 class FormBaseBD : public FormBaseDeprecated {
163 FormBaseBD(LyXView &, Dialogs &, string const &,
164 bool allowResize = true);
167 virtual void connect();
168 /// Disconnect signals
169 virtual void disconnect();
170 /// bool indicates if a buffer switch took place
171 virtual void updateSlot(bool) { update(); }
173 /// Update connection.
174 boost::signals::connection u_;
178 #endif // FORMBASEDEPRECATED_H