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