3 * \file FormBaseDeprecated.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS
12 /* A base class for those remaining xforms dialogs that haven't yet undergone
13 * the controller-view split.
14 * It is meant to be used solely as the parent class to FormBaseBI
18 #ifndef FORMBASEDEPRECATED_H
19 #define FORMBASEDEPRECATED_H
27 #include "FeedbackController.h"
29 #include "forms_fwd.h"
31 #include <boost/utility.hpp>
32 #include <boost/signals/connection.hpp>
39 class FormBaseDeprecated : boost::noncopyable, public FeedbackController
43 FormBaseDeprecated(LyXView &, Dialogs &, string const &, bool);
45 virtual ~FormBaseDeprecated();
47 /// Callback functions
56 void InputCB(FL_OBJECT *, long);
60 Tooltips & tooltips();
62 /// Create the dialog if necessary, update it and display it.
67 /// Pointer to the actual instantiation of the ButtonController.
68 virtual xformsBC & bc() = 0;
70 /** Redraw the form (on receipt of a Signal indicating, for example,
71 * that the xform colors have been re-mapped).
72 * Must be virtual because dialogs with tabbed folders will need to
73 * redraw the form for each tab.
75 virtual void redraw();
79 /// Update the dialog.
80 virtual void update() {}
81 /// Connect signals. Also perform any necessary initialisation.
82 virtual void connect();
83 /// Disconnect signals. Also perform any necessary housekeeping.
84 virtual void disconnect();
86 virtual void build() = 0;
87 /** Filter the inputs on callback from xforms
88 * Return true if inputs are valid.
90 virtual bool input(FL_OBJECT *, long) {
93 /// Apply from dialog (modify or create inset)
94 virtual void apply() {}
100 /// Cancel from dialog
101 virtual void cancel() {
104 /// Restore from dialog
105 virtual void restore() {
108 /// Pointer to the actual instantiation of xform's form
109 virtual FL_FORM * form() const = 0;
111 /** Prepare the way to:
112 * 1. display feedback as the mouse moves over ob. This feedback will
113 * typically be rather more verbose than just a tooltip.
114 * 2. activate the button controller after a paste with the middle
117 static void setPrehandler(FL_OBJECT * ob);
119 /** Which LyXFunc do we use?
120 * We could modify Dialogs to have a visible LyXFunc* instead and
121 * save a couple of bytes per dialog.
124 /// Used so we can get at the signals we have to connect to.
127 boost::signals::connection h_;
128 /// Redraw connection.
129 boost::signals::connection r_;
130 /// dialog title, displayed by WM.
134 /// The dialog's minimum allowable dimensions.
138 /// Can the dialog be resized after it has been created?
141 Tooltips * tooltips_;
145 /** This class is an XForms GUI base class for Buffer Independent dialogs.
146 * Such dialogs do not require an update Connection although they may use
147 * an update() function which is also supported by restore().
149 class FormBaseBI : public FormBaseDeprecated {
152 FormBaseBI(LyXView &, Dialogs &, string const &,
153 bool allowResize = true);
156 virtual void connect();
160 /** This class is an XForms GUI base class for Buffer Dependent dialogs
162 class FormBaseBD : public FormBaseDeprecated {
165 FormBaseBD(LyXView &, Dialogs &, string const &,
166 bool allowResize = true);
169 virtual void connect();
170 /// Disconnect signals
171 virtual void disconnect();
172 /// bool indicates if a buffer switch took place
173 virtual void updateSlot(bool) { update(); }
175 /// Update connection.
176 boost::signals::connection u_;
180 #endif // FORMBASEDEPRECATED_H