diff options
Diffstat (limited to 'kxkb/pixmap.cpp')
-rw-r--r-- | kxkb/pixmap.cpp | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/kxkb/pixmap.cpp b/kxkb/pixmap.cpp index 238023d9b..63fc4f1db 100644 --- a/kxkb/pixmap.cpp +++ b/kxkb/pixmap.cpp @@ -1,5 +1,5 @@ #include <tqimage.h> -//#include <tqbitmap.h> +#include <tqbitmap.h> #include <tqfont.h> #include <tqpainter.h> #include <tqregexp.h> @@ -49,6 +49,7 @@ LayoutIcon::findPixmap(const TQString& code_, int pixmapStyle, const TQString& d m_labelFont = m_kxkbConfig.m_labelFont; m_labelShadow = m_kxkbConfig.m_labelShadow; m_shColor = m_kxkbConfig.m_colorShadow; + m_bgTransparent = m_kxkbConfig.m_bgTransparent; // Decide on how to style the pixmap switch(pixmapStyle) { @@ -96,7 +97,7 @@ LayoutIcon::findPixmap(const TQString& code_, int pixmapStyle, const TQString& d const TQString pixmapKey( TQString( m_showFlag ? "f" : "" ) + TQString( m_showLabel ? "l" : "" ) + TQString( m_labelShadow ? "s" : "" ) + "." + - m_labelFont.key() + "." + m_bgColor.name() + "." + m_fgColor.name() + "." + m_shColor.name() + '.' + code_ + "." + displayName + m_labelFont.key() + "." + ( m_bgTransparent ? "x" : m_bgColor.name() ) + "." + m_fgColor.name() + "." + m_shColor.name() + '.' + code_ + "." + displayName ); // Only use cache for indicator @@ -140,13 +141,34 @@ LayoutIcon::findPixmap(const TQString& code_, int pixmapStyle, const TQString& d if( m_labelShadow ) { p.setPen(m_shColor); - p.drawText(1, 1, pm->width(), pm->height(), Qt::AlignCenter, displayName); + p.drawText(1, 1, pm->width(), pm->height(), TQt::AlignCenter, displayName); } p.setPen(m_fgColor); - p.drawText(0, 0, pm->width(), pm->height(), Qt::AlignCenter, displayName); + p.drawText(0, 0, pm->width(), pm->height(), TQt::AlignCenter, displayName); + + if( m_bgTransparent && !m_showFlag ) + { + TQPixmap maskpix(pm->width(), pm->height()); + TQPainter maskp(&maskpix); + + maskpix.fill(TQt::white); + maskp.setPen(TQt::black); + maskp.setFont(m_labelFont); + + maskp.drawText(0, 0, maskpix.width(), maskpix.height(), TQt::AlignCenter, displayName); + if( m_labelShadow ) + { + maskp.drawText(1, 1, maskpix.width(), maskpix.height(), TQt::AlignCenter, displayName); + } + + TQBitmap mask; + mask = maskpix; + pm->setMask(mask); + } } + if( pixmapStyle == PIXMAP_STYLE_INDICATOR ) m_pixmapCache.insert(pixmapKey, pm); @@ -270,8 +292,8 @@ void LayoutIcon::dimPixmap(TQPixmap& pm) for (int y=0; y<image.height(); y++) for(int x=0; x<image.width(); x++) { - QRgb rgb = image.pixel(x,y); - QRgb dimRgb(tqRgb(tqRed(rgb)*3/4, tqGreen(rgb)*3/4, tqBlue(rgb)*3/4)); + TQRgb rgb = image.pixel(x,y); + TQRgb dimRgb(tqRgb(tqRed(rgb)*3/4, tqGreen(rgb)*3/4, tqBlue(rgb)*3/4)); image.setPixel(x, y, dimRgb); } pm.convertFromImage(image); @@ -283,15 +305,15 @@ static const char* ERROR_LABEL = "err"; TQPixmap* LayoutIcon::createErrorPixmap() { TQPixmap* pm = new TQPixmap(21, 14); - pm->fill(Qt::white); + pm->fill(TQt::white); TQPainter p(pm); p.setFont(m_labelFont); - p.setPen(Qt::red); - p.drawText(1, 1, pm->width(), pm->height()-2, Qt::AlignCenter, ERROR_LABEL); - p.setPen(Qt::blue); - p.drawText(0, 0, pm->width(), pm->height()-2, Qt::AlignCenter, ERROR_LABEL); + p.setPen(TQt::red); + p.drawText(1, 1, pm->width(), pm->height()-2, TQt::AlignCenter, ERROR_LABEL); + p.setPen(TQt::blue); + p.drawText(0, 0, pm->width(), pm->height()-2, TQt::AlignCenter, ERROR_LABEL); m_pixmapCache.insert(ERROR_CODE, pm); return pm; |