Make kwin decorations API free of Qt3 support members
svn path=/trunk/KDE/kdebase/workspace/; revision=515804
This commit is contained in:
parent
b22c86f670
commit
fdb1b61473
21 changed files with 131 additions and 123 deletions
|
@ -429,7 +429,7 @@ void B2Client::init()
|
|||
|
||||
titleLayout->addSpacing(3);
|
||||
|
||||
QColor c = options()->colorGroup(KDecoration::ColorTitleBar, isActive()).
|
||||
QColor c = options()->palette(KDecoration::ColorTitleBar, isActive()).active().
|
||||
color(QColorGroup::Button);
|
||||
|
||||
for (int i = 0; i < BtnCount; i++) {
|
||||
|
@ -625,7 +625,7 @@ void B2Client::paintEvent(QPaintEvent* e)
|
|||
int bb = mustDrawHandle() ? 4 : 0;
|
||||
int bDepth = thickness + bb;
|
||||
|
||||
QColorGroup fillColor = options()->colorGroup(frameColorGroup, isActive());
|
||||
QColorGroup fillColor = options()->palette(frameColorGroup, isActive()).active();
|
||||
QBrush fillBrush(options()->color(frameColorGroup, isActive()));
|
||||
|
||||
// outer frame rect
|
||||
|
@ -847,8 +847,8 @@ void B2Client::activeChange()
|
|||
widget()->repaint(false);
|
||||
titlebar->repaint(false);
|
||||
|
||||
QColor c = options()->colorGroup(
|
||||
KDecoration::ColorTitleBar, isActive()).color(QColorGroup::Button);
|
||||
QColor c = options()->palette(
|
||||
KDecoration::ColorTitleBar, isActive()).active().color(QColorGroup::Button);
|
||||
|
||||
for (int i = 0; i < BtnCount; i++)
|
||||
if (button[i]) {
|
||||
|
@ -947,8 +947,8 @@ void B2Client::unobscureTitlebar()
|
|||
static void redraw_pixmaps()
|
||||
{
|
||||
int i;
|
||||
QColorGroup aGrp = options()->colorGroup(KDecoration::ColorButtonBg, true);
|
||||
QColorGroup iGrp = options()->colorGroup(KDecoration::ColorButtonBg, false);
|
||||
QColorGroup aGrp = options()->palette(KDecoration::ColorButtonBg, true).active();
|
||||
QColorGroup iGrp = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
|
||||
// close
|
||||
drawB2Rect(PIXMAP_A(P_CLOSE), aGrp.button(), false);
|
||||
|
@ -1349,7 +1349,7 @@ void B2Titlebar::drawTitlebar(QPainter &p, bool state)
|
|||
|
||||
// titlebar fill
|
||||
const QColorGroup cg =
|
||||
options()->colorGroup(KDecoration::ColorTitleBar, state);
|
||||
options()->palette(KDecoration::ColorTitleBar, state).active();
|
||||
QBrush brush(cg.background());
|
||||
if (gradient) brush.setPixmap(*gradient);
|
||||
qDrawShadeRect(&p, 1, 1, t.right() - 1, t.height() - 1,
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
|
||||
public:
|
||||
B2Client* client;
|
||||
Qt::ButtonState last_button;
|
||||
Qt::MouseButtons last_button;
|
||||
int realizeButtons;
|
||||
bool hover;
|
||||
};
|
||||
|
|
|
@ -329,7 +329,7 @@ void KDEDefaultHandler::createPixmaps()
|
|||
QPainter p;
|
||||
|
||||
// Active pins
|
||||
g = options()->colorGroup( ColorButtonBg, true );
|
||||
g = options()->palette( ColorButtonBg, true ).active();
|
||||
pinUpPix = new KPixmap();
|
||||
pinUpPix->resize(16, 16);
|
||||
p.begin( pinUpPix );
|
||||
|
@ -347,7 +347,7 @@ void KDEDefaultHandler::createPixmaps()
|
|||
pinDownPix->setMask( QBitmap(16, 16, pindown_mask_bits, true) );
|
||||
|
||||
// Inactive pins
|
||||
g = options()->colorGroup( ColorButtonBg, false );
|
||||
g = options()->palette( ColorButtonBg, false ).active();
|
||||
ipinUpPix = new KPixmap();
|
||||
ipinUpPix->resize(16, 16);
|
||||
p.begin( ipinUpPix );
|
||||
|
@ -405,25 +405,25 @@ void KDEDefaultHandler::createPixmaps()
|
|||
irightBtnDownPix[false]->resize(toolTitleHeight, toolTitleHeight);
|
||||
|
||||
// Draw the button state pixmaps
|
||||
g = options()->colorGroup( ColorTitleBar, true );
|
||||
g = options()->palette( ColorTitleBar, true ).active();
|
||||
drawButtonBackground( leftBtnUpPix[true], g, false );
|
||||
drawButtonBackground( leftBtnDownPix[true], g, true );
|
||||
drawButtonBackground( leftBtnUpPix[false], g, false );
|
||||
drawButtonBackground( leftBtnDownPix[false], g, true );
|
||||
|
||||
g = options()->colorGroup( ColorButtonBg, true );
|
||||
g = options()->palette( ColorButtonBg, true ).active();
|
||||
drawButtonBackground( rightBtnUpPix[true], g, false );
|
||||
drawButtonBackground( rightBtnDownPix[true], g, true );
|
||||
drawButtonBackground( rightBtnUpPix[false], g, false );
|
||||
drawButtonBackground( rightBtnDownPix[false], g, true );
|
||||
|
||||
g = options()->colorGroup( ColorTitleBar, false );
|
||||
g = options()->palette( ColorTitleBar, false ).active();
|
||||
drawButtonBackground( ileftBtnUpPix[true], g, false );
|
||||
drawButtonBackground( ileftBtnDownPix[true], g, true );
|
||||
drawButtonBackground( ileftBtnUpPix[false], g, false );
|
||||
drawButtonBackground( ileftBtnDownPix[false], g, true );
|
||||
|
||||
g = options()->colorGroup( ColorButtonBg, false );
|
||||
g = options()->palette( ColorButtonBg, false ).active();
|
||||
drawButtonBackground( irightBtnUpPix[true], g, false );
|
||||
drawButtonBackground( irightBtnDownPix[true], g, true );
|
||||
drawButtonBackground( irightBtnUpPix[false], g, false );
|
||||
|
@ -559,7 +559,7 @@ bool KDEDefaultHandler::supports( Ability ability )
|
|||
// ===========================================================================
|
||||
|
||||
KDEDefaultButton::KDEDefaultButton(ButtonType type, KDEDefaultClient *parent, const char *name)
|
||||
: KCommonDecorationButton(type, parent, name)
|
||||
: KCommonDecorationButton(type, parent)
|
||||
{
|
||||
setAttribute( Qt::WA_NoBackground );
|
||||
|
||||
|
@ -915,7 +915,7 @@ void KDEDefaultClient::paintEvent( QPaintEvent* )
|
|||
p.drawRect(x,y,w,h);
|
||||
|
||||
// Draw part of the frame that is the titlebar color
|
||||
g = options()->colorGroup(ColorTitleBar, isActive());
|
||||
g = options()->palette(ColorTitleBar, isActive()).active();
|
||||
p.setPen(g.light());
|
||||
p.drawLine(x+1, y+1, rightOffset-1, y+1);
|
||||
p.drawLine(x+1, y+1, x+1, leftFrameStart+borderWidth-4);
|
||||
|
@ -935,7 +935,7 @@ void KDEDefaultClient::paintEvent( QPaintEvent* )
|
|||
p.drawLine(x+borderWidth-2, y+titleHeight+3, x+borderWidth-2, leftFrameStart-2);
|
||||
|
||||
// Fill out the border edges
|
||||
g = options()->colorGroup(ColorFrame, isActive());
|
||||
g = options()->palette(ColorFrame, isActive()).active();
|
||||
p.setPen(g.light());
|
||||
p.drawLine(rightOffset, y+1, x2-1, y+1);
|
||||
p.drawLine(x+1, leftFrameStart+borderWidth-3, x+1, y2-1);
|
||||
|
|
|
@ -115,7 +115,7 @@ namespace Keramik {
|
|||
KeramikButton( KeramikClient *, const char *, Button, const QString &, const int realizeBtns = Qt::LeftButton );
|
||||
~KeramikButton();
|
||||
|
||||
Qt::ButtonState lastButton() const { return lastbutton; }
|
||||
Qt::MouseButtons lastButton() const { return lastbutton; }
|
||||
|
||||
private:
|
||||
void enterEvent( QEvent * );
|
||||
|
@ -128,7 +128,7 @@ namespace Keramik {
|
|||
KeramikClient *client;
|
||||
Button button;
|
||||
bool hover;
|
||||
Qt::ButtonState lastbutton;
|
||||
Qt::MouseButtons lastbutton;
|
||||
int realizeButtons;
|
||||
}; // class KeramikButton
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ void KWMThemeClient::drawTitle(QPainter &dest)
|
|||
p.begin(&buffer);
|
||||
|
||||
if(titleSunken){
|
||||
qDrawShadeRect(&p, r, options()->colorGroup(KDecorationOptions::ColorFrame, isActive()),
|
||||
qDrawShadeRect(&p, r, options()->palette(KDecorationOptions::ColorFrame, isActive()).active(),
|
||||
true, 1, 0);
|
||||
r.setRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2);
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ void KWMThemeClient::drawTitle(QPainter &dest)
|
|||
p.drawTiledPixmap(r, *fill);
|
||||
}
|
||||
else{
|
||||
p.fillRect(r, options()->colorGroup(KDecorationOptions::ColorTitleBar, isActive()).
|
||||
p.fillRect(r, options()->palette(KDecorationOptions::ColorTitleBar, isActive()).active().
|
||||
brush(QColorGroup::Button));
|
||||
}
|
||||
p.setFont(options()->font(isActive()));
|
||||
|
|
|
@ -160,7 +160,7 @@ static void create_pixmaps()
|
|||
KPixmapEffect::VerticalGradient);
|
||||
}
|
||||
// buttons (active/inactive, sunken/unsunken, 2 sizes each)
|
||||
QColorGroup g = options()->colorGroup(KDecoration::ColorButtonBg, true);
|
||||
QColorGroup g = options()->palette(KDecoration::ColorButtonBg, true).active();
|
||||
QColor c = g.background();
|
||||
btnPix1 = new KPixmap;
|
||||
btnPix1->resize(btnWidth1, titleHeight);
|
||||
|
@ -187,7 +187,7 @@ static void create_pixmaps()
|
|||
KPixmapEffect::DiagonalGradient);
|
||||
KPixmapEffect::gradient(*btnDownPix2, c.dark(130), c.light(120),
|
||||
KPixmapEffect::DiagonalGradient);
|
||||
g = options()->colorGroup(KDecoration::ColorButtonBg, false);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
c = g.background();
|
||||
KPixmapEffect::gradient(*iBtnPix1, c.light(120), c.dark(130),
|
||||
KPixmapEffect::DiagonalGradient);
|
||||
|
@ -203,20 +203,20 @@ static void create_pixmaps()
|
|||
btnDownPix1->fill(c.rgb());
|
||||
btnPix2->fill(c.rgb());
|
||||
btnDownPix2->fill(c.rgb());
|
||||
g = options()->colorGroup(KDecoration::ColorButtonBg, false);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
c = g.background();
|
||||
iBtnPix1->fill(c.rgb());
|
||||
iBtnDownPix1->fill(c.rgb());
|
||||
iBtnPix2->fill(c.rgb());
|
||||
iBtnDownPix2->fill(c.rgb());
|
||||
}
|
||||
g = options()->colorGroup(KDecoration::ColorButtonBg, true);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, true).active();
|
||||
c = g.background();
|
||||
drawButtonFrame(btnPix1, g, false);
|
||||
drawButtonFrame(btnDownPix1, g, true);
|
||||
drawButtonFrame(btnPix2, g, false);
|
||||
drawButtonFrame(btnDownPix2, g, true);
|
||||
g = options()->colorGroup(KDecoration::ColorButtonBg, false);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
c = g.background();
|
||||
drawButtonFrame(iBtnPix1, g, false);
|
||||
drawButtonFrame(iBtnDownPix1, g, true);
|
||||
|
@ -250,7 +250,7 @@ static void delete_pixmaps()
|
|||
// =====================================
|
||||
|
||||
LaptopButton::LaptopButton(ButtonType type, LaptopClient *parent, const char *name)
|
||||
: KCommonDecorationButton(type, parent, name)
|
||||
: KCommonDecorationButton(type, parent)
|
||||
{
|
||||
setBackgroundMode(Qt::NoBackground);
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ void LaptopButton::drawButton(QPainter *p)
|
|||
}
|
||||
}
|
||||
else{
|
||||
QColorGroup g = options()->colorGroup(KDecoration::ColorButtonBg, decoration()->isActive());
|
||||
QColorGroup g = options()->palette(KDecoration::ColorButtonBg, decoration()->isActive()).active();
|
||||
int w = width();
|
||||
int h = height();
|
||||
p->fillRect(1, 1, w-2, h-2, isDown() ? g.mid() : g.button());
|
||||
|
@ -478,7 +478,7 @@ void LaptopClient::captionChange()
|
|||
void LaptopClient::paintEvent( QPaintEvent* )
|
||||
{
|
||||
QPainter p(widget());
|
||||
QColorGroup g = options()->colorGroup(KDecoration::ColorFrame, isActive());
|
||||
QColorGroup g = options()->palette(KDecoration::ColorFrame, isActive()).active();
|
||||
|
||||
QRect r(widget()->rect());
|
||||
p.setPen(Qt::black);
|
||||
|
@ -555,7 +555,7 @@ void LaptopClient::paintEvent( QPaintEvent* )
|
|||
|
||||
p.setFont(options()->font(false, isToolWindow() ));
|
||||
QFontMetrics fm(options()->font(false));
|
||||
g = options()->colorGroup(KDecoration::ColorTitleBar, false);
|
||||
g = options()->palette(KDecoration::ColorTitleBar, false).active();
|
||||
if(iUpperGradient)
|
||||
p.drawTiledPixmap(r.x()+((r.width()-fm.width(caption()))/2)-4,
|
||||
r.y(), fm.width(caption())+8, r.height()-1,
|
||||
|
@ -573,7 +573,7 @@ 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()->colorGroup(KDecoration::ColorFrame, true);
|
||||
g = options()->palette(KDecoration::ColorFrame, true).active();
|
||||
p.setPen(g.background());
|
||||
p.drawPoint(r.x(), r.y());
|
||||
p.drawPoint(r.right(), r.y());
|
||||
|
@ -638,7 +638,7 @@ void LaptopClient::updateActiveBuffer( )
|
|||
|
||||
p.setFont(options()->font(true, isToolWindow() ));
|
||||
QFontMetrics fm(options()->font(true));
|
||||
QColorGroup g = options()->colorGroup(KDecoration::ColorTitleBar, true);
|
||||
QColorGroup g = options()->palette(KDecoration::ColorTitleBar, true).active();
|
||||
if(aUpperGradient)
|
||||
p.drawTiledPixmap(r.x()+((r.width()-fm.width(caption()))/2)-4,
|
||||
r.y(), fm.width(caption())+8, r.height()-1,
|
||||
|
@ -656,7 +656,7 @@ 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()->colorGroup(KDecoration::ColorFrame, true);
|
||||
g = options()->palette(KDecoration::ColorFrame, true).active();
|
||||
p.setPen(g.background());
|
||||
p.drawPoint(r.x(), r.y());
|
||||
p.drawPoint(r.right(), r.y());
|
||||
|
|
|
@ -174,13 +174,13 @@ static void create_pixmaps()
|
|||
KPixmapEffect::VerticalGradient);
|
||||
}
|
||||
// buttons
|
||||
QColorGroup btnColor(options()->colorGroup(KDecoration::ColorButtonBg, true));
|
||||
QColorGroup btnColor(options()->palette(KDecoration::ColorButtonBg, true).active());
|
||||
buttonPix = new QPixmap(14, 15);
|
||||
make_button_fx(btnColor, buttonPix);
|
||||
buttonPixDown = new QPixmap(14, 15);
|
||||
make_button_fx(btnColor, buttonPixDown, true);
|
||||
|
||||
btnColor = options()->colorGroup(KDecoration::ColorButtonBg, false);
|
||||
btnColor = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
iButtonPix = new QPixmap(14, 15);
|
||||
make_button_fx(btnColor, iButtonPix);
|
||||
iButtonPixDown = new QPixmap(14, 15);
|
||||
|
@ -288,7 +288,7 @@ QList< ModernSysFactory::BorderSize > ModernSysFactory::borderSizes() const
|
|||
}
|
||||
|
||||
ModernButton::ModernButton(ButtonType type, ModernSys *parent, const char *name)
|
||||
: KCommonDecorationButton(type, parent, name)
|
||||
: KCommonDecorationButton(type, parent)
|
||||
{
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
|
||||
|
@ -524,7 +524,7 @@ void ModernSys::recalcTitleBuffer()
|
|||
p.drawTiledPixmap(0, 0, width(), title_height+2, *aUpperGradient);
|
||||
else
|
||||
p.fillRect(0, 0, width(), title_height+2,
|
||||
options()->colorGroup(ColorTitleBar, true).
|
||||
options()->palette(ColorTitleBar, true).active().
|
||||
brush(QColorGroup::Button));
|
||||
|
||||
QRect t = titleRect(); // titlebar->geometry();
|
||||
|
@ -563,7 +563,7 @@ void ModernSys::updateCaption()
|
|||
void ModernSys::drawRoundFrame(QPainter &p, int x, int y, int w, int h)
|
||||
{
|
||||
kDrawRoundButton(&p, x, y, w, h,
|
||||
options()->colorGroup(ColorFrame, isActive()), false);
|
||||
options()->palette(ColorFrame, isActive()).active(), false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -581,7 +581,7 @@ void ModernSys::paintEvent( QPaintEvent* )
|
|||
|
||||
QBrush fillBrush(widget()->colorGroup().brush(QColorGroup::Background).pixmap() ?
|
||||
widget()->colorGroup().brush(QColorGroup::Background) :
|
||||
options()->colorGroup(ColorFrame, isActive()).
|
||||
options()->palette(ColorFrame, isActive()).active().
|
||||
brush(QColorGroup::Button));
|
||||
|
||||
p.fillRect(1, title_height+3, width()-2, height()-(title_height+3), fillBrush);
|
||||
|
@ -595,7 +595,7 @@ void ModernSys::paintEvent( QPaintEvent* )
|
|||
int h = height() - hw;
|
||||
|
||||
// titlebar
|
||||
QColorGroup g = options()->colorGroup(ColorTitleBar, isActive());
|
||||
QColorGroup g = options()->palette(ColorTitleBar, isActive()).active();
|
||||
if(isActive()){
|
||||
p.drawPixmap(1, 1, titleBuffer, 0, 0, w-2, title_height+2);
|
||||
}
|
||||
|
@ -618,7 +618,7 @@ void ModernSys::paintEvent( QPaintEvent* )
|
|||
p.drawLine(0, title_height+2, w-2, title_height+2);
|
||||
|
||||
// frame
|
||||
g = options()->colorGroup(ColorFrame, isActive());
|
||||
g = options()->palette(ColorFrame, isActive()).active();
|
||||
p.setPen(g.light());
|
||||
p.drawLine(1, title_height+3, 1, h-2);
|
||||
p.setPen(g.dark());
|
||||
|
|
|
@ -41,8 +41,8 @@ namespace KWinPlastik
|
|||
static const uint TIMERINTERVAL = 50; // msec
|
||||
static const uint ANIMATIONSTEPS = 4;
|
||||
|
||||
PlastikButton::PlastikButton(ButtonType type, PlastikClient *parent, const char *name)
|
||||
: KCommonDecorationButton(type, parent, name),
|
||||
PlastikButton::PlastikButton(ButtonType type, PlastikClient *parent)
|
||||
: KCommonDecorationButton(type, parent),
|
||||
m_client(parent),
|
||||
m_iconType(NumButtonIcons),
|
||||
hover(false)
|
||||
|
|
|
@ -38,7 +38,7 @@ class PlastikButton : public KCommonDecorationButton
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PlastikButton(ButtonType type, PlastikClient *parent, const char *name);
|
||||
PlastikButton(ButtonType type, PlastikClient *parent);
|
||||
~PlastikButton();
|
||||
|
||||
void reset(unsigned long changed);
|
||||
|
|
|
@ -157,31 +157,31 @@ KCommonDecorationButton *PlastikClient::createButton(ButtonType type)
|
|||
{
|
||||
switch (type) {
|
||||
case MenuButton:
|
||||
return new PlastikButton(MenuButton, this, "menu");
|
||||
return new PlastikButton(MenuButton, this);
|
||||
|
||||
case OnAllDesktopsButton:
|
||||
return new PlastikButton(OnAllDesktopsButton, this, "on_all_desktops");
|
||||
return new PlastikButton(OnAllDesktopsButton, this);
|
||||
|
||||
case HelpButton:
|
||||
return new PlastikButton(HelpButton, this, "help");
|
||||
return new PlastikButton(HelpButton, this);
|
||||
|
||||
case MinButton:
|
||||
return new PlastikButton(MinButton, this, "minimize");
|
||||
return new PlastikButton(MinButton, this);
|
||||
|
||||
case MaxButton:
|
||||
return new PlastikButton(MaxButton, this, "maximize");
|
||||
return new PlastikButton(MaxButton, this);
|
||||
|
||||
case CloseButton:
|
||||
return new PlastikButton(CloseButton, this, "close");
|
||||
return new PlastikButton(CloseButton, this);
|
||||
|
||||
case AboveButton:
|
||||
return new PlastikButton(AboveButton, this, "above");
|
||||
return new PlastikButton(AboveButton, this);
|
||||
|
||||
case BelowButton:
|
||||
return new PlastikButton(BelowButton, this, "below");
|
||||
return new PlastikButton(BelowButton, this);
|
||||
|
||||
case ShadeButton:
|
||||
return new PlastikButton(ShadeButton, this, "shade");
|
||||
return new PlastikButton(ShadeButton, this);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
|
|
|
@ -294,18 +294,18 @@ 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()->colorGroup(ColorTitleBlend, true);
|
||||
QColorGroup g2 = options()->palette(ColorTitleBlend, true).active();
|
||||
QColor c2 = g2.background();
|
||||
g2 = options()->colorGroup(ColorTitleBar, true );
|
||||
g2 = options()->palette(ColorTitleBar, true ).active();
|
||||
QColor c = g2.background().light(130);
|
||||
|
||||
titleBlocks = new KPixmap();
|
||||
titleBlocks->resize( normalTitleHeight*25/18, normalTitleHeight );
|
||||
drawBlocks( titleBlocks, *titleBlocks, c, c2 );
|
||||
|
||||
g2 = options()->colorGroup(ColorTitleBlend, false);
|
||||
g2 = options()->palette(ColorTitleBlend, false).active();
|
||||
c2 = g2.background();
|
||||
g2 = options()->colorGroup(ColorTitleBar, false );
|
||||
g2 = options()->palette(ColorTitleBar, false ).active();
|
||||
c = g2.background().light(130);
|
||||
|
||||
ititleBlocks = new KPixmap();
|
||||
|
@ -316,9 +316,9 @@ void QuartzHandler::createPixmaps()
|
|||
QColorGroup g;
|
||||
QPainter p;
|
||||
|
||||
g = options()->colorGroup( onAllDesktopsButtonOnLeft ? ColorTitleBar : ColorTitleBlend, true );
|
||||
g = options()->palette( onAllDesktopsButtonOnLeft ? ColorTitleBar : ColorTitleBlend, true ).active();
|
||||
c = onAllDesktopsButtonOnLeft ? g.background().light(130) : g.background();
|
||||
g2 = options()->colorGroup( ColorButtonBg, true );
|
||||
g2 = options()->palette( ColorButtonBg, true ).active();
|
||||
|
||||
pinUpPix = new KPixmap();
|
||||
pinUpPix->resize(16, 16);
|
||||
|
@ -338,9 +338,9 @@ void QuartzHandler::createPixmaps()
|
|||
|
||||
|
||||
// Inactive pins
|
||||
g = options()->colorGroup( onAllDesktopsButtonOnLeft ? ColorTitleBar : ColorTitleBlend, false );
|
||||
g = options()->palette( onAllDesktopsButtonOnLeft ? ColorTitleBar : ColorTitleBlend, false ).active();
|
||||
c = onAllDesktopsButtonOnLeft ? g.background().light(130) : g.background();
|
||||
g2 = options()->colorGroup( ColorButtonBg, false );
|
||||
g2 = options()->palette( ColorButtonBg, false ).active();
|
||||
|
||||
ipinUpPix = new KPixmap();
|
||||
ipinUpPix->resize(16, 16);
|
||||
|
@ -381,7 +381,7 @@ QList< QuartzHandler::BorderSize > QuartzHandler::borderSizes() const
|
|||
|
||||
|
||||
QuartzButton::QuartzButton(ButtonType type, QuartzClient *parent, const char *name)
|
||||
: KCommonDecorationButton(type, parent, name)
|
||||
: KCommonDecorationButton(type, parent)
|
||||
{
|
||||
// Eliminate any possible background flicker
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
|
@ -684,9 +684,9 @@ void QuartzClient::paintEvent( QPaintEvent* )
|
|||
// Draw part of the frame that is the title color
|
||||
|
||||
if( coloredFrame )
|
||||
g = options()->colorGroup(ColorTitleBar, isActive());
|
||||
g = options()->palette(ColorTitleBar, isActive()).active();
|
||||
else
|
||||
g = options()->colorGroup(ColorFrame, isActive());
|
||||
g = options()->palette(ColorFrame, isActive()).active();
|
||||
|
||||
// Draw outer highlights and lowlights
|
||||
p.setPen( g.light().light(120) );
|
||||
|
|
|
@ -152,7 +152,7 @@ static void create_pixmaps ()
|
|||
defaultMenuPix = new QPixmap(kdelogo);
|
||||
|
||||
// buttons (active/inactive, sunken/unsunken)
|
||||
QColorGroup g = options()->colorGroup(KDecoration::ColorButtonBg, true);
|
||||
QColorGroup g = options()->palette(KDecoration::ColorButtonBg, true).active();
|
||||
QColor c = g.background();
|
||||
btnPix1->resize(normalTitleHeight, normalTitleHeight-2);
|
||||
btnDownPix1->resize(normalTitleHeight, normalTitleHeight-2);
|
||||
|
@ -175,7 +175,7 @@ static void create_pixmaps ()
|
|||
KPixmapEffect::gradient(*miniBtnDownPix1, c.dark(130), c.light(130),
|
||||
KPixmapEffect::VerticalGradient);
|
||||
|
||||
g = options()->colorGroup(KDecoration::ColorButtonBg, false);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
c = g.background();
|
||||
KPixmapEffect::gradient(*iBtnPix1, c.light(130), c.dark(130),
|
||||
KPixmapEffect::VerticalGradient);
|
||||
|
@ -191,7 +191,7 @@ static void create_pixmaps ()
|
|||
miniBtnPix1->fill(c.rgb());
|
||||
miniBtnDownPix1->fill(c.rgb());
|
||||
|
||||
g = options()->colorGroup(KDecoration::ColorButtonBg, false);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
c = g.background();
|
||||
iBtnPix1->fill(c.rgb());
|
||||
iBtnDownPix1->fill(c.rgb());
|
||||
|
@ -199,13 +199,13 @@ static void create_pixmaps ()
|
|||
iMiniBtnDownPix1->fill(c.rgb());
|
||||
}
|
||||
|
||||
g = options()->colorGroup(KDecoration::ColorButtonBg, true);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, true).active();
|
||||
drawButtonFrame(btnPix1, g, false);
|
||||
drawButtonFrame(btnDownPix1, g, true);
|
||||
drawButtonFrame(miniBtnPix1, g, false);
|
||||
drawButtonFrame(miniBtnDownPix1, g, true);
|
||||
|
||||
g = options()->colorGroup(KDecoration::ColorButtonBg, false);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false).active();
|
||||
drawButtonFrame(iBtnPix1, g, false);
|
||||
drawButtonFrame(iBtnDownPix1, g, true);
|
||||
drawButtonFrame(iMiniBtnPix1, g, false);
|
||||
|
@ -234,7 +234,7 @@ void delete_pixmaps()
|
|||
}
|
||||
|
||||
RedmondButton::RedmondButton(ButtonType type, RedmondDeco *parent, const char *name)
|
||||
: KCommonDecorationButton(type, parent, name)
|
||||
: KCommonDecorationButton(type, parent)
|
||||
{
|
||||
// Eliminate background flicker
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
|
@ -493,7 +493,7 @@ void RedmondDeco::paintEvent( QPaintEvent* )
|
|||
|
||||
// Draw part of the frame that is the frame color
|
||||
// ==============================================
|
||||
QColorGroup g = options()->colorGroup(KDecoration::ColorFrame, isActive());
|
||||
QColorGroup g = options()->palette(KDecoration::ColorFrame, isActive()).active();
|
||||
p.setPen( g.background() );
|
||||
p.drawLine( x, y, x2-1, y );
|
||||
p.drawLine( x, y, x, y2-1 );
|
||||
|
|
|
@ -122,31 +122,31 @@ KCommonDecorationButton *WebClient::createButton(ButtonType type)
|
|||
{
|
||||
switch (type) {
|
||||
case MenuButton:
|
||||
return new WebButton(MenuButton, this, "menu", shape_);
|
||||
return new WebButton(MenuButton, this, shape_);
|
||||
|
||||
case OnAllDesktopsButton:
|
||||
return new WebButton(OnAllDesktopsButton, this, "on_all_desktops", shape_);
|
||||
return new WebButton(OnAllDesktopsButton, this, shape_);
|
||||
|
||||
case HelpButton:
|
||||
return new WebButton(HelpButton, this, "help", shape_);
|
||||
return new WebButton(HelpButton, this, shape_);
|
||||
|
||||
case MinButton:
|
||||
return new WebButton(MinButton, this, "minimize", shape_);
|
||||
return new WebButton(MinButton, this, shape_);
|
||||
|
||||
case MaxButton:
|
||||
return new WebButton(MaxButton, this, "maximize", shape_);
|
||||
return new WebButton(MaxButton, this, shape_);
|
||||
|
||||
case CloseButton:
|
||||
return new WebButton(CloseButton, this, "close", shape_);
|
||||
return new WebButton(CloseButton, this, shape_);
|
||||
|
||||
case AboveButton:
|
||||
return new WebButton(AboveButton, this, "above", shape_);
|
||||
return new WebButton(AboveButton, this, shape_);
|
||||
|
||||
case BelowButton:
|
||||
return new WebButton(BelowButton, this, "below", shape_);
|
||||
return new WebButton(BelowButton, this, shape_);
|
||||
|
||||
case ShadeButton:
|
||||
return new WebButton(ShadeButton, this, "shade", shape_);
|
||||
return new WebButton(ShadeButton, this, shape_);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
|
@ -233,7 +233,7 @@ WebClient::paintEvent(QPaintEvent * pe)
|
|||
QPainter p(widget());
|
||||
|
||||
p.setPen(Qt::black);
|
||||
p.setBrush(options()->colorGroup(ColorFrame, isActive()).background());
|
||||
p.setBrush(options()->palette(ColorFrame, isActive()).active().background());
|
||||
|
||||
p.setClipRegion(pe->region() - titleRect);
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@ namespace Web {
|
|||
0xff, 0x81, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff
|
||||
};
|
||||
|
||||
WebButton::WebButton(ButtonType type, WebClient *parent, const char *name, bool shape)
|
||||
: KCommonDecorationButton (type, parent, name),
|
||||
WebButton::WebButton(ButtonType type, WebClient *parent, bool shape)
|
||||
: KCommonDecorationButton (type, parent),
|
||||
mouseOver_ (false),
|
||||
shape_ (shape),
|
||||
deco_ (parent)
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Web
|
|||
Left, Mid, Right
|
||||
};
|
||||
|
||||
WebButton(ButtonType type, WebClient *parent, const char *name, bool shape);
|
||||
WebButton(ButtonType type, WebClient *parent, bool shape);
|
||||
|
||||
virtual ~WebButton();
|
||||
|
||||
|
|
|
@ -872,8 +872,8 @@ QRect KCommonDecoration::titleRect() const
|
|||
}
|
||||
|
||||
|
||||
KCommonDecorationButton::KCommonDecorationButton(ButtonType type, KCommonDecoration *parent, const char *name)
|
||||
: QAbstractButton(parent->widget(), name),
|
||||
KCommonDecorationButton::KCommonDecorationButton(ButtonType type, KCommonDecoration *parent)
|
||||
: QAbstractButton(parent->widget() ),
|
||||
m_decoration(parent),
|
||||
m_type(type),
|
||||
m_realizeButtons(Qt::LeftButton),
|
||||
|
@ -933,14 +933,14 @@ void KCommonDecorationButton::setTipText(const QString &tip) {
|
|||
|
||||
void KCommonDecorationButton::setToggleButton(bool toggle)
|
||||
{
|
||||
QAbstractButton::setToggleButton(toggle);
|
||||
QAbstractButton::setCheckable(toggle);
|
||||
reset(ToggleChange);
|
||||
}
|
||||
|
||||
void KCommonDecorationButton::setOn(bool on)
|
||||
{
|
||||
if (on != isChecked() ) {
|
||||
QAbstractButton::setOn(on);
|
||||
QAbstractButton::setChecked(on);
|
||||
reset(StateChange);
|
||||
}
|
||||
}
|
||||
|
@ -949,8 +949,7 @@ void KCommonDecorationButton::mousePressEvent(QMouseEvent* e)
|
|||
{
|
||||
m_lastMouse = e->button();
|
||||
// pass on event after changing button to LeftButton
|
||||
QMouseEvent me(e->type(), e->pos(), e->globalPos(),
|
||||
(e->button()&m_realizeButtons)?Qt::LeftButton : Qt::NoButton, e->state());
|
||||
QMouseEvent me(e->type(), e->pos(), (e->button()&m_realizeButtons)?Qt::LeftButton : Qt::NoButton, e->buttons(), e->modifiers() );
|
||||
|
||||
QAbstractButton::mousePressEvent(&me);
|
||||
}
|
||||
|
@ -959,8 +958,10 @@ void KCommonDecorationButton::mouseReleaseEvent(QMouseEvent* e)
|
|||
{
|
||||
m_lastMouse = e->button();
|
||||
// pass on event after changing button to LeftButton
|
||||
QMouseEvent me(e->type(), e->pos(), e->globalPos(),
|
||||
(e->button()&m_realizeButtons)?Qt::LeftButton : Qt::NoButton, e->state());
|
||||
QMouseEvent me(e->type(), e->pos(), (e->button()&m_realizeButtons)?Qt::LeftButton : Qt::NoButton, e->buttons(), e->modifiers() );
|
||||
|
||||
QAbstractButton::mouseReleaseEvent(&me);
|
||||
}
|
||||
|
||||
// kate: space-indent on; indent-width 4; mixedindent off; indent-mode cstyle;
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ class KWIN_EXPORT KCommonDecorationButton : public QAbstractButton
|
|||
friend class KCommonDecoration;
|
||||
|
||||
public:
|
||||
KCommonDecorationButton(ButtonType type, KCommonDecoration *parent, const char *name);
|
||||
KCommonDecorationButton(ButtonType type, KCommonDecoration *parent);
|
||||
virtual ~KCommonDecorationButton();
|
||||
|
||||
/**
|
||||
|
@ -339,7 +339,7 @@ class KWIN_EXPORT KCommonDecorationButton : public QAbstractButton
|
|||
/**
|
||||
* The mouse button that has been clicked last time.
|
||||
*/
|
||||
Qt::ButtonState lastMousePress() const { return m_lastMouse; }
|
||||
Qt::MouseButtons lastMousePress() const { return m_lastMouse; }
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
|
@ -355,7 +355,7 @@ class KWIN_EXPORT KCommonDecorationButton : public QAbstractButton
|
|||
ButtonType m_type;
|
||||
int m_realizeButtons;
|
||||
QSize m_size;
|
||||
Qt::ButtonState m_lastMouse;
|
||||
Qt::MouseButtons m_lastMouse;
|
||||
|
||||
bool m_isLeft;
|
||||
|
||||
|
@ -363,3 +363,5 @@ class KWIN_EXPORT KCommonDecorationButton : public QAbstractButton
|
|||
};
|
||||
|
||||
#endif // KCOMMONDECORATION_H
|
||||
|
||||
// kate: space-indent on; indent-width 4; mixedindent off; indent-mode cstyle;
|
||||
|
|
|
@ -60,7 +60,9 @@ const KDecorationOptions* KDecoration::options()
|
|||
void KDecoration::createMainWidget( Qt::WFlags flags )
|
||||
{
|
||||
// FRAME check flags?
|
||||
setMainWidget( new QWidget( initialParentWidget(), "decoration widget", initialWFlags() | flags ));
|
||||
QWidget *w = new QWidget( initialParentWidget(), initialWFlags() | flags );
|
||||
w->setObjectName("decoration widget");
|
||||
setMainWidget(w);
|
||||
}
|
||||
|
||||
void KDecoration::setMainWidget( QWidget* w )
|
||||
|
@ -236,7 +238,7 @@ void KDecoration::closeWindow()
|
|||
bridge_->closeWindow();
|
||||
}
|
||||
|
||||
void KDecoration::maximize( Qt::ButtonState button )
|
||||
void KDecoration::maximize( Qt::MouseButtons button )
|
||||
{
|
||||
performWindowOperation( options()->operationMaxButtonClick( button ));
|
||||
}
|
||||
|
@ -388,16 +390,19 @@ const QFont& KDecorationOptions::font(bool active, bool small) const
|
|||
return(active ? d->activeFont : d->inactiveFont);
|
||||
}
|
||||
|
||||
const QColorGroup& KDecorationOptions::colorGroup(ColorType type, bool active) const
|
||||
const QPalette& KDecorationOptions::palette(ColorType type, bool active) const
|
||||
{
|
||||
int idx = type + (active ? 0 : NUM_COLORS);
|
||||
if(d->cg[idx])
|
||||
return(*d->cg[idx]);
|
||||
d->cg[idx] = new QColorGroup(Qt::black, d->colors[idx], d->colors[idx].light(150),
|
||||
d->colors[idx].dark(), d->colors[idx].dark(120),
|
||||
Qt::black, QApplication::palette().active().
|
||||
base());
|
||||
return(*d->cg[idx]);
|
||||
if(d->pal[idx])
|
||||
return(*d->pal[idx]);
|
||||
#warning KDE4 : why construct the palette this way?
|
||||
// TODO: Is this worth 'porting' to Qt4?
|
||||
// d->pal[idx] = new QPalette(Qt::black, d->colors[idx], d->colors[idx].light(150),
|
||||
// d->colors[idx].dark(), d->colors[idx].dark(120),
|
||||
// Qt::black, QApplication::palette().active().
|
||||
// base());
|
||||
d->pal[idx] = new QPalette(d->colors[idx]);
|
||||
return(*d->pal[idx]);
|
||||
}
|
||||
|
||||
bool KDecorationOptions::customButtonPositions() const
|
||||
|
@ -434,7 +439,7 @@ bool KDecorationOptions::moveResizeMaximizedWindows() const
|
|||
return d->move_resize_maximized_windows;
|
||||
}
|
||||
|
||||
KDecorationDefines::WindowOperation KDecorationOptions::operationMaxButtonClick( Qt::ButtonState button ) const
|
||||
KDecorationDefines::WindowOperation KDecorationOptions::operationMaxButtonClick( Qt::MouseButtons button ) const
|
||||
{
|
||||
return button == Qt::RightButton? d->OpMaxButtonRightClick :
|
||||
button == Qt::MidButton? d->OpMaxButtonMiddleClick :
|
||||
|
|
|
@ -198,13 +198,13 @@ public:
|
|||
*/
|
||||
const QColor& color(ColorType type, bool active=true) const;
|
||||
/**
|
||||
* Returns a colorgroup using the given decoration color as the background.
|
||||
* Returns a palette using the given decoration color as the background.
|
||||
* The changed flags for this setting is SettingColors.
|
||||
*
|
||||
* @param type The requested color type.
|
||||
* @param active Whether to return the color for active or inactive windows.
|
||||
*/
|
||||
const QColorGroup& colorGroup(ColorType type, bool active=true) const;
|
||||
const QPalette& palette(ColorType type, bool active=true) const;
|
||||
/**
|
||||
* Returns the active or inactive decoration font.
|
||||
* The changed flags for this setting is SettingFont.
|
||||
|
@ -285,7 +285,7 @@ public:
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
WindowOperation operationMaxButtonClick( Qt::ButtonState button ) const;
|
||||
WindowOperation operationMaxButtonClick( Qt::MouseButtons button ) const;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
@ -745,7 +745,7 @@ class KWIN_EXPORT KDecoration
|
|||
* NOTE: This function is new in KDE3.3. In order to support also KDE3.2,
|
||||
* it is recommended to use code like this:
|
||||
* \code
|
||||
* ButtonState button = ... ;
|
||||
* MouseButtons button = ... ;
|
||||
* #if KDE_IS_VERSION( 3, 3, 0 )
|
||||
* maximize( button );
|
||||
* #else
|
||||
|
@ -759,7 +759,7 @@ class KWIN_EXPORT KDecoration
|
|||
* \endcode
|
||||
*/
|
||||
#warning Update the docs.
|
||||
void maximize( Qt::ButtonState button );
|
||||
void maximize( Qt::MouseButtons button );
|
||||
/**
|
||||
* Set the maximize mode of the decorated window.
|
||||
* @param mode The maximization mode to be set.
|
||||
|
|
|
@ -33,7 +33,7 @@ DEALINGS IN THE SOFTWARE.
|
|||
KDecorationOptionsPrivate::KDecorationOptionsPrivate()
|
||||
{
|
||||
for(int i=0; i < NUM_COLORS*2; ++i)
|
||||
cg[i] = NULL;
|
||||
pal[i] = NULL;
|
||||
}
|
||||
|
||||
KDecorationOptionsPrivate::~KDecorationOptionsPrivate()
|
||||
|
@ -41,10 +41,10 @@ KDecorationOptionsPrivate::~KDecorationOptionsPrivate()
|
|||
int i;
|
||||
for(i=0; i < NUM_COLORS*2; ++i)
|
||||
{
|
||||
if(cg[i])
|
||||
if(pal[i])
|
||||
{
|
||||
delete cg[i];
|
||||
cg[i] = NULL;
|
||||
delete pal[i];
|
||||
pal[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,9 +76,9 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
|
|||
++i )
|
||||
old_colors[ i ] = colors[ i ];
|
||||
|
||||
QPalette pal = QApplication::palette();
|
||||
QPalette appPal = QApplication::palette();
|
||||
// normal colors
|
||||
colors[ColorFrame] = pal.active().background();
|
||||
colors[ColorFrame] = appPal.active().background();
|
||||
colors[ColorFrame] = config->readEntry("frame", colors[ColorFrame]);
|
||||
colors[ColorHandle] = colors[ColorFrame];
|
||||
colors[ColorHandle] = config->readEntry("handle", colors[ColorHandle]);
|
||||
|
@ -90,7 +90,7 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
|
|||
colors[ColorButtonBg] = colors[ColorFrame];
|
||||
colors[ColorButtonBg] = config->readEntry("activeTitleBtnBg",
|
||||
colors[ColorFrame]);
|
||||
colors[ColorTitleBar] = pal.active().highlight();
|
||||
colors[ColorTitleBar] = appPal.active().highlight();
|
||||
colors[ColorTitleBar] = config->readEntry("activeBackground",
|
||||
colors[ColorTitleBar]);
|
||||
if(QPixmap::defaultDepth() > 8)
|
||||
|
@ -100,7 +100,7 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
|
|||
colors[ColorTitleBlend] = config->readEntry("activeBlend",
|
||||
colors[ColorTitleBlend]);
|
||||
|
||||
colors[ColorFont] = pal.active().highlightedText();
|
||||
colors[ColorFont] = appPal.active().highlightedText();
|
||||
colors[ColorFont] = config->readEntry("activeForeground", colors[ColorFont]);
|
||||
|
||||
// inactive
|
||||
|
@ -214,10 +214,10 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
|
|||
int i;
|
||||
for(i=0; i < NUM_COLORS*2; ++i)
|
||||
{
|
||||
if(cg[i])
|
||||
if(pal[i])
|
||||
{
|
||||
delete cg[i];
|
||||
cg[i] = NULL;
|
||||
delete pal[i];
|
||||
pal[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class KWIN_EXPORT KDecorationOptionsPrivate : public KDecorationDefines
|
|||
BorderSize findPreferredBorderSize( BorderSize size, QList< BorderSize > ) const; // shared implementation
|
||||
|
||||
QColor colors[NUM_COLORS*2];
|
||||
QColorGroup *cg[NUM_COLORS*2];
|
||||
QPalette *pal[NUM_COLORS*2];
|
||||
QFont activeFont, inactiveFont, activeFontSmall, inactiveFontSmall;
|
||||
QString title_buttons_left;
|
||||
QString title_buttons_right;
|
||||
|
|
Loading…
Reference in a new issue