2002-09-24 13:57:09 +00:00
|
|
|
/**
|
|
|
|
* \file Qt2Base.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-03-26 19:34:45 +00:00
|
|
|
*
|
2002-09-24 13:57:09 +00:00
|
|
|
* \author Angus Leeming
|
2001-03-26 19:34:45 +00:00
|
|
|
*
|
2002-09-24 13:57:09 +00:00
|
|
|
* Full author contact details are available in file CREDITS
|
2001-03-26 19:34:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <qdialog.h>
|
2002-03-21 21:21:28 +00:00
|
|
|
#include <qapplication.h>
|
2001-03-26 19:34:45 +00:00
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
#include "debug.h"
|
2003-05-22 15:42:50 +00:00
|
|
|
#include "qt_helpers.h"
|
2002-03-21 21:21:28 +00:00
|
|
|
#include "QtLyXView.h"
|
2001-03-26 19:34:45 +00:00
|
|
|
#include "Qt2Base.h"
|
2001-08-23 21:21:50 +00:00
|
|
|
#include "Qt2BC.h"
|
2003-03-10 03:13:28 +00:00
|
|
|
#include "ButtonController.h"
|
2002-08-12 14:28:43 +00:00
|
|
|
#include "ControlButtons.h"
|
2001-03-26 19:34:45 +00:00
|
|
|
#include "support/LAssert.h"
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2003-05-22 15:42:50 +00:00
|
|
|
Qt2Base::Qt2Base(string const & t)
|
|
|
|
: ViewBase(t), updating_(false)
|
2001-03-26 19:34:45 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2003-03-10 03:13:28 +00:00
|
|
|
Qt2BC & Qt2Base::bcview()
|
2002-08-12 14:28:43 +00:00
|
|
|
{
|
2003-03-10 03:13:28 +00:00
|
|
|
return static_cast<Qt2BC &>(bc().view());
|
|
|
|
// return dynamic_cast<Qt2BC &>(bc());
|
2002-08-12 14:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-02 00:48:38 +00:00
|
|
|
bool Qt2Base::isVisible() const
|
|
|
|
{
|
|
|
|
return form() && form()->isVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-26 19:34:45 +00:00
|
|
|
void Qt2Base::show()
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
if (!form()) {
|
|
|
|
build();
|
|
|
|
}
|
|
|
|
|
2001-08-21 01:14:54 +00:00
|
|
|
form()->setMinimumSize(form()->sizeHint());
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
update(); // make sure its up-to-date
|
|
|
|
|
2003-05-22 15:42:50 +00:00
|
|
|
form()->setCaption(toqstr(getTitle()));
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
if (form()->isVisible()) {
|
|
|
|
form()->raise();
|
|
|
|
} else {
|
|
|
|
form()->show();
|
|
|
|
}
|
2001-03-26 19:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Qt2Base::hide()
|
|
|
|
{
|
2001-08-21 01:14:54 +00:00
|
|
|
if (form() && form()->isVisible())
|
2001-06-05 17:05:51 +00:00
|
|
|
form()->hide();
|
2001-03-26 19:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-23 21:21:50 +00:00
|
|
|
bool Qt2Base::isValid()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-21 01:14:54 +00:00
|
|
|
void Qt2Base::changed()
|
2001-03-26 19:34:45 +00:00
|
|
|
{
|
2001-08-25 20:04:15 +00:00
|
|
|
if (updating_)
|
|
|
|
return;
|
2003-03-14 00:20:42 +00:00
|
|
|
bc().valid(isValid());
|
2001-03-26 19:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Qt2Base::slotWMHide()
|
|
|
|
{
|
2002-08-12 14:28:43 +00:00
|
|
|
getController().CancelButton();
|
2001-03-26 19:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Qt2Base::slotApply()
|
|
|
|
{
|
2002-08-12 14:28:43 +00:00
|
|
|
getController().ApplyButton();
|
2001-03-26 19:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Qt2Base::slotOK()
|
|
|
|
{
|
2002-08-12 14:28:43 +00:00
|
|
|
getController().OKButton();
|
2001-03-26 19:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-25 03:00:19 +00:00
|
|
|
void Qt2Base::slotClose()
|
2001-03-26 19:34:45 +00:00
|
|
|
{
|
2002-08-12 14:28:43 +00:00
|
|
|
getController().CancelButton();
|
2001-03-26 19:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Qt2Base::slotRestore()
|
|
|
|
{
|
2002-08-12 14:28:43 +00:00
|
|
|
getController().RestoreButton();
|
2001-03-26 19:34:45 +00:00
|
|
|
}
|