]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormBaseDeprecated.h
Bugfixes: checkboxes to radiobuttons (from J�rgen S) and remove a little
[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 &, bool);
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
119 private:
120         /// The dialog's minimum allowable dimensions.
121         int minw_;
122         ///
123         int minh_;
124         /// Can the dialog be resized after it has been created?
125         bool allow_resize_;
126 };
127
128
129 /** This class is an XForms GUI base class for Buffer Independent dialogs.
130     Such dialogs do not require an update Connection although they may use
131     an update() function which is also supported by restore().
132  */
133 class FormBaseBI : public FormBaseDeprecated {
134 protected:
135         /// Constructor
136         FormBaseBI(LyXView *, Dialogs *, string const &, bool allowResize=true);
137
138         /// Connect signals
139         virtual void connect();
140 };
141
142
143 /** This class is an XForms GUI base class for Buffer Dependent dialogs
144  */
145 class FormBaseBD : public FormBaseDeprecated {
146 protected:
147         /// Constructor
148         FormBaseBD(LyXView *, Dialogs *, string const &, bool allowResize=true);
149
150         /// Connect signals
151         virtual void connect();
152         /// Disconnect signals
153         virtual void disconnect();
154         /// bool indicates if a buffer switch took place
155         virtual void updateSlot(bool) { update(); }
156
157         /// Update connection.
158         SigC::Connection u_;
159 };
160
161
162 #endif // FORMBASEDEPRECATED_H