summaryrefslogtreecommitdiff
authorsandman <sandman>2002-07-06 19:16:43 (UTC)
committer sandman <sandman>2002-07-06 19:16:43 (UTC)
commit2fa52f80f59249c3f838fa6fdbc2a890e4d96334 (patch) (unidiff)
tree676cd870c02fad226755f0d6ddb95ed6147bfa4a
parent3a422983abc7342c9229dccac825d0608fca10f3 (diff)
downloadopie-2fa52f80f59249c3f838fa6fdbc2a890e4d96334.zip
opie-2fa52f80f59249c3f838fa6fdbc2a890e4d96334.tar.gz
opie-2fa52f80f59249c3f838fa6fdbc2a890e4d96334.tar.bz2
Use only two (instead of three) button controls on scrollbars due to space
constraints) -- will be configureable somtime ...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index acf0a42..67e53e9 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1331,655 +1331,655 @@ void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p)
1331 p->setFont(font); 1331 p->setFont(font);
1332 QColor shadow(btn->colorGroup().button().dark(130)); 1332 QColor shadow(btn->colorGroup().button().dark(130));
1333 drawItem( p, x1+1, y1+1, w, h, 1333 drawItem( p, x1+1, y1+1, w, h,
1334 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1334 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1335 btn->pixmap(), btn->text(), -1, 1335 btn->pixmap(), btn->text(), -1,
1336 &shadow); 1336 &shadow);
1337 1337
1338 drawItem( p, x1, y1, w, h, 1338 drawItem( p, x1, y1, w, h,
1339 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1339 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1340 btn->pixmap(), btn->text(), -1, &btn->colorGroup().light()); 1340 btn->pixmap(), btn->text(), -1, &btn->colorGroup().light());
1341 } 1341 }
1342 else{ 1342 else{
1343 /* Too blurry 1343 /* Too blurry
1344 drawItem( p, x1+1, y1+1, w, h, 1344 drawItem( p, x1+1, y1+1, w, h,
1345 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1345 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1346 btn->pixmap(), btn->text(), -1, 1346 btn->pixmap(), btn->text(), -1,
1347 &btn->colorGroup().button().dark(115)); 1347 &btn->colorGroup().button().dark(115));
1348 */ 1348 */
1349 drawItem( p, x1, y1, w, h, 1349 drawItem( p, x1, y1, w, h,
1350 AlignCenter | ShowPrefix, 1350 AlignCenter | ShowPrefix,
1351 btn->colorGroup(), btn->isEnabled(), 1351 btn->colorGroup(), btn->isEnabled(),
1352 btn->pixmap(), btn->text(), -1, 1352 btn->pixmap(), btn->text(), -1,
1353 &btn->colorGroup().buttonText()); 1353 &btn->colorGroup().buttonText());
1354 } 1354 }
1355} 1355}
1356 1356
1357void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h) 1357void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h)
1358{ 1358{
1359 int x2 = x+w-1; 1359 int x2 = x+w-1;
1360 int y2 = y+h-1; 1360 int y2 = y+h-1;
1361 1361
1362 p->setPen(Qt::color1); 1362 p->setPen(Qt::color1);
1363 p->fillRect(x, y, w, h, Qt::color0); 1363 p->fillRect(x, y, w, h, Qt::color0);
1364 if(w < 21 || h < 21){ 1364 if(w < 21 || h < 21){
1365 // outer rect 1365 // outer rect
1366 p->drawLine(x, y+2, x, y2-2); // l 1366 p->drawLine(x, y+2, x, y2-2); // l
1367 p->drawLine(x2, y+2, x2, y2-2); // r 1367 p->drawLine(x2, y+2, x2, y2-2); // r
1368 p->drawLine(x+2, y, x2-2, y); // t 1368 p->drawLine(x+2, y, x2-2, y); // t
1369 p->drawLine(x+2, y2, x2-2, y2); // b 1369 p->drawLine(x+2, y2, x2-2, y2); // b
1370 p->drawLine(x+1, y+1, x2-1, y+1); // top second line 1370 p->drawLine(x+1, y+1, x2-1, y+1); // top second line
1371 p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line 1371 p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line
1372 p->fillRect(x+1, y+2, w-2, h-4, Qt::color1); 1372 p->fillRect(x+1, y+2, w-2, h-4, Qt::color1);
1373 } 1373 }
1374 else{ 1374 else{
1375 int x2 = x+w-1; 1375 int x2 = x+w-1;
1376 int y2 = y+h-1; 1376 int y2 = y+h-1;
1377 int bx2 = htmlBtnMaskBmp.width()-1; 1377 int bx2 = htmlBtnMaskBmp.width()-1;
1378 int by2 = htmlBtnMaskBmp.height()-1; 1378 int by2 = htmlBtnMaskBmp.height()-1;
1379 p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl 1379 p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl
1380 p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr 1380 p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr
1381 p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl 1381 p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl
1382 p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br 1382 p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br
1383 // fills 1383 // fills
1384 p->fillRect(10, 0, w-20, 10, Qt::color1); // top 1384 p->fillRect(10, 0, w-20, 10, Qt::color1); // top
1385 p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 1385 p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
1386 p->fillRect(0, 10, w, h-20, Qt::color1); // middle 1386 p->fillRect(0, 10, w, h-20, Qt::color1); // middle
1387 } 1387 }
1388} 1388}
1389 1389
1390void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, 1390void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h,
1391 const QColorGroup &g, bool sunken, 1391 const QColorGroup &g, bool sunken,
1392 const QBrush */*fill*/) 1392 const QBrush */*fill*/)
1393{ 1393{
1394 if(currentHeader && p->device() == currentHeader){ 1394 if(currentHeader && p->device() == currentHeader){
1395 int id = currentHeader->sectionAt(x); 1395 int id = currentHeader->sectionAt(x);
1396 bool isHeaderHover = id != -1 && id == headerHoverID; 1396 bool isHeaderHover = id != -1 && id == headerHoverID;
1397 drawClearBevel(p, x, y, w, h, sunken ? 1397 drawClearBevel(p, x, y, w, h, sunken ?
1398 g.button() : isHeaderHover ? g.button().light(110) : 1398 g.button() : isHeaderHover ? g.button().light(110) :
1399 g.background(), g.background()); 1399 g.background(), g.background());
1400 } 1400 }
1401 else 1401 else
1402 drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), 1402 drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(),
1403 g.background()); 1403 g.background());
1404} 1404}
1405 1405
1406QRect LiquidStyle::buttonRect(int x, int y, int w, int h) 1406QRect LiquidStyle::buttonRect(int x, int y, int w, int h)
1407{ 1407{
1408 return(QRect(x+5, y+5, w-10, h-10)); 1408 return(QRect(x+5, y+5, w-10, h-10));
1409} 1409}
1410 1410
1411void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h, 1411void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h,
1412 const QColorGroup &g, bool sunken, 1412 const QColorGroup &g, bool sunken,
1413 bool edit, bool, const QBrush *) 1413 bool edit, bool, const QBrush *)
1414{ 1414{
1415 bool isHover = highlightWidget == painter->device(); 1415 bool isHover = highlightWidget == painter->device();
1416 bool isMasked = false; 1416 bool isMasked = false;
1417 if(painter->device()->devType() == QInternal::Widget) 1417 if(painter->device()->devType() == QInternal::Widget)
1418 isMasked = ((QWidget*)painter->device())->autoMask(); 1418 isMasked = ((QWidget*)painter->device())->autoMask();
1419 // TODO: Do custom code, don't just call drawRoundButton into a pixmap 1419 // TODO: Do custom code, don't just call drawRoundButton into a pixmap
1420 QPixmap tmpPix(w, h); 1420 QPixmap tmpPix(w, h);
1421 QPainter p(&tmpPix); 1421 QPainter p(&tmpPix);
1422 1422
1423 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, 1423 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false,
1424 sunken, false, isMasked); 1424 sunken, false, isMasked);
1425 if(!isHover){ 1425 if(!isHover){
1426 p.setClipRect(0, 0, w-17, h); 1426 p.setClipRect(0, 0, w-17, h);
1427 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, 1427 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false,
1428 sunken, false, isMasked); 1428 sunken, false, isMasked);
1429 } 1429 }
1430 p.end(); 1430 p.end();
1431 int x2 = x+w-1; 1431 int x2 = x+w-1;
1432 int y2 = y+h-1; 1432 int y2 = y+h-1;
1433 int bx2 = btnMaskBmp.width()-1; 1433 int bx2 = btnMaskBmp.width()-1;
1434 int by2 = btnMaskBmp.height()-1; 1434 int by2 = btnMaskBmp.height()-1;
1435 QBitmap btnMask(w, h); 1435 QBitmap btnMask(w, h);
1436 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; 1436 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
1437 p.begin(&btnMask); 1437 p.begin(&btnMask);
1438 p.fillRect(0, 0, w, h, Qt::color0); 1438 p.fillRect(0, 0, w, h, Qt::color0);
1439 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl 1439 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl
1440 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr 1440 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr
1441 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl 1441 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl
1442 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br 1442 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br
1443 // fills 1443 // fills
1444 p.fillRect(10, 0, w-20, 10, Qt::color1); // top 1444 p.fillRect(10, 0, w-20, 10, Qt::color1); // top
1445 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 1445 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
1446 p.fillRect(0, 10, w, h-20, Qt::color1); // middle 1446 p.fillRect(0, 10, w, h-20, Qt::color1); // middle
1447 p.end(); 1447 p.end();
1448 tmpPix.setMask(btnMask); 1448 tmpPix.setMask(btnMask);
1449 1449
1450 painter->drawPixmap(x, y, tmpPix); 1450 painter->drawPixmap(x, y, tmpPix);
1451 1451
1452 painter->setPen(g.button().dark(120)); 1452 painter->setPen(g.button().dark(120));
1453 painter->drawLine(x2-16, y+1, x2-16, y2-1); 1453 painter->drawLine(x2-16, y+1, x2-16, y2-1);
1454 1454
1455 if(edit){ 1455 if(edit){
1456 painter->setPen(g.mid()); 1456 painter->setPen(g.mid());
1457 painter->drawRect(x+8, y+2, w-25, h-4); 1457 painter->drawRect(x+8, y+2, w-25, h-4);
1458 } 1458 }
1459 int arrow_h = h / 3; 1459 int arrow_h = h / 3;
1460 int arrow_w = arrow_h; 1460 int arrow_w = arrow_h;
1461 int arrow_x = w - arrow_w - 6; 1461 int arrow_x = w - arrow_w - 6;
1462 int arrow_y = (h - arrow_h) / 2; 1462 int arrow_y = (h - arrow_h) / 2;
1463 drawArrow(painter, DownArrow, false, arrow_x, arrow_y, arrow_w, arrow_h, g, true); 1463 drawArrow(painter, DownArrow, false, arrow_x, arrow_y, arrow_w, arrow_h, g, true);
1464} 1464}
1465 1465
1466void LiquidStyle::drawComboButtonMask(QPainter *p, int x, int y, int w, int h) 1466void LiquidStyle::drawComboButtonMask(QPainter *p, int x, int y, int w, int h)
1467{ 1467{
1468 drawButtonMask(p, x, y, w, h); 1468 drawButtonMask(p, x, y, w, h);
1469} 1469}
1470 1470
1471QRect LiquidStyle::comboButtonRect(int x, int y, int w, int h) 1471QRect LiquidStyle::comboButtonRect(int x, int y, int w, int h)
1472{ 1472{
1473 //return(QRect(x+3, y+3, w - (h / 3) - 13, h-6)); 1473 //return(QRect(x+3, y+3, w - (h / 3) - 13, h-6));
1474 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6)); 1474 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6));
1475} 1475}
1476 1476
1477QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h) 1477QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h)
1478{ 1478{
1479 return(QRect(x+5, y+3, w-(h/3)-13, h-5)); 1479 return(QRect(x+5, y+3, w-(h/3)-13, h-5));
1480} 1480}
1481 1481
1482void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, 1482void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
1483 int sliderStart, uint controls, 1483 int sliderStart, uint controls,
1484 uint activeControl) 1484 uint activeControl)
1485{ 1485{
1486 bool isHover = highlightWidget == p->device(); 1486 bool isHover = highlightWidget == p->device();
1487 int sliderMin, sliderMax, sliderLength, buttonDim; 1487 int sliderMin, sliderMax, sliderLength, buttonDim;
1488 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 1488 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
1489 1489
1490 if (sliderStart > sliderMax) 1490 if (sliderStart > sliderMax)
1491 sliderStart = sliderMax; 1491 sliderStart = sliderMax;
1492 1492
1493 bool horiz = sb->orientation() == QScrollBar::Horizontal; 1493 bool horiz = sb->orientation() == QScrollBar::Horizontal;
1494 QColorGroup g = sb->colorGroup(); 1494 QColorGroup g = sb->colorGroup();
1495 QRect addB, subHC, subB; 1495 QRect addB, subHC, subB;
1496 QRect addPageR, subPageR, sliderR; 1496 QRect addPageR, subPageR, sliderR;
1497 int addX, addY, subX, subY; 1497 int addX, addY, subX, subY;
1498 int len = horiz ? sb->width() : sb->height(); 1498 int len = horiz ? sb->width() : sb->height();
1499 int extent = horiz ? sb->height() : sb->width(); 1499 int extent = horiz ? sb->height() : sb->width();
1500 1500
1501 // a few apps (ie: KSpread), are broken and use a hardcoded scrollbar 1501 // a few apps (ie: KSpread), are broken and use a hardcoded scrollbar
1502 // extent of 16. Luckily, most apps (ie: Kate), seem fixed by now. 1502 // extent of 16. Luckily, most apps (ie: Kate), seem fixed by now.
1503 bool brokenApp; 1503 bool brokenApp;
1504 if(extent == 16) 1504 if(extent == 16)
1505 brokenApp = true; 1505 brokenApp = true;
1506 else 1506 else
1507 brokenApp = false; 1507 brokenApp = false;
1508 1508
1509 if (horiz) { 1509 if (horiz) {
1510 subY = addY = ( extent - buttonDim ) / 2; 1510 subY = addY = ( extent - buttonDim ) / 2;
1511 subX = 0; 1511 subX = 0;
1512 addX = len - buttonDim; 1512 addX = len - buttonDim;
1513 if(sbBuffer.size() != sb->size()) 1513 if(sbBuffer.size() != sb->size())
1514 sbBuffer.resize(sb->size()); 1514 sbBuffer.resize(sb->size());
1515 } 1515 }
1516 else { 1516 else {
1517 subX = addX = ( extent - buttonDim ) / 2; 1517 subX = addX = ( extent - buttonDim ) / 2;
1518 subY = 0; 1518 subY = 0;
1519 addY = len - buttonDim; 1519 addY = len - buttonDim;
1520 if(sbBuffer.size() != sb->size()) 1520 if(sbBuffer.size() != sb->size())
1521 sbBuffer.resize(sb->size()); 1521 sbBuffer.resize(sb->size());
1522 } 1522 }
1523 subB.setRect( subX,subY,buttonDim,buttonDim ); 1523 subB.setRect( subX,subY,0,0); // buttonDim,buttonDim );
1524 addB.setRect( addX,addY,buttonDim,buttonDim ); 1524 addB.setRect( addX,addY,buttonDim,buttonDim );
1525 if(horiz) 1525 if(horiz)
1526 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); 1526 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim );
1527 else 1527 else
1528 subHC.setRect(addX,addY-buttonDim,buttonDim,buttonDim ); 1528 subHC.setRect(addX,addY-buttonDim,buttonDim,buttonDim );
1529 1529
1530 int sliderEnd = sliderStart + sliderLength; 1530 int sliderEnd = sliderStart + sliderLength;
1531 int sliderW = extent; 1531 int sliderW = extent;
1532 1532
1533 if (horiz) { 1533 if (horiz) {
1534 subPageR.setRect( subB.right() + 1, 0, 1534 subPageR.setRect( subB.right() + 1, 0,
1535 sliderStart - subB.right() - 1 , sliderW ); 1535 sliderStart - subB.right() - 1 , sliderW );
1536 addPageR.setRect( sliderEnd, 0, addX - sliderEnd - buttonDim, sliderW ); 1536 addPageR.setRect( sliderEnd, 0, addX - sliderEnd - buttonDim, sliderW );
1537 sliderR .setRect( sliderStart, 0, sliderLength, sliderW ); 1537 sliderR .setRect( sliderStart, 0, sliderLength, sliderW );
1538 } 1538 }
1539 else { 1539 else {
1540 subPageR.setRect( 0, subB.bottom() + 1, sliderW, 1540 subPageR.setRect( 0, subB.bottom() + 1, sliderW,
1541 sliderStart - subB.bottom() - 1 ); 1541 sliderStart - subB.bottom() - 1 );
1542 addPageR.setRect( 0, sliderEnd, sliderW, addY - buttonDim - sliderEnd); 1542 addPageR.setRect( 0, sliderEnd, sliderW, addY - buttonDim - sliderEnd);
1543 sliderR .setRect( 0, sliderStart, sliderW, sliderLength ); 1543 sliderR .setRect( 0, sliderStart, sliderW, sliderLength );
1544 } 1544 }
1545 1545
1546 bool maxed = sb->maxValue() == sb->minValue(); 1546 bool maxed = sb->maxValue() == sb->minValue();
1547 1547
1548 QPainter painter; 1548 QPainter painter;
1549 if(!horiz){ 1549 if(!horiz){
1550 painter.begin(&sbBuffer); 1550 painter.begin(&sbBuffer);
1551 QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1); 1551 QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1);
1552 if(sliderR.height() >= 8){ 1552 if(sliderR.height() >= 8){
1553 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, 1553 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0,
1554 13, 8); 1554 13, 8);
1555 painter.drawPixmap(bgR.x()+1, bgR.y(), *getPixmap(VSBSliderTopBg)); 1555 painter.drawPixmap(bgR.x()+1, bgR.y(), *getPixmap(VSBSliderTopBg));
1556 painter.drawTiledPixmap(bgR.x()+1, bgR.y()+8, 13, 1556 painter.drawTiledPixmap(bgR.x()+1, bgR.y()+8, 13,
1557 bgR.height()-16, *getPixmap(VSBSliderMidBg)); 1557 bgR.height()-16, *getPixmap(VSBSliderMidBg));
1558 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *vsbSliderFillPix, 1558 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *vsbSliderFillPix,
1559 0, 0, 13, 8); 1559 0, 0, 13, 8);
1560 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *getPixmap(VSBSliderBtmBg)); 1560 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *getPixmap(VSBSliderBtmBg));
1561 } 1561 }
1562 else{ 1562 else{
1563 painter.drawTiledPixmap(bgR.x()+1, bgR.y(), 13, bgR.height(), 1563 painter.drawTiledPixmap(bgR.x()+1, bgR.y(), 13, bgR.height(),
1564 *getPixmap(VSBSliderMidBg)); 1564 *getPixmap(VSBSliderMidBg));
1565 painter.setPen(g.background().dark(210)); 1565 painter.setPen(g.background().dark(210));
1566 painter.drawRect(bgR.x()+1, bgR.y(), 13, bgR.height()-1); 1566 painter.drawRect(bgR.x()+1, bgR.y(), 13, bgR.height()-1);
1567 painter.setPen(g.mid()); 1567 painter.setPen(g.mid());
1568 painter.drawPoint(bgR.x()+1, bgR.y()); 1568 painter.drawPoint(bgR.x()+1, bgR.y());
1569 painter.drawPoint(bgR.x()+13, bgR.y()); 1569 painter.drawPoint(bgR.x()+13, bgR.y());
1570 painter.drawPoint(bgR.x()+1, bgR.bottom()-1); 1570 painter.drawPoint(bgR.x()+1, bgR.bottom()-1);
1571 painter.drawPoint(bgR.x()+13, bgR.bottom()-1); 1571 painter.drawPoint(bgR.x()+13, bgR.bottom()-1);
1572 } 1572 }
1573 if(controls & Slider){ 1573 if(controls & Slider){
1574 if(sliderR.height() >= 16){ 1574 if(sliderR.height() >= 16){
1575 painter.drawPixmap(sliderR.x()+1, sliderR.y(), 1575 painter.drawPixmap(sliderR.x()+1, sliderR.y(),
1576 isHover ? *getPixmap(VSBSliderTopHover): 1576 isHover ? *getPixmap(VSBSliderTopHover):
1577 *getPixmap(VSBSliderTop)); 1577 *getPixmap(VSBSliderTop));
1578 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13, 1578 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13,
1579 sliderR.height()-16, isHover ? 1579 sliderR.height()-16, isHover ?
1580 *getPixmap(VSBSliderMidHover) : 1580 *getPixmap(VSBSliderMidHover) :
1581 *getPixmap(VSBSliderMid)); 1581 *getPixmap(VSBSliderMid));
1582 painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, 1582 painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8,
1583 isHover ? *getPixmap(VSBSliderBtmHover) : 1583 isHover ? *getPixmap(VSBSliderBtmHover) :
1584 *getPixmap(VSBSliderBtm)); 1584 *getPixmap(VSBSliderBtm));
1585 } 1585 }
1586 else if(sliderR.height() >= 8){ 1586 else if(sliderR.height() >= 8){
1587 int m = sliderR.height()/2; 1587 int m = sliderR.height()/2;
1588 painter.drawPixmap(sliderR.x()+1, sliderR.y(), 1588 painter.drawPixmap(sliderR.x()+1, sliderR.y(),
1589 isHover ? *getPixmap(VSBSliderTopHover): 1589 isHover ? *getPixmap(VSBSliderTopHover):
1590 *getPixmap(VSBSliderTop), 0, 0, 13, m); 1590 *getPixmap(VSBSliderTop), 0, 0, 13, m);
1591 painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, 1591 painter.drawPixmap(sliderR.x()+1, sliderR.y()+m,
1592 isHover ? *getPixmap(VSBSliderBtmHover): 1592 isHover ? *getPixmap(VSBSliderBtmHover):
1593 *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); 1593 *getPixmap(VSBSliderBtm), 0, 8-m, 13, m);
1594 } 1594 }
1595 else{ 1595 else{
1596 painter.setPen(g.button().dark(210)); 1596 painter.setPen(g.button().dark(210));
1597 drawRoundRect(&painter, sliderR.x()+1, sliderR.y(), 1597 drawRoundRect(&painter, sliderR.x()+1, sliderR.y(),
1598 13, sliderR.height()); 1598 13, sliderR.height());
1599 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1, 1599 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1,
1600 11, sliderR.height()-2, 1600 11, sliderR.height()-2,
1601 isHover ? *getPixmap(VSBSliderMidHover) : 1601 isHover ? *getPixmap(VSBSliderMidHover) :
1602 *getPixmap(VSBSliderMid), 1, 0); 1602 *getPixmap(VSBSliderMid), 1, 0);
1603 } 1603 }
1604 } 1604 }
1605 painter.setPen(g.mid()); 1605 painter.setPen(g.mid());
1606 painter.drawLine(bgR.x(), bgR.y(), bgR.x(), bgR.bottom()); 1606 painter.drawLine(bgR.x(), bgR.y(), bgR.x(), bgR.bottom());
1607 painter.drawLine(bgR.right(), bgR.y(), bgR.right(), bgR.bottom()); 1607 painter.drawLine(bgR.right(), bgR.y(), bgR.right(), bgR.bottom());
1608 if(brokenApp && (controls & Slider)){ 1608 if(brokenApp && (controls & Slider)){
1609 painter.setPen(g.background()); 1609 painter.setPen(g.background());
1610 painter.drawLine(bgR.right()-1, bgR.y(), bgR.right()-1, 1610 painter.drawLine(bgR.right()-1, bgR.y(), bgR.right()-1,
1611 bgR.bottom()); 1611 bgR.bottom());
1612 } 1612 }
1613 painter.end(); 1613 painter.end();
1614 } 1614 }
1615 else{ 1615 else{
1616 painter.begin(&sbBuffer); 1616 painter.begin(&sbBuffer);
1617 QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height()); 1617 QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height());
1618 if(sliderR.width() >= 8){ 1618 if(sliderR.width() >= 8){
1619 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, 1619 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0,
1620 8, 13); 1620 8, 13);
1621 painter.drawPixmap(bgR.x(), bgR.y()+1, *getPixmap(HSBSliderTopBg)); 1621 painter.drawPixmap(bgR.x(), bgR.y()+1, *getPixmap(HSBSliderTopBg));
1622 painter.drawTiledPixmap(bgR.x()+8, bgR.y()+1, bgR.width()-16, 1622 painter.drawTiledPixmap(bgR.x()+8, bgR.y()+1, bgR.width()-16,
1623 13, *getPixmap(HSBSliderMidBg)); 1623 13, *getPixmap(HSBSliderMidBg));
1624 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *vsbSliderFillPix, 1624 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *vsbSliderFillPix,
1625 0, 0, 8, 13); 1625 0, 0, 8, 13);
1626 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *getPixmap(HSBSliderBtmBg)); 1626 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *getPixmap(HSBSliderBtmBg));
1627 } 1627 }
1628 else{ 1628 else{
1629 painter.drawTiledPixmap(bgR.x(), bgR.y()+1, bgR.width(), 13, 1629 painter.drawTiledPixmap(bgR.x(), bgR.y()+1, bgR.width(), 13,
1630 *getPixmap(HSBSliderMidBg)); 1630 *getPixmap(HSBSliderMidBg));
1631 painter.setPen(g.background().dark(210)); 1631 painter.setPen(g.background().dark(210));
1632 painter.drawRect(bgR.x(), bgR.y()+1, bgR.width()-1, 13); 1632 painter.drawRect(bgR.x(), bgR.y()+1, bgR.width()-1, 13);
1633 painter.setPen(g.mid()); 1633 painter.setPen(g.mid());
1634 painter.drawPoint(bgR.x(), bgR.y()+1); 1634 painter.drawPoint(bgR.x(), bgR.y()+1);
1635 painter.drawPoint(bgR.x(), bgR.bottom()-1); 1635 painter.drawPoint(bgR.x(), bgR.bottom()-1);
1636 painter.drawPoint(bgR.right()-1, bgR.y()+1); 1636 painter.drawPoint(bgR.right()-1, bgR.y()+1);
1637 painter.drawPoint(bgR.right()-1, bgR.bottom()-1); 1637 painter.drawPoint(bgR.right()-1, bgR.bottom()-1);
1638 } 1638 }
1639 if(controls & Slider){ 1639 if(controls & Slider){
1640 if(sliderR.width() >= 16){ 1640 if(sliderR.width() >= 16){
1641 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1641 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1642 isHover ? *getPixmap(HSBSliderTopHover) : 1642 isHover ? *getPixmap(HSBSliderTopHover) :
1643 *getPixmap(HSBSliderTop)); 1643 *getPixmap(HSBSliderTop));
1644 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16, 1644 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16,
1645 13, isHover ? *getPixmap(HSBSliderMidHover) : 1645 13, isHover ? *getPixmap(HSBSliderMidHover) :
1646 *getPixmap(HSBSliderMid)); 1646 *getPixmap(HSBSliderMid));
1647 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? 1647 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ?
1648 *getPixmap(HSBSliderBtmHover) : 1648 *getPixmap(HSBSliderBtmHover) :
1649 *getPixmap(HSBSliderBtm)); 1649 *getPixmap(HSBSliderBtm));
1650 } 1650 }
1651 else if(sliderR.width() >= 8){ 1651 else if(sliderR.width() >= 8){
1652 int m = sliderR.width()/2; 1652 int m = sliderR.width()/2;
1653 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1653 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1654 isHover ? *getPixmap(HSBSliderTopHover) : 1654 isHover ? *getPixmap(HSBSliderTopHover) :
1655 *getPixmap(HSBSliderTop), 0, 0, m, 13); 1655 *getPixmap(HSBSliderTop), 0, 0, m, 13);
1656 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? 1656 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ?
1657 *getPixmap(HSBSliderBtmHover) : 1657 *getPixmap(HSBSliderBtmHover) :
1658 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13); 1658 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13);
1659 } 1659 }
1660 else{ 1660 else{
1661 painter.setPen(g.button().dark(210)); 1661 painter.setPen(g.button().dark(210));
1662 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1, 1662 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1,
1663 sliderR.width(), 13); 1663 sliderR.width(), 13);
1664 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2, 1664 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2,
1665 sliderR.width()-2, 11, isHover ? 1665 sliderR.width()-2, 11, isHover ?
1666 *getPixmap(HSBSliderMidHover) : 1666 *getPixmap(HSBSliderMidHover) :
1667 *getPixmap(HSBSliderMid), 0, 1); 1667 *getPixmap(HSBSliderMid), 0, 1);
1668 } 1668 }
1669 } 1669 }
1670 painter.setPen(g.mid()); 1670 painter.setPen(g.mid());
1671 painter.drawLine(bgR.x(), bgR.y(), bgR.right(), bgR.y()); 1671 painter.drawLine(bgR.x(), bgR.y(), bgR.right(), bgR.y());
1672 painter.drawLine(bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom()); 1672 painter.drawLine(bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom());
1673 if(brokenApp && (controls & Slider)){ 1673 if(brokenApp && (controls & Slider)){
1674 painter.setPen(g.background()); 1674 painter.setPen(g.background());
1675 painter.drawLine(bgR.x(), bgR.bottom()-1, bgR.right(), 1675 painter.drawLine(bgR.x(), bgR.bottom()-1, bgR.right(),
1676 bgR.bottom()-1); 1676 bgR.bottom()-1);
1677 } 1677 }
1678 painter.end(); 1678 painter.end();
1679 } 1679 }
1680 1680
1681 if ( controls & AddLine ) { 1681 if ( controls & AddLine ) {
1682 drawSBButton(p, addB, g, activeControl == AddLine); 1682 drawSBButton(p, addB, g, activeControl == AddLine);
1683 drawArrow( p, horiz ? RightArrow : DownArrow, 1683 drawArrow( p, horiz ? RightArrow : DownArrow,
1684 false, addB.x()+4, addB.y()+4, 1684 false, addB.x()+4, addB.y()+4,
1685 addB.width()-8, addB.height()-8, g, !maxed); 1685 addB.width()-8, addB.height()-8, g, !maxed);
1686 } 1686 }
1687 if ( controls & SubLine ) { 1687 if ( controls & SubLine ) {
1688 drawSBButton(p, subB, g, activeControl == SubLine); 1688 // drawSBButton(p, subB, g, activeControl == SubLine);
1689 drawArrow( p, horiz ? LeftArrow : UpArrow, 1689 // drawArrow( p, horiz ? LeftArrow : UpArrow,
1690 false, subB.x()+4, subB.y()+4, 1690 // false, subB.x()+4, subB.y()+4,
1691 subB.width()-8, subB.height()-8, g, !maxed); 1691 // subB.width()-8, subB.height()-8, g, !maxed);
1692 drawSBButton(p, subHC, g, activeControl == SubLine); 1692 drawSBButton(p, subHC, g, activeControl == SubLine);
1693 drawArrow( p, horiz ? LeftArrow : UpArrow, 1693 drawArrow( p, horiz ? LeftArrow : UpArrow,
1694 false, subHC.x()+4, subHC.y()+4, 1694 false, subHC.x()+4, subHC.y()+4,
1695 subHC.width()-8, subHC.height()-8, g, !maxed); 1695 subHC.width()-8, subHC.height()-8, g, !maxed);
1696 } 1696 }
1697 1697
1698 if(controls & AddPage){ 1698 if(controls & AddPage){
1699 if(addPageR.width()){ 1699 if(addPageR.width()){
1700 p->drawPixmap(addPageR.x(), addPageR.y(), sbBuffer, 1700 p->drawPixmap(addPageR.x(), addPageR.y(), sbBuffer,
1701 addPageR.x(), addPageR.y(), addPageR.width(), 1701 addPageR.x(), addPageR.y(), addPageR.width(),
1702 addPageR.height()); 1702 addPageR.height());
1703 } 1703 }
1704 } 1704 }
1705 if(controls & SubPage){ 1705 if(controls & SubPage){
1706 if(subPageR.height()){ 1706 if(subPageR.height()){
1707 p->drawPixmap(subPageR.x(), subPageR.y(), sbBuffer, 1707 p->drawPixmap(subPageR.x(), subPageR.y(), sbBuffer,
1708 subPageR.x(), subPageR.y(), subPageR.width(), 1708 subPageR.x(), subPageR.y(), subPageR.width(),
1709 subPageR.height()); 1709 subPageR.height());
1710 } 1710 }
1711 } 1711 }
1712 if ( controls & Slider ) { 1712 if ( controls & Slider ) {
1713 p->drawPixmap(sliderR.x(), sliderR.y(), sbBuffer, 1713 p->drawPixmap(sliderR.x(), sliderR.y(), sbBuffer,
1714 sliderR.x(), sliderR.y(), sliderR.width(), 1714 sliderR.x(), sliderR.y(), sliderR.width(),
1715 sliderR.height()); 1715 sliderR.height());
1716 } 1716 }
1717} 1717}
1718 1718
1719void LiquidStyle::drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, 1719void LiquidStyle::drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g,
1720 bool down, bool /*fast*/) 1720 bool down, bool /*fast*/)
1721{ 1721{
1722 p->setPen(g.mid()); 1722 p->setPen(g.mid());
1723 p->drawRect(r); 1723 p->drawRect(r);
1724 QColor c(down ? g.button() : g.background()); 1724 QColor c(down ? g.button() : g.background());
1725 QPixmap *pix = bevelFillDict.find(c.rgb()); 1725 QPixmap *pix = bevelFillDict.find(c.rgb());
1726 if(!pix){ 1726 if(!pix){
1727 int h, s, v; 1727 int h, s, v;
1728 c.hsv(&h, &s, &v); 1728 c.hsv(&h, &s, &v);
1729 pix = new QPixmap(*bevelFillPix); 1729 pix = new QPixmap(*bevelFillPix);
1730 adjustHSV(*pix, h, s, v); 1730 adjustHSV(*pix, h, s, v);
1731 bevelFillDict.insert(c.rgb(), pix); 1731 bevelFillDict.insert(c.rgb(), pix);
1732 } 1732 }
1733 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); 1733 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix);
1734 1734
1735} 1735}
1736 1736
1737void LiquidStyle::drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g, 1737void LiquidStyle::drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g,
1738 bool horiz) 1738 bool horiz)
1739{ 1739{
1740 if(horiz){ 1740 if(horiz){
1741 if(r.width() >= 15){ 1741 if(r.width() >= 15){
1742 int y = r.y()+3; 1742 int y = r.y()+3;
1743 int x = r.x() + (r.width()-7)/2; 1743 int x = r.x() + (r.width()-7)/2;
1744 int y2 = r.bottom()-3; 1744 int y2 = r.bottom()-3;
1745 p->setPen(g.light()); 1745 p->setPen(g.light());
1746 p->drawLine(x, y, x, y2); 1746 p->drawLine(x, y, x, y2);
1747 p->drawLine(x+3, y, x+3, y2); 1747 p->drawLine(x+3, y, x+3, y2);
1748 p->drawLine(x+6, y, x+6, y2); 1748 p->drawLine(x+6, y, x+6, y2);
1749 1749
1750 p->setPen(g.mid()); 1750 p->setPen(g.mid());
1751 p->drawLine(x+1, y, x+1, y2); 1751 p->drawLine(x+1, y, x+1, y2);
1752 p->drawLine(x+4, y, x+4, y2); 1752 p->drawLine(x+4, y, x+4, y2);
1753 p->drawLine(x+7, y, x+7, y2); 1753 p->drawLine(x+7, y, x+7, y2);
1754 } 1754 }
1755 } 1755 }
1756 else{ 1756 else{
1757 if(r.height() >= 15){ 1757 if(r.height() >= 15){
1758 int x = r.x()+3; 1758 int x = r.x()+3;
1759 int y = r.y() + (r.height()-7)/2; 1759 int y = r.y() + (r.height()-7)/2;
1760 int x2 = r.right()-3; 1760 int x2 = r.right()-3;
1761 p->setPen(g.light()); 1761 p->setPen(g.light());
1762 p->drawLine(x, y, x2, y); 1762 p->drawLine(x, y, x2, y);
1763 p->drawLine(x, y+3, x2, y+3); 1763 p->drawLine(x, y+3, x2, y+3);
1764 p->drawLine(x, y+6, x2, y+6); 1764 p->drawLine(x, y+6, x2, y+6);
1765 1765
1766 p->setPen(g.mid()); 1766 p->setPen(g.mid());
1767 p->drawLine(x, y+1, x2, y+1); 1767 p->drawLine(x, y+1, x2, y+1);
1768 p->drawLine(x, y+4, x2, y+4); 1768 p->drawLine(x, y+4, x2, y+4);
1769 p->drawLine(x, y+7, x2, y+7); 1769 p->drawLine(x, y+7, x2, y+7);
1770 } 1770 }
1771 } 1771 }
1772 1772
1773} 1773}
1774 1774
1775 1775
1776void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin, 1776void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin,
1777 int &sliderMax, int &sliderLength, 1777 int &sliderMax, int &sliderLength,
1778 int &buttonDim) 1778 int &buttonDim)
1779{ 1779{
1780 1780
1781 int maxLength; 1781 int maxLength;
1782 int b = 0; 1782 int b = 0;
1783 bool horiz = sb->orientation() == QScrollBar::Horizontal; 1783 bool horiz = sb->orientation() == QScrollBar::Horizontal;
1784 int length = horiz ? sb->width() : sb->height(); 1784 int length = horiz ? sb->width() : sb->height();
1785 int extent = horiz ? sb->height() : sb->width(); 1785 int extent = horiz ? sb->height() : sb->width();
1786 1786
1787 if ( length > ( extent - b*2 - 1 )*2 + b*2 ) 1787 if ( length > ( extent - b*2 - 1 )*2 + b*2 )
1788 buttonDim = extent - b*2; 1788 buttonDim = extent - b*2;
1789 else 1789 else
1790 buttonDim = ( length - b*2 )/2 - 1; 1790 buttonDim = ( length - b*2 )/2 - 1;
1791 1791
1792 sliderMin = b + buttonDim; 1792 sliderMin = b + 0; // buttonDim;
1793 maxLength = length - b*2 - buttonDim*3; 1793 maxLength = length - b*2 - buttonDim*2; // 3;
1794 1794
1795 if ( sb->maxValue() == sb->minValue() ) { 1795 if ( sb->maxValue() == sb->minValue() ) {
1796 sliderLength = maxLength; 1796 sliderLength = maxLength;
1797 } else { 1797 } else {
1798 sliderLength = (sb->pageStep()*maxLength)/ 1798 sliderLength = (sb->pageStep()*maxLength)/
1799 (sb->maxValue()-sb->minValue()+sb->pageStep()); 1799 (sb->maxValue()-sb->minValue()+sb->pageStep());
1800 uint range = sb->maxValue()-sb->minValue(); 1800 uint range = sb->maxValue()-sb->minValue();
1801 if ( sliderLength < 9 || range > INT_MAX/2 ) 1801 if ( sliderLength < 9 || range > INT_MAX/2 )
1802 sliderLength = 9; 1802 sliderLength = 9;
1803 if ( sliderLength > maxLength ) 1803 if ( sliderLength > maxLength )
1804 sliderLength = maxLength; 1804 sliderLength = maxLength;
1805 } 1805 }
1806 sliderMax = sliderMin + maxLength - sliderLength; 1806 sliderMax = sliderMin + maxLength - sliderLength;
1807 1807
1808} 1808}
1809 1809
1810QStyle::ScrollControl LiquidStyle::scrollBarPointOver(const QScrollBar *sb, 1810QStyle::ScrollControl LiquidStyle::scrollBarPointOver(const QScrollBar *sb,
1811 int sliderStart, 1811 int sliderStart,
1812 const QPoint &p) 1812 const QPoint &p)
1813{ 1813{
1814 if ( !sb->rect().contains( p ) ) 1814 if ( !sb->rect().contains( p ) )
1815 return NoScroll; 1815 return NoScroll;
1816 int sliderMin, sliderMax, sliderLength, buttonDim, pos; 1816 int sliderMin, sliderMax, sliderLength, buttonDim, pos;
1817 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 1817 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
1818 pos = (sb->orientation() == QScrollBar::Horizontal)? p.x() : p.y(); 1818 pos = (sb->orientation() == QScrollBar::Horizontal)? p.x() : p.y();
1819 if ( pos < sliderMin ) 1819 if ( pos < sliderMin )
1820 return SubLine; 1820 return SubLine;
1821 if ( pos < sliderStart ) 1821 if ( pos < sliderStart )
1822 return SubPage; 1822 return SubPage;
1823 if ( pos < sliderStart + sliderLength ) 1823 if ( pos < sliderStart + sliderLength )
1824 return Slider; 1824 return Slider;
1825 if ( pos < sliderMax + sliderLength) 1825 if ( pos < sliderMax + sliderLength)
1826 return AddPage; 1826 return AddPage;
1827 if(pos > sliderMax + sliderLength + 16) 1827 if(pos > sliderMax + sliderLength + 16)
1828 return AddLine; 1828 return AddLine;
1829 1829
1830 return SubLine; 1830 return SubLine;
1831} 1831}
1832 1832
1833#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 1833#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
1834 1834
1835 1835
1836QSize LiquidStyle::exclusiveIndicatorSize() const 1836QSize LiquidStyle::exclusiveIndicatorSize() const
1837{ 1837{
1838 return(QSize(16, 16)); 1838 return(QSize(16, 16));
1839} 1839}
1840 1840
1841void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, 1841void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/,
1842 int /*h*/, const QColorGroup &/*g*/, bool on, 1842 int /*h*/, const QColorGroup &/*g*/, bool on,
1843 bool down, bool) 1843 bool down, bool)
1844{ 1844{
1845 bool isHover = highlightWidget == p->device(); 1845 bool isHover = highlightWidget == p->device();
1846 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1846 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1847 && ((QWidget*)p->device())->autoMask(); 1847 && ((QWidget*)p->device())->autoMask();
1848 1848
1849 if(isMasked){ 1849 if(isMasked){
1850 if(on || down){ 1850 if(on || down){
1851 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) : 1851 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) :
1852 *getPixmap(HTMLRadioDown)); 1852 *getPixmap(HTMLRadioDown));
1853 } 1853 }
1854 else 1854 else
1855 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) : 1855 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) :
1856 *getPixmap(HTMLRadio)); 1856 *getPixmap(HTMLRadio));
1857 1857
1858 } 1858 }
1859 else{ 1859 else{
1860 if(on || down){ 1860 if(on || down){
1861 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) : 1861 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) :
1862 *getPixmap(RadioOn)); 1862 *getPixmap(RadioOn));
1863 } 1863 }
1864 else 1864 else
1865 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) : 1865 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) :
1866 *getPixmap(RadioOff)); 1866 *getPixmap(RadioOff));
1867 } 1867 }
1868} 1868}
1869 1869
1870void LiquidStyle::drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w, 1870void LiquidStyle::drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w,
1871 int h, bool) 1871 int h, bool)
1872{ 1872{
1873 p->fillRect(x, y, w, h, Qt::color0); 1873 p->fillRect(x, y, w, h, Qt::color0);
1874 p->setPen(Qt::color1); 1874 p->setPen(Qt::color1);
1875 p->drawPixmap(x, y, *getPixmap(RadioOn)->mask()); 1875 p->drawPixmap(x, y, *getPixmap(RadioOn)->mask());
1876} 1876}
1877 1877
1878 1878
1879QSize LiquidStyle::indicatorSize() const 1879QSize LiquidStyle::indicatorSize() const
1880{ 1880{
1881 return(QSize(20, 22)); 1881 return(QSize(20, 22));
1882} 1882}
1883 1883
1884void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1884void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1885 const QColorGroup &/*g*/, int state, bool /*down*/, bool) 1885 const QColorGroup &/*g*/, int state, bool /*down*/, bool)
1886{ 1886{
1887 bool isHover = highlightWidget == p->device(); 1887 bool isHover = highlightWidget == p->device();
1888 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1888 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1889 && ((QWidget*)p->device())->autoMask(); 1889 && ((QWidget*)p->device())->autoMask();
1890 if(isMasked){ 1890 if(isMasked){
1891 if(state != QButton::Off){ 1891 if(state != QButton::Off){
1892 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) : 1892 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) :
1893 *getPixmap(HTMLCBDown)); 1893 *getPixmap(HTMLCBDown));
1894 } 1894 }
1895 else 1895 else
1896 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) : 1896 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) :
1897 *getPixmap(HTMLCB)); 1897 *getPixmap(HTMLCB));
1898 1898
1899 } 1899 }
1900 else{ 1900 else{
1901 if(state != QButton::Off){ 1901 if(state != QButton::Off){
1902 p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) : 1902 p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) :
1903 *getPixmap(CBDown)); 1903 *getPixmap(CBDown));
1904 /* Todo - tristate 1904 /* Todo - tristate
1905 if(state == QButton::On){ 1905 if(state == QButton::On){
1906 p->setPen(Qt::black); 1906 p->setPen(Qt::black);
1907 p->drawPixmap(3, 3, xBmp); 1907 p->drawPixmap(3, 3, xBmp);
1908 } 1908 }
1909 else{ 1909 else{
1910 p->setPen(g.dark()); 1910 p->setPen(g.dark());
1911 p->drawRect(x+2, y+2, w-4, h-4); 1911 p->drawRect(x+2, y+2, w-4, h-4);
1912 p->setPen(Qt::black); 1912 p->setPen(Qt::black);
1913 p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2); 1913 p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2);
1914 p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2); 1914 p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2);
1915 p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2); 1915 p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2);
1916 }*/ 1916 }*/
1917 } 1917 }
1918 else 1918 else
1919 p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB)); 1919 p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB));
1920 } 1920 }
1921} 1921}
1922 1922
1923void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1923void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1924 int /*state*/) 1924 int /*state*/)
1925{ 1925{
1926 // needed for some reason by KHtml, even tho it's all filled ;P 1926 // needed for some reason by KHtml, even tho it's all filled ;P
1927 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); 1927 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask());
1928 1928
1929} 1929}
1930 1930
1931void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, 1931void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h,
1932 const QColorGroup &/*g*/, Orientation orient, 1932 const QColorGroup &/*g*/, Orientation orient,
1933 bool, bool) 1933 bool, bool)
1934{ 1934{
1935 QWidget *parent = (QWidget *)p->device(); 1935 QWidget *parent = (QWidget *)p->device();
1936 p->setBrushOrigin(parent->pos()); 1936 p->setBrushOrigin(parent->pos());
1937 parent->erase(x, y, w, h); 1937 parent->erase(x, y, w, h);
1938 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : 1938 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) :
1939 *getPixmap(VSlider)); 1939 *getPixmap(VSlider));
1940} 1940}
1941 1941
1942void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1942void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1943 Orientation orient, bool, bool) 1943 Orientation orient, bool, bool)
1944{ 1944{
1945 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : 1945 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() :
1946 *getPixmap(VSlider)->mask()); 1946 *getPixmap(VSlider)->mask());
1947} 1947}
1948 1948
1949int LiquidStyle::sliderLength() const 1949int LiquidStyle::sliderLength() const
1950{ 1950{
1951 return(10); 1951 return(10);
1952} 1952}
1953 1953
1954#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 1954#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
1955 1955
1956void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x, 1956void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x,
1957 int y, int w, int h, const QColorGroup &g, 1957 int y, int w, int h, const QColorGroup &g,
1958 bool enabled, const QBrush *) 1958 bool enabled, const QBrush *)
1959{ 1959{
1960 static const QCOORD u_arrow[]={3,1, 4,1, 2,2, 5,2, 1,3, 6,3, 0,4, 7,4, 0,5, 7,5}; 1960 static const QCOORD u_arrow[]={3,1, 4,1, 2,2, 5,2, 1,3, 6,3, 0,4, 7,4, 0,5, 7,5};
1961 static const QCOORD d_arrow[]={0,2, 7,2, 0,3, 7,3, 1,4, 6,4, 2,5, 5,5, 3,6, 4,6}; 1961 static const QCOORD d_arrow[]={0,2, 7,2, 0,3, 7,3, 1,4, 6,4, 2,5, 5,5, 3,6, 4,6};
1962 static const QCOORD l_arrow[]={1,3, 1,4, 2,2, 2,5, 3,1, 3,6, 4,0, 4,7, 5,0, 5,7}; 1962 static const QCOORD l_arrow[]={1,3, 1,4, 2,2, 2,5, 3,1, 3,6, 4,0, 4,7, 5,0, 5,7};
1963 static const QCOORD r_arrow[]={2,0, 2,7, 3,0, 3,7, 4,1, 4,6, 5,2, 5,5, 6,3, 6,4}; 1963 static const QCOORD r_arrow[]={2,0, 2,7, 3,0, 3,7, 4,1, 4,6, 5,2, 5,5, 6,3, 6,4};
1964 1964
1965 p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid()); 1965 p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid());
1966 if(w > 8){ 1966 if(w > 8){
1967 x = x + (w-8)/2; 1967 x = x + (w-8)/2;
1968 y = y + (h-8)/2; 1968 y = y + (h-8)/2;
1969 } 1969 }
1970 1970
1971 QPointArray a; 1971 QPointArray a;
1972 switch(type){ 1972 switch(type){
1973 case Qt::UpArrow: 1973 case Qt::UpArrow:
1974 a.setPoints(QCOORDARRLEN(u_arrow), u_arrow); 1974 a.setPoints(QCOORDARRLEN(u_arrow), u_arrow);
1975 break; 1975 break;
1976 case Qt::DownArrow: 1976 case Qt::DownArrow:
1977 a.setPoints(QCOORDARRLEN(d_arrow), d_arrow); 1977 a.setPoints(QCOORDARRLEN(d_arrow), d_arrow);
1978 break; 1978 break;
1979 case Qt::LeftArrow: 1979 case Qt::LeftArrow:
1980 a.setPoints(QCOORDARRLEN(l_arrow), l_arrow); 1980 a.setPoints(QCOORDARRLEN(l_arrow), l_arrow);
1981 break; 1981 break;
1982 default: 1982 default:
1983 a.setPoints(QCOORDARRLEN(r_arrow), r_arrow); 1983 a.setPoints(QCOORDARRLEN(r_arrow), r_arrow);
1984 break; 1984 break;
1985 } 1985 }