author | sandman <sandman> | 2002-07-01 09:41:55 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-07-01 09:41:55 (UTC) |
commit | 05d74acac3af056bfd784c6f2b7f72d313ea64bc (patch) (side-by-side diff) | |
tree | 8138f495cdd08fa249bd429ddefc36df26b12a79 | |
parent | d538fa9811906117a3ea68e3d434a1de7f46fc67 (diff) | |
download | opie-05d74acac3af056bfd784c6f2b7f72d313ea64bc.zip opie-05d74acac3af056bfd784c6f2b7f72d313ea64bc.tar.gz opie-05d74acac3af056bfd784c6f2b7f72d313ea64bc.tar.bz2 |
- Fix a bug in the original liquid regarding slider handles and bg
pixmaps (volume-applet, reported by Harlekin)
- Fix some "unused variable" compiler warnings
- Regenerated QPL diff
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 25 | ||||
-rw-r--r-- | noncore/styles/liquid/opie-liquid.diff | 100 |
2 files changed, 95 insertions, 30 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 9a7d2dd..313d52c 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp @@ -1782,305 +1782,304 @@ void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin, maxLength = length - b*2 - buttonDim*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 ); pos = (sb->orientation() == QScrollBar::Horizontal)? p.x() : p.y(); if ( pos < sliderMin ) return SubLine; if ( pos < sliderStart ) return SubPage; if ( pos < sliderStart + sliderLength ) return Slider; if ( pos < sliderMax + sliderLength) return AddPage; if(pos > sliderMax + sliderLength + 16) return AddLine; return SubLine; } #define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) QSize LiquidStyle::exclusiveIndicatorSize() const { return(QSize(16, 16)); } -void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, - int h, const QColorGroup &g, bool on, +void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, + int /*h*/, const QColorGroup &/*g*/, bool on, bool down, bool) { bool isHover = highlightWidget == p->device(); bool isMasked = p->device() && p->device()->devType() == QInternal::Widget && ((QWidget*)p->device())->autoMask(); if(isMasked){ if(on || down){ p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) : *getPixmap(HTMLRadioDown)); } else p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) : *getPixmap(HTMLRadio)); } else{ if(on || down){ p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) : *getPixmap(RadioOn)); } else p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) : *getPixmap(RadioOff)); } } void LiquidStyle::drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w, int h, bool) { p->fillRect(x, y, w, h, Qt::color0); p->setPen(Qt::color1); p->drawPixmap(x, y, *getPixmap(RadioOn)->mask()); } QSize LiquidStyle::indicatorSize() const { return(QSize(20, 22)); } -void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, int state, bool down, bool) +void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, + const QColorGroup &/*g*/, int state, bool /*down*/, bool) { bool isHover = highlightWidget == p->device(); bool isMasked = p->device() && p->device()->devType() == QInternal::Widget && ((QWidget*)p->device())->autoMask(); if(isMasked){ if(state != QButton::Off){ p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) : *getPixmap(HTMLCBDown)); } else p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) : *getPixmap(HTMLCB)); } else{ if(state != QButton::Off){ p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) : *getPixmap(CBDown)); /* Todo - tristate if(state == QButton::On){ p->setPen(Qt::black); p->drawPixmap(3, 3, xBmp); } else{ p->setPen(g.dark()); p->drawRect(x+2, y+2, w-4, h-4); p->setPen(Qt::black); p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2); p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2); p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2); }*/ } else p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB)); } } -void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, - int state) +void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, + int /*state*/) { // needed for some reason by KHtml, even tho it's all filled ;P p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); } void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, Orientation orient, + const QColorGroup &/*g*/, Orientation orient, bool, bool) { QWidget *parent = (QWidget *)p->device(); p->setBrushOrigin(parent->pos()); - p->fillRect(x, y, w, h, - QApplication::palette().active().brush(QColorGroup::Background)); + parent->erase(x, y, w, h); p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : *getPixmap(VSlider)); } -void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, +void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, Orientation orient, bool, bool) { p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : *getPixmap(VSlider)->mask()); } int LiquidStyle::sliderLength() const { return(10); } #define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x, int y, int w, int h, const QColorGroup &g, bool enabled, const QBrush *) { 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}; 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}; 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}; 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}; p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid()); if(w > 8){ x = x + (w-8)/2; y = y + (h-8)/2; } QPointArray a; switch(type){ case Qt::UpArrow: a.setPoints(QCOORDARRLEN(u_arrow), u_arrow); break; case Qt::DownArrow: a.setPoints(QCOORDARRLEN(d_arrow), d_arrow); break; case Qt::LeftArrow: a.setPoints(QCOORDARRLEN(l_arrow), l_arrow); break; default: a.setPoints(QCOORDARRLEN(r_arrow), r_arrow); break; } a.translate(x, y); p->drawLineSegments(a); } void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, - QMenuItem *mi, QColorGroup &g, bool enabled, bool active ) + QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) { x -= 2; // Bug in Qt/E y -= 2; w += 2; h += 2; p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background)); w -= 2; if(menuHandler->useShadowText()){ QColor shadow; if(p->device() && p->device()->devType() == QInternal::Widget && ((QWidget *)p->device())->inherits("QMenuBar")){ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : g.background().dark(130); } else shadow = g.background().dark(130); if(active){ drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); QApplication::style().drawItem(p, x+1, y+1, w, h, AlignCenter|ShowPrefix|DontClip|SingleLine, g, mi->isEnabled(), NULL, mi->text(), -1, &shadow); QApplication::style().drawItem(p, x, y, w, h, AlignCenter|ShowPrefix|DontClip|SingleLine, g, mi->isEnabled(), NULL, mi->text(), -1, &g.text()); } else{ QApplication::style().drawItem(p, x+1, y+1, w, h, AlignCenter|ShowPrefix|DontClip|SingleLine, g, mi->isEnabled(), NULL, mi->text(), -1, &shadow); QApplication::style().drawItem(p, x, y, w, h, AlignCenter|ShowPrefix|DontClip|SingleLine, g, mi->isEnabled(), NULL, mi->text(), -1, &g.text()); } } else{ if(active) drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); QApplication::style().drawItem(p, x, y, w, h, AlignCenter|ShowPrefix|DontClip|SingleLine, g, mi->isEnabled(), NULL, mi->text(), -1, &g.text()); } } void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, int lineWidth, - const QBrush * fill) + const QColorGroup &g, int /*lineWidth*/, + const QBrush * /*fill*/) { QColor c; switch(menuHandler->transType()){ case None: case StippledBg: case TransStippleBg: c = g.background(); break; case StippledBtn: case TransStippleBtn: c = g.button(); break; default: c = menuHandler->bgColor(); } p->setPen(c.dark(140)); p->drawRect(x, y, w, h); p->setPen(c.light(120)); p->drawRect(x+1, y+1, w-2, h-2); } void LiquidStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, const QPalette& pal, bool act, bool enabled, int x, int y, int w, int h) { static const int motifItemFrame = 2; static const int motifItemHMargin = 3; static const int motifItemVMargin = 2; static const int motifArrowHMargin = 6; static const int windowsRightBorder = 12; maxpmw = QMAX( maxpmw, 20 ); bool dis = !enabled; QColorGroup itemg = dis ? pal.disabled() : pal.active(); int checkcol = maxpmw; if(act){ // FIXME drawClearBevel(p, x, y, w, h, itemg.button(), itemg.background()); } //else if(((QWidget*)p->device())->backgroundPixmap()){ // p->drawPixmap(x, y, *((QWidget*)p->device())->backgroundPixmap(), // x, y, w, h); //} diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff index ef7300d..bcbdc8d 100644 --- a/noncore/styles/liquid/opie-liquid.diff +++ b/noncore/styles/liquid/opie-liquid.diff @@ -1,54 +1,54 @@ This is a patch to mosfet's liquid 0.7. Features: - Qt-only - works with Qt/E on QPE/OPIE ---- - Sun Jun 30 22:38:02 2002 +--- - Mon Jul 1 11:38:05 2002 +++ liquid.h Mon Jun 24 19:07:45 2002 @@ -2,7 +2,7 @@ #define LIQUID_STYLE_H -#include <kstyle.h> +#include <qwindowsstyle.h> #include <qpainter.h> #include <qdrawutil.h> #include <qpalette.h> @@ -20,7 +20,7 @@ * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. */ -class KPixmap; +class QPixmap; #define BITMAP_ITEMS 41 #define LIQUID_MENU_CHANGE 667 @@ -50,24 +50,22 @@ ~TransMenuHandler(){;} void reloadSettings(); int transType(){return(type);} - KPixmap *pixmap(WId id){return(pixDict.find(id));} + QPixmap *pixmap(WId id){return(pixDict.find(id));} const QColor& textColor(){return(fgColor);} const QColor& bgColor(){return(color);} bool useShadowText(){return(shadowText);} -protected slots: - void slotKIPCMessage(int id, int arg); protected: bool eventFilter(QObject *obj, QEvent *ev); - void stripePixmap(KPixmap &pix, const QColor &color); + void stripePixmap(QPixmap &pix, const QColor &color); QColor color, fgColor; int opacity; int type; bool shadowText; - QIntDict<KPixmap>pixDict; + QIntDict<QPixmap>pixDict; }; -class LiquidStyle : public KStyle +class LiquidStyle : public QWindowsStyle { friend class TransMenuHandler; public: @@ -57,98 +57,98 @@ Features: void drawSliderMask(QPainter *p, int x, int y, int w, int h, Orientation orient, bool, bool); - void drawKToolBar(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, KToolBarPos type, - QBrush *fill=NULL); - void drawKBarHandle(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, - KToolBarPos type, QBrush *fill=NULL); - void drawKMenuBar(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool macMode, - QBrush *fill=NULL); - void drawKToolBarButton(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool sunken=false, - bool raised = true, bool enabled = true, - bool popup = false, - KToolButtonType icontext = Icon, - const QString& btext=QString::null, - const QPixmap *icon=NULL, - QFont *font=NULL, QWidget *btn=NULL); - void drawKMenuItem(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool active, - QMenuItem *item, QBrush *fill=NULL); + void drawMenuBarItem(QPainter *p, int x, int y, int w, int h, + QMenuItem *mi, QColorGroup &g, bool enabled, bool active ); + void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw, int tab, QMenuItem *mi, const QPalette &pal, bool act, bool enabled, int x, int y, int w, int h); int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm); - void drawKProgressBlock(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, QBrush *fill); void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, const QColor *pen, bool atBorder); int defaultFrameWidth() const {return(2);} @@ -167,12 +146,6 @@ void drawToolButton(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, const QBrush *fill); - void drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, QBrush *); - void drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, - const QString &title, bool active, - QPixmap *icon, QBrush *fill); // for repainting toolbuttons when the toolbar is resized bool eventFilter(QObject *obj, QEvent *ev); void drawSliderGroove(QPainter * p, int x, int y, int w, int h, ---- - Sun Jun 30 22:38:02 2002 -+++ liquid.cpp Sun Jun 30 22:37:56 2002 +--- - Mon Jul 1 11:38:05 2002 ++++ liquid.cpp Mon Jul 1 03:45:28 2002 @@ -10,12 +10,10 @@ #include <qmenudata.h> #include "liquid.h" -#include <kapp.h> -#include <kglobal.h> -#include <kconfig.h> -#include <kdrawutil.h> -#include <kglobalsettings.h> -#include <kpixmapeffect.h> +#include "liquiddeco.h" +#include <qapplication.h> +#include <qpe/config.h> +#include "effects.h" #include <qpalette.h> #include <qbitmap.h> #include <qtabbar.h> @@ -25,28 +23,29 @@ #include <qtimer.h> #include <qpixmapcache.h> #include <qradiobutton.h> -#include <kimageeffect.h> -#include <ktoolbar.h> +#include <qcombobox.h> #include <qdrawutil.h> #include <qwidgetlist.h> #include <qtoolbutton.h> #include <qheader.h> #include <unistd.h> -#include <klocale.h> -#include <kiconloader.h> -#include <kmenubar.h> -#include <kipc.h> +#include <qmenubar.h> -#include <X11/X.h> -#include <X11/Xlib.h> + +#include <stdio.h> #include "htmlmasks.h" #include "embeddata.h" -void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color) +typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, + QColorGroup &, bool, bool); + +QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); @@ -607,164 +607,219 @@ Features: - btn->repaint(false); - } - else if(ev->type() == QEvent::Leave){ - highlightWidget = NULL; - btn->repaint(false); - } - - } - else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || - obj->isA("AppletHandle")){ + else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ QWidget *btn = (QWidget *)obj; if(ev->type() == QEvent::Enter){ if(btn->isEnabled()){ @@ -1119,20 +1050,7 @@ } } } - else if(obj->inherits("TaskContainer")){ - QButton *btn = (QButton *)obj; - QPalette pal = btn->palette(); - if(ev->type() == QEvent::Enter){ - pal.setColor(QColorGroup::Background, pal.active().button().light(110)); - btn->setPalette(pal); - } - else if(ev->type() == QEvent::Leave){ - pal.setColor(QColorGroup::Background, - QApplication::palette().active().background()); - btn->setPalette(pal); - } - } - else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ + else if(obj->inherits("QToolButton")){ QToolButton *btn = (QToolButton *)btn; if(!btn->autoRaise()){ if(btn->isEnabled()){ @@ -1340,11 +1258,6 @@ QColorGroup g = btn->colorGroup(); - QColor testColor; - if(btn->parent() && btn->parent()->isWidgetType()){ - testColor = p->backgroundColor(); // remove me - } - //int dw = buttonDefaultIndicatorWidth(); if(btn->hasFocus() || btn->isDefault()){ QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); -@@ -2065,203 +1978,24 @@ +@@ -1914,8 +1827,8 @@ + return(QSize(16, 16)); + } + +-void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, +- int h, const QColorGroup &g, bool on, ++void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, ++ int /*h*/, const QColorGroup &/*g*/, bool on, + bool down, bool) + { + bool isHover = highlightWidget == p->device(); +@@ -1957,8 +1870,8 @@ + return(QSize(20, 22)); + } + +-void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, +- const QColorGroup &g, int state, bool down, bool) ++void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, ++ const QColorGroup &/*g*/, int state, bool /*down*/, bool) + { + bool isHover = highlightWidget == p->device(); + bool isMasked = p->device() && p->device()->devType() == QInternal::Widget +@@ -1996,8 +1909,8 @@ + } + } + +-void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, +- int state) ++void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, ++ int /*state*/) + { + // needed for some reason by KHtml, even tho it's all filled ;P + p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); +@@ -2005,18 +1918,17 @@ + } + + void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, +- const QColorGroup &g, Orientation orient, ++ const QColorGroup &/*g*/, Orientation orient, + bool, bool) + { + QWidget *parent = (QWidget *)p->device(); + p->setBrushOrigin(parent->pos()); +- p->fillRect(x, y, w, h, +- QApplication::palette().active().brush(QColorGroup::Background)); ++ parent->erase(x, y, w, h); + p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : + *getPixmap(VSlider)); + } + +-void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, ++void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, + Orientation orient, bool, bool) + { + p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : +@@ -2065,203 +1977,24 @@ p->drawLineSegments(a); } -void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, KToolBarPos, - QBrush *) -{ - p->setPen(g.button().dark(120)); - int x2 = x+w-1; - int y2 = y+h-1; - p->drawLine(x+1, y, x2-1, y); - p->drawLine(x+1, y2, x2-1, y2); - p->drawLine(x, y+1, x, y2-1); - p->drawLine(x2, y+1, x2, y2-1); - - p->setPen(g.background()); - p->drawPoint(x, y); - p->drawPoint(x2, y); - p->drawPoint(x, y2); - p->drawPoint(x2, y2); - - - - // p->drawRect(x, y, w, h); - QPixmap *pix = bevelFillDict.find(g.button().rgb()); - if(!pix){ - int h, s, v; - g.button().hsv(&h, &s, &v); - pix = new QPixmap(*bevelFillPix); - adjustHSV(*pix, h, s, v); - bevelFillDict.insert(g.button().rgb(), pix); - } - - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix); -} - -void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool mac, QBrush *) -{ - if(p->device() && p->device()->devType() == QInternal::Widget && - ((KMenuBar *)p->device())->isTopLevelMenu()){ - p->setPen(Qt::black); - p->drawRect(x, y, w, h); - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix); - // left - p->drawLine(x+1, y+1, x+1, y+5); - p->drawLine(x+2, y+1, x+2, y+3); - p->drawLine(x+3, y+1, x+3, y+2); - p->drawLine(x+4, y+1, x+6, y+1); - // right - int x2 = x+w-1; - p->drawLine(x2-1, y+1, x2-1, y+5); - p->drawLine(x2-2, y+1, x2-2, y+3); - p->drawLine(x2-3, y+1, x2-3, y+2); - p->drawLine(x2-4, y+1, x2-6, y+1); - } - else{ - qDrawShadePanel(p, x, y, w, h, g, false, 1, - &g.brush(QColorGroup::Background)); - } - -} -void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, KToolBarPos, QBrush *) +void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, -+ QMenuItem *mi, QColorGroup &g, bool enabled, bool active ) ++ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) { - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); -} + x -= 2; // Bug in Qt/E + y -= 2; + w += 2; + h += 2; -void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool sunken, - bool raised, bool enabled, bool popup, - KToolButtonType icontext, - const QString& btext, const QPixmap *pixmap, - QFont *font, QWidget *btn) -{ - int dx, dy; - - QFontMetrics fm(*font); - - QToolBar* toolbar = 0; - if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar")) - toolbar = static_cast<QToolBar*>(btn->parent()); - - --w, --h; - if(sunken) - ++x, ++y; - - QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) : - g.background()); - drawClearBevel(p, x, y, w, h, btnColor, g.background()); - - p->setPen(g.text()); - - if (icontext == Icon){ // icon only - if (pixmap){ - dx = ( w - pixmap->width() ) / 2; - dy = ( h - pixmap->height() ) / 2; - if ( sunken ) - { - ++dx; - ++dy; - } - p->drawPixmap( x+dx, y+dy, *pixmap ); - } - } - else if (icontext == IconTextRight){ // icon and text (if any) - if (pixmap){ - dx = 4; @@ -821,189 +876,200 @@ Features: - } - p->drawPixmap( x+dx, y+dy, *pixmap ); - } - if (!btext.isNull()){ - int tf = AlignBottom|AlignHCenter; - dy= pixmap->height(); - dx = 2; - if ( sunken ){ - ++dx; - ++dy; - } - if (font) - p->setFont(*font); - if(raised) - p->setPen(KGlobalSettings::toolBarHighlightColor()); - p->drawText(x, y, w, h-3, tf, btext); - } - } - if (popup){ - if (enabled) - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, - g, true); - else - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, - 0, 0, g, false); - } -} + p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background)); - -void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool active, QMenuItem *mi, - QBrush *) -{ - if ( p->font() == KGlobalSettings::generalFont() ) - p->setFont( KGlobalSettings::menuFont() ); + w -= 2; if(menuHandler->useShadowText()){ QColor shadow; if(p->device() && p->device()->devType() == QInternal::Widget && - ((QWidget *)p->device())->inherits("KMenuBar")){ - shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : + ((QWidget *)p->device())->inherits("QMenuBar")){ + shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : g.background().dark(130); } else -@@ -2336,8 +2070,6 @@ +@@ -2300,8 +2033,8 @@ + } + + void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, +- const QColorGroup &g, int lineWidth, +- const QBrush * fill) ++ const QColorGroup &g, int /*lineWidth*/, ++ const QBrush * /*fill*/) + { + QColor c; + switch(menuHandler->transType()){ +@@ -2336,8 +2069,6 @@ maxpmw = QMAX( maxpmw, 20 ); - if ( p->font() == KGlobalSettings::generalFont() ) - p->setFont( KGlobalSettings::menuFont() ); bool dis = !enabled; QColorGroup itemg = dis ? pal.disabled() : pal.active(); -@@ -2363,7 +2095,7 @@ +@@ -2363,7 +2094,7 @@ p->fillRect(x, y, w, h, menuBrush); } else{ - KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); + QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); if(pix) p->drawPixmap(x, y, *pix, x, y, w, h); } -@@ -2508,25 +2240,6 @@ +@@ -2508,25 +2239,6 @@ return h; } -void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, QBrush *fill) -{ - p->setPen(g.button().dark(130)); - p->drawRect(x, y, w, h); - p->setPen(g.button().light(120)); - p->drawRect(x+1, y+1, w-2, h-2); - if(w >= 4 && h >= 4){ - QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); - if(!pix){ - int h, s, v; - g.button().dark(120).hsv(&h, &s, &v); - pix = new QPixmap(*bevelFillPix); - adjustHSV(*pix, h, s, v); - bevelFillDict.insert(g.button().dark(120).rgb(), pix); - } - p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); - } -} void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, const QColor *c, -@@ -2540,25 +2253,25 @@ +@@ -2540,25 +2252,25 @@ return; } else{ - KStyle::drawFocusRect(p, r, g, c, atBorder); + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); } } else - KStyle::drawFocusRect(p, r, g, c, atBorder); + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); } void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) { mnu->installEventFilter(menuHandler); - KStyle::polishPopupMenu(mnu); + QWindowsStyle::polishPopupMenu(mnu); } void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, bool selected) { if(tabBar->shape() != QTabBar::RoundedAbove){ - KStyle::drawTab(p, tabBar, tab, selected); + QWindowsStyle::drawTab(p, tabBar, tab, selected); return; } QPixmap tilePix; -@@ -2671,7 +2384,7 @@ +@@ -2671,7 +2383,7 @@ vFrame = 8; // was 10 } else - KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); + QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); } -@@ -2699,7 +2412,7 @@ +@@ -2699,7 +2411,7 @@ p->drawLine(x+1, y+1, x+1, y2-1); } else if(lineWidth != 2 || !sunken) - KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); + QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); else{ QPen oldPen = p->pen(); int x2 = x+w-1; -@@ -2726,105 +2439,6 @@ +@@ -2726,105 +2438,6 @@ } } -void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, QBrush *) -{ - p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); - drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? - g.button().light(120) : g.button(), g.button()); - /* - if(h > w){ - int y2 = y+h-1; - - p->setPen(g.light()); - - p->drawLine(x+1, y+2, x+1, y2-2); - p->drawLine(x+4, y+2, x+4, y2-2); - - p->setPen(g.dark()); - p->drawLine(x+2, y+2, x+2, y2-2); - p->drawLine(x+5, y+2, x+5, y2-2); - - } - else{ - int x2 = x+w-1; - - p->setPen(g.light()); - - p->drawLine(x+2, y+1, x2-2, y+1); - p->drawLine(x+2, y+4, x2-2, y+4); - - p->setPen(g.dark()); - p->drawLine(x+2, y+2, x2-2, y+2); - p->drawLine(x+2, y+5, x2-2, y+5); - }*/ - -} - -void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, - const QString &text, bool sunken, - QPixmap *pixmap, QBrush *) -{ - p->fillRect(x, y, w, h, g.brush(QColorGroup::Button)); - drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button()); - p->setPen(g.buttonText()); // Kicker doesn't set this ;-) - - if(text.isNull() && !pixmap) @@ -1019,149 +1085,149 @@ Features: - if ( pixmap && !pixmap->isNull() ) { - int dx = ( pxWidth - pixmap->width() ) / 2; - int dy = ( h - pixmap->height() ) / 2; - p->drawPixmap( br.x()+dx, dy, *pixmap ); - } - - QString s = text; - static const QString &modStr = KGlobal::staticQString( - QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]")); - - int modStrPos = s.find(modStr); - - if (-1 != modStrPos) { - - // +1 because we include a space after the closing brace. - s.remove(modStrPos, modStr.length()+1); - - QPixmap modPixmap = SmallIcon("modified"); - - int dx = (pxWidth - modPixmap.width()) / 2; - int dy = (h - modPixmap.height()) / 2; - - p->drawPixmap(br.x() + textPos + dx, dy, modPixmap); - - textPos += pxWidth; - } - - if (!s.isEmpty()){ - if (p->fontMetrics().width(s) > br.width() - textPos) { - - int maxLen = br.width() - textPos - p->fontMetrics().width("..."); - - while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen)) - s.truncate(s.length() - 1); - - s.append("..."); - } - - p->setPen(g.buttonText()); - - p->drawText(br.x()+ textPos, -1, w-textPos, h, - AlignLeft|AlignVCenter, s); - } - -} void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) { -@@ -2998,22 +2612,22 @@ +@@ -2998,22 +2611,22 @@ customBtnIconList.clear(); customBtnLabelList.clear(); - KConfig *config = KGlobal::config(); - QString oldGrp = config->group(); - config->setGroup("MosfetButtons"); +// KConfig *config = KGlobal::config(); +// QString oldGrp = config->group(); +// config->setGroup("MosfetButtons"); QStrList iconList, colorList; //temp, we store QPixmaps and QColors iconList.setAutoDelete(true); colorList.setAutoDelete(true); - config->readListEntry("Labels", customBtnLabelList); - config->readListEntry("Icons", iconList); - config->readListEntry("Colors", colorList); +// config->readListEntry("Labels", customBtnLabelList); +// config->readListEntry("Icons", iconList); +// config->readListEntry("Colors", colorList); const char *labelStr = customBtnLabelList.first(); const char *colorStr = colorList.first(); const char *iconStr = iconList.first(); - KIconLoader *ldr = KGlobal::iconLoader(); +// KIconLoader *ldr = KGlobal::iconLoader(); while(labelStr != NULL){ QColor *c = new QColor; c->setNamedColor(QString(colorStr)); -@@ -3022,7 +2636,7 @@ +@@ -3022,7 +2635,7 @@ QString tmpStr(iconStr); if(!tmpStr.isEmpty()){ QPixmap *pixmap = - new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); + new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); if(pixmap->isNull()){ delete pixmap; customBtnIconList.append(NULL); -@@ -3037,7 +2651,6 @@ +@@ -3037,7 +2650,6 @@ colorStr = colorList.next(); iconStr = iconList.next(); } - config->setGroup(oldGrp); } void LiquidStyle::applyCustomAttributes(QPushButton *btn) -@@ -3087,7 +2700,7 @@ +@@ -3087,7 +2699,7 @@ } } -#include "liquid.moc" +// #include "liquid.moc" ---- - Sun Jun 30 22:38:02 2002 +--- - Mon Jul 1 11:38:05 2002 +++ plugin.cpp Fri Jun 28 13:25:25 2002 @@ -1,29 +1,29 @@ #include "liquid.h" -#include <klocale.h> + extern "C" { - KStyle* allocate(); - int minor_version(); - int major_version(); - const char *description(); + QStyle* allocate ( ); + int minor_version ( ); + int major_version ( ); + const char *description ( ); } -KStyle* allocate() +QStyle* allocate ( ) { - return(new LiquidStyle); + return new LiquidStyle ( ); } -int minor_version() +int minor_version ( ) { - return(0); + return 0; } -int major_version() +int major_version ( ) { - return(1); + return 1; } -const char *description() +const char *description ( ) { - return(i18n("High performance liquid plugin").utf8()); + return "High Performance Liquid"; } |