-rw-r--r-- | core/launcher/launchertab.cpp | 24 | ||||
-rw-r--r-- | core/settings/launcher/menusettings.cpp | 44 | ||||
-rw-r--r-- | libopie2/opieui/otabbar.cpp | 48 | ||||
-rw-r--r-- | libopie2/opieui/otabbar.h | 42 | ||||
-rw-r--r-- | libopie2/opieui/otabwidget.cpp | 1 | ||||
-rw-r--r-- | noncore/styles/flat/flat.cpp | 10 | ||||
-rw-r--r-- | noncore/styles/fresh/fresh.cpp | 8 | ||||
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 15 | ||||
-rw-r--r-- | noncore/styles/phase/phasestyle.cpp | 14 | ||||
-rw-r--r-- | noncore/styles/theme/othemestyle.cpp | 11 | ||||
-rw-r--r-- | noncore/styles/web/webstyle.cpp | 126 | ||||
-rw-r--r-- | noncore/styles/web/webstyle.h | 2 |
12 files changed, 248 insertions, 97 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 @@ -88,77 +88,77 @@ void LauncherTabBar::layoutTabs() QListIterator< LauncherTab > it( items ); int required = 0; int eventabwidth = (width()-1)/count(); enum Mode { HideBackText, Pack, Even } mode=Even; for (it.toFirst(); it.current(); ++it ) { t = it.current(); if ( !t ) continue; int iw = fm.width( t->text() ) + hframe - overlap; if ( t != current ) { 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. if ( iw >= eventabwidth-10 ) mode = Pack; } if ( mode == Pack && required > width()-1 ) mode = HideBackText; for ( it.toFirst(); it.current(); ++it ) { t = it.current(); if ( !t ) continue; if ( mode != HideBackText ) { int w = fm.width( t->text() ); 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 ); h = QMAX( h, QApplication::globalStrut().height() ); h += vframe; w += hframe; QRect totr(x, 0, mode == Even ? eventabwidth : w * (width()-1)/required, h); t->setRect(totr); x += totr.width() - overlap; r = r.unite(totr); } else if ( t != current ) { int w = hiddenTabWidth; 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 ); h = QMAX( h, QApplication::globalStrut().height() ); h += vframe; w += hframe; t->setRect( QRect(x, 0, w, h) ); x += t->rect().width() - overlap; r = r.unite( t->rect() ); } else { 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 ); h = QMAX( h, QApplication::globalStrut().height() ); h += vframe; t->setRect( QRect(x, 0, available, h) ); x += t->rect().width() - overlap; r = r.unite( t->rect() ); } } @@ -211,26 +211,26 @@ void LauncherTabBar::paint( QPainter * p, QTab * t, bool selected ) const p->setFont( f ); if ( ct->fgColor.isValid() ) { pal.setColor( QPalette::Active, QColorGroup::Foreground, ct->fgColor ); pal.setColor( QPalette::Inactive, QColorGroup::Foreground, ct->fgColor ); that->setUpdatesEnabled( FALSE ); that->setPalette( pal ); setPal = TRUE; } int iw = 0; 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; int h = QMAX(p->fontMetrics().height() + 4, ih ); paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, r.top() + (r.height()-h)/2, w, h ), t, #if QT_VERSION >= 0x030000 t->identifier() == keyboardFocusTab() #else t->identitifer() == keyboardFocusTab() #endif ); if ( setPal ) { @@ -242,25 +242,29 @@ void LauncherTabBar::paint( QPainter * p, QTab * t, bool selected ) const void LauncherTabBar::paintLabel( QPainter* p, const QRect&, QTab* t, bool has_focus ) const { QRect r = t->rect(); // if ( t->id != currentTab() ) //r.moveBy( 1, 1 ); // if ( t->iconSet() ) { // the tab has an iconset, draw it in the right mode QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; 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(); p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); r.setLeft( r.left() + pixw + 5 ); } QRect tr = r; if ( r.width() < 20 ) return; if ( t->isEnabled() && isEnabled() ) { 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,35 +1,35 @@ /* - 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. */ #include "menusettings.h" #include <qpe/config.h> #include <qpe/qlibrary.h> #include <qpe/qpeapplication.h> #include <qpe/menuappletinterface.h> #include <qpe/qcopenvelope_qws.h> @@ -96,25 +96,25 @@ void MenuSettings::init ( ) QLibrary *lib = new QLibrary ( path + "/" + *it ); lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); if ( iface ) { QString lang = getenv( "LANG" ); QTranslator *trans = new QTranslator ( qApp ); QString type = (*it). left ((*it). find (".")); QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm"; if ( trans-> load ( tfn )) qApp-> installTranslator ( trans ); else delete trans; name = iface-> name ( ); - icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); + icon = iface-> icon ( ). pixmap (); iface-> release ( ); lib-> unload ( ); QCheckListItem *item; item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); if ( !icon. isNull ( )) item-> setPixmap ( 0, icon ); item-> setOn ( exclude. find ( *it ) == exclude. end ( )); m_applets [*it] = item; } else { delete lib; } 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,63 +1,67 @@ /* - This file is part of the Opie Project + This file is part of the Opie Project - Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + 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. */ #include <opie2/otabbar.h> +#include <qpe/applnk.h> + +#include <stdio.h> + using namespace Opie::Ui; OTabBar::OTabBar( QWidget *parent , const char *name ) :QTabBar( parent, name ) {} void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const { QRect r = br; if ( t->iconset) { QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; if ( mode == QIconSet::Normal && 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(); r.setLeft( r.left() + pixw + 2 ); p->drawPixmap( br.left()+2, br.center().y()-pixh/2, pixmap ); } QRect tr = r; if ( t->id == currentTab() ) { tr.setBottom( tr.bottom() - style().defaultFrameWidth() ); } 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,37 +1,37 @@ /* - This file is part of the Opie Project + This file is part of the Opie Project - Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + 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. */ #ifndef OTABBAR_H #define OTABBAR_H /* QT */ #include <qtabbar.h> 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 @@ -25,25 +25,24 @@ Â Â -- Â Â Â Â :-=` 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. */ #include <opie2/otabwidget.h> /* OPIE */ #include <opie2/oresource.h> #include <opie2/otabbar.h> -#include <qpe/applnk.h> #include <qpe/config.h> /* QT */ #include <qcombobox.h> #include <qwidgetstack.h> using namespace Opie::Ui; OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) : QWidget( parent, name ) , m_currTab( 0l ) , m_tabBarStyle( Global ) 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 @@ -364,25 +364,25 @@ void FlatStyle::drawPushButtonLabel( QPushButton *btn, QPainter *p ) drawArrow( p, DownArrow, FALSE, x+w-dx, y+2, dx-4, h-4, cg, btn->isEnabled() ); w -= dx; } if ( btn->iconSet() && !btn->iconSet()->isNull() ) { QIconSet::Mode mode = btn->isEnabled() ? QIconSet::Normal : QIconSet::Disabled; 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(); p->drawPixmap( x+2, y+h/2-pixh/2, pixmap ); x += pixw + 4; w -= pixw + 4; } drawItem( p, x, y, w, h, AlignCenter | ShowPrefix, cg, btn->isEnabled(), btn->pixmap(), btn->text(), -1, &cg.buttonText() ); } @@ -893,25 +893,25 @@ int FlatStyle::extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem* m int FlatStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm ) { #ifndef QT_NO_MENUDATA int h = 0; if ( mi->isSeparator() ) // separator height h = motifSepHeight; else if ( mi->pixmap() ) // pixmap height h = mi->pixmap()->height() + 2*motifItemFrame; else // text height h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; 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() ) h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; return h; #endif } void FlatStyle::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) { #ifndef QT_NO_MENUDATA @@ -945,25 +945,29 @@ void FlatStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int qDrawShadePanel( p, x, y, checkcol, h, g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); } } else if ( !act ) { p->fillRect(x, y, checkcol , h, g.brush( QColorGroup::Button )); } if ( mi->iconSet() ) { // draw iconset QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; 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(); if ( act && !dis ) { if ( !mi->isChecked() ) qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); } QRect cr( x, y, checkcol, h ); QRect pmr( 0, 0, pixw, pixh ); pmr.moveCenter( cr.center() ); p->setPen( itemg.text() ); p->drawPixmap( pmr.topLeft(), pixmap ); 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 @@ -639,25 +639,25 @@ int FreshStyle::extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem* int FreshStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm ) { #ifndef QT_NO_MENUDATA int h = 0; if ( mi->isSeparator() ) // separator height h = motifSepHeight; else if ( mi->pixmap() ) // pixmap height h = mi->pixmap()->height() + 2*motifItemFrame; else // text height h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; 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() ) h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; return h; #endif } void FreshStyle::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) { #ifndef QT_NO_MENUDATA @@ -693,25 +693,29 @@ void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int qDrawShadePanel( p, x, y, checkcol, h, g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); } } else if ( !act ) { p->fillRect(x, y, checkcol , h, g.brush( QColorGroup::Button )); } if ( mi->iconSet() ) { // draw iconset QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; 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(); if ( act && !dis ) { if ( !mi->isChecked() ) qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); } QRect cr( x, y, checkcol, h ); QRect pmr( 0, 0, pixw, pixh ); pmr.moveCenter( cr.center() ); p->setPen( itemg.text() ); p->drawPixmap( pmr.topLeft(), pixmap ); 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 @@ -1294,25 +1294,29 @@ void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) bool act = btn->isOn() || btn->isDown(); if(act){ ++x1, ++y1; } // Draw iconset first, if any if ( btn->iconSet() && !btn->iconSet()->isNull() ) { QIconSet::Mode mode = btn->isEnabled() ? QIconSet::Normal : QIconSet::Disabled; 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(); p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); x1 += pixw + 8; w -= pixw + 8; } if(act){ QFont font = btn->font(); font.setBold(true); p->setFont(font); @@ -2146,25 +2150,29 @@ static const int windowsRightBorder = 12; c = menuHandler->bgColor(); } p->setPen(c.dark(140)); p->drawLine(x, y, x+w, y ); p->setPen(c.light(115)); p->drawLine(x, y+1, x+w, y+1 ); return; } if(mi->iconSet()) { QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal; 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(); QRect cr(x, y, checkcol, h); QRect pmr(0, 0, pixw, pixh); pmr.moveCenter( cr.center() ); p->setPen(itemg.highlightedText()); p->drawPixmap(pmr.topLeft(), pixmap ); } else if(checkable) { int mw = checkcol + motifItemFrame; int mh = h - 2*motifItemFrame; @@ -2227,26 +2235,25 @@ static const int windowsRightBorder = 12; int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi, const QFontMetrics &fm) { if (mi->isSeparator()) return 2; int h = 0; if (mi->pixmap()) h = mi->pixmap()->height(); 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); // we want a minimum size of 18 h = QMAX(h, 18); return h; } void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, const QColor *c, 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 @@ -381,25 +381,28 @@ void PhaseStyle::drawPushButtonLabel (QPushButton *button, QPainter *painter) { } else { mode = QIconSet::Disabled; } #if 0 if (button->isToggleButton() && button->isOn()) { state = true; } else { state = false; } #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, y+h/2 - pixmap.height()/2, pixmap); } else { painter->drawPixmap(x+4, y+h/2 - pixmap.height()/2, pixmap); } x += pixmap.width() + 4; w -= pixmap.width() + 4; } if (active || button->isDefault()) { // default button for(int n=0; n<2; n++) { @@ -560,26 +563,25 @@ int PhaseStyle::popupMenuItemHeight ( bool , h += ITEMVMARGIN*2 + ITEMFRAME*2; }else if (mi->isSeparator() ) { h = 1; }else { if ( mi->pixmap() ) { h = QMAX(h, mi->pixmap()->height() + ITEMFRAME*2); }else { h = QMAX(h, MINICONSIZE+ITEMFRAME*2 ); h = QMAX(h, fm.height() + ITEMVMARGIN*2 + ITEMFRAME*2 ); } if ( mi->iconSet() ) - h = QMAX(h, mi->iconSet()-> - pixmap(QIconSet::Small, QIconSet::Normal ).height() + h = QMAX(h, mi->iconSet()->pixmap().height() + ITEMFRAME*2 ); } return h; } int PhaseStyle::extraPopupMenuItemWidth(bool checkable, int maxpmw, QMenuItem* mi, const QFontMetrics& ) { int w = 0; if (mi->isSeparator() ) return 3; @@ -652,25 +654,29 @@ void PhaseStyle::drawPopupMenuItem ( QPainter * p, bool checkable, 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 = 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 ); pmrect.moveCenter( cr.center() ); p->drawPixmap(pmrect.topLeft(), pixmap); } // draw check if(mi->isChecked() ) { drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled ); } 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 @@ -1174,25 +1174,25 @@ void OThemeStyle::drawPushButtonLabel( QPushButton *btn, QPainter *p ) x + w - dx - 2, y + 2, dx, h - 4, btn->colorGroup(), btn->isEnabled() ); w -= dx; } // Next, draw iconset, if any if ( btn->iconSet() && !btn->iconSet() ->isNull() ) { QIconSet::Mode mode = btn->isEnabled() ? QIconSet::Normal : QIconSet::Disabled; 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(); p->drawPixmap( x + 6, y + h / 2 - pixh / 2, pixmap ); x += pixw + 8; w -= pixw + 8; } if ( widget == PushButtonDown ) { drawItem( p, x + buttonXShift(), y + buttonYShift(), w, h, AlignCenter | ShowPrefix, *cg, btn->isEnabled(), btn->pixmap(), btn->text(), -1, &cg->buttonText() ); @@ -1237,26 +1237,25 @@ int OThemeStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem *mi, int offset = QMAX( decoWidth( MenuItemDown ), decoWidth( MenuItem ) ) + 4; if ( mi->isSeparator() ) return ( 2 ); if ( mi->isChecked() ) h = isPixmap( CheckMark ) ? uncached( CheckMark ) ->height() + offset : offset + 16; if ( mi->pixmap() ) { h2 = mi->pixmap() ->height() + offset; h = h2 > h ? h2 : h; } if ( mi->iconSet() ) { - h2 = mi->iconSet() -> - pixmap( QIconSet::Small, QIconSet::Normal ).height() + offset; + h2 = mi->iconSet() ->pixmap().height() + offset; h = h2 > h ? h2 : h; } h2 = fm.height() + offset; h = h2 > h ? h2 : h; return ( h ); } void OThemeStyle::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 ) { @@ -1316,25 +1315,29 @@ void OThemeStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int mw = checkcol + motifItemFrame; drawShade( p, x, y, mw, h, g, true, false, highlightWidth( MenuItemDown ), borderWidth( MenuItemDown ), shade() ); } } if ( !mi ) return ; if ( mi->iconSet() ) { QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; 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(); QRect cr( x, y, checkcol, h ); QRect pmr( 0, 0, pixw, pixh ); pmr.moveCenter( cr.center() ); p->setPen( itemg.text() ); p->drawPixmap( pmr.topLeft(), pixmap ); } else if ( checkable ) { int mw = checkcol + motifItemFrame; int mh = h - 2 * motifItemFrame; 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 @@ -34,24 +34,33 @@ #include "webstyle.h" static const int _indicatorSize = 9; static QButton * _highlightedButton = 0; static const int _scrollBarExtent = 12; static QFrame * _currentFrame = 0; static int _savedFrameLineWidth; 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) { int h, s, vbg, vfg; bg.hsv(&h, &s, &vbg); fg.hsv(&h, &s, &vfg); int diff(vbg - vfg); if ((diff > -72) && (diff < 72)) { return (vbg < 128) ? Qt::white : Qt::black; @@ -960,37 +969,148 @@ WebStyle::drawSlider if( o == Qt::Vertical ) p->drawEllipse(x + w / 2 - sl / 2, y, sl, sl); p->restore(); } void WebStyle::drawPopupMenuItem ( QPainter * p, bool checkable, int maxpmw, - int tab, + int tabwidth, QMenuItem * mi, const QPalette & pal, bool act, bool enabled, int x, int y, int w, int h ) { // 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 ); + } } void WebStyle::drawFocusRect ( QPainter * p, const QRect & r, const QColorGroup & g, const QColor * pen, bool atBorder ) { @@ -1159,25 +1279,25 @@ WebStyle::popupMenuItemHeight(bool, QMenuItem * i, const QFontMetrics & fm) int h = 0; if (0 != i->pixmap()) { h = i->pixmap()->height(); } if (0 != i->iconSet()) { h = QMAX ( - i->iconSet()->pixmap(QIconSet::Small, QIconSet::Normal).height(), + i->iconSet()->pixmap().height(), h ); } h = QMAX(fm.height() + 4, h); h = QMAX(18, h); return 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 @@ -206,25 +206,25 @@ class WebStyle : public QWindowsStyle { int h, const QColorGroup &, Orientation, bool tickAbove, bool tickBelow ); void drawPopupMenuItem ( QPainter *, bool checkable, int maxpmw, - int tab, + int tabwidth, QMenuItem *, const QPalette &, bool act, bool enabled, int x, int y, int w, int h ); void drawFocusRect ( |