summaryrefslogtreecommitdiffstats
path: root/kdm/kfrontend/themer/kdmitem.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-08 16:29:41 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-08 16:29:41 +0000
commite67a6fa53d4d8a34118fe05b9ae50c5ac15d0cc4 (patch)
treefa38c4b3a6aedee24174ea49bb1a0d15c376bc85 /kdm/kfrontend/themer/kdmitem.cpp
parent4e4db6156bed745d0cc72ef4bd5a1a2df4be3ac5 (diff)
downloadtdebase-e67a6fa53d4d8a34118fe05b9ae50c5ac15d0cc4.tar.gz
tdebase-e67a6fa53d4d8a34118fe05b9ae50c5ac15d0cc4.zip
* Add user list background transparency support to KDM themer
This adds a new XML tag, bgmodifier, to the theme file 0 is completely transparent, 255 is completely opaque (white) git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1173092 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdm/kfrontend/themer/kdmitem.cpp')
-rw-r--r--kdm/kfrontend/themer/kdmitem.cpp48
1 files changed, 41 insertions, 7 deletions
diff --git a/kdm/kfrontend/themer/kdmitem.cpp b/kdm/kfrontend/themer/kdmitem.cpp
index e8be05923..a171bd1bb 100644
--- a/kdm/kfrontend/themer/kdmitem.cpp
+++ b/kdm/kfrontend/themer/kdmitem.cpp
@@ -72,6 +72,7 @@ KdmItem::init( const TQDomNode &node, const char * )
pos.width = pos.height = 1;
pos.xType = pos.yType = pos.wType = pos.hType = DTnone;
pos.anchor = "nw";
+ m_backgroundModifier = 255;
isShown = InitialHidden;
@@ -99,6 +100,10 @@ KdmItem::init( const TQDomNode &node, const char * )
parseAttribute( el.attribute( "height", TQString::null ), pos.height, pos.hType );
pos.anchor = el.attribute( "anchor", "nw" );
}
+
+ if (tagName == "bgmodifier") {
+ m_backgroundModifier = TQString(el.attribute( "value", "255" )).toInt();
+ }
}
TQDomNode tnode = node;
@@ -285,15 +290,44 @@ KdmItem::paint( TQPainter *p, const TQRect &rect )
if (myWidget || (myLayoutItem && myLayoutItem->widget())) {
// KListView because it's missing a Q_OBJECT'
// FIXME: This is a nice idea intheory, but in practice it is
- // very confusing for the user not to see then empty list box
+ // very confusing for the user not to see the empty list box
// delineated from the rest of the greeter.
// Maybe set a darker version of the background instead of an exact copy?
-// if ( myWidget && myWidget->isA( "KListView" ) ) {
-// TQPixmap copy( myWidget->size() );
-// kdDebug() << myWidget->geometry() << " " << area << " " << myWidget->size() << endl;
-// bitBlt( &copy, TQPoint( 0, 0), p->device(), myWidget->geometry(), Qt::CopyROP );
-// myWidget->setPaletteBackgroundPixmap( copy );
-// }
+ if ( myWidget && myWidget->isA( "KListView" ) ) {
+ TQPixmap copy( myWidget->size() );
+ kdDebug() << myWidget->geometry() << " " << area << " " << myWidget->size() << endl;
+ bitBlt( &copy, TQPoint( 0, 0), p->device(), myWidget->geometry(), Qt::CopyROP );
+ // Lighten it slightly
+ TQImage lightVersion;
+ lightVersion = copy.convertToImage();
+
+ register uchar * r = lightVersion.bits();
+ register uchar * g = lightVersion.bits() + 1;
+ register uchar * b = lightVersion.bits() + 2;
+ uchar * end = lightVersion.bits() + lightVersion.numBytes();
+
+ while ( r != end ) {
+ if ((*r) < (255-m_backgroundModifier))
+ *r = (uchar) (*r) + m_backgroundModifier;
+ else
+ *r = 255;
+ if ((*g) < (255-m_backgroundModifier))
+ *g = (uchar) (*g) + m_backgroundModifier;
+ else
+ *g = 255;
+ if ((*b) < (255-m_backgroundModifier))
+ *b = (uchar) (*b) + m_backgroundModifier;
+ else
+ *b = 255;
+ r += 4;
+ g += 4;
+ b += 4;
+ }
+
+ copy = lightVersion;
+ // Set it
+ myWidget->setPaletteBackgroundPixmap( copy );
+ }
return;
}