mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-22 16:04:07 +00:00
9705be9f1b
Cleaned up code in controllers in the process; I think that the interface is stabilising now. Cleaned up code in InsetInclude a little. Mental note (to me?!): the Bibitem, Bibtex and Include insets create an inset when the appropriate menu item is selected. This is incorrect; the inset should only be created when "Ok" is pressed, as with the majority of insets. CREATE_XXX flags and associated code are needed. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1817 a592a061-630c-0410-9148-cb99ea01b6c8
93 lines
1.8 KiB
C++
93 lines
1.8 KiB
C++
/* This file is part of
|
|
* ======================================================
|
|
*
|
|
* LyX, The Document Processor
|
|
*
|
|
* Copyright 2001 The LyX Team.
|
|
*
|
|
* ======================================================
|
|
*
|
|
* \file ControlDialogs.h
|
|
* \author Angus Leeming <a.leeming@ic.ac.uk>
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#ifndef CONTROLDIALOGS_H
|
|
#define CONTROLDIALOGS_H
|
|
|
|
#include "ControlConnections.h"
|
|
|
|
/** Base class to control connection/disconnection of signals with the LyX
|
|
kernel for dialogs NOT used with insets.
|
|
The Base class will be either ControlConnectBI or ControlConnectBD.
|
|
*/
|
|
template <class Base>
|
|
class ControlDialog : public Base
|
|
{
|
|
public:
|
|
///
|
|
ControlDialog(LyXView &, Dialogs &);
|
|
|
|
protected:
|
|
/// Show the dialog.
|
|
virtual void show();
|
|
/// Hide the dialog.
|
|
virtual void hide();
|
|
/// Update the dialog.
|
|
virtual void update();
|
|
|
|
/// clean-up on hide.
|
|
virtual void clearParams() {}
|
|
/// set the params before show or update
|
|
virtual void setParams() {}
|
|
};
|
|
|
|
|
|
#include "LyXView.h"
|
|
|
|
|
|
template <class Base>
|
|
ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
|
|
: Base(lv, d)
|
|
{}
|
|
|
|
|
|
template <class Base>
|
|
void ControlDialog<Base>::show()
|
|
{
|
|
if (isBufferDependent() && !lv_.view()->available())
|
|
return;
|
|
|
|
setParams();
|
|
|
|
bc().readOnly(isReadonly());
|
|
view().show();
|
|
}
|
|
|
|
template <class Base>
|
|
void ControlDialog<Base>::update()
|
|
{
|
|
if (isBufferDependent() && !lv_.view()->available())
|
|
return;
|
|
|
|
setParams();
|
|
|
|
bc().readOnly(isReadonly());
|
|
view().update();
|
|
}
|
|
|
|
template <class Base>
|
|
void ControlDialog<Base>::hide()
|
|
{
|
|
clearParams();
|
|
|
|
disconnect();
|
|
view().hide();
|
|
}
|
|
|
|
#endif // CONTROLDIALOGS_H
|