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
23 #include "xform_macros.h"
25 C_RETURNCB (FormBase, WMHideCB)
26 C_GENERICCB(FormBase, ApplyCB)
27 C_GENERICCB(FormBase, OKCB)
28 C_GENERICCB(FormBase, CancelCB)
29 C_GENERICCB(FormBase, InputCB)
30 C_GENERICCB(FormBase, RestoreCB)
33 FormBase::FormBase(LyXView * lv, Dialogs * d, string const & t,
34 ButtonPolicy * bp, char const * close, char const * cancel)
35 : lv_(lv), bc_(bp, cancel, close), d_(d), h_(0), title(t), bp_(bp)
49 fl_set_form_atclose(form(),
50 C_FormBaseWMHideCB, 0);
53 fl_freeze_form( form() );
54 update(); // make sure its up-to-date
55 fl_unfreeze_form( form() );
57 if (form()->visible) {
58 fl_raise_form(form());
61 FL_PLACE_MOUSE | FL_FREE_SIZE,
71 if (form() && form()->visible) {
72 // some dialogs might do things to the form first
73 // such as the nested tabfolder problem in Preferences
80 int FormBase::WMHideCB(FL_FORM * form, void *)
82 // Ensure that the signals (u and h) are disconnected even if the
83 // window manager is used to close the dialog.
84 FormBase * pre = static_cast<FormBase*>(form->u_vdata);
91 void FormBase::ApplyCB(FL_OBJECT * ob, long)
93 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
99 void FormBase::OKCB(FL_OBJECT * ob, long)
101 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
107 void FormBase::CancelCB(FL_OBJECT * ob, long)
109 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
115 void FormBase::InputCB(FL_OBJECT * ob, long data )
117 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
118 pre->bc_.valid( pre->input( ob, data ) );
122 void FormBase::RestoreCB(FL_OBJECT * ob, long)
124 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
130 FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t,
132 char const * close, char const * cancel)
133 : FormBase( lv, d, t, bp, close, cancel )
137 void FormBaseBI::connect()
139 h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide));
143 void FormBaseBI::disconnect()
149 FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t,
151 char const * close, char const * cancel)
152 : FormBase( lv, d, t, bp, close, cancel ),
157 void FormBaseBD::connect()
159 u_ = d_->updateBufferDependent.
160 connect(slot(this, &FormBaseBD::update));
161 h_ = d_->hideBufferDependent.
162 connect(slot(this, &FormBaseBD::hide));
166 void FormBaseBD::disconnect()