2
Copyright (C) 1997 Mathias Mueller <in5y158@public.uni-hamburg.de>
4
Kmahjongg is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
#include "FrameImage.h"
21
#include <kcomponentdata.h>
22
#include <kfiledialog.h>
24
#include <kmessagebox.h>
25
#include <kpushbutton.h>
26
#include <kstandarddirs.h>
27
#include <KStandardGuiItem>
33
#include <qtextstream.h>
39
FrameImage::FrameImage (QWidget *parent, const QSize& initialImageSize)
40
: KGameCanvasWidget(parent)
43
thePixmap = new QPixmap(initialImageSize);
46
FrameImage::~FrameImage()
51
void FrameImage::resizeEvent( QResizeEvent* ev )
53
*thePixmap = QPixmap(ev->size());
56
void FrameImage::paintEvent( QPaintEvent* pa )
58
//QFrame::paintEvent(pa);
64
line.setStyle(Qt::DotLine);
66
line.setColor(Qt::yellow);
68
p.setBackgroundMode(Qt::OpaqueMode);
69
p.setBackground(Qt::black);
71
int x = pa->rect().left();
72
int y = pa->rect().top();
73
int h = pa->rect().height();
74
int w = pa->rect().width();
76
//p.drawPixmap(x+frameWidth(),y+frameWidth(),*thePixmap,x+frameWidth(),y+frameWidth(),w-(2*frameWidth()),h-(2*frameWidth()));
77
p.drawPixmap(x,y,*thePixmap,x,y,w-(2),h-(2));
80
p.drawRect(rx, ry, rw, rh);
81
p.drawRect(rx+rs, ry, rw-rs, rh-rs);
82
p.drawLine(rx, ry+rh, rx+rs, ry+rh-rs);
84
int midX = rx+rs+((rw-rs)/2);
85
int midY = ry+((rh-rs)/2);
87
case 0: // delete mode cursor
88
p.drawLine(rx+rs, ry, rx+rw, ry+rh-rs);
89
p.drawLine(rx+rw, ry, rx+rs, ry+rh-rs);
91
case 1: // insert cursor
92
p.drawLine(midX, ry, midX, ry+rh-rs);
93
p.drawLine(rx+rs, midY, rx+rw, midY);
95
case 2: // move mode cursor
96
p.drawLine(midX, ry, rx+rw, midY);
97
p.drawLine(rx+rw, midY, midX, ry+rh-rs);
98
p.drawLine(midX, ry+rh-rs, rx+rs, midY);
99
p.drawLine(rx+rs, midY, midX, ry);
107
void FrameImage::setRect(int x,int y,int w,int h, int s, int t)
117
// Pass on the mouse presed event to our owner
119
void FrameImage::mousePressEvent(QMouseEvent *m) {
120
emit mousePressed(m);
123
void FrameImage::mouseMoveEvent(QMouseEvent *e) {
127
#include "FrameImage.moc"