<default>true</default>
</entry>
- <!-- background pixmap -->
- <entry name="BackgroundPixmap" type = "String" >
- <default></default>
- </entry>
-
</group>
<!-- widget style -->
if( event->type() == QEvent::Show && _helper.hasDecoration( widget ) )
{
_helper.setHasBackgroundGradient( widget->winId(), true );
- _helper.setHasBackgroundPixmap( widget->winId(), _helper.hasBackgroundPixmap() );
}
return false;
// background gradient
helper().setUseBackgroundGradient( StyleConfigData::useBackgroundGradient() );
- // background pixmap
- helper().setBackgroundPixmap( StyleConfigData::backgroundPixmap() );
-
// reset config
StyleConfigData::self()->readConfig();
p->fillRect( widget->rect(), color );
}
-
- // background pixmap
- Helper::renderBackgroundPixmap( p, clipRect, widget, widget->window(), y_shift, gradientHeight );
-
}
//____________________________________________________________________
}
- // background pixmap
- if( isPreview() || helper().hasBackgroundPixmap( windowId() ) )
- {
- int offset = layoutMetric( LM_OuterPaddingTop );
-
- // radial gradient positionning
- const int height = hideTitleBar() ? 0:layoutMetric(LM_TitleHeight);
- if( isMaximized() ) offset -= 3;
-
- // background pixmap
- const QPoint backgroundPixmapOffset( layoutMetric( LM_OuterPaddingLeft ) + layoutMetric( LM_BorderLeft ), 0 );
- helper().setBackgroundPixmapOffset( backgroundPixmapOffset );
-
- const QWidget* window( isPreview() ? this->widget() : widget->window() );
- helper().renderBackgroundPixmap(painter, rect, widget, window, offset, height );
-
- }
-
}
//_________________________________________________________
// read shadowCache configuration
_shadowCache.readConfig();
- // background pixmap
- {
- KConfigGroup group( config->group("Common") );
- helper().setBackgroundPixmap( group.readEntry( "BackgroundPixmap", "" ) );
- }
-
}
//_________________________________________________________________
// create background atoms
_backgroundGradientAtom = XInternAtom( QX11Info::display(), "_KDE_OXYGEN_BACKGROUND_GRADIENT", False);
- _backgroundPixmapAtom = XInternAtom( QX11Info::display(), "_KDE_OXYGEN_BACKGROUND_PIXMAP", False);
#endif
{ p->restore(); }
}
-
- //____________________________________________________________________
- void Helper::renderBackgroundPixmap( QPainter* p, const QRect& clipRect, const QWidget* widget, const QWidget* window, int yShift, int gradientHeight )
- {
-
- // background pixmap
- if( _backgroundPixmap.isNull() ) return;
-
- // get coordinates relative to the client area
- // this is stupid. One could use mapTo if this was taking const QWidget* and not
- // QWidget* as argument.
- const QWidget* w( widget );
- int x( 0 );
- int y( -yShift );
-
- while ( w != window && !w->isWindow() && w != w->parentWidget() )
- {
- x += w->geometry().x();
- y += w->geometry().y();
- w = w->parentWidget();
- }
-
- if ( clipRect.isValid() )
- {
- p->save();
- p->setClipRegion( clipRect,Qt::IntersectClip );
- }
-
- // calculate upper part height
- // special tricks are needed
- // to handle both window contents and window decoration
- int height( window->frameGeometry().height() );
- int width( window->frameGeometry().width() );
-
- // account for vertical shift
- if( yShift > 0 ) height -= 2*yShift;
-
- // calculate source rect
- QPoint offset( 40, 48 - 20 );
- QRect source( 0, 0, width + offset.x(), height + offset.y() );
-
- offset -= _backgroundPixmapOffset;
- source.translate( offset.x(), offset.y() );
- source.translate( 0, 20 - gradientHeight );
-
- // draw
- p->drawPixmap( QPoint( -x, -y ), _backgroundPixmap, source );
-
- if ( clipRect.isValid() )
- { p->restore(); }
-
- }
-
//_____________________________________________________________
void Helper::renderDot( QPainter* p, const QPoint& point, const QColor& baseColor )
{
#endif
}
- //____________________________________________________________________
- void Helper::setHasBackgroundPixmap( WId id, bool value ) const
- {
-
- #ifdef Q_WS_X11
- setHasHint( id, _backgroundPixmapAtom, value );
- #else
- Q_UNUSED( id );
- Q_UNUSED( value );
- #endif
- return;
- }
-
- //____________________________________________________________________
- bool Helper::hasBackgroundPixmap( WId id ) const
- {
-
- #ifdef Q_WS_X11
- return hasHint( id, _backgroundPixmapAtom );
- #else
- Q_UNUSED( id );
- return false;
- #endif
- }
-
//______________________________________________________________________________________
void Helper::drawSlab( QPainter& p, const QColor& color, qreal shade )
{
//! render window background using a given color as a reference
virtual void renderWindowBackground( QPainter* p, const QRect& clipRect, const QWidget* widget, const QWidget* window, const QColor& color, int y_shift=-23, int gradientHeight = 20 );
- //! background pixmap
- bool hasBackgroundPixmap( void ) const
- { return !_backgroundPixmap.isNull(); }
-
- //! background pixmap
- void setBackgroundPixmap( const QPixmap& pixmap )
- { _backgroundPixmap = pixmap; }
-
- //! offset
- void setBackgroundPixmapOffset( const QPoint& offset )
- { _backgroundPixmapOffset = offset; }
-
- //! render window background using a given color as a reference
- virtual void renderBackgroundPixmap( QPainter* p, const QRect& clipRect, const QWidget* widget, const QWidget* window, int y_shift=-23, int gradientHeight = 20 );
-
//@}
//! dots
//! true if background gradient hint is set
virtual bool hasBackgroundGradient( WId ) const;
- //! set background pixmap hint to widget
- virtual void setHasBackgroundPixmap( WId, bool ) const;
-
- //! true if background pixmap hint is set
- virtual bool hasBackgroundPixmap( WId ) const;
-
//@}
protected:
ColorMap _highThreshold;
ColorMap _lowThreshold;
- //! background pixmap
- QPixmap _backgroundPixmap;
-
- //! background pixmap offsets
- QPoint _backgroundPixmapOffset;
-
#ifdef Q_WS_X11
//! set value for given hint
//! background gradient hint atom
Atom _backgroundGradientAtom;
- //! background gradient hint atom
- Atom _backgroundPixmapAtom;
-
#endif
};