- Indentation cleanup
- Use largest size for VeryHuge and Oversize cases svn path=/trunk/KDE/kdebase/workspace/; revision=602387
This commit is contained in:
parent
cd5d04d060
commit
33fca586c5
1 changed files with 42 additions and 42 deletions
|
@ -9,7 +9,7 @@
|
||||||
* Thin frame in fixed size windows, titlebar gradient support, accessibility
|
* Thin frame in fixed size windows, titlebar gradient support, accessibility
|
||||||
* improvements, customizable menu double click action and button hover
|
* improvements, customizable menu double click action and button hover
|
||||||
* effects are
|
* effects are
|
||||||
* Copyright (c) 2003,2004 Luciano Montanaro <mikelima@cirulla.net>
|
* Copyright (c) 2003, 2004, 2006 Luciano Montanaro <mikelima@cirulla.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "b2client.h"
|
#include "b2client.h"
|
||||||
|
@ -144,10 +144,10 @@ static void read_config(B2ClientFactory *f)
|
||||||
thickness = 8;
|
thickness = 8;
|
||||||
break;
|
break;
|
||||||
case KDecoration::BorderHuge:
|
case KDecoration::BorderHuge:
|
||||||
thickness = 12;
|
|
||||||
break;
|
|
||||||
case KDecoration::BorderVeryHuge:
|
case KDecoration::BorderVeryHuge:
|
||||||
case KDecoration::BorderOversized:
|
case KDecoration::BorderOversized:
|
||||||
|
thickness = 12;
|
||||||
|
break;
|
||||||
case KDecoration::BorderNormal:
|
case KDecoration::BorderNormal:
|
||||||
default:
|
default:
|
||||||
thickness = 4;
|
thickness = 4;
|
||||||
|
@ -218,18 +218,18 @@ static void create_pixmaps()
|
||||||
|
|
||||||
// there seems to be no way to load X bitmaps from data properly, so
|
// there seems to be no way to load X bitmaps from data properly, so
|
||||||
// we need to create new ones for each mask :P
|
// we need to create new ones for each mask :P
|
||||||
QBitmap pinupMask = QBitmap::fromData(QSize( 16, 16 ), pinup_mask_bits);
|
QBitmap pinupMask = QBitmap::fromData(QSize(16, 16), pinup_mask_bits);
|
||||||
PIXMAP_A(P_PINUP)->setMask(pinupMask);
|
PIXMAP_A(P_PINUP)->setMask(pinupMask);
|
||||||
PIXMAP_I(P_PINUP)->setMask(pinupMask);
|
PIXMAP_I(P_PINUP)->setMask(pinupMask);
|
||||||
QBitmap pindownMask = QBitmap::fromData(QSize( 16, 16 ), pindown_mask_bits);
|
QBitmap pindownMask = QBitmap::fromData(QSize(16, 16), pindown_mask_bits);
|
||||||
PIXMAP_AD(P_PINUP)->setMask(pindownMask);
|
PIXMAP_AD(P_PINUP)->setMask(pindownMask);
|
||||||
PIXMAP_ID(P_PINUP)->setMask(pindownMask);
|
PIXMAP_ID(P_PINUP)->setMask(pindownMask);
|
||||||
|
|
||||||
QBitmap menuMask = QBitmap::fromData(QSize( 16, 16 ), menu_mask_bits);
|
QBitmap menuMask = QBitmap::fromData(QSize(16, 16), menu_mask_bits);
|
||||||
for (i = 0; i < NumStates; i++)
|
for (i = 0; i < NumStates; i++)
|
||||||
pixmap[P_MENU * NumStates + i]->setMask(menuMask);
|
pixmap[P_MENU * NumStates + i]->setMask(menuMask);
|
||||||
|
|
||||||
QBitmap helpMask = QBitmap::fromData(QSize( 16, 16 ), help_mask_bits);
|
QBitmap helpMask = QBitmap::fromData(QSize(16, 16), help_mask_bits);
|
||||||
for (i = 0; i < NumStates; i++)
|
for (i = 0; i < NumStates; i++)
|
||||||
pixmap[P_HELP * NumStates + i]->setMask(helpMask);
|
pixmap[P_HELP * NumStates + i]->setMask(helpMask);
|
||||||
|
|
||||||
|
@ -309,10 +309,9 @@ bool B2ClientFactory::reset(unsigned long changed)
|
||||||
return needsReset;
|
return needsReset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool B2ClientFactory::supports( Ability ability )
|
bool B2ClientFactory::supports(Ability ability)
|
||||||
{
|
{
|
||||||
switch( ability )
|
switch (ability) {
|
||||||
{
|
|
||||||
case AbilityAnnounceButtons:
|
case AbilityAnnounceButtons:
|
||||||
case AbilityButtonMenu:
|
case AbilityButtonMenu:
|
||||||
case AbilityButtonOnAllDesktops:
|
case AbilityButtonOnAllDesktops:
|
||||||
|
@ -416,7 +415,7 @@ void B2Client::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// titlebar
|
// titlebar
|
||||||
g->addItem( new QSpacerItem( 0, buttonSize + 4 ), 0, 0 );
|
g->addItem( new QSpacerItem(0, buttonSize + 4), 0, 0 );
|
||||||
|
|
||||||
titlebar = new B2Titlebar(this);
|
titlebar = new B2Titlebar(this);
|
||||||
titlebar->setMinimumWidth(buttonSize + 4);
|
titlebar->setMinimumWidth(buttonSize + 4);
|
||||||
|
@ -650,7 +649,7 @@ void B2Client::paintEvent(QPaintEvent* e)
|
||||||
qDrawShadePanel(&p, 1, t.bottom() - thickness + 2,
|
qDrawShadePanel(&p, 1, t.bottom() - thickness + 2,
|
||||||
width() - 2, fHeight - 2 - bb + thickness, fillColor, false);
|
width() - 2, fHeight - 2 - bb + thickness, fillColor, false);
|
||||||
if (thickness == 4) {
|
if (thickness == 4) {
|
||||||
p.setPen(fillColor.color( QPalette::Background ) );
|
p.setPen(fillColor.color(QPalette::Background));
|
||||||
p.drawRect(thickness - 2, t.bottom() - 1,
|
p.drawRect(thickness - 2, t.bottom() - 1,
|
||||||
width() - 2 * (thickness - 2), fHeight + 4 - bDepth);
|
width() - 2 * (thickness - 2), fHeight + 4 - bDepth);
|
||||||
} else if (thickness > 4) {
|
} else if (thickness > 4) {
|
||||||
|
@ -686,12 +685,12 @@ void B2Client::paintEvent(QPaintEvent* e)
|
||||||
p.fillRect(hx + 1, height() - thickness - 3,
|
p.fillRect(hx + 1, height() - thickness - 3,
|
||||||
hw - 2, thickness + 2, fillBrush);
|
hw - 2, thickness + 2, fillBrush);
|
||||||
|
|
||||||
p.setPen(fillColor.color( QPalette::Dark ));
|
p.setPen(fillColor.color(QPalette::Dark));
|
||||||
p.drawLine(width() - 2, height() - thickness - 4,
|
p.drawLine(width() - 2, height() - thickness - 4,
|
||||||
width() - 2, height() - 2);
|
width() - 2, height() - 2);
|
||||||
p.drawLine(hx + 1, height() - 2, width() - 2, height() - 2);
|
p.drawLine(hx + 1, height() - 2, width() - 2, height() - 2);
|
||||||
|
|
||||||
p.setPen(fillColor.color( QPalette::Light ));
|
p.setPen(fillColor.color(QPalette::Light));
|
||||||
p.drawLine(hx + 1, height() - thickness - 2,
|
p.drawLine(hx + 1, height() - thickness - 2,
|
||||||
hx + 1, height() - 3);
|
hx + 1, height() - 3);
|
||||||
p.drawLine(hx + 1, height() - thickness - 3,
|
p.drawLine(hx + 1, height() - thickness - 3,
|
||||||
|
@ -729,7 +728,7 @@ void B2Client::doShape()
|
||||||
}
|
}
|
||||||
if (t.right() < width() - 1) {
|
if (t.right() < width() - 1) {
|
||||||
mask -= QRect(width() - 1,
|
mask -= QRect(width() - 1,
|
||||||
t.height() - thickness, 1, 1); //top right point
|
t.height() - thickness, 1, 1); // top right point
|
||||||
mask -= QRect(t.right() + 1, 0,
|
mask -= QRect(t.right() + 1, 0,
|
||||||
width() - t.right() - 1, t.height() - thickness);
|
width() - t.right() - 1, t.height() - thickness);
|
||||||
}
|
}
|
||||||
|
@ -872,7 +871,7 @@ void B2Client::shadeChange()
|
||||||
g->activate();
|
g->activate();
|
||||||
doShape();
|
doShape();
|
||||||
if (B2Button *b = button[BtnShade]) {
|
if (B2Button *b = button[BtnShade]) {
|
||||||
b->setToolTip( isSetShade() ? i18n("Unshade") : i18n("Shade"));
|
b->setToolTip(isSetShade() ? i18n("Unshade") : i18n("Shade"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -940,7 +939,7 @@ void B2Client::unobscureTitlebar()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
in_unobs = 1;
|
in_unobs = 1;
|
||||||
QRegion reg(QRect(0,0,width(), buttonSize + 4));
|
QRegion reg(QRect(0, 0, width(), buttonSize + 4));
|
||||||
reg = unobscuredRegion(reg);
|
reg = unobscuredRegion(reg);
|
||||||
if (!reg.isEmpty()) {
|
if (!reg.isEmpty()) {
|
||||||
// there is at least _one_ pixel from our title area, which is not
|
// there is at least _one_ pixel from our title area, which is not
|
||||||
|
@ -1137,10 +1136,10 @@ bool B2Client::drawbound(const QRect& geom, bool clear)
|
||||||
if (barRight > geom.right()) barRight = geom.right();
|
if (barRight > geom.right()) barRight = geom.right();
|
||||||
// line width is 5 pixels, so compensate for the 2 outer pixels (#88657)
|
// line width is 5 pixels, so compensate for the 2 outer pixels (#88657)
|
||||||
QRect g = geom;
|
QRect g = geom;
|
||||||
g.setLeft( g.left() + 2 );
|
g.setLeft(g.left() + 2);
|
||||||
g.setTop( g.top() + 2 );
|
g.setTop(g.top() + 2);
|
||||||
g.setRight( g.right() - 2 );
|
g.setRight(g.right() - 2);
|
||||||
g.setBottom( g.bottom() - 2 );
|
g.setBottom(g.bottom() - 2);
|
||||||
frameTop += 2;
|
frameTop += 2;
|
||||||
barLeft += 2;
|
barLeft += 2;
|
||||||
barRight -= 2;
|
barRight -= 2;
|
||||||
|
@ -1209,7 +1208,7 @@ B2Button::B2Button(B2Client *_client, QWidget *parent,
|
||||||
client = _client;
|
client = _client;
|
||||||
useMiniIcon = false;
|
useMiniIcon = false;
|
||||||
setFixedSize(buttonSize, buttonSize);
|
setFixedSize(buttonSize, buttonSize);
|
||||||
this->setToolTip( tip);
|
this->setToolTip(tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1232,7 +1231,8 @@ void B2Button::drawButton(QPainter *p)
|
||||||
p->fillRect(rect(), bg);
|
p->fillRect(rect(), bg);
|
||||||
}
|
}
|
||||||
if (useMiniIcon) {
|
if (useMiniIcon) {
|
||||||
QPixmap miniIcon = client->icon().pixmap(style()->pixelMetric( QStyle::PM_SmallIconSize ),
|
QPixmap miniIcon = client->icon().pixmap(
|
||||||
|
style()->pixelMetric(QStyle::PM_SmallIconSize),
|
||||||
client->isActive() ? QIcon::Normal : QIcon::Disabled);
|
client->isActive() ? QIcon::Normal : QIcon::Disabled);
|
||||||
p->drawPixmap((width() - miniIcon.width()) / 2,
|
p->drawPixmap((width() - miniIcon.width()) / 2,
|
||||||
(height() - miniIcon.height()) / 2, miniIcon);
|
(height() - miniIcon.height()) / 2, miniIcon);
|
||||||
|
@ -1386,7 +1386,7 @@ void B2Titlebar::resizeEvent(QResizeEvent *)
|
||||||
|
|
||||||
void B2Titlebar::paintEvent(QPaintEvent *)
|
void B2Titlebar::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
if(client->isActive())
|
if (client->isActive())
|
||||||
bitBlt(this, 0, 0, &titleBuffer, 0, 0, titleBuffer.width(),
|
bitBlt(this, 0, 0, &titleBuffer, 0, 0, titleBuffer.width(),
|
||||||
titleBuffer.height());
|
titleBuffer.height());
|
||||||
else {
|
else {
|
||||||
|
@ -1436,6 +1436,6 @@ void B2Titlebar::mouseMoveEvent(QMouseEvent * e)
|
||||||
|
|
||||||
#include "b2client.moc"
|
#include "b2client.moc"
|
||||||
|
|
||||||
// vim: sw=4
|
// vim: sw=4 ts=8
|
||||||
|
|
||||||
#endif // CLIENTS/B2/B2CLIENT.CPP
|
#endif // CLIENTS/B2/B2CLIENT.CPP
|
||||||
|
|
Loading…
Reference in a new issue