summaryrefslogtreecommitdiffstats
path: root/kmines/frame.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
commit838baf3f99ec5ab81b063eb5449a3381d860f377 (patch)
treedd31abcfde08ca92e4623b8f50b3d762a87c997a /kmines/frame.cpp
parent2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff)
downloadtdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz
tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmines/frame.cpp')
-rw-r--r--kmines/frame.cpp66
1 files changed, 34 insertions, 32 deletions
diff --git a/kmines/frame.cpp b/kmines/frame.cpp
index 6c9446c2..7c712383 100644
--- a/kmines/frame.cpp
+++ b/kmines/frame.cpp
@@ -26,8 +26,8 @@
#include "settings.h"
-FieldFrame::FieldFrame(TQWidget *parent)
- : TQFrame(parent, "field"), _button(0)
+FieldFrame::FieldFrame(TQWidget *tqparent)
+ : TQFrame(tqparent, "field"), _button(0)
{
setFrameStyle( TQFrame::Box | TQFrame::Raised );
setLineWidth(2);
@@ -36,65 +36,67 @@ FieldFrame::FieldFrame(TQWidget *parent)
void FieldFrame::adjustSize()
{
- setFixedSize(sizeHint());
+ setFixedSize(tqsizeHint());
_button.resize(Settings::caseSize(), Settings::caseSize());
- TQBitmap mask;
+ TQBitmap tqmask;
for (uint i=0; i<Nb_Pixmap_Types; i++) {
- drawPixmap(mask, (PixmapType)i, true);
+ TQPixmap tqmask_pm = tqmask;
+ drawPixmap(tqmask_pm, (PixmapType)i, true);
drawPixmap(_pixmaps[i], (PixmapType)i, false);
- _pixmaps[i].setMask(mask);
+ _pixmaps[i].setMask(tqmask);
}
for (uint i=0; i<Nb_Advised; i++) {
- drawAdvised(mask, i, true);
+ TQPixmap tqmask_pm = tqmask;
+ drawAdvised(tqmask_pm, i, true);
drawAdvised(_advised[i], i, false);
- _advised[i].setMask(mask);
+ _advised[i].setMask(tqmask);
}
TQFont f = font();
- f.setPointSize(QMAX(1, Settings::caseSize()-6));
+ f.setPointSize(TQMAX(1, Settings::caseSize()-6));
f.setBold(true);
setFont(f);
}
-void FieldFrame::initPixmap(TQPixmap &pix, bool mask) const
+void FieldFrame::initPixmap(TQPixmap &pix, bool tqmask) const
{
pix.resize(Settings::caseSize(), Settings::caseSize());
- if (mask) pix.fill(color0);
+ if (tqmask) pix.fill(color0);
}
-void FieldFrame::drawPixmap(TQPixmap &pix, PixmapType type, bool mask) const
+void FieldFrame::drawPixmap(TQPixmap &pix, PixmapType type, bool tqmask) const
{
- initPixmap(pix, mask);
+ initPixmap(pix, tqmask);
TQPainter p(&pix);
if ( type==FlagPixmap ) {
p.setWindow(0, 0, 16, 16);
- p.setPen( (mask ? color1 : black) );
+ p.setPen( (tqmask ? color1 : black) );
p.drawLine(6, 13, 14, 13);
p.drawLine(8, 12, 12, 12);
p.drawLine(9, 11, 11, 11);
p.drawLine(10, 2, 10, 10);
- if (!mask) p.setPen(black);
- p.setBrush( (mask ? color1 : Settings::color(Settings::EnumType::flag)) );
+ if (!tqmask) p.setPen(black);
+ p.setBrush( (tqmask ? color1 : Settings::color(Settings::EnumType::flag)) );
p.drawRect(4, 3, 6, 5);
return;
}
p.setWindow(0, 0, 20, 20);
if ( type==ExplodedPixmap )
- p.fillRect(2, 2, 16, 16, (mask ? color1 : Settings::color(Settings::EnumType::explosion)));
- TQPen pen(mask ? color1 : black, 1);
+ p.fillRect(2, 2, 16, 16, (tqmask ? color1 : Settings::color(Settings::EnumType::explosion)));
+ TQPen pen(tqmask ? color1 : black, 1);
p.setPen(pen);
- p.setBrush(mask ? color1 : black);
+ p.setBrush(tqmask ? color1 : black);
p.drawLine(10,3,10,18);
p.drawLine(3,10,18,10);
p.drawLine(5, 5, 16, 16);
p.drawLine(5, 15, 15, 5);
p.drawEllipse(5, 5, 11, 11);
- p.fillRect(8, 8, 2, 2, (mask ? color1 : white));
+ p.fillRect(8, 8, 2, 2, (tqmask ? color1 : white));
if ( type==ErrorPixmap ) {
- if (!mask) {
+ if (!tqmask) {
pen.setColor(Settings::color(Settings::EnumType::error));
p.setPen(pen);
}
@@ -107,12 +109,12 @@ void FieldFrame::drawPixmap(TQPixmap &pix, PixmapType type, bool mask) const
}
}
-void FieldFrame::drawAdvised(TQPixmap &pix, uint i, bool mask) const
+void FieldFrame::drawAdvised(TQPixmap &pix, uint i, bool tqmask) const
{
- initPixmap(pix, mask);
+ initPixmap(pix, tqmask);
TQPainter p(&pix);
p.setWindow(0, 0, 16, 16);
- p.setPen( TQPen(mask ? color1 : Settings::mineColor(i), 2) );
+ p.setPen( TQPen(tqmask ? color1 : Settings::mineColor(i), 2) );
p.drawRect(3, 3, 11, 11);
}
@@ -122,22 +124,22 @@ void FieldFrame::drawBox(TQPainter &painter, const TQPoint &p,
bool hasFocus) const
{
qDrawShadePanel(&painter, p.x(), p.y(), _button.width(), _button.height(),
- colorGroup(), pressed, 2,
- &colorGroup().brush(TQColorGroup::Background));
+ tqcolorGroup(), pressed, 2,
+ &tqcolorGroup().brush(TQColorGroup::Background));
if (hasFocus) {
painter.translate(p.x(), p.y());
- TQRect fbr = style().subRect(TQStyle::SR_PushButtonFocusRect, &_button);
- style().drawPrimitive(TQStyle::PE_FocusRect, &painter, fbr,
- colorGroup(), TQStyle::Style_Enabled);
+ TQRect fbr = tqstyle().subRect(TQStyle::SR_PushButtonFocusRect, &_button);
+ tqstyle().tqdrawPrimitive(TQStyle::PE_FocusRect, &painter, fbr,
+ tqcolorGroup(), TQStyle::Style_Enabled);
painter.resetXForm();
}
TQRect r(p, _button.size());
const TQPixmap *pixmap = (type==NoPixmap ? 0 : &_pixmaps[type]);
TQColor color = (nbMines==0 ? black : Settings::mineColor(nbMines-1));
- style().drawItem(&painter, r, AlignCenter, colorGroup(), true, pixmap,
+ tqstyle().drawItem(&painter, r, AlignCenter, tqcolorGroup(), true, pixmap,
text, -1, &color);
if ( advised!=-1 )
- style().drawItem(&painter, r, AlignCenter, colorGroup(), true,
- &_advised[advised], TQString::null);
+ tqstyle().drawItem(&painter, r, AlignCenter, tqcolorGroup(), true,
+ &_advised[advised], TQString());
}