author | sandman <sandman> | 2002-11-21 19:49:00 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-11-21 19:49:00 (UTC) |
commit | 440f1d4d439c83368a855355cdceda43660137f2 (patch) (unidiff) | |
tree | 1b7ffd5157d2c141b9f978d08e47699ea2d013ff /noncore/styles/liquid/liquid.cpp | |
parent | 0b0ebb03a1fc0a316b52ce147d87fa89d3b5af16 (diff) | |
download | opie-440f1d4d439c83368a855355cdceda43660137f2.zip opie-440f1d4d439c83368a855355cdceda43660137f2.tar.gz opie-440f1d4d439c83368a855355cdceda43660137f2.tar.bz2 |
- pixmaps in in menubars are now drawn (this is uncommon, but resulted in
blank icons in nethack for example)
- small size optimization
- updated the QPL diff
Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index ba732aa..c8f8d20 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp | |||
@@ -1984,76 +1984,86 @@ void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x, | |||
1984 | void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | 1984 | void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, |
1985 | QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) | 1985 | QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) |
1986 | { | 1986 | { |
1987 | if(active){ | 1987 | if(active){ |
1988 | x -= 2; // Bug in Qt/E | 1988 | x -= 2; // Bug in Qt/E |
1989 | y -= 2; | 1989 | y -= 2; |
1990 | w += 2; | 1990 | w += 2; |
1991 | h += 2; | 1991 | h += 2; |
1992 | } | 1992 | } |
1993 | 1993 | ||
1994 | QWidget *parent = (QWidget *)p->device(); | 1994 | QWidget *parent = (QWidget *)p->device(); |
1995 | p->setBrushOrigin(parent->pos()); | 1995 | p->setBrushOrigin(parent->pos()); |
1996 | parent->erase(x, y, w, h); | 1996 | parent->erase(x, y, w, h); |
1997 | 1997 | ||
1998 | if(menuHandler->useShadowText()){ | 1998 | if(menuHandler->useShadowText()){ |
1999 | QColor shadow; | 1999 | QColor shadow; |
2000 | if(p->device() && p->device()->devType() == QInternal::Widget && | 2000 | if(p->device() && p->device()->devType() == QInternal::Widget && |
2001 | ((QWidget *)p->device())->inherits("QMenuBar")){ | 2001 | ((QWidget *)p->device())->inherits("QMenuBar")){ |
2002 | shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : | 2002 | shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : |
2003 | g.background().dark(130); | 2003 | g.background().dark(130); |
2004 | } | 2004 | } |
2005 | else | 2005 | else |
2006 | shadow = g.background().dark(130); | 2006 | shadow = g.background().dark(130); |
2007 | 2007 | ||
2008 | QPixmap *dummy = 0; | ||
2009 | |||
2010 | if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) { | ||
2011 | dummy = new QPixmap ( mi-> pixmap ( )-> size ( )); | ||
2012 | QBitmap dummy_mask ( dummy-> size ( )); | ||
2013 | dummy_mask. fill ( color1 ); | ||
2014 | dummy-> setMask ( dummy_mask ); | ||
2015 | } | ||
2016 | |||
2008 | if(active){ | 2017 | if(active){ |
2009 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); | 2018 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); |
2010 | QApplication::style().drawItem(p, x+1, y+1, w, h, | 2019 | QApplication::style().drawItem(p, x+1, y+1, w, h, |
2011 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2020 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2012 | g, mi->isEnabled(), NULL, mi->text(), | 2021 | g, mi->isEnabled(), dummy, mi->text(), |
2013 | -1, &shadow); | 2022 | -1, &shadow); |
2014 | QApplication::style().drawItem(p, x, y, w, h, | 2023 | QApplication::style().drawItem(p, x, y, w, h, |
2015 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2024 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2016 | g, mi->isEnabled(), NULL, mi->text(), | 2025 | g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), |
2017 | -1, &g.text()); | 2026 | -1, &g.text()); |
2018 | } | 2027 | } |
2019 | else{ | 2028 | else{ |
2020 | QApplication::style().drawItem(p, x+1, y+1, w, h, | 2029 | QApplication::style().drawItem(p, x+1, y+1, w, h, |
2021 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2030 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2022 | g, mi->isEnabled(), NULL, mi->text(), | 2031 | g, mi->isEnabled(), dummy, mi->text(), |
2023 | -1, &shadow); | 2032 | -1, &shadow); |
2024 | QApplication::style().drawItem(p, x, y, w, h, | 2033 | QApplication::style().drawItem(p, x, y, w, h, |
2025 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2034 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2026 | g, mi->isEnabled(), NULL, mi->text(), | 2035 | g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), |
2027 | -1, &g.text()); | 2036 | -1, &g.text()); |
2028 | } | 2037 | } |
2038 | delete dummy; | ||
2029 | } | 2039 | } |
2030 | else{ | 2040 | else{ |
2031 | if(active) | 2041 | if(active) |
2032 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); | 2042 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); |
2033 | QApplication::style().drawItem(p, x, y, w, h, | 2043 | QApplication::style().drawItem(p, x, y, w, h, |
2034 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2044 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2035 | g, mi->isEnabled(), NULL, mi->text(), | 2045 | g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), |
2036 | -1, &g.text()); | 2046 | -1, &g.text()); |
2037 | } | 2047 | } |
2038 | } | 2048 | } |
2039 | 2049 | ||
2040 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, | 2050 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, |
2041 | const QColorGroup &g, int /*lineWidth*/, | 2051 | const QColorGroup &g, int /*lineWidth*/, |
2042 | const QBrush * /*fill*/) | 2052 | const QBrush * /*fill*/) |
2043 | { | 2053 | { |
2044 | QColor c; | 2054 | QColor c; |
2045 | switch(menuHandler->transType()){ | 2055 | switch(menuHandler->transType()){ |
2046 | case None: | 2056 | case None: |
2047 | case StippledBg: | 2057 | case StippledBg: |
2048 | case TransStippleBg: | 2058 | case TransStippleBg: |
2049 | c = g.background(); | 2059 | c = g.background(); |
2050 | break; | 2060 | break; |
2051 | case StippledBtn: | 2061 | case StippledBtn: |
2052 | case TransStippleBtn: | 2062 | case TransStippleBtn: |
2053 | c = g.button(); | 2063 | c = g.button(); |
2054 | break; | 2064 | break; |
2055 | default: | 2065 | default: |
2056 | c = menuHandler->bgColor(); | 2066 | c = menuHandler->bgColor(); |
2057 | } | 2067 | } |
2058 | p->setPen(c.dark(140)); | 2068 | p->setPen(c.dark(140)); |
2059 | p->drawRect(x, y, w, h); | 2069 | p->drawRect(x, y, w, h); |