2001-08-29 02:08:04 +00:00
|
|
|
/**
|
|
|
|
* \file lengthcombo.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-08-29 02:08:04 +00:00
|
|
|
*
|
|
|
|
* \author John Levon
|
2002-11-17 11:24:08 +00:00
|
|
|
* \author Herbert Voss
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2001-08-29 02:08:04 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
|
|
|
2001-08-29 02:08:04 +00:00
|
|
|
#include "lengthcombo.h"
|
2002-03-21 21:21:28 +00:00
|
|
|
#include <qwhatsthis.h>
|
2001-08-29 02:08:04 +00:00
|
|
|
|
2002-11-17 11:24:08 +00:00
|
|
|
#include "lengthcommon.h"
|
2002-12-17 20:37:13 +00:00
|
|
|
#include "qt_helpers.h"
|
2002-11-17 11:24:08 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2001-08-29 02:08:04 +00:00
|
|
|
LengthCombo::LengthCombo(QWidget * parent, char * name)
|
|
|
|
: QComboBox(parent, name)
|
|
|
|
{
|
2002-11-17 11:24:08 +00:00
|
|
|
for (int i=0; i < num_units; i++)
|
|
|
|
insertItem(unit_name_gui[i]);
|
2001-08-29 02:08:04 +00:00
|
|
|
|
|
|
|
connect(this, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(has_activated(int)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyXLength::UNIT LengthCombo::currentLengthItem() const
|
2002-03-21 21:21:28 +00:00
|
|
|
{
|
2002-11-17 11:24:08 +00:00
|
|
|
return static_cast<LyXLength::UNIT>(currentItem());
|
2002-03-21 21:21:28 +00:00
|
|
|
}
|
|
|
|
|
2001-08-29 02:08:04 +00:00
|
|
|
|
|
|
|
void LengthCombo::has_activated(int)
|
|
|
|
{
|
|
|
|
emit selectionChanged(currentLengthItem());
|
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 02:08:04 +00:00
|
|
|
void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
|
|
|
|
{
|
2002-11-17 11:24:08 +00:00
|
|
|
QComboBox::setCurrentItem(int(unit));
|
2001-08-29 02:08:04 +00:00
|
|
|
}
|
2002-11-17 11:24:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
void LengthCombo::setEnabled(bool b)
|
|
|
|
{
|
|
|
|
QComboBox::setEnabled(b);
|
|
|
|
}
|