summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index e6d8310..4a65952 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1,91 +1,93 @@
/*-
* Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
*/
//
// (c) 2002 Robert 'sandman' Griebl
//
#ifndef INCLUDE_MENUITEM_DEF
#define INCLUDE_MENUITEM_DEF
#endif
#include <qmenudata.h>
#include "liquid.h"
//#include "liquiddeco.h"
#include <qapplication.h>
#include <qpe/config.h>
#include "effects.h"
#include <qpalette.h>
#include <qbitmap.h>
#include <qtabbar.h>
#include <qpopupmenu.h>
#include <qobjectlist.h>
#include <qimage.h>
#include <qtimer.h>
#include <qpixmapcache.h>
#include <qradiobutton.h>
#include <qcombobox.h>
#include <qdrawutil.h>
#include <qwidgetlist.h>
#include <qtoolbutton.h>
#include <qheader.h>
#include <unistd.h>
#include <qmenubar.h>
#include <qprogressbar.h>
#include <qlineedit.h>
+#include <qlistbox.h>
#include <stdio.h>
#include "htmlmasks.h"
#include "embeddata.h"
+
typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
QColorGroup &, bool, bool);
QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
{
QImage img(pix.convertToImage());
QImageEffect::fade(img, 0.9, color);
int x, y;
int r, g, b;
for(y=0; y < img.height(); y+=3){
unsigned int *data = (unsigned int *) img.scanLine(y);
for(x=0; x < img.width(); ++x){
r = qRed(data[x]);
g = qGreen(data[x]);
b = qBlue(data[x]);
if(r-10)
r-=10;
if(g-10)
g-=10;
if(b-10)
b-=10;
data[x] = qRgb(r, g, b);
}
}
pix.convertFromImage(img);
}
TransMenuHandler::TransMenuHandler(QObject *parent)
: QObject(parent)
{
pixDict.setAutoDelete(true);
reloadSettings();
}
void TransMenuHandler::reloadSettings()
{
pixDict.clear();
Config config ( "qpe" );
config. setGroup ( "Liquid-Style" );
type = config. readNumEntry("Type", TransStippleBg);
color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
opacity = config. readNumEntry("Opacity", 10);
if ( opacity < -20 )
@@ -1363,97 +1365,98 @@ void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h)
else{
int x2 = x+w-1;
int y2 = y+h-1;
int bx2 = htmlBtnMaskBmp.width()-1;
int by2 = htmlBtnMaskBmp.height()-1;
p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl
p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr
p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl
p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br
// fills
p->fillRect(10, 0, w-20, 10, Qt::color1); // top
p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
p->fillRect(0, 10, w, h-20, Qt::color1); // middle
}
}
void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken,
const QBrush */*fill*/)
{
if(currentHeader && p->device() == currentHeader){
int id = currentHeader->sectionAt(x);
bool isHeaderHover = id != -1 && id == headerHoverID;
drawClearBevel(p, x, y, w, h, sunken ?
g.button() : isHeaderHover ? g.button().light(110) :
g.background(), g.background());
}
else
drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(),
g.background());
}
QRect LiquidStyle::buttonRect(int x, int y, int w, int h)
{
return(QRect(x+5, y+5, w-10, h-10));
}
void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h,
const QColorGroup &g, bool sunken,
bool edit, bool, const QBrush *)
{
bool isActive = false;
if (( painter->device()->devType() == QInternal::Widget ) &&
(
( qApp-> focusWidget ( ) == painter-> device ( )) ||
(
edit &&
((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) &&
- ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( ))
+ ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( ) ||
+ qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->listBox ( ))
)
)
) {
isActive = true;
}
bool isMasked = false;
if(painter->device()->devType() == QInternal::Widget)
isMasked = ((QWidget*)painter->device())->autoMask();
// TODO: Do custom code, don't just call drawRoundButton into a pixmap
QPixmap tmpPix(w, h);
QPainter p(&tmpPix);
drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false,
sunken, false, isMasked);
if(!isActive){
p.setClipRect(0, 0, w-17, h);
drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false,
sunken, false, isMasked);
}
p.end();
int x2 = x+w-1;
int y2 = y+h-1;
int bx2 = btnMaskBmp.width()-1;
int by2 = btnMaskBmp.height()-1;
QBitmap btnMask(w, h);
QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
p.begin(&btnMask);
p.fillRect(0, 0, w, h, Qt::color0);
p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl
p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr
p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl
p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br
// fills
p.fillRect(10, 0, w-20, 10, Qt::color1); // top
p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
p.fillRect(0, 10, w, h-20, Qt::color1); // middle
p.end();
tmpPix.setMask(btnMask);
painter->drawPixmap(x, y, tmpPix);
painter->setPen(g.button().dark(120));
painter->drawLine(x2-16, y+1, x2-16, y2-1);
if(edit){
painter->setPen(g.mid());
painter->drawRect(x+8, y+2, w-25, h-4);