+
+
+namespace {
+
+FormBaseDeprecated * GetForm(FL_OBJECT * ob)
+{
+ lyx::Assert(ob && ob->form && ob->form->u_vdata);
+ FormBaseDeprecated * ptr =
+ static_cast<FormBaseDeprecated *>(ob->form->u_vdata);
+ return ptr;
+}
+
+} // namespace anon
+
+
+extern "C" {
+
+void C_FormBaseDeprecatedApplyCB(FL_OBJECT * ob, long)
+{
+ GetForm(ob)->ApplyCB();
+}
+
+
+void C_FormBaseDeprecatedOKCB(FL_OBJECT * ob, long)
+{
+ GetForm(ob)->OKCB();
+}
+
+
+void C_FormBaseDeprecatedCancelCB(FL_OBJECT * ob, long)
+{
+ GetForm(ob)->CancelCB();
+}
+
+
+void C_FormBaseDeprecatedInputCB(FL_OBJECT * ob, long d)
+{
+ GetForm(ob)->InputCB(ob, d);
+}
+
+
+void C_FormBaseDeprecatedRestoreCB(FL_OBJECT * ob, long)
+{
+ GetForm(ob)->RestoreCB();
+}
+
+static int C_WMHideCB(FL_FORM * form, void *)
+{
+ // Close the dialog cleanly, even if the WM is used to do so.
+ lyx::Assert(form && form->u_vdata);
+ FormBaseDeprecated * ptr =
+ static_cast<FormBaseDeprecated *>(form->u_vdata);
+ ptr->WMHideCB();
+ return FL_CANCEL;
+}
+
+static int C_PrehandlerCB(FL_OBJECT * ob, int event,
+ FL_Coord, FL_Coord, int key, void *)
+{
+ // Note that the return value is important in the pre-emptive handler.
+ // Don't return anything other than 0.
+ lyx::Assert(ob);
+
+ // Don't Assert this one, as it can happen quite naturally when things
+ // are being deleted in the d-tor.
+ //Assert(ob->form);
+ if (!ob->form) return 0;
+
+ FormBaseDeprecated * ptr =
+ static_cast<FormBaseDeprecated *>(ob->form->u_vdata);
+
+ if (ptr)
+ ptr->PrehandlerCB(ob, event, key);
+
+ return 0;
+}
+
+} // extern "C"