summaryrefslogtreecommitdiff
path: root/noncore/styles/liquid/liquid.cpp
authorsandman <sandman>2002-07-06 19:16:43 (UTC)
committer sandman <sandman>2002-07-06 19:16:43 (UTC)
commit2fa52f80f59249c3f838fa6fdbc2a890e4d96334 (patch) (side-by-side diff)
tree676cd870c02fad226755f0d6ddb95ed6147bfa4a /noncore/styles/liquid/liquid.cpp
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 (limited to 'noncore/styles/liquid/liquid.cpp') (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
@@ -1499,77 +1499,77 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
int extent = horiz ? sb->height() : sb->width();
// a few apps (ie: KSpread), are broken and use a hardcoded scrollbar
// extent of 16. Luckily, most apps (ie: Kate), seem fixed by now.
bool brokenApp;
if(extent == 16)
brokenApp = true;
else
brokenApp = false;
if (horiz) {
subY = addY = ( extent - buttonDim ) / 2;
subX = 0;
addX = len - buttonDim;
if(sbBuffer.size() != sb->size())
sbBuffer.resize(sb->size());
}
else {
subX = addX = ( extent - buttonDim ) / 2;
subY = 0;
addY = len - buttonDim;
if(sbBuffer.size() != sb->size())
sbBuffer.resize(sb->size());
}
- subB.setRect( subX,subY,buttonDim,buttonDim );
+ subB.setRect( subX,subY,0,0); // buttonDim,buttonDim );
addB.setRect( addX,addY,buttonDim,buttonDim );
if(horiz)
subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim );
else
subHC.setRect(addX,addY-buttonDim,buttonDim,buttonDim );
int sliderEnd = sliderStart + sliderLength;
int sliderW = extent;
if (horiz) {
subPageR.setRect( subB.right() + 1, 0,
sliderStart - subB.right() - 1 , sliderW );
addPageR.setRect( sliderEnd, 0, addX - sliderEnd - buttonDim, sliderW );
sliderR .setRect( sliderStart, 0, sliderLength, sliderW );
}
else {
subPageR.setRect( 0, subB.bottom() + 1, sliderW,
sliderStart - subB.bottom() - 1 );
addPageR.setRect( 0, sliderEnd, sliderW, addY - buttonDim - sliderEnd);
sliderR .setRect( 0, sliderStart, sliderW, sliderLength );
}
bool maxed = sb->maxValue() == sb->minValue();
QPainter painter;
if(!horiz){
painter.begin(&sbBuffer);
- QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1);
+ QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1);
if(sliderR.height() >= 8){
painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0,
13, 8);
painter.drawPixmap(bgR.x()+1, bgR.y(), *getPixmap(VSBSliderTopBg));
painter.drawTiledPixmap(bgR.x()+1, bgR.y()+8, 13,
bgR.height()-16, *getPixmap(VSBSliderMidBg));
painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *vsbSliderFillPix,
0, 0, 13, 8);
painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *getPixmap(VSBSliderBtmBg));
}
else{
painter.drawTiledPixmap(bgR.x()+1, bgR.y(), 13, bgR.height(),
*getPixmap(VSBSliderMidBg));
painter.setPen(g.background().dark(210));
painter.drawRect(bgR.x()+1, bgR.y(), 13, bgR.height()-1);
painter.setPen(g.mid());
painter.drawPoint(bgR.x()+1, bgR.y());
painter.drawPoint(bgR.x()+13, bgR.y());
painter.drawPoint(bgR.x()+1, bgR.bottom()-1);
painter.drawPoint(bgR.x()+13, bgR.bottom()-1);
}
if(controls & Slider){
if(sliderR.height() >= 16){
painter.drawPixmap(sliderR.x()+1, sliderR.y(),
@@ -1593,49 +1593,49 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
*getPixmap(VSBSliderBtm), 0, 8-m, 13, m);
}
else{
painter.setPen(g.button().dark(210));
drawRoundRect(&painter, sliderR.x()+1, sliderR.y(),
13, sliderR.height());
painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1,
11, sliderR.height()-2,
isHover ? *getPixmap(VSBSliderMidHover) :
*getPixmap(VSBSliderMid), 1, 0);
}
}
painter.setPen(g.mid());
painter.drawLine(bgR.x(), bgR.y(), bgR.x(), bgR.bottom());
painter.drawLine(bgR.right(), bgR.y(), bgR.right(), bgR.bottom());
if(brokenApp && (controls & Slider)){
painter.setPen(g.background());
painter.drawLine(bgR.right()-1, bgR.y(), bgR.right()-1,
bgR.bottom());
}
painter.end();
}
else{
painter.begin(&sbBuffer);
- QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height());
+ QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height());
if(sliderR.width() >= 8){
painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0,
8, 13);
painter.drawPixmap(bgR.x(), bgR.y()+1, *getPixmap(HSBSliderTopBg));
painter.drawTiledPixmap(bgR.x()+8, bgR.y()+1, bgR.width()-16,
13, *getPixmap(HSBSliderMidBg));
painter.drawPixmap(bgR.right()-8, bgR.y()+1, *vsbSliderFillPix,
0, 0, 8, 13);
painter.drawPixmap(bgR.right()-8, bgR.y()+1, *getPixmap(HSBSliderBtmBg));
}
else{
painter.drawTiledPixmap(bgR.x(), bgR.y()+1, bgR.width(), 13,
*getPixmap(HSBSliderMidBg));
painter.setPen(g.background().dark(210));
painter.drawRect(bgR.x(), bgR.y()+1, bgR.width()-1, 13);
painter.setPen(g.mid());
painter.drawPoint(bgR.x(), bgR.y()+1);
painter.drawPoint(bgR.x(), bgR.bottom()-1);
painter.drawPoint(bgR.right()-1, bgR.y()+1);
painter.drawPoint(bgR.right()-1, bgR.bottom()-1);
}
if(controls & Slider){
if(sliderR.width() >= 16){
painter.drawPixmap(sliderR.x(), sliderR.y()+1,
@@ -1664,52 +1664,52 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2,
sliderR.width()-2, 11, isHover ?
*getPixmap(HSBSliderMidHover) :
*getPixmap(HSBSliderMid), 0, 1);
}
}
painter.setPen(g.mid());
painter.drawLine(bgR.x(), bgR.y(), bgR.right(), bgR.y());
painter.drawLine(bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom());
if(brokenApp && (controls & Slider)){
painter.setPen(g.background());
painter.drawLine(bgR.x(), bgR.bottom()-1, bgR.right(),
bgR.bottom()-1);
}
painter.end();
}
if ( controls & AddLine ) {
drawSBButton(p, addB, g, activeControl == AddLine);
drawArrow( p, horiz ? RightArrow : DownArrow,
false, addB.x()+4, addB.y()+4,
addB.width()-8, addB.height()-8, g, !maxed);
}
if ( controls & SubLine ) {
- drawSBButton(p, subB, g, activeControl == SubLine);
- drawArrow( p, horiz ? LeftArrow : UpArrow,
- false, subB.x()+4, subB.y()+4,
- subB.width()-8, subB.height()-8, g, !maxed);
+ // drawSBButton(p, subB, g, activeControl == SubLine);
+ // drawArrow( p, horiz ? LeftArrow : UpArrow,
+ // false, subB.x()+4, subB.y()+4,
+ // subB.width()-8, subB.height()-8, g, !maxed);
drawSBButton(p, subHC, g, activeControl == SubLine);
drawArrow( p, horiz ? LeftArrow : UpArrow,
false, subHC.x()+4, subHC.y()+4,
subHC.width()-8, subHC.height()-8, g, !maxed);
}
if(controls & AddPage){
if(addPageR.width()){
p->drawPixmap(addPageR.x(), addPageR.y(), sbBuffer,
addPageR.x(), addPageR.y(), addPageR.width(),
addPageR.height());
}
}
if(controls & SubPage){
if(subPageR.height()){
p->drawPixmap(subPageR.x(), subPageR.y(), sbBuffer,
subPageR.x(), subPageR.y(), subPageR.width(),
subPageR.height());
}
}
if ( controls & Slider ) {
p->drawPixmap(sliderR.x(), sliderR.y(), sbBuffer,
sliderR.x(), sliderR.y(), sliderR.width(),
sliderR.height());
@@ -1768,50 +1768,50 @@ void LiquidStyle::drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g,
p->drawLine(x, y+4, x2, y+4);
p->drawLine(x, y+7, x2, y+7);
}
}
}
void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin,
int &sliderMax, int &sliderLength,
int &buttonDim)
{
int maxLength;
int b = 0;
bool horiz = sb->orientation() == QScrollBar::Horizontal;
int length = horiz ? sb->width() : sb->height();
int extent = horiz ? sb->height() : sb->width();
if ( length > ( extent - b*2 - 1 )*2 + b*2 )
buttonDim = extent - b*2;
else
buttonDim = ( length - b*2 )/2 - 1;
- sliderMin = b + buttonDim;
- maxLength = length - b*2 - buttonDim*3;
+ sliderMin = b + 0; // buttonDim;
+ maxLength = length - b*2 - buttonDim*2; // 3;
if ( sb->maxValue() == sb->minValue() ) {
sliderLength = maxLength;
} else {
sliderLength = (sb->pageStep()*maxLength)/
(sb->maxValue()-sb->minValue()+sb->pageStep());
uint range = sb->maxValue()-sb->minValue();
if ( sliderLength < 9 || range > INT_MAX/2 )
sliderLength = 9;
if ( sliderLength > maxLength )
sliderLength = maxLength;
}
sliderMax = sliderMin + maxLength - sliderLength;
}
QStyle::ScrollControl LiquidStyle::scrollBarPointOver(const QScrollBar *sb,
int sliderStart,
const QPoint &p)
{
if ( !sb->rect().contains( p ) )
return NoScroll;
int sliderMin, sliderMax, sliderLength, buttonDim, pos;
scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );