summaryrefslogtreecommitdiff
path: root/noncore/styles/liquid/liquid.cpp
Side-by-side diff
Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp129
1 files changed, 68 insertions, 61 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 51814e7..77cf198 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -5,3 +5,3 @@
//
-// (c) 2002 Robert 'sandman' Griebl
+// (c) 2002 Robert 'sandman' Griebl
//
@@ -14,3 +14,3 @@
#include "liquid.h"
-#include "effects.h"
+#include "effects.h"
#include "htmlmasks.h"
@@ -101,3 +101,3 @@ void TransMenuHandler::reloadSettings()
opacity = 20;
-
+
shadowText = config. readBoolEntry("ShadowText", true);
@@ -139,6 +139,6 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
pixDict.insert(p->winId(), pix);
-
- if ( !p->inherits("QPopupMenu"))
+
+ if ( !p->inherits("QPopupMenu"))
p->setBackgroundPixmap(*pix);
-
+
QObjectList *ol = p-> queryList("QWidget");
@@ -146,5 +146,5 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
QWidget *wid = (QWidget *) it.current ( );
-
+
wid-> setBackgroundPixmap(*pix);
- wid-> setBackgroundOrigin(QWidget::ParentOrigin);
+ wid-> setBackgroundOrigin(QWidget::ParentOrigin);
}
@@ -156,6 +156,6 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
type == Custom){
-// owarn << "Deleting menu pixmap, width " << pixDict.find(p->winId())->width() << "" << oendl;
+// owarn << "Deleting menu pixmap, width " << pixDict.find(p->winId())->width() << "" << oendl;
pixDict.remove(p->winId());
- if ( !p->inherits("QPopupMenu"))
+ if ( !p->inherits("QPopupMenu"))
p->setBackgroundMode(QWidget::PaletteBackground);
@@ -165,3 +165,3 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
QWidget *wid = (QWidget *) it.current ( );
-
+
wid-> setBackgroundMode( QWidget::PaletteBackground );
@@ -175,3 +175,3 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
-
+
@@ -501,3 +501,3 @@ QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v,
if(img.isNull()){ // shouldn't happen, been tested
- owarn << "Invalid embedded label " << label << "" << oendl;
+ owarn << "Invalid embedded label " << label << "" << oendl;
return(NULL);
@@ -601,6 +601,6 @@ QPixmap* LiquidStyle::getPixmap(BitmapData item)
pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/);
- break;
+ break;
case TabFocus:
pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/);
- break;
+ break;
@@ -803,4 +803,4 @@ void LiquidStyle::polish(QWidget *w)
w->setBackgroundMode(QWidget::NoBackground);
- else if(w-> testWFlags(Qt::WType_Popup) &&
- !w->inherits("QListBox") &&
+ else if(w-> testWFlags(Qt::WType_Popup) &&
+ !w->inherits("QListBox") &&
( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) {
@@ -808,3 +808,3 @@ void LiquidStyle::polish(QWidget *w)
}
-
+
if(w->isTopLevel()){
@@ -812,3 +812,3 @@ void LiquidStyle::polish(QWidget *w)
}
-
+
if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) {
@@ -867,3 +867,3 @@ void LiquidStyle::polish(QWidget *w)
palette().active().brush(QColorGroup::Background).pixmap()){
- owarn << "No parent pixmap for child widget " << w->className() << "" << oendl;
+ owarn << "No parent pixmap for child widget " << w->className() << "" << oendl;
return;
@@ -880,3 +880,3 @@ void LiquidStyle::polish(QWidget *w)
if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
- w-> setBackgroundOrigin ( QWidget::ParentOrigin );
+ w-> setBackgroundOrigin ( QWidget::ParentOrigin );
else if ( w-> inherits("QFrame") )
@@ -899,3 +899,3 @@ void LiquidStyle::unPolish(QWidget *w)
w->setBackgroundMode(QWidget::PaletteButton);
- else if(w-> testWFlags(Qt::WType_Popup) &&
+ else if(w-> testWFlags(Qt::WType_Popup) &&
!w->inherits("QListBox") &&
@@ -961,11 +961,11 @@ void LiquidStyle::polish(QApplication *app)
app->setEffectEnabled(UI_FadeMenu, false);
-
+
qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
-
+
Config config ( "qpe" );
config. setGroup ( "Liquid-Style" );
-
-// if ( config. readBoolEntry ( "WinDecoration", true ))
+
+// if ( config. readBoolEntry ( "WinDecoration", true ))
// QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
-
+
flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
@@ -980,3 +980,3 @@ void LiquidStyle::unPolish(QApplication *app)
qt_set_draw_menu_bar_impl ( 0 );
-
+
// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
@@ -986,5 +986,5 @@ void LiquidStyle::unPolish(QApplication *app)
/* !! HACK !! Beware
- *
+ *
* TT forgot to make the QProgressBar widget styleable in Qt 2.x
- * So the only way to customize the drawing, is to intercept the
+ * So the only way to customize the drawing, is to intercept the
* paint event - since we have to use protected functions, we need
@@ -992,3 +992,3 @@ void LiquidStyle::unPolish(QApplication *app)
* in there.
- *
+ *
* - sandman
@@ -999,3 +999,3 @@ public:
HackProgressBar ( );
-
+
void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix )
@@ -1033,4 +1033,4 @@ public:
p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix);
-
- if ( progress ( )>= 0 && totalSteps ( ) > 0 ) {
+
+ if ( progress ( )>= 0 && totalSteps ( ) > 0 ) {
QString pstr;
@@ -1056,3 +1056,3 @@ public:
HackToolButton ( );
-
+
void paint ( QPaintEvent *ev )
@@ -1100,3 +1100,3 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
QToolButton *btn = (QToolButton *)obj;
- if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise ()
+ if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise ()
if(btn->isEnabled()){
@@ -1140,3 +1140,3 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
*/
- int x = 0;
+ int x = 0;
int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
@@ -1195,3 +1195,3 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
const QColorGroup &g = p-> colorGroup ( );
-
+
QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb());
@@ -1205,5 +1205,5 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
p-> paint ((QPaintEvent *) ev, g, pix );
- return true;
+ return true;
}
- }
+ }
return false ;
@@ -1305,3 +1305,7 @@ void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p)
mode = QIconSet::Active;
- QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode );
+ QPixmap pixmap;
+ if ( mode == QIconSet::Disabled )
+ pixmap = btn->iconSet()->pixmap( QIconSet::Automatic, mode );
+ else
+ pixmap = btn->iconSet()->pixmap();
int pixw = pixmap.width();
@@ -1313,3 +1317,3 @@ void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p)
}
-
+
if(act){
@@ -1407,3 +1411,3 @@ void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h,
edit &&
- ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) &&
+ ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) &&
( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( ) ||
@@ -1415,3 +1419,3 @@ void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h,
}
-
+
bool isMasked = false;
@@ -1419,3 +1423,3 @@ void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h,
isMasked = ((QWidget*)painter->device())->autoMask();
- // TODO: Do custom code, don't just call drawRoundButton into a pixmap
+ // TODO: Do custom code, don't just call drawRoundButton into a pixmap
QPixmap tmpPix(w, h);
@@ -1480,3 +1484,3 @@ QRect LiquidStyle::comboButtonFocusRect(int /*x*/, int /*y*/, int /*w*/, int /*h
return QRect ( );
-
+
// return(QRect(x+5, y+3, w-(h/3)-13, h-5));
@@ -1635,3 +1639,3 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
13, *getPixmap(HSBSliderMid));
- painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
+ painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
*getPixmap(HSBSliderBtm));
@@ -1642,3 +1646,3 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
*getPixmap(HSBSliderTop), 0, 0, m, 13);
- painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
+ painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
*getPixmap(HSBSliderBtm), 8-m, 0, m, 13);
@@ -1650,3 +1654,3 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2,
- sliderR.width()-2, 11,
+ sliderR.width()-2, 11,
*getPixmap(HSBSliderMid), 0, 1);
@@ -1978,5 +1982,5 @@ void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active )
-{
+{
if(active){
- x -= 2; // Bug in Qt/E
+ x -= 2; // Bug in Qt/E
y -= 2;
@@ -1985,3 +1989,3 @@ void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
}
-
+
QWidget *parent = (QWidget *)p->device();
@@ -1989,3 +1993,3 @@ void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
parent->erase(x, y, w, h);
-
+
if(menuHandler->useShadowText()){
@@ -2001,3 +2005,3 @@ void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
QPixmap *dummy = 0;
-
+
if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) {
@@ -2157,3 +2161,7 @@ static const int windowsRightBorder = 12;
mode = QIconSet::Active;
- QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode);
+ QPixmap pixmap;
+ if ( mode == QIconSet::Disabled )
+ pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode );
+ else
+ pixmap = mi->iconSet()->pixmap();
int pixw = pixmap.width();
@@ -2238,4 +2246,3 @@ int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi,
if (mi->iconSet())
- h = QMAX(mi->iconSet()->
- pixmap(QIconSet::Small, QIconSet::Normal).height(), h);
+ h = QMAX(mi->iconSet()->pixmap().height(), h);
@@ -2432,3 +2439,3 @@ void LiquidStyle::drawPanel(QPainter *p, int x, int y, int w, int h,
p->drawLine(x, y, x, y2);
-
+
p->setPen(g.midlight());
@@ -2490,3 +2497,3 @@ void LiquidStyle::intensity(QPixmap &pix, float percent)
(unsigned int *)image.colorTable();
-
+
bool brighten = (percent >= 0);
@@ -2494,3 +2501,3 @@ void LiquidStyle::intensity(QPixmap &pix, float percent)
percent = -percent;
-
+
if(brighten){ // keep overflow check out of loops
@@ -2511,3 +2518,3 @@ void LiquidStyle::intensity(QPixmap &pix, float percent)
}
-
+
if(brighten){ // same here