diff options
Diffstat (limited to 'kalarm/lib/spinbox2.cpp')
-rw-r--r-- | kalarm/lib/spinbox2.cpp | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/kalarm/lib/spinbox2.cpp b/kalarm/lib/spinbox2.cpp index 313d3eb56..48b88d51c 100644 --- a/kalarm/lib/spinbox2.cpp +++ b/kalarm/lib/spinbox2.cpp @@ -18,17 +18,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <qglobal.h> +#include <tqglobal.h> #include <stdlib.h> -#include <qstyle.h> -#include <qobjectlist.h> -#include <qapplication.h> -#include <qpixmap.h> -#include <qcursor.h> -#include <qtimer.h> -#include <qwmatrix.h> +#include <tqstyle.h> +#include <tqobjectlist.h> +#include <tqapplication.h> +#include <tqpixmap.h> +#include <tqcursor.h> +#include <tqtimer.h> +#include <tqwmatrix.h> #include "spinbox2.moc" #include "spinbox2private.moc" @@ -43,29 +43,29 @@ static const char* mirrorStyles[] = { "PlastikStyle", 0 // list terminator }; -static bool mirrorStyle(const QStyle&); +static bool mirrorStyle(const TQStyle&); int SpinBox2::mReverseLayout = -1; -SpinBox2::SpinBox2(QWidget* parent, const char* name) - : QFrame(parent, name), +SpinBox2::SpinBox2(TQWidget* parent, const char* name) + : TQFrame(parent, name), mReverseWithLayout(true) { - mUpdown2Frame = new QFrame(this); - mSpinboxFrame = new QFrame(this); + mUpdown2Frame = new TQFrame(this); + mSpinboxFrame = new TQFrame(this); mUpdown2 = new ExtraSpinBox(mUpdown2Frame, "updown2"); // mSpinbox = new MainSpinBox(0, 1, 1, this, mSpinboxFrame); mSpinbox = new MainSpinBox(this, mSpinboxFrame); init(); } -SpinBox2::SpinBox2(int minValue, int maxValue, int step, int step2, QWidget* parent, const char* name) - : QFrame(parent, name), +SpinBox2::SpinBox2(int minValue, int maxValue, int step, int step2, TQWidget* parent, const char* name) + : TQFrame(parent, name), mReverseWithLayout(true) { - mUpdown2Frame = new QFrame(this); - mSpinboxFrame = new QFrame(this); + mUpdown2Frame = new TQFrame(this); + mSpinboxFrame = new TQFrame(this); mUpdown2 = new ExtraSpinBox(minValue, maxValue, step2, mUpdown2Frame, "updown2"); mSpinbox = new MainSpinBox(minValue, maxValue, step, this, mSpinboxFrame); setSteps(step, step2); @@ -75,7 +75,7 @@ SpinBox2::SpinBox2(int minValue, int maxValue, int step, int step2, QWidget* par void SpinBox2::init() { if (mReverseLayout < 0) - mReverseLayout = QApplication::reverseLayout() ? 1 : 0; + mReverseLayout = TQApplication::reverseLayout() ? 1 : 0; mMinValue = mSpinbox->minValue(); mMaxValue = mSpinbox->maxValue(); mLineStep = mSpinbox->lineStep(); @@ -85,15 +85,15 @@ void SpinBox2::init() mSpinbox->setSelectOnStep(false); // default mUpdown2->setSelectOnStep(false); // always false setFocusProxy(mSpinbox); - mUpdown2->setFocusPolicy(QWidget::NoFocus); + mUpdown2->setFocusPolicy(TQWidget::NoFocus); mSpinMirror = new SpinMirror(mUpdown2, mUpdown2Frame, this); if (!mirrorStyle(style())) mSpinMirror->hide(); // hide mirrored spin buttons when they are inappropriate - connect(mSpinbox, SIGNAL(valueChanged(int)), SLOT(valueChange())); - connect(mSpinbox, SIGNAL(valueChanged(int)), SIGNAL(valueChanged(int))); - connect(mSpinbox, SIGNAL(valueChanged(const QString&)), SIGNAL(valueChanged(const QString&))); - connect(mUpdown2, SIGNAL(stepped(int)), SLOT(stepPage(int))); - connect(mUpdown2, SIGNAL(styleUpdated()), SLOT(updateMirror())); + connect(mSpinbox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(valueChange())); + connect(mSpinbox, TQT_SIGNAL(valueChanged(int)), TQT_SIGNAL(valueChanged(int))); + connect(mSpinbox, TQT_SIGNAL(valueChanged(const TQString&)), TQT_SIGNAL(valueChanged(const TQString&))); + connect(mUpdown2, TQT_SIGNAL(stepped(int)), TQT_SLOT(stepPage(int))); + connect(mUpdown2, TQT_SIGNAL(styleUpdated()), TQT_SLOT(updateMirror())); } void SpinBox2::setReadOnly(bool ro) @@ -118,7 +118,7 @@ void SpinBox2::setReverseWithLayout(bool reverse) void SpinBox2::setEnabled(bool enabled) { - QFrame::setEnabled(enabled); + TQFrame::setEnabled(enabled); updateMirror(); } @@ -128,12 +128,12 @@ void SpinBox2::setWrapping(bool on) mUpdown2->setWrapping(on); } -QRect SpinBox2::up2Rect() const +TQRect SpinBox2::up2Rect() const { return mUpdown2->upRect(); } -QRect SpinBox2::down2Rect() const +TQRect SpinBox2::down2Rect() const { return mUpdown2->downRect(); } @@ -179,7 +179,7 @@ void SpinBox2::setShiftSteps(int line, int page) } } -void SpinBox2::setButtonSymbols(QSpinBox::ButtonSymbols newSymbols) +void SpinBox2::setButtonSymbols(TQSpinBox::ButtonSymbols newSymbols) { if (mSpinbox->buttonSymbols() == newSymbols) return; @@ -220,28 +220,28 @@ void SpinBox2::valueChange() * (At construction time, the spin button widths cannot be determined correctly, * so we need to wait until now to definitively rearrange the widget.) */ -void SpinBox2::showEvent(QShowEvent*) +void SpinBox2::showEvent(TQShowEvent*) { arrange(); } -QSize SpinBox2::sizeHint() const +TQSize SpinBox2::sizeHint() const { getMetrics(); - QSize size = mSpinbox->sizeHint(); + TQSize size = mSpinbox->sizeHint(); size.setWidth(size.width() - xSpinbox + wUpdown2 + wGap); return size; } -QSize SpinBox2::minimumSizeHint() const +TQSize SpinBox2::minimumSizeHint() const { getMetrics(); - QSize size = mSpinbox->minimumSizeHint(); + TQSize size = mSpinbox->minimumSizeHint(); size.setWidth(size.width() - xSpinbox + wUpdown2 + wGap); return size; } -void SpinBox2::styleChange(QStyle&) +void SpinBox2::styleChange(TQStyle&) { if (mirrorStyle(style())) mSpinMirror->show(); // show rounded corners with Plastik etc. @@ -256,7 +256,7 @@ void SpinBox2::styleChange(QStyle&) */ void SpinBox2::updateMirror() { - mSpinMirror->setNormalButtons(QPixmap::grabWidget(mUpdown2Frame, 0, 0)); + mSpinMirror->setNormalButtons(TQPixmap::grabWidget(mUpdown2Frame, 0, 0)); } /****************************************************************************** @@ -265,15 +265,15 @@ void SpinBox2::updateMirror() void SpinBox2::arrange() { getMetrics(); - QRect arrowRect = QStyle::visualRect(QRect(0, 0, wUpdown2, height()), this); + TQRect arrowRect = TQStyle::visualRect(TQRect(0, 0, wUpdown2, height()), this); mUpdown2Frame->setGeometry(arrowRect); mUpdown2->setGeometry(-xUpdown2, 0, mUpdown2->width(), height()); - mSpinboxFrame->setGeometry(QStyle::visualRect(QRect(wUpdown2 + wGap, 0, width() - wUpdown2 - wGap, height()), this)); + mSpinboxFrame->setGeometry(TQStyle::visualRect(TQRect(wUpdown2 + wGap, 0, width() - wUpdown2 - wGap, height()), this)); mSpinbox->setGeometry(-xSpinbox, 0, mSpinboxFrame->width() + xSpinbox, height()); mSpinMirror->resize(wUpdown2, mUpdown2->height()); mSpinMirror->setGeometry(arrowRect); -//mSpinMirror->setGeometry(QStyle::visualRect(QRect(0, 11, wUpdown2, height()), this)); - mSpinMirror->setNormalButtons(QPixmap::grabWidget(mUpdown2Frame, 0, 0)); +//mSpinMirror->setGeometry(TQStyle::visualRect(TQRect(0, 11, wUpdown2, height()), this)); + mSpinMirror->setNormalButtons(TQPixmap::grabWidget(mUpdown2Frame, 0, 0)); } /****************************************************************************** @@ -282,16 +282,16 @@ void SpinBox2::arrange() */ void SpinBox2::getMetrics() const { - QRect rect = mUpdown2->style().querySubControlMetrics(QStyle::CC_SpinWidget, mUpdown2, QStyle::SC_SpinWidgetButtonField); + TQRect rect = mUpdown2->style().querySubControlMetrics(TQStyle::CC_SpinWidget, mUpdown2, TQStyle::SC_SpinWidgetButtonField); if (style().inherits("PlastikStyle")) rect.setLeft(rect.left() - 1); // Plastik excludes left border from spin widget rectangle xUpdown2 = mReverseLayout ? 0 : rect.left(); wUpdown2 = mUpdown2->width() - rect.left(); - xSpinbox = mSpinbox->style().querySubControlMetrics(QStyle::CC_SpinWidget, mSpinbox, QStyle::SC_SpinWidgetEditField).left(); + xSpinbox = mSpinbox->style().querySubControlMetrics(TQStyle::CC_SpinWidget, mSpinbox, TQStyle::SC_SpinWidgetEditField).left(); wGap = 0; // Make style-specific adjustments for a better appearance - if (style().inherits("QMotifPlusStyle")) + if (style().inherits("TQMotifPlusStyle")) { xSpinbox = 0; // show the edit control left border wGap = 2; // leave a space to the right of the left-hand pair of spin buttons @@ -334,7 +334,7 @@ void SpinBox2::stepPage(int step) mSpinbox->selectAll(); // Make the covering arrows image show the pressed arrow - mSpinMirror->redraw(QPixmap::grabWidget(mUpdown2Frame, 0, 0)); + mSpinMirror->redraw(TQPixmap::grabWidget(mUpdown2Frame, 0, 0)); } @@ -376,7 +376,7 @@ int SpinBox2::MainSpinBox::shiftStepAdjustment(int oldValue, int shiftStep) * presumably reasonable assumption that when a style change occurs, the spin * buttons are unpressed. */ -void ExtraSpinBox::paintEvent(QPaintEvent* e) +void ExtraSpinBox::paintEvent(TQPaintEvent* e) { SpinBox::paintEvent(e); if (mNewStylePending) @@ -391,24 +391,24 @@ void ExtraSpinBox::paintEvent(QPaintEvent* e) = Class SpinMirror =============================================================================*/ -SpinMirror::SpinMirror(SpinBox* spinbox, QFrame* spinFrame, QWidget* parent, const char* name) - : QCanvasView(new QCanvas, parent, name), +SpinMirror::SpinMirror(SpinBox* spinbox, TQFrame* spinFrame, TQWidget* parent, const char* name) + : TQCanvasView(new TQCanvas, parent, name), mSpinbox(spinbox), mSpinFrame(spinFrame), mReadOnly(false) { - setVScrollBarMode(QScrollView::AlwaysOff); - setHScrollBarMode(QScrollView::AlwaysOff); - setFrameStyle(QFrame::NoFrame); + setVScrollBarMode(TQScrollView::AlwaysOff); + setHScrollBarMode(TQScrollView::AlwaysOff); + setFrameStyle(TQFrame::NoFrame); // Find the spin widget which is part of the spin box, in order to // pass on its shift-button presses. - QObjectList* spinwidgets = spinbox->queryList("QSpinWidget", 0, false, true); + TQObjectList* spinwidgets = spinbox->queryList("TQSpinWidget", 0, false, true); mSpinWidget = (SpinBox*)spinwidgets->getFirst(); delete spinwidgets; } -void SpinMirror::setNormalButtons(const QPixmap& px) +void SpinMirror::setNormalButtons(const TQPixmap& px) { mNormalButtons = px; redraw(mNormalButtons); @@ -416,12 +416,12 @@ void SpinMirror::setNormalButtons(const QPixmap& px) void SpinMirror::redraw() { - redraw(QPixmap::grabWidget(mSpinFrame, 0, 0)); + redraw(TQPixmap::grabWidget(mSpinFrame, 0, 0)); } -void SpinMirror::redraw(const QPixmap& px) +void SpinMirror::redraw(const TQPixmap& px) { - QCanvas* c = canvas(); + TQCanvas* c = canvas(); c->setBackgroundPixmap(px); c->setAllChanged(); c->update(); @@ -430,28 +430,28 @@ void SpinMirror::redraw(const QPixmap& px) void SpinMirror::resize(int w, int h) { canvas()->resize(w, h); - QCanvasView::resize(w, h); + TQCanvasView::resize(w, h); resizeContents(w, h); - setWorldMatrix(QWMatrix(-1, 0, 0, 1, w - 1, 0)); // mirror left to right + setWorldMatrix(TQWMatrix(-1, 0, 0, 1, w - 1, 0)); // mirror left to right } /****************************************************************************** * Pass on all mouse events to the spinbox which we're covering up. */ -void SpinMirror::contentsMouseEvent(QMouseEvent* e) +void SpinMirror::contentsMouseEvent(TQMouseEvent* e) { if (mReadOnly) return; - QPoint pt = contentsToViewport(e->pos()); + TQPoint pt = contentsToViewport(e->pos()); pt.setX(pt.x() + mSpinbox->upRect().left()); - QApplication::postEvent(mSpinWidget, new QMouseEvent(e->type(), pt, e->button(), e->state())); + TQApplication::postEvent(mSpinWidget, new TQMouseEvent(e->type(), pt, e->button(), e->state())); // If the mouse button has been pressed or released, refresh the spin buttons switch (e->type()) { - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - QTimer::singleShot(0, this, SLOT(redraw())); + case TQEvent::MouseButtonPress: + case TQEvent::MouseButtonRelease: + TQTimer::singleShot(0, this, TQT_SLOT(redraw())); break; default: break; @@ -461,36 +461,36 @@ void SpinMirror::contentsMouseEvent(QMouseEvent* e) /****************************************************************************** * Pass on all mouse events to the spinbox which we're covering up. */ -void SpinMirror::contentsWheelEvent(QWheelEvent* e) +void SpinMirror::contentsWheelEvent(TQWheelEvent* e) { if (mReadOnly) return; - QPoint pt = contentsToViewport(e->pos()); + TQPoint pt = contentsToViewport(e->pos()); pt.setX(pt.x() + mSpinbox->upRect().left()); - QApplication::postEvent(mSpinWidget, new QWheelEvent(pt, e->delta(), e->state(), e->orientation())); + TQApplication::postEvent(mSpinWidget, new TQWheelEvent(pt, e->delta(), e->state(), e->orientation())); } /****************************************************************************** * Pass on to the main spinbox events which are needed to activate mouseover and * other graphic effects when the mouse cursor enters and leaves the widget. */ -bool SpinMirror::event(QEvent* e) +bool SpinMirror::event(TQEvent* e) { switch (e->type()) { - case QEvent::Leave: - case QEvent::Enter: - QApplication::postEvent(mSpinWidget, new QEvent(e->type())); - QTimer::singleShot(0, this, SLOT(redraw())); + case TQEvent::Leave: + case TQEvent::Enter: + TQApplication::postEvent(mSpinWidget, new TQEvent(e->type())); + TQTimer::singleShot(0, this, TQT_SLOT(redraw())); break; - case QEvent::FocusIn: + case TQEvent::FocusIn: mSpinbox->setFocus(); - QTimer::singleShot(0, this, SLOT(redraw())); + TQTimer::singleShot(0, this, TQT_SLOT(redraw())); break; default: break; } - return QCanvasView::event(e); + return TQCanvasView::event(e); } @@ -502,7 +502,7 @@ bool SpinMirror::event(QEvent* e) * Determine whether the extra pair of spin buttons needs to be mirrored * left-to-right in the specified style. */ -static bool mirrorStyle(const QStyle& style) +static bool mirrorStyle(const TQStyle& style) { for (const char** s = mirrorStyles; *s; ++s) if (style.inherits(*s)) |