1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2000-2001 The LyX Team.
8 * ======================================================
13 #include FORMS_H_LOCATION
16 #pragma implementation
20 #include "FormBaseDeprecated.h"
22 #include "support/LAssert.h"
28 extern "C" int C_FormBaseDeprecatedWMHideCB(FL_FORM * ob, void * d)
30 return FormBaseDeprecated::WMHideCB(ob, d);
32 extern "C" void C_FormBaseDeprecatedApplyCB(FL_OBJECT * ob, long d)
34 FormBaseDeprecated::ApplyCB(ob, d);
36 extern "C" void C_FormBaseDeprecatedOKCB(FL_OBJECT * ob, long d)
38 FormBaseDeprecated::OKCB(ob, d);
40 extern "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT * ob, long d)
42 FormBaseDeprecated::CancelCB(ob, d);
44 extern "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT * ob, long d)
46 FormBaseDeprecated::InputCB(ob, d);
48 extern "C" void C_FormBaseDeprecatedRestoreCB(FL_OBJECT * ob, long d)
50 FormBaseDeprecated::RestoreCB(ob, d);
54 FormBaseDeprecated::FormBaseDeprecated(LyXView * lv, Dialogs * d,
56 : lv_(lv), d_(d), h_(0), r_(0), title_(t), minw_(0), minh_(0)
62 void FormBaseDeprecated::redraw()
64 if (form() && form()->visible)
65 fl_redraw_form(form());
69 void FormBaseDeprecated::connect()
71 fl_set_form_minsize(form(), minw_, minh_);
72 r_ = Dialogs::redrawGUI.connect(slot(this,&FormBaseDeprecated::redraw));
76 void FormBaseDeprecated::disconnect()
83 void FormBaseDeprecated::show()
88 // work around dumb xforms sizing bug
92 fl_set_form_atclose(form(),
93 C_FormBaseDeprecatedWMHideCB, 0);
96 fl_freeze_form(form());
97 update(); // make sure its up-to-date
98 fl_unfreeze_form(form());
100 if (form()->visible) {
101 fl_raise_form(form());
102 /* This XMapWindow() will hopefully ensure that
103 * iconified dialogs are de-iconified. Mad props
104 * out to those crazy Xlib guys for forgetting a
105 * XDeiconifyWindow(). At least WindowMaker, when
106 * being notified of the redirected MapRequest will
107 * specifically de-iconify. From source, fvwm2 seems
110 XMapWindow(fl_get_display(), form()->window);
112 // calls to fl_set_form_minsize/maxsize apply only to the next
113 // fl_show_form(), so connect() comes first.
116 FL_PLACE_MOUSE | FL_FREE_SIZE, 0,
122 void FormBaseDeprecated::hide()
124 if (form() && form()->visible) {
125 // some dialogs might do things to the form first
126 // such as the nested tabfolder problem in Preferences
128 fl_hide_form(form());
133 int FormBaseDeprecated::WMHideCB(FL_FORM * form, void *)
136 // Ensure that the signals (u and h) are disconnected even if the
137 // window manager is used to close the dialog.
138 FormBaseDeprecated * pre =
139 static_cast<FormBaseDeprecated*>(form->u_vdata);
147 void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long)
149 lyx::Assert(ob && ob->form);
150 FormBaseDeprecated * pre =
151 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
158 void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long)
160 lyx::Assert(ob && ob->form);
161 FormBaseDeprecated * pre =
162 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
169 void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long)
171 lyx::Assert(ob && ob->form);
172 FormBaseDeprecated * pre =
173 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
180 void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data)
182 lyx::Assert(ob && ob->form);
183 FormBaseDeprecated * pre =
184 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
186 pre->bc().valid(pre->input(ob, data));
190 void FormBaseDeprecated::RestoreCB(FL_OBJECT * ob, long)
192 lyx::Assert(ob && ob->form);
193 FormBaseDeprecated * pre =
194 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
201 FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t)
202 : FormBaseDeprecated(lv, d, t)
206 void FormBaseBI::connect()
208 h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide));
209 FormBaseDeprecated::connect();
213 FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t)
214 : FormBaseDeprecated(lv, d, t),
219 void FormBaseBD::connect()
221 u_ = d_->updateBufferDependent.
222 connect(slot(this, &FormBaseBD::updateSlot));
223 h_ = d_->hideBufferDependent.
224 connect(slot(this, &FormBaseBD::hide));
225 FormBaseDeprecated::connect();
229 void FormBaseBD::disconnect()
232 FormBaseDeprecated::disconnect();