some colorgroup porting
svn path=/trunk/KDE/kdebase/workspace/; revision=535723
This commit is contained in:
parent
c1d76aa70d
commit
abeff9d0f6
8 changed files with 136 additions and 98 deletions
|
@ -81,7 +81,7 @@ static inline const KDecorationOptions* options()
|
|||
return KDecoration::options();
|
||||
}
|
||||
|
||||
static void drawButtonFrame(KPixmap *pix, const QColorGroup &g, bool sunken)
|
||||
static void drawButtonFrame(KPixmap *pix, const QPalette &g, bool sunken)
|
||||
{
|
||||
QPainter p;
|
||||
int w = pix->width();
|
||||
|
@ -94,9 +94,9 @@ static void drawButtonFrame(KPixmap *pix, const QColorGroup &g, bool sunken)
|
|||
qDrawShadePanel(&p, 0, 0, w, h, g, true, 2);
|
||||
}
|
||||
else{
|
||||
p.setPen(g.dark());
|
||||
p.setPen(g.color(QPalette::Dark ));
|
||||
p.drawRect(0, 0, w-1, h-1);
|
||||
p.setPen(g.light());
|
||||
p.setPen(g.color(QPalette::Light));
|
||||
p.drawLine(x2, 0, x2, y2);
|
||||
p.drawLine(0, y2, x2, y2);
|
||||
p.drawLine(1, 1, x2-2, 1);
|
||||
|
@ -159,8 +159,9 @@ static void create_pixmaps()
|
|||
KPixmapEffect::VerticalGradient);
|
||||
}
|
||||
// buttons (active/inactive, sunken/unsunken, 2 sizes each)
|
||||
QColorGroup g = options()->palette(KDecoration::ColorButtonBg, true).active();
|
||||
QColor c = g.background();
|
||||
QPalette g = options()->palette(KDecoration::ColorButtonBg, true);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
QColor c = g.color( QPalette::Background );
|
||||
btnPix1 = new KPixmap(btnWidth1, titleHeight);
|
||||
btnDownPix1 = new KPixmap(btnWidth1, titleHeight);
|
||||
btnPix2 = new KPixmap(btnWidth2, titleHeight);
|
||||
|
@ -178,8 +179,9 @@ static void create_pixmaps()
|
|||
KPixmapEffect::DiagonalGradient);
|
||||
KPixmapEffect::gradient(*btnDownPix2, c.dark(130), c.light(120),
|
||||
KPixmapEffect::DiagonalGradient);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
c = g.background();
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = g.color(QPalette::Background);
|
||||
KPixmapEffect::gradient(*iBtnPix1, c.light(120), c.dark(130),
|
||||
KPixmapEffect::DiagonalGradient);
|
||||
KPixmapEffect::gradient(*iBtnDownPix1, c.dark(130), c.light(120),
|
||||
|
@ -194,20 +196,23 @@ static void create_pixmaps()
|
|||
btnDownPix1->fill(c.rgb());
|
||||
btnPix2->fill(c.rgb());
|
||||
btnDownPix2->fill(c.rgb());
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = g.background();
|
||||
iBtnPix1->fill(c.rgb());
|
||||
iBtnDownPix1->fill(c.rgb());
|
||||
iBtnPix2->fill(c.rgb());
|
||||
iBtnDownPix2->fill(c.rgb());
|
||||
}
|
||||
g = options()->palette(KDecoration::ColorButtonBg, true).active();
|
||||
g = options()->palette(KDecoration::ColorButtonBg, true);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = g.background();
|
||||
drawButtonFrame(btnPix1, g, false);
|
||||
drawButtonFrame(btnDownPix1, g, true);
|
||||
drawButtonFrame(btnPix2, g, false);
|
||||
drawButtonFrame(btnDownPix2, g, true);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = g.background();
|
||||
drawButtonFrame(iBtnPix1, g, false);
|
||||
drawButtonFrame(iBtnDownPix1, g, true);
|
||||
|
@ -243,7 +248,7 @@ static void delete_pixmaps()
|
|||
LaptopButton::LaptopButton(ButtonType type, LaptopClient *parent, const char *name)
|
||||
: KCommonDecorationButton(type, parent)
|
||||
{
|
||||
setBackgroundMode(Qt::NoBackground);
|
||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||
}
|
||||
|
||||
void LaptopButton::reset(unsigned long changed)
|
||||
|
@ -314,7 +319,8 @@ void LaptopButton::drawButton(QPainter *p)
|
|||
}
|
||||
}
|
||||
else{
|
||||
QColorGroup g = options()->palette(KDecoration::ColorButtonBg, decoration()->isActive()).active();
|
||||
QPalette g = options()->palette(KDecoration::ColorButtonBg, decoration()->isActive());
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
int w = width();
|
||||
int h = height();
|
||||
p->fillRect(1, 1, w-2, h-2, isDown() ? g.mid() : g.button());
|
||||
|
@ -469,7 +475,8 @@ void LaptopClient::captionChange()
|
|||
void LaptopClient::paintEvent( QPaintEvent* )
|
||||
{
|
||||
QPainter p(widget());
|
||||
QColorGroup g = options()->palette(KDecoration::ColorFrame, isActive()).active();
|
||||
QPalette g = options()->palette(KDecoration::ColorFrame, isActive());
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
|
||||
QRect r(widget()->rect());
|
||||
p.setPen(Qt::black);
|
||||
|
@ -511,18 +518,18 @@ void LaptopClient::paintEvent( QPaintEvent* )
|
|||
if (r.width() > 3*handleSize + 20) {
|
||||
int range = 8 + 3*handleSize/2;
|
||||
qDrawShadePanel(&p, r.x() + 1, r.bottom() - bs, range,
|
||||
handleSize - 2, g, false, 1, &g.brush(QColorGroup::Mid));
|
||||
handleSize - 2, g, false, 1, &g.brush(QPalette::Mid));
|
||||
qDrawShadePanel(&p, r.x() + range + 1, r.bottom() - bs,
|
||||
r.width() - 2*range - 2, handleSize - 2, g, false, 1,
|
||||
isActive() ? &g.brush(QColorGroup::Background) :
|
||||
&g.brush(QColorGroup::Mid));
|
||||
isActive() ? &g.brush(QPalette::Background) :
|
||||
&g.brush(QPalette::Mid));
|
||||
qDrawShadePanel(&p, r.right() - range, r.bottom() - bs,
|
||||
range, bs, g, false, 1, &g.brush(QColorGroup::Mid));
|
||||
range, bs, g, false, 1, &g.brush(QPalette::Mid));
|
||||
} else {
|
||||
qDrawShadePanel(&p, r.x() + 1, r.bottom() - bs,
|
||||
r.width() - 2, bs, g, false, 1,
|
||||
isActive() ? &g.brush(QColorGroup::Background) :
|
||||
&g.brush(QColorGroup::Mid));
|
||||
isActive() ? &g.brush(QPalette::Background) :
|
||||
&g.brush(QPalette::Mid));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,7 +553,8 @@ void LaptopClient::paintEvent( QPaintEvent* )
|
|||
|
||||
p.setFont(options()->font(false, isToolWindow() ));
|
||||
QFontMetrics fm(options()->font(false));
|
||||
g = options()->palette(KDecoration::ColorTitleBar, false).active();
|
||||
g = options()->palette(KDecoration::ColorTitleBar, false);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
if(iUpperGradient)
|
||||
p.drawTiledPixmap(r.x()+((r.width()-fm.width(caption()))/2)-4,
|
||||
r.y(), fm.width(caption())+8, r.height()-1,
|
||||
|
@ -554,7 +562,7 @@ void LaptopClient::paintEvent( QPaintEvent* )
|
|||
else
|
||||
p.fillRect(r.x()+((r.width()-fm.width(caption()))/2)-4, r.y(),
|
||||
fm.width(caption())+8, r.height()-1,
|
||||
g.brush(QColorGroup::Background));
|
||||
g.brush(QPalette::Background));
|
||||
p.setPen(g.mid());
|
||||
p.drawLine(r.x(), r.y(), r.right(), r.y());
|
||||
p.drawLine(r.x(), r.y(), r.x(), r.bottom());
|
||||
|
@ -564,7 +572,8 @@ void LaptopClient::paintEvent( QPaintEvent* )
|
|||
p.setPen(options()->color(KDecoration::ColorFont, false));
|
||||
p.drawText(r.x(), r.y(), r.width(), r.height()-1,
|
||||
Qt::AlignCenter, caption() );
|
||||
g = options()->palette(KDecoration::ColorFrame, true).active();
|
||||
g = options()->palette(KDecoration::ColorFrame, true);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
p.setPen(g.background());
|
||||
p.drawPoint(r.x(), r.y());
|
||||
p.drawPoint(r.right(), r.y());
|
||||
|
@ -628,7 +637,8 @@ void LaptopClient::updateActiveBuffer( )
|
|||
|
||||
p.setFont(options()->font(true, isToolWindow() ));
|
||||
QFontMetrics fm(options()->font(true));
|
||||
QColorGroup g = options()->palette(KDecoration::ColorTitleBar, true).active();
|
||||
QPalette g = options()->palette(KDecoration::ColorTitleBar, true);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
if(aUpperGradient)
|
||||
p.drawTiledPixmap(r.x()+((r.width()-fm.width(caption()))/2)-4,
|
||||
r.y(), fm.width(caption())+8, r.height()-1,
|
||||
|
@ -636,7 +646,7 @@ void LaptopClient::updateActiveBuffer( )
|
|||
else
|
||||
p.fillRect(r.x()+((r.width()-fm.width(caption()))/2)-4, 0,
|
||||
fm.width(caption())+8, r.height(),
|
||||
g.brush(QColorGroup::Background));
|
||||
g.brush(QPalette::Background));
|
||||
p.setPen(g.mid());
|
||||
p.drawLine(r.x(), r.y(), r.right(), r.y());
|
||||
p.drawLine(r.x(), r.y(), r.x(), r.bottom());
|
||||
|
@ -646,7 +656,8 @@ void LaptopClient::updateActiveBuffer( )
|
|||
p.setPen(options()->color(KDecoration::ColorFont, true));
|
||||
p.drawText(r.x(), r.y(), r.width(), r.height()-1,
|
||||
Qt::AlignCenter, caption() );
|
||||
g = options()->palette(KDecoration::ColorFrame, true).active();
|
||||
g = options()->palette(KDecoration::ColorFrame, true);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
p.setPen(g.background());
|
||||
p.drawPoint(r.x(), r.y());
|
||||
p.drawPoint(r.right(), r.y());
|
||||
|
|
|
@ -102,7 +102,7 @@ static inline const KDecorationOptions* options()
|
|||
return KDecoration::options();
|
||||
}
|
||||
|
||||
static void make_button_fx(const QColorGroup &g, QPixmap *pix, bool light=false)
|
||||
static void make_button_fx(const QPalette &g, QPixmap *pix, bool light=false)
|
||||
{
|
||||
pix->fill(g.background());
|
||||
QPainter p(pix);
|
||||
|
@ -173,20 +173,22 @@ static void create_pixmaps()
|
|||
KPixmapEffect::VerticalGradient);
|
||||
}
|
||||
// buttons
|
||||
QColorGroup btnColor(options()->palette(KDecoration::ColorButtonBg, true).active());
|
||||
QPalette btnColor(options()->palette(KDecoration::ColorButtonBg, true) );
|
||||
btnColor.setCurrentColorGroup(QPalette::Active);
|
||||
buttonPix = new QPixmap(14, 15);
|
||||
make_button_fx(btnColor, buttonPix);
|
||||
buttonPixDown = new QPixmap(14, 15);
|
||||
make_button_fx(btnColor, buttonPixDown, true);
|
||||
|
||||
btnColor = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
btnColor = options()->palette(KDecoration::ColorButtonBg, false);
|
||||
btnColor.setCurrentColorGroup(QPalette::Active);
|
||||
iButtonPix = new QPixmap(14, 15);
|
||||
make_button_fx(btnColor, iButtonPix);
|
||||
iButtonPixDown = new QPixmap(14, 15);
|
||||
make_button_fx(btnColor, iButtonPixDown, true);
|
||||
|
||||
|
||||
if(qGray(btnColor.background().rgb()) < 150)
|
||||
if(qGray(btnColor.background().color().rgb()) < 150)
|
||||
buttonFg = new QColor(Qt::white);
|
||||
else
|
||||
buttonFg = new QColor(Qt::black);
|
||||
|
@ -289,7 +291,8 @@ QList< ModernSysFactory::BorderSize > ModernSysFactory::borderSizes() const
|
|||
ModernButton::ModernButton(ButtonType type, ModernSys *parent, const char *name)
|
||||
: KCommonDecorationButton(type, parent)
|
||||
{
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
setObjectName( name );
|
||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||
|
||||
QBitmap mask(14, 15, QPixmap::defaultDepth() > 8 ?
|
||||
btnhighcolor_mask_bits : lowcolor_mask_bits, true);
|
||||
|
@ -519,12 +522,14 @@ void ModernSys::recalcTitleBuffer()
|
|||
titleBuffer = QPixmap(width(), title_height+2);
|
||||
QPainter p;
|
||||
p.begin(&titleBuffer);
|
||||
|
||||
QPalette pt = options()->palette(ColorTitleBar, true);
|
||||
pt.setCurrentColorGroup( QPalette::Active );
|
||||
if(aUpperGradient)
|
||||
p.drawTiledPixmap(0, 0, width(), title_height+2, *aUpperGradient);
|
||||
else
|
||||
p.fillRect(0, 0, width(), title_height+2,
|
||||
options()->palette(ColorTitleBar, true).active().
|
||||
brush(QColorGroup::Button));
|
||||
pt.brush(QColorGroup::Button));
|
||||
|
||||
QRect t = titleRect(); // titlebar->geometry();
|
||||
t.setTop( 2 );
|
||||
|
@ -561,8 +566,10 @@ void ModernSys::updateCaption()
|
|||
|
||||
void ModernSys::drawRoundFrame(QPainter &p, int x, int y, int w, int h)
|
||||
{
|
||||
QPalette pt = options()->palette(ColorFrame, isActive());
|
||||
pt.setCurrentColorGroup( QPalette::Active );
|
||||
kDrawRoundButton(&p, x, y, w, h,
|
||||
options()->palette(ColorFrame, isActive()).active(), false);
|
||||
pt, false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -578,10 +585,11 @@ void ModernSys::paintEvent( QPaintEvent* )
|
|||
QPainter p( widget() );
|
||||
QRect t = titleRect(); // titlebar->geometry();
|
||||
|
||||
QBrush fillBrush(widget()->colorGroup().brush(QColorGroup::Background).pixmap() ?
|
||||
widget()->colorGroup().brush(QColorGroup::Background) :
|
||||
options()->palette(ColorFrame, isActive()).active().
|
||||
brush(QColorGroup::Button));
|
||||
QPalette pt = options()->palette(ColorFrame, isActive());
|
||||
pt.setCurrentColorGroup( QPalette::Active );
|
||||
QBrush fillBrush(widget()->palette().brush(QPalette::Background).pixmap() ?
|
||||
widget()->palette().brush(QPalette::Background) :
|
||||
pt.brush(QPalette::Button));
|
||||
|
||||
p.fillRect(1, title_height+3, width()-2, height()-(title_height+3), fillBrush);
|
||||
p.fillRect(width()-6, 0, width()-1, height(), fillBrush);
|
||||
|
@ -594,7 +602,8 @@ void ModernSys::paintEvent( QPaintEvent* )
|
|||
int h = height() - hw;
|
||||
|
||||
// titlebar
|
||||
QColorGroup g = options()->palette(ColorTitleBar, isActive()).active();
|
||||
QPalette g = options()->palette(ColorTitleBar, isActive());
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
if(isActive()){
|
||||
p.drawPixmap(1, 1, titleBuffer, 0, 0, w-2, title_height+2);
|
||||
}
|
||||
|
@ -617,7 +626,8 @@ void ModernSys::paintEvent( QPaintEvent* )
|
|||
p.drawLine(0, title_height+2, w-2, title_height+2);
|
||||
|
||||
// frame
|
||||
g = options()->palette(ColorFrame, isActive()).active();
|
||||
g = options()->palette(ColorFrame, isActive());
|
||||
g.setCurrentColorGroup(QPalette::Active);
|
||||
p.setPen(g.light());
|
||||
p.drawLine(1, title_height+3, 1, h-2);
|
||||
p.setPen(g.dark());
|
||||
|
|
|
@ -295,29 +295,35 @@ void QuartzHandler::drawBlocks( KPixmap *pi, KPixmap &p, const QColor &c1, const
|
|||
void QuartzHandler::createPixmaps()
|
||||
{
|
||||
// Obtain titlebar blend colours, and create the block stuff on pixmaps.
|
||||
QColorGroup g2 = options()->palette(ColorTitleBlend, true).active();
|
||||
QColor c2 = g2.background();
|
||||
g2 = options()->palette(ColorTitleBar, true ).active();
|
||||
QColor c = g2.background().light(130);
|
||||
QPalette g2 = options()->palette(ColorTitleBlend, true);
|
||||
g2.setCurrentColorGroup( QPalette::Active );
|
||||
QColor c2 = g2.color( QPalette::Background );
|
||||
g2 = options()->palette(ColorTitleBar, true );
|
||||
g2.setCurrentColorGroup( QPalette::Active );
|
||||
QColor c = g2.color(QPalette::Background).light(130);
|
||||
|
||||
titleBlocks = new KPixmap( normalTitleHeight*25/18, normalTitleHeight );
|
||||
drawBlocks( titleBlocks, *titleBlocks, c, c2 );
|
||||
|
||||
g2 = options()->palette(ColorTitleBlend, false).active();
|
||||
c2 = g2.background();
|
||||
g2 = options()->palette(ColorTitleBar, false ).active();
|
||||
c = g2.background().light(130);
|
||||
g2 = options()->palette(ColorTitleBlend, false);
|
||||
g2.setCurrentColorGroup( QPalette::Active );
|
||||
c2 = g2.color( QPalette::Background );
|
||||
g2 = options()->palette(ColorTitleBar, false );
|
||||
g2.setCurrentColorGroup( QPalette::Active );
|
||||
c = g2.color(QPalette::Background).light(130);
|
||||
|
||||
ititleBlocks = new KPixmap( normalTitleHeight*25/18, normalTitleHeight );
|
||||
drawBlocks( ititleBlocks, *ititleBlocks, c, c2 );
|
||||
|
||||
// Set the on all desktops pin pixmaps;
|
||||
QColorGroup g;
|
||||
QPalette g;
|
||||
QPainter p;
|
||||
|
||||
g = options()->palette( onAllDesktopsButtonOnLeft ? ColorTitleBar : ColorTitleBlend, true ).active();
|
||||
c = onAllDesktopsButtonOnLeft ? g.background().light(130) : g.background();
|
||||
g2 = options()->palette( ColorButtonBg, true ).active();
|
||||
g = options()->palette( onAllDesktopsButtonOnLeft ? ColorTitleBar : ColorTitleBlend, true );
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = onAllDesktopsButtonOnLeft ? g.color(QPalette::Background).light(130) : g.color(QPalette::Background);
|
||||
g2 = options()->palette( ColorButtonBg, true );
|
||||
g2.setCurrentColorGroup( QPalette::Active );
|
||||
|
||||
pinUpPix = new KPixmap(16, 16);
|
||||
p.begin( pinUpPix );
|
||||
|
@ -335,9 +341,11 @@ void QuartzHandler::createPixmaps()
|
|||
|
||||
|
||||
// Inactive pins
|
||||
g = options()->palette( onAllDesktopsButtonOnLeft ? ColorTitleBar : ColorTitleBlend, false ).active();
|
||||
c = onAllDesktopsButtonOnLeft ? g.background().light(130) : g.background();
|
||||
g2 = options()->palette( ColorButtonBg, false ).active();
|
||||
g = options()->palette( onAllDesktopsButtonOnLeft ? ColorTitleBar : ColorTitleBlend, false );
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = onAllDesktopsButtonOnLeft ? g.color(QPalette::Background).light(130) : g.color( QPalette::Background );
|
||||
g2 = options()->palette( ColorButtonBg, false );
|
||||
g2.setCurrentColorGroup( QPalette::Active );
|
||||
|
||||
ipinUpPix = new KPixmap(16, 16);
|
||||
p.begin( ipinUpPix );
|
||||
|
@ -378,10 +386,11 @@ QList< QuartzHandler::BorderSize > QuartzHandler::borderSizes() const
|
|||
QuartzButton::QuartzButton(ButtonType type, QuartzClient *parent, const char *name)
|
||||
: KCommonDecorationButton(type, parent)
|
||||
{
|
||||
setObjectName( name );
|
||||
// Eliminate any possible background flicker
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
setAttribute(Qt::WA_NoSystemBackground, false);
|
||||
|
||||
deco = 0;
|
||||
deco = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -435,7 +444,7 @@ void QuartzButton::setBitmap(const unsigned char *bitmap)
|
|||
if (bitmap) {
|
||||
deco = new QBitmap(10, 10, bitmap, true);
|
||||
deco->setMask( *deco );
|
||||
repaint( false );
|
||||
repaint( );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -646,7 +655,7 @@ void QuartzClient::reset( unsigned long changed )
|
|||
if (changed & SettingColors || changed & SettingFont)
|
||||
{
|
||||
// repaint the whole thing
|
||||
widget()->repaint(false);
|
||||
widget()->repaint();
|
||||
}
|
||||
|
||||
KCommonDecoration::reset(changed);
|
||||
|
@ -662,7 +671,7 @@ void QuartzClient::paintEvent( QPaintEvent* )
|
|||
|
||||
const bool maxFull = (maximizeMode()==MaximizeFull) && !options()->moveResizeMaximizedWindows();
|
||||
|
||||
QColorGroup g;
|
||||
QPalette g;
|
||||
QPainter p(widget());
|
||||
|
||||
// Obtain widget bounds.
|
||||
|
@ -676,25 +685,26 @@ void QuartzClient::paintEvent( QPaintEvent* )
|
|||
|
||||
// Draw part of the frame that is the title color
|
||||
|
||||
if( coloredFrame )
|
||||
g = options()->palette(ColorTitleBar, isActive()).active();
|
||||
else
|
||||
g = options()->palette(ColorFrame, isActive()).active();
|
||||
if( coloredFrame )
|
||||
g = options()->palette(ColorTitleBar, isActive());
|
||||
else
|
||||
g = options()->palette(ColorFrame, isActive());
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
|
||||
// Draw outer highlights and lowlights
|
||||
p.setPen( g.light().light(120) );
|
||||
p.setPen( g.color(QPalette::Light).light(120) );
|
||||
p.drawLine( x, y, x2-1, y );
|
||||
p.drawLine( x, y+1, x, y2-1 );
|
||||
p.setPen( g.dark().light(120) );
|
||||
p.setPen( g.color(QPalette::Dark).light(120) );
|
||||
p.drawLine( x2, y, x2, y2 );
|
||||
p.drawLine( x, y2, x2, y2 );
|
||||
|
||||
// Fill out the border edges
|
||||
QColor frameColor;
|
||||
if ( coloredFrame)
|
||||
frameColor = g.background().light(130);
|
||||
frameColor = g.color(QPalette::Background).light(130);
|
||||
else
|
||||
frameColor = g.background();
|
||||
frameColor = g.color( QPalette::Background );
|
||||
if (borderSize > 2) {
|
||||
p.fillRect(x+1, y+1, w-2, borderSize-2, frameColor); // top
|
||||
if (!maxFull) {
|
||||
|
@ -705,7 +715,7 @@ void QuartzClient::paintEvent( QPaintEvent* )
|
|||
}
|
||||
|
||||
// Draw a frame around the wrapped widget.
|
||||
p.setPen( g.background() );
|
||||
p.setPen( g.color(QPalette::Background) );
|
||||
if (maxFull) {
|
||||
p.drawLine(x+1, y+titleHeight+(borderSize-1), w-2, y+titleHeight+(borderSize-1));
|
||||
} else {
|
||||
|
@ -716,9 +726,9 @@ void QuartzClient::paintEvent( QPaintEvent* )
|
|||
p.drawLine( x+borderSize, y2-borderSize, x2-borderSize, y2-borderSize);
|
||||
|
||||
// Highlight top corner
|
||||
p.setPen( g.light().light(160) );
|
||||
p.setPen( g.color(QPalette::Light).light(160) );
|
||||
p.drawPoint( x, y );
|
||||
p.setPen( g.light().light(140) );
|
||||
p.setPen( g.color(QPalette::Light).light(140) );
|
||||
p.drawPoint( x+1, y );
|
||||
p.drawPoint( x, y+1 );
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ static inline const KDecorationOptions *options()
|
|||
return KDecoration::options();
|
||||
}
|
||||
|
||||
static void drawButtonFrame( QPixmap *pix, const QColorGroup &g, bool sunken )
|
||||
static void drawButtonFrame( QPixmap *pix, const QPalette &g, bool sunken )
|
||||
{
|
||||
QPainter p;
|
||||
int x2 = pix->width() - 1;
|
||||
|
@ -112,22 +112,22 @@ static void drawButtonFrame( QPixmap *pix, const QColorGroup &g, bool sunken )
|
|||
p.begin(pix);
|
||||
|
||||
// titlebar button frame
|
||||
p.setPen( sunken ? g.dark().dark(155) : g.light());
|
||||
p.setPen( sunken ? g.color(QPalette::Dark).dark(155) : g.color(QPalette::Light));
|
||||
p.drawLine(0, 0, x2-1, 0);
|
||||
p.drawLine(0, 0, 0, y2-1);
|
||||
|
||||
if (sunken)
|
||||
{
|
||||
p.setPen( g.mid().dark(135) );
|
||||
p.setPen( g.color(QPalette::Mid).dark(135) );
|
||||
p.drawLine(1, 1, x2-2, 1);
|
||||
p.drawLine(1, 1, 1, y2-2);
|
||||
}
|
||||
|
||||
p.setPen( sunken ? g.light() : g.mid().dark(135));
|
||||
p.setPen( sunken ? g.color(QPalette::Light) : g.color(QPalette::Mid).dark(135));
|
||||
p.drawLine(1, y2-1, x2-1, y2-1);
|
||||
p.drawLine(x2-1, 1, x2-1, y2-1);
|
||||
|
||||
p.setPen( sunken ? g.light() : g.dark().dark(155));
|
||||
p.setPen( sunken ? g.color(QPalette::Light) : g.color(QPalette::Dark).dark(155));
|
||||
p.drawLine(0, y2, x2, y2);
|
||||
p.drawLine(x2, 0, x2, y2);
|
||||
}
|
||||
|
@ -176,7 +176,8 @@ static void create_pixmaps ()
|
|||
KPixmapEffect::gradient(*miniBtnDownPix1, c.dark(130), c.light(130),
|
||||
KPixmapEffect::VerticalGradient);
|
||||
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = g.background();
|
||||
KPixmapEffect::gradient(*iBtnPix1, c.light(130), c.dark(130),
|
||||
KPixmapEffect::VerticalGradient);
|
||||
|
@ -192,7 +193,8 @@ static void create_pixmaps ()
|
|||
miniBtnPix1->fill(c.rgb());
|
||||
miniBtnDownPix1->fill(c.rgb());
|
||||
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = g.background();
|
||||
iBtnPix1->fill(c.rgb());
|
||||
iBtnDownPix1->fill(c.rgb());
|
||||
|
@ -200,13 +202,15 @@ static void create_pixmaps ()
|
|||
iMiniBtnDownPix1->fill(c.rgb());
|
||||
}
|
||||
|
||||
g = options()->palette(KDecoration::ColorButtonBg, true).active();
|
||||
g = options()->palette(KDecoration::ColorButtonBg, true);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
drawButtonFrame(btnPix1, g, false);
|
||||
drawButtonFrame(btnDownPix1, g, true);
|
||||
drawButtonFrame(miniBtnPix1, g, false);
|
||||
drawButtonFrame(miniBtnDownPix1, g, true);
|
||||
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
drawButtonFrame(iBtnPix1, g, false);
|
||||
drawButtonFrame(iBtnDownPix1, g, true);
|
||||
drawButtonFrame(iMiniBtnPix1, g, false);
|
||||
|
@ -238,7 +242,7 @@ RedmondButton::RedmondButton(ButtonType type, RedmondDeco *parent, const char *n
|
|||
: KCommonDecorationButton(type, parent)
|
||||
{
|
||||
// Eliminate background flicker
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||
|
||||
miniBtn = decoration()->isToolWindow();
|
||||
}
|
||||
|
@ -493,7 +497,8 @@ void RedmondDeco::paintEvent( QPaintEvent* )
|
|||
|
||||
// Draw part of the frame that is the frame color
|
||||
// ==============================================
|
||||
QColorGroup g = options()->palette(KDecoration::ColorFrame, isActive()).active();
|
||||
QPalette g = options()->palette(KDecoration::ColorFrame, isActive());
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
p.setPen( g.background() );
|
||||
p.drawLine( x, y, x2-1, y );
|
||||
p.drawLine( x, y, x, y2-1 );
|
||||
|
@ -514,14 +519,14 @@ void RedmondDeco::paintEvent( QPaintEvent* )
|
|||
p.drawLine( x+i, y+i, x+i, y2-i-1);
|
||||
}
|
||||
|
||||
p.setPen(g.mid().dark(135));
|
||||
p.setPen(g.color(QPalette::Dark).dark(135));
|
||||
for (int i = 1; i <= borderWidth/3; i++) {
|
||||
p.drawLine( x2-i, y+i+1, x2-i, y2-i);
|
||||
p.drawLine( x+i+1, y2-i, x2-i, y2-i);
|
||||
}
|
||||
|
||||
// Draw black edges
|
||||
p.setPen( g.dark().dark(155) );
|
||||
p.setPen( g.color(QPalette::Dark).dark(155) );
|
||||
p.drawLine(x2, y, x2, y2);
|
||||
p.drawLine(x, y2, x2, y2);
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ WebClient::reset( unsigned long changed )
|
|||
if (changed & SettingColors)
|
||||
{
|
||||
// repaint the whole thing
|
||||
widget()->repaint(false);
|
||||
widget()->repaint();
|
||||
} else if (changed & SettingFont) {
|
||||
// font has changed -- update title height
|
||||
// title height
|
||||
|
@ -208,7 +208,7 @@ WebClient::reset( unsigned long changed )
|
|||
if (0 != titleHeight_ % 2)
|
||||
titleHeight_ += 1;
|
||||
|
||||
widget()->repaint(false);
|
||||
widget()->repaint();
|
||||
}
|
||||
|
||||
KCommonDecoration::reset(changed);
|
||||
|
@ -233,7 +233,9 @@ WebClient::paintEvent(QPaintEvent * pe)
|
|||
QPainter p(widget());
|
||||
|
||||
p.setPen(Qt::black);
|
||||
p.setBrush(options()->palette(ColorFrame, isActive()).active().background());
|
||||
QPalette pal = options()->palette(ColorFrame, isActive());
|
||||
pal.setCurrentColorGroup( QPalette::Active );
|
||||
p.setBrush( pal.background() );
|
||||
|
||||
p.setClipRegion(pe->region() - titleRect);
|
||||
|
||||
|
|
|
@ -153,17 +153,17 @@ WebButton::drawButton(QPainter *p)
|
|||
QPen highlightPen;
|
||||
|
||||
if (isDown() )
|
||||
highlightPen = QPen(QColorGroup( palette() ).light());
|
||||
highlightPen = QPen( palette().color( QPalette::Light ));
|
||||
|
||||
else
|
||||
{
|
||||
if (mouseOver_)
|
||||
highlightPen = QPen( QColorGroup( palette() ).highlight());
|
||||
highlightPen = QPen( palette().highlight());
|
||||
else
|
||||
highlightPen = QPen(Qt::NoPen);
|
||||
}
|
||||
|
||||
p->fillRect(rect(), QColorGroup( palette() ).background());
|
||||
p->fillRect(rect(), palette().color( QPalette::Background ) );
|
||||
|
||||
Position position_;
|
||||
if (0 == mapToParent(rect().topLeft() ).x() )
|
||||
|
|
|
@ -261,13 +261,13 @@ int ButtonDropSiteItem::height()
|
|||
return 20;
|
||||
}
|
||||
|
||||
void ButtonDropSiteItem::draw(QPainter *p, const QColorGroup& cg, QRect r)
|
||||
void ButtonDropSiteItem::draw(QPainter *p, const QPalette& cg, QRect r)
|
||||
{
|
||||
// p->fillRect(r, cg.base() );
|
||||
if (m_button.supported)
|
||||
p->setPen(cg.foreground() );
|
||||
p->setPen(cg.color(QPalette::Foreground) );
|
||||
else
|
||||
p->setPen(cg.mid() );
|
||||
p->setPen( cg.color(QPalette::Mid) );
|
||||
QBitmap &i = m_button.icon;
|
||||
p->drawPixmap(r.left()+(r.width()-i.width())/2, r.top()+(r.height()-i.height())/2, i);
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ void ButtonDropSite::drawButtonList(QPainter *p, const ButtonList& btns, int off
|
|||
for (ButtonList::const_iterator it = btns.begin(); it != btns.end(); ++it) {
|
||||
QRect itemRect = (*it)->rect;
|
||||
if (itemRect.isValid() ) {
|
||||
(*it)->draw(p, colorGroup(), itemRect);
|
||||
(*it)->draw(p, palette(), itemRect);
|
||||
}
|
||||
offset += (*it)->width();
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ ButtonSourceItem::~ButtonSourceItem()
|
|||
{
|
||||
}
|
||||
|
||||
void ButtonSourceItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align)
|
||||
void ButtonSourceItem::paintCell(QPainter *p, const QPalette &cg, int column, int width, int align)
|
||||
{
|
||||
// we need the color group cg, so to the work here, not in setButton...
|
||||
if (m_dirty) {
|
||||
|
@ -658,8 +658,8 @@ void ButtonSourceItem::paintCell(QPainter *p, const QColorGroup &cg, int column,
|
|||
Q3ListViewItem::paintCell(p,cg,column,width,align);
|
||||
} else {
|
||||
// grey out unsupported buttons
|
||||
QColorGroup cg2 = cg;
|
||||
cg2.setColor(QColorGroup::Text, cg.mid() );
|
||||
QPalette cg2 = cg;
|
||||
cg2.setColor(QPalette::Text, cg.mid() );
|
||||
Q3ListViewItem::paintCell(p,cg2,column,width,align);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ class ButtonDropSiteItem
|
|||
int width();
|
||||
int height();
|
||||
|
||||
void draw(QPainter *p, const QColorGroup& cg, QRect rect);
|
||||
void draw(QPainter *p, const QPalette& cg, QRect rect);
|
||||
|
||||
private:
|
||||
Button m_button;
|
||||
|
@ -106,7 +106,7 @@ class ButtonSourceItem : public Q3ListViewItem
|
|||
ButtonSourceItem(Q3ListView * parent, const Button& btn);
|
||||
virtual ~ButtonSourceItem();
|
||||
|
||||
void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align);
|
||||
void paintCell(QPainter *p, const QPalette &cg, int column, int width, int align);
|
||||
|
||||
void setButton(const Button& btn);
|
||||
Button button() const;
|
||||
|
|
Loading…
Reference in a new issue