+// -*- C++ -*-
/* This file is part of
* ======================================================
*
* \file ControlDialogs.h
* \author Angus Leeming <a.leeming@ic.ac.uk>
*
- * ControlDialogs.h contains the definition of two template controller classes,
- * ControlDialog and ControlInset, rather clumsy names for classes that
- * control the showing, updating and hiding of popups.
- *
- * ControlInset is to be used as a parent class for popups that display and
- * can perhaps modify the contents of an individual inset. An example being the
- * ubiquitous Citation popup.
- *
- * ControlDialog is to be used as a parent class for popups that are not
- * Inset-popups. (An ugly description I know, but I hope the meaning is clear!
- * Can anyone do any better?) Examples would be the Document and Paragraph
- * popups.
- *
- * At the moment, ControlDialog is reaching a state of maturity as several
- * controllers are now derived from it and its required functionality
- * becaomes clear.
- *
- * ControlInset is still in a state of flux as currently only InsetCommand-type
- * insets have a controller.
- *
+ * ControlDialog is to be used as a parent class for dialogs that are not
+ * views onto parameters of insets. (An ugly description I know, but I hope
+ * the meaning is clear! * Can anyone do any better?) Examples would be the
+ * Document and Paragraph dialogs.
*/
-#ifndef CONTROLCONNECTIONS2_H
-#define CONTROLCONNECTIONS2_H
+#ifndef CONTROLDIALOGS_H
+#define CONTROLDIALOGS_H
#include "ControlConnections.h"
-#include "LyXView.h"
/** Base class to control connection/disconnection of signals with the LyX
kernel for dialogs NOT used with insets.
/// Update the dialog.
virtual void update();
- /// set the params before show or update
- virtual void setParams() {}
/// clean-up on hide.
virtual void clearParams() {}
+ /// set the params before show or update
+ virtual void setParams() {}
};
-/** Base class to control connection/disconnection of signals with the LyX
- kernel for Inset dialogs.
- */
-class Inset;
-
-template <class Inset>
-class ControlInset : public ControlConnectBD
-{
-public:
- ///
- ControlInset(LyXView &, Dialogs &);
-
-protected:
- /// Slot connected to update signal.
- virtual void updateSlot(bool);
- /// Connect signals
- void connectInset(Inset * = 0);
- /// Disconnect signals
- virtual void disconnect();
- ///
- void disconnectInset();
-
-protected:
- /// pointer to the inset passed through connectInset
- Inset * inset_;
-
-private:
- /// inset::hide connection.
- SigC::Connection ih_;
-};
-
-
-
-
+#include "LyXView.h"
template <class Base>
ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
setParams();
+ static bool isBuilt = false;
+ if (!isBuilt) {
+ isBuilt = true;
+ view().build();
+ }
+
bc().readOnly(isReadonly());
view().show();
}
return;
setParams();
-
+
bc().readOnly(isReadonly());
+ // Reset the Button Controller to it's initial state
+ bc().invalid();
+ bc().restore();
+
view().update();
}
view().hide();
}
-
-template <class Inset>
-ControlInset<Inset>::ControlInset(LyXView & lv, Dialogs & d)
- : ControlConnectBD(lv, d),
- inset_(0), ih_(0)
-{}
-
-
-template <class Inset>
-void ControlInset<Inset>::updateSlot(bool switched)
-{
- if (switched)
- hide();
- else
- update();
-}
-
-
-template <class Inset>
-void ControlInset<Inset>::disconnect()
-{
- inset_ = 0;
- ih_.disconnect();
- ControlConnectBD::disconnect();
-}
-
-
-template <class Inset>
-void ControlInset<Inset>::connectInset(Inset * inset)
-{
- // If connected to another inset, disconnect from it.
- if (inset_) {
- ih_.disconnect();
- inset_ = 0;
- }
-
- if (inset) {
- inset_ = inset;
- ih_ = inset->hideDialog.connect(
- SigC::slot(this, &ControlInset::hide));
- }
- connect();
-}
-
-
-template <class Inset>
-void ControlInset<Inset>::disconnectInset()
-{
- ih_.disconnect();
-}
-
-
-#endif // CONTROLCONNECTIONS2_H
+#endif // CONTROLDIALOGS_H