summaryrefslogtreecommitdiff
authorzecke <zecke>2004-08-02 19:58:09 (UTC)
committer zecke <zecke>2004-08-02 19:58:09 (UTC)
commit1e8f0e771789b353ab025320dcb845818ed3d977 (patch) (side-by-side diff)
treef6b02187a54d460f6b75251a44c5e9b764b302bf
parentafec356b8cbbda815308fb5fe8e277737e0ca32c (diff)
downloadopie-1e8f0e771789b353ab025320dcb845818ed3d977.zip
opie-1e8f0e771789b353ab025320dcb845818ed3d977.tar.gz
opie-1e8f0e771789b353ab025320dcb845818ed3d977.tar.bz2
Make CheckBox a bit smaller
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/styles/web/webstyle.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/styles/web/webstyle.cpp b/noncore/styles/web/webstyle.cpp
index 10d9791..cd3cf08 100644
--- a/noncore/styles/web/webstyle.cpp
+++ b/noncore/styles/web/webstyle.cpp
@@ -1,133 +1,133 @@
/*
* Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef INCLUDE_MENUITEM_DEF
#define INCLUDE_MENUITEM_DEF
#endif
#include <qmenudata.h>
#include <qpalette.h>
#include <qbitmap.h>
#include <qtabbar.h>
#include <qpointarray.h>
#include <qscrollbar.h>
#include <qframe.h>
#include <qpushbutton.h>
#include <qdrawutil.h>
#include <qpainter.h>
#include "webstyle.h"
-static const int _indicatorSize = 13;
+static const int _indicatorSize = 9;
static QButton * _highlightedButton = 0;
static const int _scrollBarExtent = 12;
static QFrame * _currentFrame = 0;
static int _savedFrameLineWidth;
static int _savedFrameMidLineWidth;
static ulong _savedFrameStyle;
static QColor contrastingForeground(const QColor & fg, const QColor & bg)
{
int h, s, vbg, vfg;
bg.hsv(&h, &s, &vbg);
fg.hsv(&h, &s, &vfg);
int diff(vbg - vfg);
if ((diff > -72) && (diff < 72))
{
return (vbg < 128) ? Qt::white : Qt::black;
}
else
{
return fg;
}
}
// Gotta keep it separated.
static void
scrollBarControlsMetrics
(
const QScrollBar * sb,
int sliderStart,
int /* sliderMin */,
int sliderMax,
int sliderLength,
int buttonDim,
QRect & rSub,
QRect & rAdd,
QRect & rSubPage,
QRect & rAddPage,
QRect & rSlider
)
{
bool horizontal = sb->orientation() == QScrollBar::Horizontal;
int len = horizontal ? sb->width() : sb->height();
int extent = horizontal ? sb->height() : sb->width();
QColorGroup g = sb->colorGroup();
if (sliderStart > sliderMax)
sliderStart = sliderMax;
int sliderEnd = sliderStart + sliderLength;
int addX, addY;
int subX, subY;
int subPageX, subPageY, subPageW, subPageH;
int addPageX, addPageY, addPageW, addPageH;
int sliderX, sliderY, sliderW, sliderH;
if (horizontal)
{
subY = 0;
addY = 0;
subX = 0;
addX = buttonDim;
subPageX = buttonDim * 2;
subPageY = 0;
subPageW = sliderStart - 1;
subPageH = extent;
addPageX = sliderEnd;
addPageY = 0;
addPageW = len - sliderEnd;
addPageH = extent;
sliderX = sliderStart;
sliderY = 0;
sliderW = sliderLength;
sliderH = extent;
}
else
{
subX = 0;
addX = 0;
subY = len - buttonDim * 2;
addY = len - buttonDim;
subPageX = 0;
subPageY = 0;
subPageW = extent;
@@ -628,193 +628,193 @@ WebStyle::scrollBarPointOver
WebStyle::scrollBarMetrics
(
const QScrollBar * sb,
int & sliderMin,
int & sliderMax,
int & sliderLength,
int & buttonDim
)
{
// return QWindowsStyle::scrollBarMetrics(sb, sliderMin, sliderMax,
// sliderLength, buttonDim );
int maxlen;
bool horizontal = sb->orientation() == QScrollBar::Horizontal;
int len = (horizontal) ? sb->width() : sb->height();
int extent = (horizontal) ? sb->height() : sb->width();
if (len > (extent - 1) * 2)
buttonDim = extent;
else
buttonDim = len / 2 - 1;
if (horizontal)
sliderMin = buttonDim * 2;
else
sliderMin = 1;
maxlen = len - buttonDim * 2 - 1;
int div = QMAX(1, (sb->maxValue() - sb->minValue() + sb->pageStep() ) );
sliderLength =
(sb->pageStep() * maxlen) / div;
if (sliderLength < _scrollBarExtent)
sliderLength = _scrollBarExtent;
if (sliderLength > maxlen)
sliderLength = maxlen;
sliderMax = sliderMin + maxlen - sliderLength;
}
QSize
WebStyle::indicatorSize() const
{
return QSize(_indicatorSize, _indicatorSize);
}
void
WebStyle::drawIndicator
(
QPainter * p,
int x,
int y,
int w,
int h,
const QColorGroup & g,
int state,
bool down,
bool enabled
)
{
p->save();
p->fillRect(x, y, w, h, g.background());
if (enabled)
{
p->setPen(down ? g.highlight() : contrastingForeground(g.dark(), g.background()));
}
else
{
g.mid();
}
p->drawRect(x, y, w, h);
if (state != QButton::Off)
{
p->fillRect(x + 2, y + 2, w - 4, h - 4, enabled ? g.highlight() : g.mid());
if (state == QButton::NoChange)
{
p->fillRect(x + 4, y + 4, w - 8, h - 8, g.background());
}
}
p->restore();
}
QSize
WebStyle::exclusiveIndicatorSize() const
{
- return QSize(_indicatorSize, _indicatorSize);
+ return QSize(_indicatorSize+2, _indicatorSize+2);
}
void
WebStyle::drawExclusiveIndicator
(
QPainter * p,
int x,
int y,
int w,
int h,
const QColorGroup & g,
bool on,
bool down,
bool enabled
)
{
p->save();
p->fillRect(x, y, w, h, g.background());
if (enabled)
{
p->setPen(down ? g.highlight() : contrastingForeground(g.dark(), g.background()));
}
else
{
p->setPen(g.mid());
}
p->setBrush(g.brush(QColorGroup::Background));
// Avoid misshapen ellipses. Qt or X bug ? Who knows...
if (0 == w % 2)
--w;
if (0 == h % 2)
--h;
p->drawEllipse(x, y, w, h);
if (on)
{
p->setPen(enabled ? g.highlight() : g.mid());
p->setBrush(enabled ? g.highlight() : g.mid());
p->drawEllipse(x + 3, y + 3, w - 6, h - 6);
}
p->restore();
}
void
WebStyle::drawIndicatorMask
(
QPainter * p,
int x,
int y,
int w,
int h,
int /* state */
)
{
p->fillRect(x, y, w, h, Qt::color1);
}
void
WebStyle::drawExclusiveIndicatorMask
(
QPainter * p,
int x,
int y,
int w,
int h,
bool /* on */
)
{
if (0 == w % 2)
--w;
if (0 == h % 2)
--h;
p->setPen(Qt::color1);
p->setBrush(Qt::color1);
p->drawEllipse(x, y, w, h);
}
void
WebStyle::drawComboButton
(
QPainter * p,
int x,
int y,
int w,
int h,
const QColorGroup & g,