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),
46 void FormBase::connect()
48 fl_set_form_minsize( form(), minw_, minh_ );
56 fl_set_form_atclose(form(),
57 C_FormBaseWMHideCB, 0);
60 fl_freeze_form( form() );
61 update(); // make sure its up-to-date
62 fl_unfreeze_form( form() );
64 if (form()->visible) {
65 fl_raise_form(form());
67 // calls to fl_set_form_minsize/maxsize apply only to the next
68 // fl_show_form(), so connect() comes first.
71 FL_PLACE_MOUSE | FL_FREE_SIZE,
80 if (form() && form()->visible) {
81 // some dialogs might do things to the form first
82 // such as the nested tabfolder problem in Preferences
89 int FormBase::WMHideCB(FL_FORM * form, void *)
91 // Ensure that the signals (u and h) are disconnected even if the
92 // window manager is used to close the dialog.
93 FormBase * pre = static_cast<FormBase*>(form->u_vdata);
100 void FormBase::ApplyCB(FL_OBJECT * ob, long)
102 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
108 void FormBase::OKCB(FL_OBJECT * ob, long)
110 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
116 void FormBase::CancelCB(FL_OBJECT * ob, long)
118 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
124 void FormBase::InputCB(FL_OBJECT * ob, long data )
126 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
127 pre->bc_.valid( pre->input( ob, data ) );
131 void FormBase::RestoreCB(FL_OBJECT * ob, long)
133 FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
139 FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t,
141 char const * close, char const * cancel)
142 : FormBase( lv, d, t, bp, close, cancel )
146 void FormBaseBI::connect()
148 h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide));
153 void FormBaseBI::disconnect()
159 FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t,
161 char const * close, char const * cancel)
162 : FormBase( lv, d, t, bp, close, cancel ),
167 void FormBaseBD::connect()
169 u_ = d_->updateBufferDependent.
170 connect(slot(this, &FormBaseBD::update));
171 h_ = d_->hideBufferDependent.
172 connect(slot(this, &FormBaseBD::hide));
177 void FormBaseBD::disconnect()