-rw-r--r-- | core/launcher/launchertab.cpp | 24 | ||||
-rw-r--r-- | core/settings/launcher/menusettings.cpp | 44 | ||||
-rw-r--r-- | libopie2/opieui/otabbar.cpp | 50 | ||||
-rw-r--r-- | libopie2/opieui/otabbar.h | 46 | ||||
-rw-r--r-- | libopie2/opieui/otabwidget.cpp | 1 | ||||
-rw-r--r-- | noncore/styles/flat/flat.cpp | 18 | ||||
-rw-r--r-- | noncore/styles/fresh/fresh.cpp | 18 | ||||
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 129 | ||||
-rw-r--r-- | noncore/styles/phase/phasestyle.cpp | 14 | ||||
-rw-r--r-- | noncore/styles/theme/othemestyle.cpp | 53 | ||||
-rw-r--r-- | noncore/styles/web/webstyle.cpp | 126 | ||||
-rw-r--r-- | noncore/styles/web/webstyle.h | 2 |
12 files changed, 338 insertions, 187 deletions
diff --git a/core/launcher/launchertab.cpp b/core/launcher/launchertab.cpp index 710f259..72ebf59 100644 --- a/core/launcher/launchertab.cpp +++ b/core/launcher/launchertab.cpp @@ -98,8 +98,8 @@ void LauncherTabBar::layoutTabs() available -= hiddenTabWidth + hframe - overlap; if ( t->iconSet() != 0 ) - available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); + available -= t->iconSet()->pixmap().width(); } if ( t->iconSet() != 0 ) - iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); + iw += t->iconSet()->pixmap().width(); required += iw; // As space gets tight, packed looks better than even. "10" must be at least 0. @@ -117,6 +117,6 @@ void LauncherTabBar::layoutTabs() int ih = 0; if ( t->iconSet() != 0 ) { - w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); - ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); + w += t->iconSet()->pixmap().width(); + ih = t->iconSet()->pixmap().height(); } int h = QMAX( fm.height(), ih ); @@ -135,6 +135,6 @@ void LauncherTabBar::layoutTabs() int ih = 0; if ( t->iconSet() != 0 ) { - w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); - ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); + w += t->iconSet()->pixmap().width(); + ih = t->iconSet()->pixmap().height(); } int h = QMAX( fm.height(), ih ); @@ -150,5 +150,5 @@ void LauncherTabBar::layoutTabs() int ih = 0; if ( t->iconSet() != 0 ) { - ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); + ih = t->iconSet()->pixmap().height(); } int h = QMAX( fm.height(), ih ); @@ -221,6 +221,6 @@ void LauncherTabBar::paint( QPainter * p, QTab * t, bool selected ) const int ih = 0; if ( t->iconSet() != 0 ) { - iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; - ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); + iw = t->iconSet()->pixmap().width() + 2; + ih = t->iconSet()->pixmap().height(); } int w = iw + p->fontMetrics().width( t->text() ) + 4; @@ -252,5 +252,9 @@ void LauncherTabBar::paintLabel( QPainter* p, const QRect&, if ( mode == QIconSet::Normal && has_focus ) mode = QIconSet::Active; - QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); + QPixmap pixmap; + if ( mode == QIconSet::Disabled ) + pixmap = t->iconSet()->pixmap( QIconSet::Automatic, mode ); + else + pixmap = t->iconSet()->pixmap(); int pixw = pixmap.width(); int pixh = pixmap.height(); diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp index 55bf358..29ce841 100644 --- a/core/settings/launcher/menusettings.cpp +++ b/core/settings/launcher/menusettings.cpp @@ -1,25 +1,25 @@ /* - This file is part of the OPIE Project + This file is part of the OPIE Project =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> - .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> - .>+-= - _;:, .> :=|. This file is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This file 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 General -..}^=.= = ; Public License for more details. -++= -. .` .: - : = ...= . :.=- You should have received a copy of the GNU - -. .:....=;==+<; General Public License along with this file; - -_. . . )=. = see the file COPYING. If not, write to the - -- :-=` Free Software Foundation, Inc., + .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> + .>+-= +_;:, .> :=|. This file is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This file 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 General +..}^=.= = ; Public License for more details. +++= -. .` .: +: = ...= . :.=- You should have received a copy of the GNU +-. .:....=;==+<; General Public License along with this file; + -_. . . )=. = see the file COPYING. If not, write to the + -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -106,5 +106,5 @@ void MenuSettings::init ( ) delete trans; name = iface-> name ( ); - icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); + icon = iface-> icon ( ). pixmap (); iface-> release ( ); lib-> unload ( ); diff --git a/libopie2/opieui/otabbar.cpp b/libopie2/opieui/otabbar.cpp index a62e18b..dc5df42 100644 --- a/libopie2/opieui/otabbar.cpp +++ b/libopie2/opieui/otabbar.cpp @@ -1,27 +1,27 @@ /* - This file is part of the Opie Project - - Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + This file is part of the Opie Project + + Copyright (c) 2002 Dan Williams <williamsdr@acm.org> =. .=l. - .>+-= - _;:, .> :=|. This program is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU Library General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This program 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. + .>+-= +_;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program 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, @@ -32,4 +32,8 @@ #include <opie2/otabbar.h> +#include <qpe/applnk.h> + +#include <stdio.h> + using namespace Opie::Ui; @@ -49,5 +53,5 @@ void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus mode = QIconSet::Active; } - QPixmap pixmap = t->iconset->pixmap( QIconSet::Small, mode ); + QPixmap pixmap = t->iconset->pixmap(); int pixw = pixmap.width(); int pixh = pixmap.height(); diff --git a/libopie2/opieui/otabbar.h b/libopie2/opieui/otabbar.h index 925ae96..1044bdd 100644 --- a/libopie2/opieui/otabbar.h +++ b/libopie2/opieui/otabbar.h @@ -1,31 +1,31 @@ /* - This file is part of the Opie Project - - Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + This file is part of the Opie Project + + Copyright (c) 2002 Dan Williams <williamsdr@acm.org> =. .=l. - .>+-= - _;:, .> :=|. This program is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU Library General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This program 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. + .>+-= +_;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program 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. - + */ diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp index 7333f5e..d617a9c 100644 --- a/libopie2/opieui/otabwidget.cpp +++ b/libopie2/opieui/otabwidget.cpp @@ -35,5 +35,4 @@ #include <opie2/otabbar.h> -#include <qpe/applnk.h> #include <qpe/config.h> diff --git a/noncore/styles/flat/flat.cpp b/noncore/styles/flat/flat.cpp index f3bacf9..c164ecc 100644 --- a/noncore/styles/flat/flat.cpp +++ b/noncore/styles/flat/flat.cpp @@ -374,5 +374,5 @@ void FlatStyle::drawPushButtonLabel( QPushButton *btn, QPainter *p ) if ( mode == QIconSet::Normal && btn->hasFocus() ) mode = QIconSet::Active; - QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); + QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Automatic, mode ); int pixw = pixmap.width(); int pixh = pixmap.height(); @@ -392,6 +392,6 @@ QRect FlatStyle::comboButtonRect( int x, int y, int w, int h) return QRect(x+2, y+2, w-4-13, h-4); } - - + + QRect FlatStyle::comboButtonFocusRect( int x, int y, int w, int h) { @@ -893,5 +893,5 @@ int FlatStyle::extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem* m int FlatStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm ) { -#ifndef QT_NO_MENUDATA +#ifndef QT_NO_MENUDATA int h = 0; if ( mi->isSeparator() ) // separator height @@ -903,5 +903,5 @@ int FlatStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFo if ( !mi->isSeparator() && mi->iconSet() != 0 ) { - h = QMAX( h, mi->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height() + 2*motifItemFrame ); + h = QMAX( h, mi->iconSet()->pixmap().height() + 2*motifItemFrame ); } if ( mi->custom() ) @@ -915,5 +915,5 @@ void FlatStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int bool act, bool enabled, int x, int y, int w, int h) { -#ifndef QT_NO_MENUDATA +#ifndef QT_NO_MENUDATA const QColorGroup & g = pal.active(); bool dis = !enabled; @@ -955,5 +955,9 @@ void FlatStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int if (act && !dis ) 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(); int pixh = pixmap.height(); diff --git a/noncore/styles/fresh/fresh.cpp b/noncore/styles/fresh/fresh.cpp index 831b620..856f68b 100644 --- a/noncore/styles/fresh/fresh.cpp +++ b/noncore/styles/fresh/fresh.cpp @@ -148,6 +148,6 @@ QRect FreshStyle::comboButtonRect( int x, int y, int w, int h) return QRect(x+1, y+1, w-2-14, h-2); } - - + + QRect FreshStyle::comboButtonFocusRect( int x, int y, int w, int h) { @@ -529,5 +529,5 @@ void FreshStyle::drawTab( QPainter *p, const QTabBar *tb, QTab *t, bool selected //do shading; will not work for pixmap brushes - QColor bg = tb->colorGroup().button(); + QColor bg = tb->colorGroup().button(); // int h,s,v; // bg.hsv( &h, &s, &v ); @@ -639,5 +639,5 @@ int FreshStyle::extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem* int FreshStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm ) { -#ifndef QT_NO_MENUDATA +#ifndef QT_NO_MENUDATA int h = 0; if ( mi->isSeparator() ) // separator height @@ -649,5 +649,5 @@ int FreshStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QF if ( !mi->isSeparator() && mi->iconSet() != 0 ) { - h = QMAX( h, mi->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height() + 2*motifItemFrame ); + h = QMAX( h, mi->iconSet()->pixmap().height() + 2*motifItemFrame ); } if ( mi->custom() ) @@ -661,5 +661,5 @@ void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int bool act, bool enabled, int x, int y, int w, int h) { -#ifndef QT_NO_MENUDATA +#ifndef QT_NO_MENUDATA const QColorGroup & g = pal.active(); bool dis = !enabled; @@ -703,5 +703,9 @@ void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int if (act && !dis ) 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(); int pixh = pixmap.height(); 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 @@ -4,5 +4,5 @@ // -// (c) 2002 Robert 'sandman' Griebl +// (c) 2002 Robert 'sandman' Griebl // @@ -13,5 +13,5 @@ #include "liquid.h" -#include "effects.h" +#include "effects.h" #include "htmlmasks.h" #include "embeddata.h" @@ -100,5 +100,5 @@ void TransMenuHandler::reloadSettings() else if ( opacity > 20 ) opacity = 20; - + shadowText = config. readBoolEntry("ShadowText", true); } @@ -138,14 +138,14 @@ 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"); for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { QWidget *wid = (QWidget *) it.current ( ); - + wid-> setBackgroundPixmap(*pix); - wid-> setBackgroundOrigin(QWidget::ParentOrigin); + wid-> setBackgroundOrigin(QWidget::ParentOrigin); } delete ol; @@ -155,8 +155,8 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) if(type == TransStippleBg || type == TransStippleBtn || 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); @@ -164,5 +164,5 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { QWidget *wid = (QWidget *) it.current ( ); - + wid-> setBackgroundMode( QWidget::PaletteBackground ); } @@ -174,5 +174,5 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) - + LiquidStyle::LiquidStyle() @@ -500,5 +500,5 @@ QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, img.detach(); if(img.isNull()){ // shouldn't happen, been tested - owarn << "Invalid embedded label " << label << "" << oendl; + owarn << "Invalid embedded label " << label << "" << oendl; return(NULL); } @@ -600,8 +600,8 @@ QPixmap* LiquidStyle::getPixmap(BitmapData item) case TabDown: pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/); - break; + break; case TabFocus: pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/); - break; + break; case CB: @@ -802,14 +802,14 @@ void LiquidStyle::polish(QWidget *w) if(w->inherits("QPopupMenu")) 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 )) { w->installEventFilter(menuHandler); } - + if(w->isTopLevel()){ return; } - + if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { w->installEventFilter(this); @@ -866,5 +866,5 @@ void LiquidStyle::polish(QWidget *w) if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 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; } @@ -879,5 +879,5 @@ 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") ) w->setBackgroundOrigin ( QWidget::WidgetOrigin ); @@ -898,5 +898,5 @@ void LiquidStyle::unPolish(QWidget *w) if(w->inherits("QPopupMenu")) w->setBackgroundMode(QWidget::PaletteButton); - else if(w-> testWFlags(Qt::WType_Popup) && + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox") && ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { @@ -960,13 +960,13 @@ void LiquidStyle::polish(QApplication *app) if(menuFade) 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 ); } @@ -979,5 +979,5 @@ void LiquidStyle::unPolish(QApplication *app) qt_set_draw_menu_bar_impl ( 0 ); - + // QApplication::qwsSetDecoration ( new QPEDecoration ( )); } @@ -985,11 +985,11 @@ 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 * to derive a "hack" class from QProgressBar and do the painting * in there. - * + * * - sandman */ @@ -998,5 +998,5 @@ class HackProgressBar : public QProgressBar { public: HackProgressBar ( ); - + void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix ) { @@ -1032,6 +1032,6 @@ public: if(bw >= 4 && h >= 4 && pix) p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix); - - if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { + + if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { QString pstr; pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); @@ -1055,5 +1055,5 @@ class HackToolButton : public QToolButton { public: HackToolButton ( ); - + void paint ( QPaintEvent *ev ) { @@ -1099,5 +1099,5 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) else if(obj->inherits("QToolButton")){ QToolButton *btn = (QToolButton *)obj; - if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise () + if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise () if(btn->isEnabled()){ highlightWidget = btn; @@ -1139,5 +1139,5 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) } */ - int x = 0; + int x = 0; int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; if(isRadio) @@ -1194,5 +1194,5 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) HackProgressBar *p = (HackProgressBar *) obj; const QColorGroup &g = p-> colorGroup ( ); - + QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); if(!pix){ @@ -1204,7 +1204,7 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) } p-> paint ((QPaintEvent *) ev, g, pix ); - return true; + return true; } - } + } return false ; } @@ -1304,5 +1304,9 @@ void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) if ( mode == QIconSet::Normal && btn->hasFocus() ) 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(); int pixh = pixmap.height(); @@ -1312,5 +1316,5 @@ void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) w -= pixw + 8; } - + if(act){ QFont font = btn->font(); @@ -1406,5 +1410,5 @@ 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 ( ) || qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->listBox ( )) @@ -1414,9 +1418,9 @@ void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h, 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 + // TODO: Do custom code, don't just call drawRoundButton into a pixmap QPixmap tmpPix(w, h); QPainter p(&tmpPix); @@ -1479,5 +1483,5 @@ 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)); } @@ -1634,5 +1638,5 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16, 13, *getPixmap(HSBSliderMid)); - painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, + painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, *getPixmap(HSBSliderBtm)); } @@ -1641,5 +1645,5 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, painter.drawPixmap(sliderR.x(), sliderR.y()+1, *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); } @@ -1649,5 +1653,5 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, sliderR.width(), 13); painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2, - sliderR.width()-2, 11, + sliderR.width()-2, 11, *getPixmap(HSBSliderMid), 0, 1); } @@ -1977,16 +1981,16 @@ void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x, 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; w += 2; h += 2; } - + QWidget *parent = (QWidget *)p->device(); p->setBrushOrigin(parent->pos()); parent->erase(x, y, w, h); - + if(menuHandler->useShadowText()){ QColor shadow; @@ -2000,5 +2004,5 @@ void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, QPixmap *dummy = 0; - + if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) { dummy = new QPixmap ( mi-> pixmap ( )-> size ( )); @@ -2156,5 +2160,9 @@ static const int windowsRightBorder = 12; if (!dis) 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(); int pixh = pixmap.height(); @@ -2237,6 +2245,5 @@ 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); h = QMAX(fm.height() + 4, h); @@ -2431,5 +2438,5 @@ void LiquidStyle::drawPanel(QPainter *p, int x, int y, int w, int h, p->drawLine(x, y, x2, y); p->drawLine(x, y, x, y2); - + p->setPen(g.midlight()); p->drawLine(x+1, y2-1, x2-1, y2-1); @@ -2489,9 +2496,9 @@ void LiquidStyle::intensity(QPixmap &pix, float percent) unsigned int *data = image.depth() > 8 ? (unsigned int *)image.bits() : (unsigned int *)image.colorTable(); - + bool brighten = (percent >= 0); if(percent < 0) percent = -percent; - + if(brighten){ // keep overflow check out of loops for(i=0; i < segColors; ++i){ @@ -2510,5 +2517,5 @@ void LiquidStyle::intensity(QPixmap &pix, float percent) } } - + if(brighten){ // same here for(i=0; i < pixels; ++i){ diff --git a/noncore/styles/phase/phasestyle.cpp b/noncore/styles/phase/phasestyle.cpp index 746354e..c2b9de8 100644 --- a/noncore/styles/phase/phasestyle.cpp +++ b/noncore/styles/phase/phasestyle.cpp @@ -391,5 +391,8 @@ void PhaseStyle::drawPushButtonLabel (QPushButton *button, QPainter *painter) { #endif - pixmap = button->iconSet()->pixmap(QIconSet::Small, mode); + if ( mode == QIconSet::Disabled ) + pixmap = button->iconSet()->pixmap( QIconSet::Automatic, mode ); + else + pixmap = button->iconSet()->pixmap(); if (button->text().isEmpty() && !button->pixmap()) { painter->drawPixmap(x+w/2 - pixmap.width()/2, @@ -570,6 +573,5 @@ int PhaseStyle::popupMenuItemHeight ( bool , } if ( mi->iconSet() ) - h = QMAX(h, mi->iconSet()-> - pixmap(QIconSet::Small, QIconSet::Normal ).height() + h = QMAX(h, mi->iconSet()->pixmap().height() + ITEMFRAME*2 ); } @@ -662,5 +664,9 @@ void PhaseStyle::drawPopupMenuItem ( QPainter * p, bool checkable, else mode = enabled ? QIconSet::Normal : QIconSet::Disabled; - 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(); QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); QRect cr(x, y, maxpmw, h ); diff --git a/noncore/styles/theme/othemestyle.cpp b/noncore/styles/theme/othemestyle.cpp index 98e7253..106d206 100644 --- a/noncore/styles/theme/othemestyle.cpp +++ b/noncore/styles/theme/othemestyle.cpp @@ -38,11 +38,11 @@ QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); /* !! 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 * to derive a "hack" class from QProgressBar and do the painting * in there. - * + * * - sandman */ @@ -51,5 +51,5 @@ class HackProgressBar : public QProgressBar { public: HackProgressBar ( ); - + void paint ( QPaintEvent *event, OThemeStyle *style ) { @@ -76,7 +76,7 @@ public: int perc = prog * 100 / total; - style-> drawProgressBar ( &p, x, y, w, h, colorGroup ( ), perc ); + style-> drawProgressBar ( &p, x, y, w, h, colorGroup ( ), perc ); - if ( progress ( ) >= 0 && totalSteps ( ) > 0 ) { + if ( progress ( ) >= 0 && totalSteps ( ) > 0 ) { QString pstr; pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); @@ -110,5 +110,5 @@ void OThemeStyle::polish( QPalette &p ) { oldPalette = p; - + QColor bg = oldPalette. color ( QPalette::Normal, QColorGroup::Background ); @@ -116,5 +116,5 @@ void OThemeStyle::polish( QPalette &p ) bg = bgcolor; - if ( isColor ( Background )) + if ( isColor ( Background )) bg = colorGroup ( oldPalette. active ( ), Background )-> background ( ); @@ -125,16 +125,16 @@ void OThemeStyle::polish( QPalette &p ) if ( fgcolor. isValid ( )) { - p. setColor ( QColorGroup::Foreground, fgcolor ); + p. setColor ( QColorGroup::Foreground, fgcolor ); p. setColor ( QColorGroup::ButtonText, fgcolor ); } if ( selfgcolor. isValid ( )) - p. setColor ( QColorGroup::HighlightedText, selfgcolor ); + p. setColor ( QColorGroup::HighlightedText, selfgcolor ); if ( selbgcolor. isValid ( )) - p. setColor ( QColorGroup::Highlight, selbgcolor ); - if ( winfgcolor. isValid ( )) - p. setColor ( QColorGroup::Text, winfgcolor ); + p. setColor ( QColorGroup::Highlight, selbgcolor ); + if ( winfgcolor. isValid ( )) + p. setColor ( QColorGroup::Text, winfgcolor ); if ( winbgcolor. isValid ( )) - p. setColor ( QColorGroup::Base, winbgcolor ); - + p. setColor ( QColorGroup::Base, winbgcolor ); + } @@ -1184,5 +1184,5 @@ void OThemeStyle::drawPushButtonLabel( QPushButton *btn, QPainter *p ) if ( mode == QIconSet::Normal && btn->hasFocus() ) mode = QIconSet::Active; - QPixmap pixmap = btn->iconSet() ->pixmap( QIconSet::Small, mode ); + QPixmap pixmap = btn->iconSet() ->pixmap( QIconSet::Automatic, mode ); int pixw = pixmap.width(); int pixh = pixmap.height(); @@ -1247,6 +1247,5 @@ int OThemeStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem *mi, } if ( mi->iconSet() ) { - h2 = mi->iconSet() -> - pixmap( QIconSet::Small, QIconSet::Normal ).height() + offset; + h2 = mi->iconSet() ->pixmap().height() + offset; h = h2 > h ? h2 : h; } @@ -1326,5 +1325,9 @@ void OThemeStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, if ( act && !dis ) 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(); int pixh = pixmap.height(); @@ -1435,9 +1438,9 @@ void OThemeStyle::drawKMenuBar( QPainter *p, int x, int y, int w, int h, void OThemeStyle::drawMenuBarItem( QPainter *p, int x, int y, int w, int h, - QMenuItem *mi, const QColorGroup &g, + QMenuItem *mi, const QColorGroup &g, bool /*enabled*/, bool active ) { if(active){ - x -= 2; // Bug in Qt/E + x -= 2; // Bug in Qt/E y -= 2; w += 2; @@ -1465,9 +1468,9 @@ void OThemeStyle::drawProgressBar ( QPainter *p, int x, int y, int w, int h, con if ( isPixmap( ProgressBg ) ) bg.setPixmap( *uncached( ProgressBg ) ); - + int pw = w * percent / 100; - - p-> fillRect ( x + pw, y, w - pw, h, bg ); // ### TODO - + + p-> fillRect ( x + pw, y, w - pw, h, bg ); // ### TODO + drawBaseButton( p, x, y, pw, h, *cg, false, false, ProgressBar ); } diff --git a/noncore/styles/web/webstyle.cpp b/noncore/styles/web/webstyle.cpp index cd3cf08..7b58d89 100644 --- a/noncore/styles/web/webstyle.cpp +++ b/noncore/styles/web/webstyle.cpp @@ -44,4 +44,13 @@ static int _savedFrameMidLineWidth; static ulong _savedFrameStyle; +static const int ITEMFRAME = 1; // menu stuff +static const int ITEMHMARGIN = 3; +static const int ITEMVMARGIN = 0; + +static const int ARROWMARGIN = 6; +static const int RIGHTBORDER = 10; +static const int MINICONSIZE = 12; + + static QColor contrastingForeground(const QColor & fg, const QColor & bg) { @@ -970,5 +979,5 @@ WebStyle::drawPopupMenuItem bool checkable, int maxpmw, - int tab, + int tabwidth, QMenuItem * mi, const QPalette & pal, @@ -982,5 +991,116 @@ WebStyle::drawPopupMenuItem { // TODO - QWindowsStyle::drawPopupMenuItem(p, checkable, maxpmw, tab, mi, pal, act, enabled, x, y, w, h); + //QWindowsStyle::drawPopupMenuItem(p, checkable, maxpmw, tab, mi, pal, act, enabled, x, y, w, h); + if ( !mi ) + return; + + QRect rect(x, y, w, h ); + int x2, y2; + x2 = rect.right(); + y2 = rect.bottom(); + const QColorGroup& g = pal.active(); + QColorGroup itemg = !enabled ? pal.disabled() : pal.active(); + + if ( checkable || maxpmw ) maxpmw = QMAX(maxpmw, 20); + + if (act && enabled ) + p->fillRect(x, y, w, h, g.highlight() ); + else + p->fillRect(x, y, w, h, g.background() ); + + // draw seperator + if (mi->isSeparator() ) { + p->setPen( g.dark() ); + p->drawLine( x+8, y+1, x+w-8, y+1 ); + + p->setPen( g.mid() ); + p->drawLine( x+8, y, x+w-8, y ); + p->drawPoint(x+w,y+1); + + p->setPen( g.midlight() ); + p->drawLine( x+8, y-1, x+w-8, y-1 ); + p->drawPoint(x+8, y ); + return; + } + + // draw icon + QIconSet::Mode mode; + if ( mi->iconSet() && !mi->isChecked() ) { + if ( act ) + mode = enabled ? QIconSet::Active : QIconSet::Disabled; + else + mode = enabled ? QIconSet::Normal : QIconSet::Disabled; + QPixmap pixmap; + if ( mode == QIconSet::Disabled ) + pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); + else + pixmap = mi->iconSet()->pixmap(); + QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); + QRect cr(x, y, maxpmw, h ); + pmrect.moveCenter( cr.center() ); + p->drawPixmap(pmrect.topLeft(), pixmap); + } + + // draw check + if(mi->isChecked() ) { + drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled ); + } + + + // draw text + int xm = maxpmw + 2; + int xp = x + xm; + int tw = w -xm - 2; + + p->setPen( enabled ? ( act ? g.highlightedText() : g.buttonText() ) : + g.mid() ); + + + if ( mi->custom() ) { + p->save(); + mi->custom()->paint(p, g, act, enabled, + xp, y+1, tw, h-2 ); + p->restore(); + }else { // draw label + QString text = mi->text(); + if (!text.isNull() ) { + int t = text.find('\t'); + const int tflags = AlignVCenter | DontClip | + ShowPrefix | SingleLine | + AlignLeft; + + if (t >= 0) { + int tabx = x + w - tabwidth - RIGHTBORDER - + ITEMHMARGIN - ITEMFRAME; + p->drawText(tabx, y+ITEMVMARGIN, tabwidth, + h-2*ITEMVMARGIN, tflags, + text.mid(t+1) ); + text = text.left(t ); + } + + // draw left label + p->drawText(xp, y+ITEMVMARGIN, + tw, h-2*ITEMVMARGIN, + tflags, text, t); + }else if ( mi->pixmap() ) { // pixmap as label + QPixmap pixmap = *mi->pixmap(); + if ( pixmap.depth() == 1 ) + p->setBackgroundMode( OpaqueMode ); + + int dx = ((w-pixmap.width() ) /2 ) + + ((w - pixmap.width()) %2 ); + p->drawPixmap(x+dx, y+ITEMFRAME, pixmap ); + + if ( pixmap.depth() == 1 ) + p->setBackgroundMode( TransparentMode ); + } + } + + if ( mi->popup() ) { // draw submenu arrow + int dim = (h-2*ITEMFRAME) / 2; + drawArrow( p, RightArrow, false, + x+w-ARROWMARGIN-ITEMFRAME-dim, + y+h/2-dim/2, dim, dim, g, enabled ); + } } @@ -1169,5 +1289,5 @@ WebStyle::popupMenuItemHeight(bool, QMenuItem * i, const QFontMetrics & fm) h = QMAX ( - i->iconSet()->pixmap(QIconSet::Small, QIconSet::Normal).height(), + i->iconSet()->pixmap().height(), h ); diff --git a/noncore/styles/web/webstyle.h b/noncore/styles/web/webstyle.h index 83ab784..d6f153b 100644 --- a/noncore/styles/web/webstyle.h +++ b/noncore/styles/web/webstyle.h @@ -216,5 +216,5 @@ class WebStyle : public QWindowsStyle { bool checkable, int maxpmw, - int tab, + int tabwidth, QMenuItem *, const QPalette &, |