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()
89 // work around dumb xforms sizing bug
93 fl_set_form_atclose(form(),
94 C_FormBaseDeprecatedWMHideCB, 0);
97 fl_freeze_form(form());
98 update(); // make sure its up-to-date
99 fl_unfreeze_form(form());
101 if (form()->visible) {
102 fl_raise_form(form());
103 /* This XMapWindow() will hopefully ensure that
104 * iconified dialogs are de-iconified. Mad props
105 * out to those crazy Xlib guys for forgetting a
106 * XDeiconifyWindow(). At least WindowMaker, when
107 * being notified of the redirected MapRequest will
108 * specifically de-iconify. From source, fvwm2 seems
111 XMapWindow(fl_get_display(), form()->window);
113 // calls to fl_set_form_minsize/maxsize apply only to the next
114 // fl_show_form(), so connect() comes first.
117 FL_PLACE_MOUSE | FL_FREE_SIZE, 0,
123 void FormBaseDeprecated::hide()
125 if (form() && form()->visible) {
126 // some dialogs might do things to the form first
127 // such as the nested tabfolder problem in Preferences
129 fl_hide_form(form());
134 int FormBaseDeprecated::WMHideCB(FL_FORM * form, void *)
137 // Ensure that the signals (u and h) are disconnected even if the
138 // window manager is used to close the dialog.
139 FormBaseDeprecated * pre =
140 static_cast<FormBaseDeprecated*>(form->u_vdata);
148 void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long)
150 Assert(ob && ob->form);
151 FormBaseDeprecated * pre =
152 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
159 void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long)
161 Assert(ob && ob->form);
162 FormBaseDeprecated * pre =
163 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
170 void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long)
172 Assert(ob && ob->form);
173 FormBaseDeprecated * pre =
174 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
181 void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data)
183 Assert(ob && ob->form);
184 FormBaseDeprecated * pre =
185 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
187 pre->bc().valid(pre->input(ob, data));
191 void FormBaseDeprecated::RestoreCB(FL_OBJECT * ob, long)
193 Assert(ob && ob->form);
194 FormBaseDeprecated * pre =
195 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
202 FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t)
203 : FormBaseDeprecated(lv, d, t)
207 void FormBaseBI::connect()
209 h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide));
210 FormBaseDeprecated::connect();
214 FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t)
215 : FormBaseDeprecated(lv, d, t),
220 void FormBaseBD::connect()
222 u_ = d_->updateBufferDependent.
223 connect(slot(this, &FormBaseBD::updateSlot));
224 h_ = d_->hideBufferDependent.
225 connect(slot(this, &FormBaseBD::hide));
226 FormBaseDeprecated::connect();
230 void FormBaseBD::disconnect()
233 FormBaseDeprecated::disconnect();