]> git.lyx.org Git - features.git/blob - src/frontends/xforms/FormBaseDeprecated.h
Give people a rational basis to describe what they dislike about tooltips!!!
[features.git] / src / frontends / xforms / FormBaseDeprecated.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2000-2001 The LyX Team.
8  *
9  * ======================================================
10  */
11
12 #ifndef FORMBASEDEPRECATED_H
13 #define FORMBASEDEPRECATED_H
14
15 #include FORMS_H_LOCATION
16 #include <sigc++/signal_system.h>
17
18 #ifdef __GNUG__
19 #pragma interface
20 #endif
21
22 #include "DialogBase.h"
23 #include "LString.h"
24 #include "xformsBC.h"
25 #include "FeedbackController.h"
26
27 class Buffer;
28 class Dialogs;
29 class LyXView;
30 class Tooltips;
31
32 /** This class is an XForms GUI base class.
33     It is meant to be used solely as the parent class to FormBaseBI
34     and FormBaseBD.
35     It has now been superceeded by the Controller/View split.
36     See FormBase.[Ch] for the way to go!
37     @author Angus Leeming
38  */
39
40 class FormBaseDeprecated : public DialogBase, public FeedbackController
41 {
42 public:
43         ///
44         FormBaseDeprecated(LyXView *, Dialogs *, string const &, bool);
45         ///
46         virtual ~FormBaseDeprecated();
47
48         /// Callback functions
49         void WMHideCB();
50         ///
51         void ApplyCB();
52         ///
53         void OKCB();
54         ///
55         void CancelCB();
56         ///
57         void InputCB(FL_OBJECT *, long);
58         ///
59         void RestoreCB();
60
61         Tooltips & tooltips();
62
63 protected: // methods
64
65         /// Pointer to the actual instantiation of the ButtonController.
66         virtual xformsBC & bc() = 0;
67
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.
72         */
73         virtual void redraw();
74
75         /// Create the dialog if necessary, update it and display it.
76         virtual void show();
77         /// Hide the dialog.
78         virtual void hide();
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();
85         /// Build the dialog
86         virtual void build() = 0;
87         /** Filter the inputs on callback from xforms
88             Return true if inputs are valid.
89          */
90         virtual bool input( FL_OBJECT *, long) {
91                 return true;
92         }
93         /// Apply from dialog (modify or create inset)
94         virtual void apply() {}
95         /// OK from dialog
96         virtual void ok() {
97                 apply();
98                 hide();
99         }
100         /// Cancel from dialog
101         virtual void cancel() {
102                 hide();
103         }
104         /// Restore from dialog
105         virtual void restore() {
106                 update();
107         }
108         /// Pointer to the actual instantiation of xform's form
109         virtual FL_FORM * form() const = 0;
110
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
115             mouse button.
116         */
117         static void setPrehandler(FL_OBJECT * ob);
118
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.
122         */
123         LyXView * lv_;
124         /// Used so we can get at the signals we have to connect to.
125         Dialogs * d_;
126         /// Hide connection.
127         SigC::Connection h_;
128         /// Redraw connection.
129         SigC::Connection r_;
130         /// dialog title, displayed by WM.
131         string title_;
132
133 private:
134         /// The dialog's minimum allowable dimensions.
135         int minw_;
136         ///
137         int minh_;
138         /// Can the dialog be resized after it has been created?
139         bool allow_resize_;
140         ///
141         Tooltips * tooltips_;
142 };
143
144
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().
148  */
149 class FormBaseBI : public FormBaseDeprecated {
150 protected:
151         /// Constructor
152         FormBaseBI(LyXView *, Dialogs *, string const &, bool allowResize=true);
153
154         /// Connect signals
155         virtual void connect();
156 };
157
158
159 /** This class is an XForms GUI base class for Buffer Dependent dialogs
160  */
161 class FormBaseBD : public FormBaseDeprecated {
162 protected:
163         /// Constructor
164         FormBaseBD(LyXView *, Dialogs *, string const &, bool allowResize=true);
165
166         /// Connect signals
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(); }
172
173         /// Update connection.
174         SigC::Connection u_;
175 };
176
177
178 #endif // FORMBASEDEPRECATED_H