2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2000 The LyX Team.
9 * ======================================================
15 #pragma implementation
21 #include "support/LAssert.h"
23 extern "C" int C_FormBaseWMHideCB(FL_FORM * form, void *);
26 FormBase::FormBase(ControlBase & c, string const & t)
27 : ViewBC<xformsBC>(c), minw_(0), minh_(0), title_(t)
31 void FormBase::redraw()
33 if (form() && form()->visible)
34 fl_redraw_form(form());
43 // work around dumb xforms sizing bug
47 fl_set_form_atclose(form(),
48 C_FormBaseWMHideCB, 0);
51 fl_freeze_form(form());
52 update(); // make sure its up-to-date
53 fl_unfreeze_form(form());
55 if (form()->visible) {
56 fl_raise_form(form());
57 /* This XMapWindow() will hopefully ensure that
58 * iconified dialogs are de-iconified. Mad props
59 * out to those crazy Xlib guys for forgetting a
60 * XDeiconifyWindow(). At least WindowMaker, when
61 * being notified of the redirected MapRequest will
62 * specifically de-iconify. From source, fvwm2 seems
65 XMapWindow(fl_get_display(), form()->window);
67 // calls to fl_set_form_minsize/maxsize apply only to the next
68 // fl_show_form(), so this comes first.
69 fl_set_form_minsize(form(), minw_, minh_);
71 FL_PLACE_MOUSE | FL_FREE_SIZE, 0,
79 if (form() && form()->visible)
84 void FormBase::InputCB(FL_OBJECT * ob, long data)
86 bc().input(input(ob, data));
92 FormBase * GetForm(FL_OBJECT * ob)
94 Assert(ob && ob->form && ob->form->u_vdata);
95 FormBase * pre = static_cast<FormBase *>(ob->form->u_vdata);
102 extern "C" int C_FormBaseWMHideCB(FL_FORM * form, void *)
104 // Close the dialog cleanly, even if the WM is used to do so.
105 Assert(form && form->u_vdata);
106 FormBase * pre = static_cast<FormBase *>(form->u_vdata);
112 extern "C" void C_FormBaseApplyCB(FL_OBJECT * ob, long)
114 GetForm(ob)->ApplyButton();
118 extern "C" void C_FormBaseOKCB(FL_OBJECT * ob, long)
120 GetForm(ob)->OKButton();
124 extern "C" void C_FormBaseCancelCB(FL_OBJECT * ob, long)
126 FormBase * form = GetForm(ob);
127 form->CancelButton();
131 extern "C" void C_FormBaseRestoreCB(FL_OBJECT * ob, long)
133 GetForm(ob)->RestoreButton();
137 extern "C" void C_FormBaseInputCB(FL_OBJECT * ob, long d)
139 GetForm(ob)->InputCB(ob, d);