author | sandman <sandman> | 2002-06-27 20:23:25 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-06-27 20:23:25 (UTC) |
commit | c9871ef295afed6bc4f4cc5451f46bf3b6e8d462 (patch) (side-by-side diff) | |
tree | 2fa3264c0a847100d1368df6e1eae2dd5b7a47ac /noncore/styles/liquid/liquid.cpp | |
parent | 9cd1aef30015628e06e8f24b9b7e91acb631b52b (diff) | |
download | opie-c9871ef295afed6bc4f4cc5451f46bf3b6e8d462.zip opie-c9871ef295afed6bc4f4cc5451f46bf3b6e8d462.tar.gz opie-c9871ef295afed6bc4f4cc5451f46bf3b6e8d462.tar.bz2 |
Enhanced liquid style:
1) All WType_Popup's now get a transparent background (volume-applet)
2) Settings/Liquid Settings - a new app that acts like the KDE Control
Panel page for Liquid
Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 5f014ad..4653639 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp @@ -82,14 +82,19 @@ void TransMenuHandler::reloadSettings() type = config. readNumEntry("Type", TransStippleBg); color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); opacity = config. readNumEntry("Opacity", 10); + if ( opacity < -20 ) + opacity = 20; + else if ( opacity > 20 ) + opacity = 20; + shadowText = config. readBoolEntry("ShadowText", true); } bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) { - QPopupMenu *p = (QPopupMenu *)obj; + QWidget *p = (QWidget *)obj; if(ev->type() == QEvent::Show){ if(type == TransStippleBg || type == TransStippleBtn || type == Custom){ @@ -117,16 +122,52 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) } else{ QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); } - pixDict.insert(p->winId(), pix); + + if (p->inherits("QPopupMenu")) + pixDict.insert(p->winId(), pix); + else { + p->setBackgroundPixmap(*pix); + + QObjectList *ol = p-> queryList("QWidget"); + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { + QWidget *wid = (QWidget *) it.current ( ); + + wid-> setBackgroundPixmap(*pix); + wid-> setBackgroundOrigin(QWidget::ParentOrigin); + } + delete ol; + } } } else if(ev->type() == QEvent::Hide){ if(type == TransStippleBg || type == TransStippleBtn || type == Custom){ // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); - pixDict.remove(p->winId()); + + if (p->inherits("QPopupMenu")) + pixDict.remove(p->winId()); + else { + p->setBackgroundMode(QWidget::PaletteBackground); + + QObjectList *ol = p-> queryList("QWidget"); + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { + QWidget *wid = (QWidget *) it.current ( ); + + wid-> setBackgroundMode( QWidget::PaletteBackground ); + } + delete ol; + } + } + } + else if(ev->type() == QEvent::Paint){ + if(type == TransStippleBg || type == TransStippleBtn || + type == Custom){ +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); + + if (!p->inherits("QPopupMenu")) + p->erase(); } } return(false); } @@ -795,12 +836,17 @@ void LiquidStyle::polish(QWidget *w) return; } if(w->inherits("QPopupMenu")) w->setBackgroundMode(QWidget::NoBackground); - + else if(w-> testWFlags(Qt::WType_Popup)) { + printf("install popup: %s\n", w-> className ( )); + w->installEventFilter(menuHandler); + } + if(w->isTopLevel()){ return; } + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); if(w->inherits("QComboBox") || @@ -885,8 +931,11 @@ void LiquidStyle::unPolish(QWidget *w) } if(w->inherits("QPopupMenu")) w->setBackgroundMode(QWidget::PaletteButton); + else if(w-> testWFlags(Qt::WType_Popup)) { + w->removeEventFilter(menuHandler); + } if(w->isTopLevel()) return; |