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