]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormBaseDeprecated.h
fix tooltips in toolbar
[lyx.git] / src / frontends / xforms / FormBaseDeprecated.h
1 // -*- C++ -*-
2 /**
3  * \file FormBaseDeprecated.h
4  * Copyright 2000-2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author Angus Leeming, a.leeming@ic.ac.uk
8  */
9
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
13  * and FormBaseBD.
14  */
15
16 #ifndef FORMBASEDEPRECATED_H
17 #define FORMBASEDEPRECATED_H
18
19 #ifdef __GNUG__
20 #pragma interface
21 #endif
22
23 #include "DialogBase.h"
24 #include "LString.h"
25 #include "xformsBC.h"
26 #include "FeedbackController.h"
27
28 #include "forms_fwd.h"
29
30 //#include <boost/signals/trackable.hpp>
31
32 class Buffer;
33 class Dialogs;
34 class LyXView;
35 class Tooltips;
36
37 class FormBaseDeprecated : public DialogBase, public FeedbackController
38 {
39 public:
40         ///
41         FormBaseDeprecated(LyXView *, Dialogs *, string const &, bool);
42         ///
43         virtual ~FormBaseDeprecated();
44
45         /// Callback functions
46         void WMHideCB();
47         ///
48         void ApplyCB();
49         ///
50         void OKCB();
51         ///
52         void CancelCB();
53         ///
54         void InputCB(FL_OBJECT *, long);
55         ///
56         void RestoreCB();
57
58         Tooltips & tooltips();
59
60         friend void gui_ShowDocument(LyXView &, Dialogs &);
61
62 protected: // methods
63
64         /// Pointer to the actual instantiation of the ButtonController.
65         virtual xformsBC & bc() = 0;
66
67         /** Redraw the form (on receipt of a Signal indicating, for example,
68          *  that the xform colors have been re-mapped).
69          *  Must be virtual because dialogs with tabbed folders will need to
70          *  redraw the form for each tab.
71          */
72         virtual void redraw();
73
74         /// Create the dialog if necessary, update it and display it.
75         virtual void show();
76         /// Hide the dialog.
77         virtual void hide();
78         /// Update the dialog.
79         virtual void update() {}
80         /// Connect signals. Also perform any necessary initialisation.
81         virtual void connect();
82         /// Disconnect signals. Also perform any necessary housekeeping.
83         virtual void disconnect();
84         /// Build the dialog
85         virtual void build() = 0;
86         /** Filter the inputs on callback from xforms
87          *  Return true if inputs are valid.
88          */
89         virtual bool input( FL_OBJECT *, long) {
90                 return true;
91         }
92         /// Apply from dialog (modify or create inset)
93         virtual void apply() {}
94         /// OK from dialog
95         virtual void ok() {
96                 apply();
97                 hide();
98         }
99         /// Cancel from dialog
100         virtual void cancel() {
101                 hide();
102         }
103         /// Restore from dialog
104         virtual void restore() {
105                 update();
106         }
107         /// Pointer to the actual instantiation of xform's form
108         virtual FL_FORM * form() const = 0;
109
110         /** Prepare the way to:
111          *  1. display feedback as the mouse moves over ob. This feedback will
112          *  typically be rather more verbose than just a tooltip.
113          *  2. activate the button controller after a paste with the middle
114          *  mouse button.
115          */
116         static void setPrehandler(FL_OBJECT * ob);
117
118         /** Which LyXFunc do we use?
119          *  We could modify Dialogs to have a visible LyXFunc* instead and
120          *  save a couple of bytes per dialog.
121          */
122         LyXView * lv_;
123         /// Used so we can get at the signals we have to connect to.
124         Dialogs * d_;
125         /// Hide connection.
126         boost::signals::connection h_;
127         /// Redraw connection.
128         boost::signals::connection r_;
129         /// dialog title, displayed by WM.
130         string title_;
131
132 private:
133         /// The dialog's minimum allowable dimensions.
134         int minw_;
135         ///
136         int minh_;
137         /// Can the dialog be resized after it has been created?
138         bool allow_resize_;
139         ///
140         Tooltips * tooltips_;
141 };
142
143
144 /** This class is an XForms GUI base class for Buffer Independent dialogs.
145  *  Such dialogs do not require an update Connection although they may use
146  *  an update() function which is also supported by restore().
147  */
148 class FormBaseBI : public FormBaseDeprecated {
149 protected:
150         /// Constructor
151         FormBaseBI(LyXView *, Dialogs *, string const &,
152                    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 &,
165                    bool allowResize = true);
166
167         /// Connect signals
168         virtual void connect();
169         /// Disconnect signals
170         virtual void disconnect();
171         /// bool indicates if a buffer switch took place
172         virtual void updateSlot(bool) { update(); }
173
174         /// Update connection.
175         boost::signals::connection u_;
176 };
177
178
179 #endif // FORMBASEDEPRECATED_H