2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2000 The LyX Team.
9 * ======================================================
14 #include FORMS_H_LOCATION
17 #pragma implementation
21 #include "FormBaseDeprecated.h"
23 #include "support/LAssert.h"
29 extern "C" int C_FormBaseDeprecatedWMHideCB(FL_FORM * ob, void * d)
31 return FormBaseDeprecated::WMHideCB(ob, d);
33 extern "C" void C_FormBaseDeprecatedApplyCB(FL_OBJECT * ob, long d)
35 FormBaseDeprecated::ApplyCB(ob, d);
37 extern "C" void C_FormBaseDeprecatedOKCB(FL_OBJECT * ob, long d)
39 FormBaseDeprecated::OKCB(ob, d);
41 extern "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT * ob, long d)
43 FormBaseDeprecated::CancelCB(ob, d);
45 extern "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT * ob, long d)
47 FormBaseDeprecated::InputCB(ob, d);
49 extern "C" void C_FormBaseDeprecatedRestoreCB(FL_OBJECT * ob, long d)
51 FormBaseDeprecated::RestoreCB(ob, d);
55 FormBaseDeprecated::FormBaseDeprecated(LyXView * lv, Dialogs * d,
57 : lv_(lv), d_(d), h_(0), r_(0), title(t), minw_(0), minh_(0)
63 void FormBaseDeprecated::redraw()
65 if (form() && form()->visible)
66 fl_redraw_form(form());
70 void FormBaseDeprecated::connect()
72 fl_set_form_minsize(form(), minw_, minh_);
73 r_ = Dialogs::redrawGUI.connect(slot(this,&FormBaseDeprecated::redraw));
77 void FormBaseDeprecated::disconnect()
84 void FormBaseDeprecated::show()
88 fl_set_form_atclose(form(),
89 C_FormBaseDeprecatedWMHideCB, 0);
92 fl_freeze_form(form());
93 update(); // make sure its up-to-date
94 fl_unfreeze_form(form());
96 if (form()->visible) {
97 fl_raise_form(form());
99 // calls to fl_set_form_minsize/maxsize apply only to the next
100 // fl_show_form(), so connect() comes first.
103 FL_PLACE_MOUSE | FL_FREE_SIZE,
110 void FormBaseDeprecated::hide()
112 if (form() && form()->visible) {
113 // some dialogs might do things to the form first
114 // such as the nested tabfolder problem in Preferences
116 fl_hide_form(form());
121 int FormBaseDeprecated::WMHideCB(FL_FORM * form, void *)
124 // Ensure that the signals (u and h) are disconnected even if the
125 // window manager is used to close the dialog.
126 FormBaseDeprecated * pre =
127 static_cast<FormBaseDeprecated*>(form->u_vdata);
135 void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long)
137 Assert(ob && ob->form);
138 FormBaseDeprecated * pre =
139 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
146 void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long)
148 Assert(ob && ob->form);
149 FormBaseDeprecated * pre =
150 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
157 void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long)
159 Assert(ob && ob->form);
160 FormBaseDeprecated * pre =
161 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
168 void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data)
170 Assert(ob && ob->form);
171 FormBaseDeprecated * pre =
172 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
174 pre->bc().valid(pre->input(ob, data));
178 void FormBaseDeprecated::RestoreCB(FL_OBJECT * ob, long)
180 Assert(ob && ob->form);
181 FormBaseDeprecated * pre =
182 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
189 FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t)
190 : FormBaseDeprecated(lv, d, t)
194 void FormBaseBI::connect()
196 h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide));
197 FormBaseDeprecated::connect();
201 FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t)
202 : FormBaseDeprecated(lv, d, t),
207 void FormBaseBD::connect()
209 u_ = d_->updateBufferDependent.
210 connect(slot(this, &FormBaseBD::updateSlot));
211 h_ = d_->hideBufferDependent.
212 connect(slot(this, &FormBaseBD::hide));
213 FormBaseDeprecated::connect();
217 void FormBaseBD::disconnect()
220 FormBaseDeprecated::disconnect();