]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormBaseDeprecated.h
Compile fixes for DEC cxx, John's maths and keymap patches.
[lyx.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 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
26 class Buffer;
27 class Dialogs;
28 class LyXView;
29
30 /** This class is an XForms GUI base class.
31     It is meant to be used solely as the parent class to FormBaseBI
32     and FormBaseBD.
33     It has now been superceeded by the Controller/View split.
34     See FormBase.[Ch] for the way to go!
35     @author Angus Leeming
36  */
37
38 extern "C" int C_FormBaseDeprecatedWMHideCB(FL_FORM *, void *);
39
40 class FormBaseDeprecated : public DialogBase {
41 public:
42         /// Callback functions
43         static  int WMHideCB(FL_FORM *, void *);
44         ///
45         static void ApplyCB(FL_OBJECT *, long);
46         ///
47         static void OKCB(FL_OBJECT *, long);
48         ///
49         static void CancelCB(FL_OBJECT *, long);
50         ///
51         static void InputCB(FL_OBJECT *, long);
52         ///
53         static void RestoreCB(FL_OBJECT *, long);
54
55 protected: // methods
56         ///
57         FormBaseDeprecated(LyXView *, Dialogs *, string const &);
58         ///
59         virtual ~FormBaseDeprecated() {}
60
61         /// Pointer to the actual instantiation of the ButtonController.
62         virtual xformsBC & bc() = 0;
63
64         /** Redraw the form (on receipt of a Signal indicating, for example,
65             that the xform colors have been re-mapped).
66             Must be virtual because dialogs with tabbed folders will need to
67             redraw the form for each tab.
68         */
69         virtual void redraw();
70
71         /// Create the dialog if necessary, update it and display it.
72         virtual void show();
73         /// Hide the dialog.
74         virtual void hide();
75         /// Update the dialog.
76         virtual void update() {}
77         /// Connect signals. Also perform any necessary initialisation.
78         virtual void connect();
79         /// Disconnect signals. Also perform any necessary housekeeping.
80         virtual void disconnect();
81         /// Build the dialog
82         virtual void build() = 0;
83         /** Filter the inputs on callback from xforms
84             Return true if inputs are valid.
85          */
86         virtual bool input( FL_OBJECT *, long) {
87                 return true;
88         }
89         /// Apply from dialog (modify or create inset)
90         virtual void apply() {}
91         /// OK from dialog
92         virtual void ok() {
93                 apply();
94                 hide();
95         }
96         /// Cancel from dialog
97         virtual void cancel() {
98                 hide();
99         }
100         /// Restore from dialog
101         virtual void restore() {
102                 update();
103         }
104         /// Pointer to the actual instantiation of xform's form
105         virtual FL_FORM * form() const = 0;
106
107         /** Which LyXFunc do we use?
108             We could modify Dialogs to have a visible LyXFunc* instead and
109             save a couple of bytes per dialog.
110         */
111         LyXView * lv_;
112         /// Used so we can get at the signals we have to connect to.
113         Dialogs * d_;
114         /// Hide connection.
115         SigC::Connection h_;
116         /// Redraw connection.
117         SigC::Connection r_;
118         /// dialog title, displayed by WM.
119         string title;
120 public:
121         /// Overcome a dumb xforms sizing bug
122         mutable int minw_;
123         ///
124         mutable int minh_;
125 };
126
127
128 /** This class is an XForms GUI base class for Buffer Independent dialogs.
129     Such dialogs do not require an update Connection although they may use
130     an update() function which is also supported by restore().
131  */
132 class FormBaseBI : public FormBaseDeprecated {
133 protected:
134         /// Constructor
135         FormBaseBI(LyXView *, Dialogs *, string const &);
136
137         /// Connect signals
138         virtual void connect();
139 };
140
141
142 /** This class is an XForms GUI base class for Buffer Dependent dialogs
143  */
144 class FormBaseBD : public FormBaseDeprecated {
145 protected:
146         /// Constructor
147         FormBaseBD(LyXView *, Dialogs *, string const &);
148
149         /// Connect signals
150         virtual void connect();
151         /// Disconnect signals
152         virtual void disconnect();
153         /// bool indicates if a buffer switch took place
154         virtual void updateSlot(bool) { update(); }
155
156         /// Update connection.
157         SigC::Connection u_;
158 };
159
160
161 #endif // FORMBASEDEPRECATED_H