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
26 #include "FeedbackController.h"
27 #include "forms_fwd.h"
30 #include <boost/utility.hpp>
31 #include <boost/signals/connection.hpp>
32 #include <X11/Xlib.h> // for Pixmap
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 /** Called on the first show() request, initialising various bits and
137 void prepare_to_show();
139 /// Passed to the window manager to give a pretty little symbol ;-)
143 /// The dialog's minimum allowable dimensions.
147 /// Can the dialog be resized after it has been created?
150 Tooltips * tooltips_;
154 /** This class is an XForms GUI base class for Buffer Independent dialogs.
155 * Such dialogs do not require an update Connection although they may use
156 * an update() function which is also supported by restore().
158 class FormBaseBI : public FormBaseDeprecated {
161 FormBaseBI(LyXView &, Dialogs &, string const &,
162 bool allowResize = true);
165 virtual void connect();
169 /** This class is an XForms GUI base class for Buffer Dependent dialogs
171 class FormBaseBD : public FormBaseDeprecated {
174 FormBaseBD(LyXView &, Dialogs &, string const &,
175 bool allowResize = true);
178 virtual void connect();
179 /// Disconnect signals
180 virtual void disconnect();
181 /// bool indicates if a buffer switch took place
182 virtual void updateSlot(bool) { update(); }
184 /// Update connection.
185 boost::signals::connection u_;
189 #endif // FORMBASEDEPRECATED_H