2009-01-13 22:46:07 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2008 by Aaron Seigo <aseigo@kde.org>
|
|
|
|
* Copyright 2009 Marco Martin <notmart@gmail.com>
|
|
|
|
*
|
|
|
|
* 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_FRAMESVG_P_H
|
|
|
|
#define PLASMA_FRAMESVG_P_H
|
|
|
|
|
|
|
|
#include <QHash>
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
class FrameData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FrameData()
|
|
|
|
: enabledBorders(FrameSvg::AllBorders),
|
|
|
|
frameSize(-1,-1)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FrameData(const FrameData &other)
|
|
|
|
: enabledBorders(other.enabledBorders),
|
|
|
|
frameSize(other.frameSize)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~FrameData()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FrameSvg::EnabledBorders enabledBorders;
|
|
|
|
QPixmap cachedBackground;
|
|
|
|
QRegion cachedMask;
|
2009-02-07 21:44:08 +01:00
|
|
|
QSize frameSize;
|
2009-01-13 22:46:07 +01:00
|
|
|
|
|
|
|
//measures
|
|
|
|
int topHeight;
|
|
|
|
int leftWidth;
|
|
|
|
int rightWidth;
|
|
|
|
int bottomHeight;
|
|
|
|
|
|
|
|
//margins, are equal to the measures by default
|
|
|
|
int topMargin;
|
|
|
|
int leftMargin;
|
|
|
|
int rightMargin;
|
|
|
|
int bottomMargin;
|
|
|
|
|
|
|
|
//size of the svg where the size of the "center"
|
|
|
|
//element is contentWidth x contentHeight
|
|
|
|
bool noBorderPadding : 1;
|
|
|
|
bool stretchBorders : 1;
|
|
|
|
bool tileCenter : 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
class FrameSvgPrivate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FrameSvgPrivate(FrameSvg *psvg)
|
|
|
|
: q(psvg),
|
|
|
|
cacheAll(false),
|
|
|
|
saveTimer(0),
|
|
|
|
overlayPos(0,0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~FrameSvgPrivate()
|
|
|
|
{
|
|
|
|
qDeleteAll(frames);
|
|
|
|
frames.clear();
|
|
|
|
}
|
|
|
|
|
- Allow painting a background color, or a background pattern behind freely floating elements of the theme, to provide a better fallback mechanism for transparent themes when composition is not available.
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
2009-05-01 02:41:41 +02:00
|
|
|
QString cacheId(const FrameData* frame) const;
|
|
|
|
|
2009-01-13 22:46:07 +01:00
|
|
|
void generateBackground(FrameData *frame);
|
|
|
|
void scheduledCacheUpdate();
|
|
|
|
void updateSizes();
|
|
|
|
void updateNeeded();
|
|
|
|
void updateAndSignalSizes();
|
|
|
|
|
|
|
|
Location location;
|
|
|
|
QString prefix;
|
|
|
|
|
|
|
|
FrameSvg *q;
|
|
|
|
|
|
|
|
bool cacheAll : 1;
|
|
|
|
QStringList framesToSave;
|
|
|
|
QTimer *saveTimer;
|
|
|
|
QPoint overlayPos;
|
|
|
|
|
|
|
|
QHash<QString, FrameData*> frames;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|