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"
27 extern "C" int C_FormBaseDeprecatedWMHideCB(FL_FORM * ob, void * d)
29 return FormBaseDeprecated::WMHideCB(ob, d);
31 extern "C" void C_FormBaseDeprecatedApplyCB(FL_OBJECT * ob, long d)
33 FormBaseDeprecated::ApplyCB(ob, d);
35 extern "C" void C_FormBaseDeprecatedOKCB(FL_OBJECT * ob, long d)
37 FormBaseDeprecated::OKCB(ob, d);
39 extern "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT * ob, long d)
41 FormBaseDeprecated::CancelCB(ob, d);
43 extern "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT * ob, long d)
45 FormBaseDeprecated::InputCB(ob, d);
47 extern "C" void C_FormBaseDeprecatedRestoreCB(FL_OBJECT * ob, long d)
49 FormBaseDeprecated::RestoreCB(ob, d);
53 FormBaseDeprecated::FormBaseDeprecated(LyXView * lv, Dialogs * d,
55 : lv_(lv), d_(d), h_(0), r_(0), title(t), minw_(0), minh_(0)
61 void FormBaseDeprecated::redraw()
63 if (form() && form()->visible)
64 fl_redraw_form(form());
68 void FormBaseDeprecated::connect()
70 fl_set_form_minsize(form(), minw_, minh_);
71 r_ = Dialogs::redrawGUI.connect(slot(this,&FormBaseDeprecated::redraw));
75 void FormBaseDeprecated::disconnect()
82 void FormBaseDeprecated::show()
86 fl_set_form_atclose(form(),
87 C_FormBaseDeprecatedWMHideCB, 0);
90 fl_freeze_form(form());
91 update(); // make sure its up-to-date
92 fl_unfreeze_form(form());
94 if (form()->visible) {
95 fl_raise_form(form());
97 // calls to fl_set_form_minsize/maxsize apply only to the next
98 // fl_show_form(), so connect() comes first.
101 FL_PLACE_MOUSE | FL_FREE_SIZE,
108 void FormBaseDeprecated::hide()
110 if (form() && form()->visible) {
111 // some dialogs might do things to the form first
112 // such as the nested tabfolder problem in Preferences
114 fl_hide_form(form());
119 int FormBaseDeprecated::WMHideCB(FL_FORM * form, void *)
122 // Ensure that the signals (u and h) are disconnected even if the
123 // window manager is used to close the dialog.
124 FormBaseDeprecated * pre =
125 static_cast<FormBaseDeprecated*>(form->u_vdata);
133 void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long)
135 Assert(ob && ob->form);
136 FormBaseDeprecated * pre =
137 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
144 void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long)
146 Assert(ob && ob->form);
147 FormBaseDeprecated * pre =
148 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
155 void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long)
157 Assert(ob && ob->form);
158 FormBaseDeprecated * pre =
159 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
166 void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data)
168 Assert(ob && ob->form);
169 FormBaseDeprecated * pre =
170 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
172 pre->bc().valid(pre->input(ob, data));
176 void FormBaseDeprecated::RestoreCB(FL_OBJECT * ob, long)
178 Assert(ob && ob->form);
179 FormBaseDeprecated * pre =
180 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
187 FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t)
188 : FormBaseDeprecated(lv, d, t)
192 void FormBaseBI::connect()
194 h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide));
195 FormBaseDeprecated::connect();
199 FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t)
200 : FormBaseDeprecated(lv, d, t),
205 void FormBaseBD::connect()
207 u_ = d_->updateBufferDependent.
208 connect(slot(this, &FormBaseBD::updateSlot));
209 h_ = d_->hideBufferDependent.
210 connect(slot(this, &FormBaseBD::hide));
211 FormBaseDeprecated::connect();
215 void FormBaseBD::disconnect()
218 FormBaseDeprecated::disconnect();