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, OKCB)
27 C_GENERICCB(FormBase, CancelCB)
28 C_GENERICCB(FormBase, InputCB)
29 C_GENERICCB(FormBase, RestoreCB)
32 FormBase::FormBase(LyXView * lv, Dialogs * d, BufferDependency bd, string const & t,
33 ButtonPolicy * bp, char const * close, char const * cancel)
34 : dialogIsOpen(false), lv_(lv), bc_(bp, cancel, close),
35 u_(0), h_(0), title(t), bp_(bp)
38 case BUFFER_DEPENDENT:
39 hSignal_ = &d->hideBufferDependent;
40 uSignal_ = &d->updateBufferDependent;
42 case BUFFER_INDEPENDENT:
43 hSignal_ = &d->hideAll;
60 fl_set_form_atclose(form(),
61 C_FormBaseWMHideCB, 0);
64 fl_freeze_form( form() );
65 update(); // make sure its up-to-date
66 fl_unfreeze_form( form() );
69 if (form()->visible) {
70 fl_raise_form(form());
73 FL_PLACE_MOUSE | FL_FREE_SIZE,
83 if (form() && form()->visible) {
88 // free up the dialog for another inset
94 void FormBase::connect()
97 u_ = uSignal_->connect(slot(this, &FormBase::update));
99 h_ = hSignal_->connect(slot(this, &FormBase::hide));
103 void FormBase::disconnect()
110 int FormBase::WMHideCB(FL_FORM * form, void *)
112 // Ensure that the signals (u and h) are disconnected even if the
113 // window manager is used to close the dialog.
114 FormBase * pre = static_cast<FormBase*>(form->u_vdata);
121 void FormBase::ApplyCB(FL_OBJECT * ob, long)
123 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
129 void FormBase::OKCB(FL_OBJECT * ob, long)
131 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
137 void FormBase::CancelCB(FL_OBJECT * ob, long)
139 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
145 void FormBase::InputCB(FL_OBJECT * ob, long data )
147 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
148 pre->bc_.valid( pre->input( ob, data ) );
152 void FormBase::RestoreCB(FL_OBJECT * ob, long)
154 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);