347c0caac4
The color/pattern is given through the configuration file, and updating due to changes of the configuration file works perfectly. A simple user-interface to use this will be added to the panel configuration. If you want to try this out, put into the [Theme] section of your plasmarc file: frameBackgroundColor=#aacc00 (Your picked color) frameBackgroundColorAlpha=120 (Alpha value for the color, between 0 and 255, 0=invisible, 255=opaque) frameBackgroundPattern=/path/to/image frameBackgroundPatternAlpha=255 (Alpha value for the pattern, as above) The color is painted first, then the pattern. They are painted into the mask defined by the theme, so this only works nicely with themes that supply proper masks. svn path=/trunk/KDE/kdelibs/; revision=961915
57 lines
1.9 KiB
C++
57 lines
1.9 KiB
C++
/*
|
|
* Copyright 2009 David Nolden <david.nolden.kdevelop@art-master.de>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU Library General Public License as
|
|
* published by the Free Software Foundation; either version 2, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this program; if not, write to the
|
|
* Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#ifndef PLASMA_PANELBACKGROUNDPROVIDER_H
|
|
#define PLASMA_PANELBACKGROUNDPROVIDER_H
|
|
|
|
#include <plasma/plasma_export.h>
|
|
#include <QtCore/QPoint>
|
|
|
|
class QPainter;
|
|
class QRegion;
|
|
|
|
namespace Plasma {
|
|
|
|
/**
|
|
* Abstract class to provide additional panel backgrounds behind translucent panels.
|
|
*/
|
|
class PLASMA_EXPORT FrameBackgroundProvider
|
|
{
|
|
public:
|
|
virtual ~FrameBackgroundProvider();
|
|
/**
|
|
* Returns an identity that can be used for caching the result of the background rendering.
|
|
* @return The identity string
|
|
*/
|
|
virtual QString identity() = 0;
|
|
|
|
/**
|
|
* Applies the background to the given target. The target must have correct alpha-values,
|
|
* so the background can be painted under it. Also the clip-region must be already set correctly
|
|
* to restrict the area where the background is painted.
|
|
* @param target The target where the background should be painted
|
|
* @param offset Additional offset for the rendering: The render-source is translated by this offset
|
|
*/
|
|
virtual void apply(QPainter& target, QPoint offset = QPoint()) = 0;
|
|
};
|
|
|
|
}
|
|
|
|
#endif // PLASMA_PANELBACKGROUNDPROVIDER_H
|