summaryrefslogtreecommitdiff
authorhash <hash>2002-08-22 16:30:01 (UTC)
committer hash <hash>2002-08-22 16:30:01 (UTC)
commit4b0db964f77e4b3caa1f95ea753c89094b86e0d6 (patch) (side-by-side diff)
tree1be74ef5d6bf3101815b5ecdafb21c0db470715e
parent8503abdc93f6f3ce93cee0f1176faa919dbd04f5 (diff)
downloadopie-4b0db964f77e4b3caa1f95ea753c89094b86e0d6.zip
opie-4b0db964f77e4b3caa1f95ea753c89094b86e0d6.tar.gz
opie-4b0db964f77e4b3caa1f95ea753c89094b86e0d6.tar.bz2
xpm images now are the same color as the text
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp19
-rw-r--r--inputmethods/multikey/keyboard.h6
2 files changed, 13 insertions, 12 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index e3d3928..3f6f73b 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -176,9 +176,9 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
p.fillRect(x + 1, y + 1,
keyWidth * defaultKeyWidth - 1, keyHeight - 1,
pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor);
- QPixmap *pix = keys->pix(row,col);
+ QImage *pix = keys->pix(row,col);
ushort c = keys->uni(row, col);
p.setPen(textcolor);
@@ -194,9 +194,9 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
AlignCenter, (QChar)c);
}
else
// center the image in the middle of the key
- p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2,
+ p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2,
y + (keyHeight - pix->height())/2 + 1,
*pix );
// this fixes the problem that the very right end of the board's vertical line
@@ -218,9 +218,9 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
p.drawLine(x, y, x + width(), y);
for (int col = 0; col < keys->numKeys(row); col++) {
- QPixmap *pix = keys->pix(row, col);
+ QImage *pix = keys->pix(row, col);
int keyWidth = keys->width(row, col);
int keyWidthPix = defaultKeyWidth * keyWidth;
@@ -243,11 +243,12 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
AlignCenter, (QChar)c);
}
else {
// center the image in the middle of the key
- p.drawPixmap( x + (keyWidthPix - pix->width())/2,
+ pix->setColor(1, textcolor.rgb());
+ p.drawImage( x + (keyWidthPix - pix->width())/2,
y + (keyHeight - pix->height())/2 + 1,
- QPixmap(*pix) );
+ QImage(*pix) );
}
p.setPen(keycolor_lines);
p.drawLine(x, y, x, y + keyHeight);
@@ -1043,9 +1044,9 @@ void Keys::setKeysFromFile(const char * filename) {
int width;
QString buf;
QString comment;
char * xpm[256]; //couldnt be larger than that... could it?
- QPixmap *xpm2pix = 0;
+ QImage *xpm2pix = 0;
buf = t.readLine();
while (buf) {
@@ -1089,9 +1090,9 @@ void Keys::setKeysFromFile(const char * filename) {
buf = t.readLine();
}
if (xpmLineCount) {
- xpm2pix = new QPixmap((const char **)xpm);
+ xpm2pix = new QImage((const char **)xpm);
for (int i = 0; i < xpmLineCount; i++)
delete [] (xpm[i]);
@@ -1158,9 +1159,9 @@ void Keys::setKeysFromFile(const char * filename) {
}
// Keys::setKey {{{2
void Keys::setKey(const int row, const int qcode, const ushort unicode,
- const int width, QPixmap *pix) {
+ const int width, QImage *pix) {
Key * key;
key = new Key;
key->qcode = qcode;
@@ -1215,9 +1216,9 @@ int Keys::qcode(const int row, const int col) {
return keys[row].at(col)->qcode;
}
-QPixmap *Keys::pix(const int row, const int col) {
+QImage *Keys::pix(const int row, const int col) {
return keys[row].at(col)->pix;
}
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h
index b692975..1aa7a35 100644
--- a/inputmethods/multikey/keyboard.h
+++ b/inputmethods/multikey/keyboard.h
@@ -62,13 +62,13 @@ public:
bool pressed(const int row, const int col);
bool *pressedPtr(const int row, const int col);
ushort shift(const ushort);
ushort meta(const ushort);
- QPixmap *pix(const int row, const int col);
+ QImage *pix(const int row, const int col);
int numKeys(const int row);
void setKeysFromFile(const char *filename);
void setKey(const int row, const int qcode, const ushort unicode,
- const int width, QPixmap *pix);
+ const int width, QImage *pix);
void setPressed(const int row, const int col, const bool pressed);
QString lang;
QString label;
@@ -80,9 +80,9 @@ private:
int width; // not pixels but relative key width. normal key is 2
// only needed for keys like ctrl that can have multiple keys pressed at once
bool *pressed;
- QPixmap *pix;
+ QImage *pix;
};
QList<Key> keys[6];
QMap<ushort,ushort> shiftMap;