summaryrefslogtreecommitdiff
path: root/noncore/games/kcheckers/field.cpp
authorleseb <leseb>2002-06-11 16:25:06 (UTC)
committer leseb <leseb>2002-06-11 16:25:06 (UTC)
commit2cfbb2adc058b59140a14ba6bbfc057266fea0b8 (patch) (side-by-side diff)
tree2dc8756a9d691cdfb46b537955453f46171ceeff /noncore/games/kcheckers/field.cpp
parentd709dd35dc07d4a204380354f00a89ceb4d1f845 (diff)
downloadopie-2cfbb2adc058b59140a14ba6bbfc057266fea0b8.zip
opie-2cfbb2adc058b59140a14ba6bbfc057266fea0b8.tar.gz
opie-2cfbb2adc058b59140a14ba6bbfc057266fea0b8.tar.bz2
Version 0.3 port
Diffstat (limited to 'noncore/games/kcheckers/field.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/kcheckers/field.cpp57
1 files changed, 54 insertions, 3 deletions
diff --git a/noncore/games/kcheckers/field.cpp b/noncore/games/kcheckers/field.cpp
index 0755008..aacfc1c 100644
--- a/noncore/games/kcheckers/field.cpp
+++ b/noncore/games/kcheckers/field.cpp
@@ -5,8 +5,15 @@
-Field::Field(QWidget *parent,int i):QWidget(parent)
+
+Field::Field(QWidget* parent,int i):QWidget(parent)
{
pixmap=new QPixmap(SIZE,SIZE);
+ CHECK_PTR(pixmap);
number=i;
+
+ pattern=NULL;
+ picture=NULL;
+ frame=NULL;
}
+
void Field::paintEvent(QPaintEvent*)
@@ -16,2 +23,3 @@ void Field::paintEvent(QPaintEvent*)
+
void Field::mousePressEvent(QMouseEvent* mouseevent)
@@ -22,3 +30,4 @@ void Field::mousePressEvent(QMouseEvent* mouseevent)
-void Field::draw(QImage *image)
+
+void Field::draw()
{
@@ -26,3 +35,16 @@ void Field::draw(QImage *image)
paint.begin(pixmap);
- paint.drawImage(0,0,*image);
+
+ if(pattern) paint.drawImage(0,0,*pattern);
+
+ if(label.length())
+ {
+ paint.setPen(white);
+ paint.setFont(QFont(font().family(),10));
+ paint.drawText(2,11,label);
+ }
+
+ if(picture) paint.drawImage(0,0,*picture);
+
+ if(frame) paint.drawImage(0,0,*frame);
+
paint.end();
@@ -31 +53,30 @@ void Field::draw(QImage *image)
+
+void Field::setFrame(QImage* image)
+{
+ frame=image;
+ draw();
+}
+
+
+void Field::setPicture(QImage* image)
+{
+ picture=image;
+ draw();
+}
+
+
+void Field::setPattern(QImage* image)
+{
+ pattern=image;
+ draw();
+}
+
+
+void Field::setLabel(const QString & string)
+{
+ label=string;
+ draw();
+}
+
+