allow derived classes to manipulate signal connections

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1054 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Allan Rae 2000-09-29 06:34:04 +00:00
parent 3412eeffda
commit 0d5c7b928f
3 changed files with 31 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2000-09-29 Allan Rae <rae@lyx.org>
* src/frontends/xforms/FormBase.[Ch] (connect, disconnect): new.
Allow derived type to control connection and disconnection from signals
of its choice if desired.
2000-09-28 Juergen Vigna <jug@sad.it>
* src/insets/insettabular.C (update): fixed cursor setting when

View File

@ -64,9 +64,7 @@ void FormBase::show()
FL_PLACE_MOUSE | FL_FREE_SIZE,
FL_TRANSIENT,
title.c_str());
if( uSignal_ )
u_ = uSignal_->connect(slot(this, &FormBase::update));
h_ = hSignal_->connect(slot(this, &FormBase::hide));
connect();
}
}
@ -75,8 +73,7 @@ void FormBase::hide()
{
if (form() && form()->visible) {
fl_hide_form(form());
u_.disconnect();
h_.disconnect();
disconnect();
}
// free up the dialog for another inset
@ -85,6 +82,24 @@ void FormBase::hide()
}
void FormBase::connect()
{
if ( uSignal_ ) {
u_ = uSignal_->connect(slot(this, &FormBase::update));
}
h_ = hSignal_->connect(slot(this, &FormBase::hide));
}
void FormBase::disconnect()
{
if (u_) {
u_.disconnect();
}
h_.disconnect();
}
int FormBase::WMHideCB(FL_FORM * form, void *)
{
// Ensure that the signals (u and h) are disconnected even if the

View File

@ -29,6 +29,7 @@ using SigC::Signal0;
#endif
/** This class is an XForms GUI base class
@author Angus Leeming
*/
class FormBase : public DialogBase, public noncopyable {
public:
@ -59,6 +60,10 @@ protected:
void show();
/// Hide the dialog.
void hide();
/// Connect signals
virtual void connect();
/// Disconnect signals
virtual void disconnect();
/// Build the dialog
virtual void build() = 0;
/// Filter the inputs on callback from xforms