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"
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.
118 FL_PLACE_MOUSE | FL_FREE_SIZE,
119 (lyxrc.dialogs_iconify_with_main ? FL_TRANSIENT : 0),
125 void FormBaseDeprecated::hide()
127 if (form() && form()->visible) {
128 // some dialogs might do things to the form first
129 // such as the nested tabfolder problem in Preferences
131 fl_hide_form(form());
136 int FormBaseDeprecated::WMHideCB(FL_FORM * form, void *)
139 // Ensure that the signals (u and h) are disconnected even if the
140 // window manager is used to close the dialog.
141 FormBaseDeprecated * pre =
142 static_cast<FormBaseDeprecated*>(form->u_vdata);
150 void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long)
152 lyx::Assert(ob && ob->form);
153 FormBaseDeprecated * pre =
154 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
161 void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long)
163 lyx::Assert(ob && ob->form);
164 FormBaseDeprecated * pre =
165 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
172 void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long)
174 lyx::Assert(ob && ob->form);
175 FormBaseDeprecated * pre =
176 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
183 void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data)
185 lyx::Assert(ob && ob->form);
186 FormBaseDeprecated * pre =
187 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
189 pre->bc().valid(pre->input(ob, data));
193 void FormBaseDeprecated::RestoreCB(FL_OBJECT * ob, long)
195 lyx::Assert(ob && ob->form);
196 FormBaseDeprecated * pre =
197 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
204 FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t)
205 : FormBaseDeprecated(lv, d, t)
209 void FormBaseBI::connect()
211 h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide));
212 FormBaseDeprecated::connect();
216 FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t)
217 : FormBaseDeprecated(lv, d, t),
222 void FormBaseBD::connect()
224 u_ = d_->updateBufferDependent.
225 connect(slot(this, &FormBaseBD::updateSlot));
226 h_ = d_->hideBufferDependent.
227 connect(slot(this, &FormBaseBD::hide));
228 FormBaseDeprecated::connect();
232 void FormBaseBD::disconnect()
235 FormBaseDeprecated::disconnect();