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
22 #include "xform_macros.h"
24 C_RETURNCB (FormBase, WMHideCB)
25 C_GENERICCB(FormBase, ApplyCB)
26 C_GENERICCB(FormBase, ApplyHideCB)
27 C_GENERICCB(FormBase, HideCB)
28 C_GENERICCB(FormBase, InputCB)
31 FormBase::FormBase(LyXView * lv, Dialogs * d, BufferDependency bd, string const & t)
32 : dialogIsOpen(false), lv_(lv), u_(0), h_(0), title(t)
35 case BUFFER_DEPENDENT:
36 hSignal_ = &d->hideBufferDependent;
37 uSignal_ = &d->updateBufferDependent;
39 case BUFFER_INDEPENDENT:
40 hSignal_ = &d->hideAll;
51 fl_set_form_atclose(form(),
52 C_FormBaseWMHideCB, 0);
55 fl_freeze_form( form() );
56 update(); // make sure its up-to-date
57 fl_unfreeze_form( form() );
60 if (form()->visible) {
61 fl_raise_form(form());
64 FL_PLACE_MOUSE | FL_FREE_SIZE,
74 if (form() && form()->visible) {
79 // free up the dialog for another inset
85 void FormBase::connect()
88 u_ = uSignal_->connect(slot(this, &FormBase::update));
90 h_ = hSignal_->connect(slot(this, &FormBase::hide));
94 void FormBase::disconnect()
101 int FormBase::WMHideCB(FL_FORM * form, void *)
103 // Ensure that the signals (u and h) are disconnected even if the
104 // window manager is used to close the dialog.
105 FormBase * pre = static_cast<FormBase*>(form->u_vdata);
111 void FormBase::ApplyCB(FL_OBJECT * ob, long)
113 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
118 void FormBase::ApplyHideCB(FL_OBJECT * ob, long)
120 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
126 void FormBase::HideCB(FL_OBJECT * ob, long)
128 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
133 void FormBase::InputCB(FL_OBJECT * ob, long data)
135 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);