-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() | |||
88 | QListIterator< LauncherTab > it( items ); | 88 | QListIterator< LauncherTab > it( items ); |
89 | int required = 0; | 89 | int required = 0; |
90 | int eventabwidth = (width()-1)/count(); | 90 | int eventabwidth = (width()-1)/count(); |
91 | enum Mode { HideBackText, Pack, Even } mode=Even; | 91 | enum Mode { HideBackText, Pack, Even } mode=Even; |
92 | for (it.toFirst(); it.current(); ++it ) { | 92 | for (it.toFirst(); it.current(); ++it ) { |
93 | t = it.current(); | 93 | t = it.current(); |
94 | if ( !t ) | 94 | if ( !t ) |
95 | continue; | 95 | continue; |
96 | int iw = fm.width( t->text() ) + hframe - overlap; | 96 | int iw = fm.width( t->text() ) + hframe - overlap; |
97 | if ( t != current ) { | 97 | if ( t != current ) { |
98 | available -= hiddenTabWidth + hframe - overlap; | 98 | available -= hiddenTabWidth + hframe - overlap; |
99 | if ( t->iconSet() != 0 ) | 99 | if ( t->iconSet() != 0 ) |
100 | available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 100 | available -= t->iconSet()->pixmap().width(); |
101 | } | 101 | } |
102 | if ( t->iconSet() != 0 ) | 102 | if ( t->iconSet() != 0 ) |
103 | iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 103 | iw += t->iconSet()->pixmap().width(); |
104 | required += iw; | 104 | required += iw; |
105 | // As space gets tight, packed looks better than even. "10" must be at least 0. | 105 | // As space gets tight, packed looks better than even. "10" must be at least 0. |
106 | if ( iw >= eventabwidth-10 ) | 106 | if ( iw >= eventabwidth-10 ) |
107 | mode = Pack; | 107 | mode = Pack; |
108 | } | 108 | } |
109 | if ( mode == Pack && required > width()-1 ) | 109 | if ( mode == Pack && required > width()-1 ) |
110 | mode = HideBackText; | 110 | mode = HideBackText; |
111 | for ( it.toFirst(); it.current(); ++it ) { | 111 | for ( it.toFirst(); it.current(); ++it ) { |
112 | t = it.current(); | 112 | t = it.current(); |
113 | if ( !t ) | 113 | if ( !t ) |
114 | continue; | 114 | continue; |
115 | if ( mode != HideBackText ) { | 115 | if ( mode != HideBackText ) { |
116 | int w = fm.width( t->text() ); | 116 | int w = fm.width( t->text() ); |
117 | int ih = 0; | 117 | int ih = 0; |
118 | if ( t->iconSet() != 0 ) { | 118 | if ( t->iconSet() != 0 ) { |
119 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 119 | w += t->iconSet()->pixmap().width(); |
120 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 120 | ih = t->iconSet()->pixmap().height(); |
121 | } | 121 | } |
122 | int h = QMAX( fm.height(), ih ); | 122 | int h = QMAX( fm.height(), ih ); |
123 | h = QMAX( h, QApplication::globalStrut().height() ); | 123 | h = QMAX( h, QApplication::globalStrut().height() ); |
124 | 124 | ||
125 | h += vframe; | 125 | h += vframe; |
126 | w += hframe; | 126 | w += hframe; |
127 | 127 | ||
128 | QRect totr(x, 0, | 128 | QRect totr(x, 0, |
129 | mode == Even ? eventabwidth : w * (width()-1)/required, h); | 129 | mode == Even ? eventabwidth : w * (width()-1)/required, h); |
130 | t->setRect(totr); | 130 | t->setRect(totr); |
131 | x += totr.width() - overlap; | 131 | x += totr.width() - overlap; |
132 | r = r.unite(totr); | 132 | r = r.unite(totr); |
133 | } else if ( t != current ) { | 133 | } else if ( t != current ) { |
134 | int w = hiddenTabWidth; | 134 | int w = hiddenTabWidth; |
135 | int ih = 0; | 135 | int ih = 0; |
136 | if ( t->iconSet() != 0 ) { | 136 | if ( t->iconSet() != 0 ) { |
137 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 137 | w += t->iconSet()->pixmap().width(); |
138 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 138 | ih = t->iconSet()->pixmap().height(); |
139 | } | 139 | } |
140 | int h = QMAX( fm.height(), ih ); | 140 | int h = QMAX( fm.height(), ih ); |
141 | h = QMAX( h, QApplication::globalStrut().height() ); | 141 | h = QMAX( h, QApplication::globalStrut().height() ); |
142 | 142 | ||
143 | h += vframe; | 143 | h += vframe; |
144 | w += hframe; | 144 | w += hframe; |
145 | 145 | ||
146 | t->setRect( QRect(x, 0, w, h) ); | 146 | t->setRect( QRect(x, 0, w, h) ); |
147 | x += t->rect().width() - overlap; | 147 | x += t->rect().width() - overlap; |
148 | r = r.unite( t->rect() ); | 148 | r = r.unite( t->rect() ); |
149 | } else { | 149 | } else { |
150 | int ih = 0; | 150 | int ih = 0; |
151 | if ( t->iconSet() != 0 ) { | 151 | if ( t->iconSet() != 0 ) { |
152 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 152 | ih = t->iconSet()->pixmap().height(); |
153 | } | 153 | } |
154 | int h = QMAX( fm.height(), ih ); | 154 | int h = QMAX( fm.height(), ih ); |
155 | h = QMAX( h, QApplication::globalStrut().height() ); | 155 | h = QMAX( h, QApplication::globalStrut().height() ); |
156 | 156 | ||
157 | h += vframe; | 157 | h += vframe; |
158 | 158 | ||
159 | t->setRect( QRect(x, 0, available, h) ); | 159 | t->setRect( QRect(x, 0, available, h) ); |
160 | x += t->rect().width() - overlap; | 160 | x += t->rect().width() - overlap; |
161 | r = r.unite( t->rect() ); | 161 | r = r.unite( t->rect() ); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
@@ -211,26 +211,26 @@ void LauncherTabBar::paint( QPainter * p, QTab * t, bool selected ) const | |||
211 | p->setFont( f ); | 211 | p->setFont( f ); |
212 | 212 | ||
213 | if ( ct->fgColor.isValid() ) { | 213 | if ( ct->fgColor.isValid() ) { |
214 | pal.setColor( QPalette::Active, QColorGroup::Foreground, ct->fgColor ); | 214 | pal.setColor( QPalette::Active, QColorGroup::Foreground, ct->fgColor ); |
215 | pal.setColor( QPalette::Inactive, QColorGroup::Foreground, ct->fgColor ); | 215 | pal.setColor( QPalette::Inactive, QColorGroup::Foreground, ct->fgColor ); |
216 | that->setUpdatesEnabled( FALSE ); | 216 | that->setUpdatesEnabled( FALSE ); |
217 | that->setPalette( pal ); | 217 | that->setPalette( pal ); |
218 | setPal = TRUE; | 218 | setPal = TRUE; |
219 | } | 219 | } |
220 | int iw = 0; | 220 | int iw = 0; |
221 | int ih = 0; | 221 | int ih = 0; |
222 | if ( t->iconSet() != 0 ) { | 222 | if ( t->iconSet() != 0 ) { |
223 | iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; | 223 | iw = t->iconSet()->pixmap().width() + 2; |
224 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 224 | ih = t->iconSet()->pixmap().height(); |
225 | } | 225 | } |
226 | int w = iw + p->fontMetrics().width( t->text() ) + 4; | 226 | int w = iw + p->fontMetrics().width( t->text() ) + 4; |
227 | int h = QMAX(p->fontMetrics().height() + 4, ih ); | 227 | int h = QMAX(p->fontMetrics().height() + 4, ih ); |
228 | paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, | 228 | paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, |
229 | r.top() + (r.height()-h)/2, w, h ), t, | 229 | r.top() + (r.height()-h)/2, w, h ), t, |
230 | #if QT_VERSION >= 0x030000 | 230 | #if QT_VERSION >= 0x030000 |
231 | t->identifier() == keyboardFocusTab() | 231 | t->identifier() == keyboardFocusTab() |
232 | #else | 232 | #else |
233 | t->identitifer() == keyboardFocusTab() | 233 | t->identitifer() == keyboardFocusTab() |
234 | #endif | 234 | #endif |
235 | ); | 235 | ); |
236 | if ( setPal ) { | 236 | if ( setPal ) { |
@@ -242,25 +242,29 @@ void LauncherTabBar::paint( QPainter * p, QTab * t, bool selected ) const | |||
242 | void LauncherTabBar::paintLabel( QPainter* p, const QRect&, | 242 | void LauncherTabBar::paintLabel( QPainter* p, const QRect&, |
243 | QTab* t, bool has_focus ) const | 243 | QTab* t, bool has_focus ) const |
244 | { | 244 | { |
245 | QRect r = t->rect(); | 245 | QRect r = t->rect(); |
246 | // if ( t->id != currentTab() ) | 246 | // if ( t->id != currentTab() ) |
247 | //r.moveBy( 1, 1 ); | 247 | //r.moveBy( 1, 1 ); |
248 | // | 248 | // |
249 | if ( t->iconSet() ) { | 249 | if ( t->iconSet() ) { |
250 | // the tab has an iconset, draw it in the right mode | 250 | // the tab has an iconset, draw it in the right mode |
251 | QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; | 251 | QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; |
252 | if ( mode == QIconSet::Normal && has_focus ) | 252 | if ( mode == QIconSet::Normal && has_focus ) |
253 | mode = QIconSet::Active; | 253 | mode = QIconSet::Active; |
254 | QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); | 254 | QPixmap pixmap; |
255 | if ( mode == QIconSet::Disabled ) | ||
256 | pixmap = t->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
257 | else | ||
258 | pixmap = t->iconSet()->pixmap(); | ||
255 | int pixw = pixmap.width(); | 259 | int pixw = pixmap.width(); |
256 | int pixh = pixmap.height(); | 260 | int pixh = pixmap.height(); |
257 | p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); | 261 | p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); |
258 | r.setLeft( r.left() + pixw + 5 ); | 262 | r.setLeft( r.left() + pixw + 5 ); |
259 | } | 263 | } |
260 | 264 | ||
261 | QRect tr = r; | 265 | QRect tr = r; |
262 | 266 | ||
263 | if ( r.width() < 20 ) | 267 | if ( r.width() < 20 ) |
264 | return; | 268 | return; |
265 | 269 | ||
266 | if ( t->isEnabled() && isEnabled() ) { | 270 | 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 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> | 3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "menusettings.h" | 29 | #include "menusettings.h" |
30 | 30 | ||
31 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
32 | #include <qpe/qlibrary.h> | 32 | #include <qpe/qlibrary.h> |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #include <qpe/menuappletinterface.h> | 34 | #include <qpe/menuappletinterface.h> |
35 | #include <qpe/qcopenvelope_qws.h> | 35 | #include <qpe/qcopenvelope_qws.h> |
@@ -96,25 +96,25 @@ void MenuSettings::init ( ) | |||
96 | QLibrary *lib = new QLibrary ( path + "/" + *it ); | 96 | QLibrary *lib = new QLibrary ( path + "/" + *it ); |
97 | lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); | 97 | lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); |
98 | if ( iface ) { | 98 | if ( iface ) { |
99 | QString lang = getenv( "LANG" ); | 99 | QString lang = getenv( "LANG" ); |
100 | QTranslator *trans = new QTranslator ( qApp ); | 100 | QTranslator *trans = new QTranslator ( qApp ); |
101 | QString type = (*it). left ((*it). find (".")); | 101 | QString type = (*it). left ((*it). find (".")); |
102 | QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm"; | 102 | QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm"; |
103 | if ( trans-> load ( tfn )) | 103 | if ( trans-> load ( tfn )) |
104 | qApp-> installTranslator ( trans ); | 104 | qApp-> installTranslator ( trans ); |
105 | else | 105 | else |
106 | delete trans; | 106 | delete trans; |
107 | name = iface-> name ( ); | 107 | name = iface-> name ( ); |
108 | icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); | 108 | icon = iface-> icon ( ). pixmap (); |
109 | iface-> release ( ); | 109 | iface-> release ( ); |
110 | lib-> unload ( ); | 110 | lib-> unload ( ); |
111 | 111 | ||
112 | QCheckListItem *item; | 112 | QCheckListItem *item; |
113 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); | 113 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); |
114 | if ( !icon. isNull ( )) | 114 | if ( !icon. isNull ( )) |
115 | item-> setPixmap ( 0, icon ); | 115 | item-> setPixmap ( 0, icon ); |
116 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); | 116 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); |
117 | m_applets [*it] = item; | 117 | m_applets [*it] = item; |
118 | } else { | 118 | } else { |
119 | delete lib; | 119 | delete lib; |
120 | } | 120 | } |
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 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <opie2/otabbar.h> | 32 | #include <opie2/otabbar.h> |
33 | 33 | ||
34 | #include <qpe/applnk.h> | ||
35 | |||
36 | #include <stdio.h> | ||
37 | |||
34 | using namespace Opie::Ui; | 38 | using namespace Opie::Ui; |
35 | 39 | ||
36 | OTabBar::OTabBar( QWidget *parent , const char *name ) | 40 | OTabBar::OTabBar( QWidget *parent , const char *name ) |
37 | :QTabBar( parent, name ) | 41 | :QTabBar( parent, name ) |
38 | {} | 42 | {} |
39 | 43 | ||
40 | void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const | 44 | void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const |
41 | { | 45 | { |
42 | 46 | ||
43 | QRect r = br; | 47 | QRect r = br; |
44 | if ( t->iconset) | 48 | if ( t->iconset) |
45 | { | 49 | { |
46 | QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; | 50 | QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; |
47 | if ( mode == QIconSet::Normal && has_focus ) | 51 | if ( mode == QIconSet::Normal && has_focus ) |
48 | { | 52 | { |
49 | mode = QIconSet::Active; | 53 | mode = QIconSet::Active; |
50 | } | 54 | } |
51 | QPixmap pixmap = t->iconset->pixmap( QIconSet::Small, mode ); | 55 | QPixmap pixmap = t->iconset->pixmap(); |
52 | int pixw = pixmap.width(); | 56 | int pixw = pixmap.width(); |
53 | int pixh = pixmap.height(); | 57 | int pixh = pixmap.height(); |
54 | r.setLeft( r.left() + pixw + 2 ); | 58 | r.setLeft( r.left() + pixw + 2 ); |
55 | p->drawPixmap( br.left()+2, br.center().y()-pixh/2, pixmap ); | 59 | p->drawPixmap( br.left()+2, br.center().y()-pixh/2, pixmap ); |
56 | } | 60 | } |
57 | 61 | ||
58 | QRect tr = r; | 62 | QRect tr = r; |
59 | if ( t->id == currentTab() ) | 63 | if ( t->id == currentTab() ) |
60 | { | 64 | { |
61 | tr.setBottom( tr.bottom() - style().defaultFrameWidth() ); | 65 | tr.setBottom( tr.bottom() - style().defaultFrameWidth() ); |
62 | } | 66 | } |
63 | 67 | ||
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 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef OTABBAR_H | 32 | #ifndef OTABBAR_H |
33 | #define OTABBAR_H | 33 | #define OTABBAR_H |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qtabbar.h> | 36 | #include <qtabbar.h> |
37 | 37 | ||
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 @@ | |||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | 25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <opie2/otabwidget.h> | 31 | #include <opie2/otabwidget.h> |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/oresource.h> | 34 | #include <opie2/oresource.h> |
35 | #include <opie2/otabbar.h> | 35 | #include <opie2/otabbar.h> |
36 | 36 | ||
37 | #include <qpe/applnk.h> | ||
38 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
39 | 38 | ||
40 | /* QT */ | 39 | /* QT */ |
41 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
42 | #include <qwidgetstack.h> | 41 | #include <qwidgetstack.h> |
43 | 42 | ||
44 | using namespace Opie::Ui; | 43 | using namespace Opie::Ui; |
45 | 44 | ||
46 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) | 45 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) |
47 | : QWidget( parent, name ) | 46 | : QWidget( parent, name ) |
48 | , m_currTab( 0l ) | 47 | , m_currTab( 0l ) |
49 | , m_tabBarStyle( Global ) | 48 | , 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 ) | |||
364 | drawArrow( p, DownArrow, FALSE, | 364 | drawArrow( p, DownArrow, FALSE, |
365 | x+w-dx, y+2, dx-4, h-4, | 365 | x+w-dx, y+2, dx-4, h-4, |
366 | cg, | 366 | cg, |
367 | btn->isEnabled() ); | 367 | btn->isEnabled() ); |
368 | w -= dx; | 368 | w -= dx; |
369 | } | 369 | } |
370 | 370 | ||
371 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) { | 371 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) { |
372 | QIconSet::Mode mode = btn->isEnabled() | 372 | QIconSet::Mode mode = btn->isEnabled() |
373 | ? QIconSet::Normal : QIconSet::Disabled; | 373 | ? QIconSet::Normal : QIconSet::Disabled; |
374 | if ( mode == QIconSet::Normal && btn->hasFocus() ) | 374 | if ( mode == QIconSet::Normal && btn->hasFocus() ) |
375 | mode = QIconSet::Active; | 375 | mode = QIconSet::Active; |
376 | QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); | 376 | QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Automatic, mode ); |
377 | int pixw = pixmap.width(); | 377 | int pixw = pixmap.width(); |
378 | int pixh = pixmap.height(); | 378 | int pixh = pixmap.height(); |
379 | p->drawPixmap( x+2, y+h/2-pixh/2, pixmap ); | 379 | p->drawPixmap( x+2, y+h/2-pixh/2, pixmap ); |
380 | x += pixw + 4; | 380 | x += pixw + 4; |
381 | w -= pixw + 4; | 381 | w -= pixw + 4; |
382 | } | 382 | } |
383 | drawItem( p, x, y, w, h, | 383 | drawItem( p, x, y, w, h, |
384 | AlignCenter | ShowPrefix, | 384 | AlignCenter | ShowPrefix, |
385 | cg, btn->isEnabled(), | 385 | cg, btn->isEnabled(), |
386 | btn->pixmap(), btn->text(), -1, &cg.buttonText() ); | 386 | btn->pixmap(), btn->text(), -1, &cg.buttonText() ); |
387 | 387 | ||
388 | } | 388 | } |
@@ -893,25 +893,25 @@ int FlatStyle::extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem* m | |||
893 | int FlatStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm ) | 893 | int FlatStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm ) |
894 | { | 894 | { |
895 | #ifndef QT_NO_MENUDATA | 895 | #ifndef QT_NO_MENUDATA |
896 | int h = 0; | 896 | int h = 0; |
897 | if ( mi->isSeparator() ) // separator height | 897 | if ( mi->isSeparator() ) // separator height |
898 | h = motifSepHeight; | 898 | h = motifSepHeight; |
899 | else if ( mi->pixmap() ) // pixmap height | 899 | else if ( mi->pixmap() ) // pixmap height |
900 | h = mi->pixmap()->height() + 2*motifItemFrame; | 900 | h = mi->pixmap()->height() + 2*motifItemFrame; |
901 | else // text height | 901 | else // text height |
902 | h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; | 902 | h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; |
903 | 903 | ||
904 | if ( !mi->isSeparator() && mi->iconSet() != 0 ) { | 904 | if ( !mi->isSeparator() && mi->iconSet() != 0 ) { |
905 | h = QMAX( h, mi->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height() + 2*motifItemFrame ); | 905 | h = QMAX( h, mi->iconSet()->pixmap().height() + 2*motifItemFrame ); |
906 | } | 906 | } |
907 | if ( mi->custom() ) | 907 | if ( mi->custom() ) |
908 | h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; | 908 | h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; |
909 | return h; | 909 | return h; |
910 | #endif | 910 | #endif |
911 | } | 911 | } |
912 | 912 | ||
913 | void FlatStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, | 913 | void FlatStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, |
914 | const QPalette& pal, | 914 | const QPalette& pal, |
915 | bool act, bool enabled, int x, int y, int w, int h) | 915 | bool act, bool enabled, int x, int y, int w, int h) |
916 | { | 916 | { |
917 | #ifndef QT_NO_MENUDATA | 917 | #ifndef QT_NO_MENUDATA |
@@ -945,25 +945,29 @@ void FlatStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int | |||
945 | qDrawShadePanel( p, x, y, checkcol, h, | 945 | qDrawShadePanel( p, x, y, checkcol, h, |
946 | g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); | 946 | g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); |
947 | } | 947 | } |
948 | } else if ( !act ) { | 948 | } else if ( !act ) { |
949 | p->fillRect(x, y, checkcol , h, | 949 | p->fillRect(x, y, checkcol , h, |
950 | g.brush( QColorGroup::Button )); | 950 | g.brush( QColorGroup::Button )); |
951 | } | 951 | } |
952 | 952 | ||
953 | if ( mi->iconSet() ) { // draw iconset | 953 | if ( mi->iconSet() ) { // draw iconset |
954 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; | 954 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; |
955 | if (act && !dis ) | 955 | if (act && !dis ) |
956 | mode = QIconSet::Active; | 956 | mode = QIconSet::Active; |
957 | QPixmap pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode ); | 957 | QPixmap pixmap; |
958 | if ( mode == QIconSet::Disabled ) | ||
959 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
960 | else | ||
961 | pixmap = mi->iconSet()->pixmap(); | ||
958 | int pixw = pixmap.width(); | 962 | int pixw = pixmap.width(); |
959 | int pixh = pixmap.height(); | 963 | int pixh = pixmap.height(); |
960 | if ( act && !dis ) { | 964 | if ( act && !dis ) { |
961 | if ( !mi->isChecked() ) | 965 | if ( !mi->isChecked() ) |
962 | qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); | 966 | qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); |
963 | } | 967 | } |
964 | QRect cr( x, y, checkcol, h ); | 968 | QRect cr( x, y, checkcol, h ); |
965 | QRect pmr( 0, 0, pixw, pixh ); | 969 | QRect pmr( 0, 0, pixw, pixh ); |
966 | pmr.moveCenter( cr.center() ); | 970 | pmr.moveCenter( cr.center() ); |
967 | p->setPen( itemg.text() ); | 971 | p->setPen( itemg.text() ); |
968 | p->drawPixmap( pmr.topLeft(), pixmap ); | 972 | p->drawPixmap( pmr.topLeft(), pixmap ); |
969 | 973 | ||
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* | |||
639 | int FreshStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm ) | 639 | int FreshStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm ) |
640 | { | 640 | { |
641 | #ifndef QT_NO_MENUDATA | 641 | #ifndef QT_NO_MENUDATA |
642 | int h = 0; | 642 | int h = 0; |
643 | if ( mi->isSeparator() ) // separator height | 643 | if ( mi->isSeparator() ) // separator height |
644 | h = motifSepHeight; | 644 | h = motifSepHeight; |
645 | else if ( mi->pixmap() ) // pixmap height | 645 | else if ( mi->pixmap() ) // pixmap height |
646 | h = mi->pixmap()->height() + 2*motifItemFrame; | 646 | h = mi->pixmap()->height() + 2*motifItemFrame; |
647 | else // text height | 647 | else // text height |
648 | h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; | 648 | h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; |
649 | 649 | ||
650 | if ( !mi->isSeparator() && mi->iconSet() != 0 ) { | 650 | if ( !mi->isSeparator() && mi->iconSet() != 0 ) { |
651 | h = QMAX( h, mi->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height() + 2*motifItemFrame ); | 651 | h = QMAX( h, mi->iconSet()->pixmap().height() + 2*motifItemFrame ); |
652 | } | 652 | } |
653 | if ( mi->custom() ) | 653 | if ( mi->custom() ) |
654 | h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; | 654 | h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; |
655 | return h; | 655 | return h; |
656 | #endif | 656 | #endif |
657 | } | 657 | } |
658 | 658 | ||
659 | void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, | 659 | void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, |
660 | const QPalette& pal, | 660 | const QPalette& pal, |
661 | bool act, bool enabled, int x, int y, int w, int h) | 661 | bool act, bool enabled, int x, int y, int w, int h) |
662 | { | 662 | { |
663 | #ifndef QT_NO_MENUDATA | 663 | #ifndef QT_NO_MENUDATA |
@@ -693,25 +693,29 @@ void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int | |||
693 | qDrawShadePanel( p, x, y, checkcol, h, | 693 | qDrawShadePanel( p, x, y, checkcol, h, |
694 | g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); | 694 | g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); |
695 | } | 695 | } |
696 | } else if ( !act ) { | 696 | } else if ( !act ) { |
697 | p->fillRect(x, y, checkcol , h, | 697 | p->fillRect(x, y, checkcol , h, |
698 | g.brush( QColorGroup::Button )); | 698 | g.brush( QColorGroup::Button )); |
699 | } | 699 | } |
700 | 700 | ||
701 | if ( mi->iconSet() ) { // draw iconset | 701 | if ( mi->iconSet() ) { // draw iconset |
702 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; | 702 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; |
703 | if (act && !dis ) | 703 | if (act && !dis ) |
704 | mode = QIconSet::Active; | 704 | mode = QIconSet::Active; |
705 | QPixmap pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode ); | 705 | QPixmap pixmap; |
706 | if ( mode == QIconSet::Disabled ) | ||
707 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
708 | else | ||
709 | pixmap = mi->iconSet()->pixmap(); | ||
706 | int pixw = pixmap.width(); | 710 | int pixw = pixmap.width(); |
707 | int pixh = pixmap.height(); | 711 | int pixh = pixmap.height(); |
708 | if ( act && !dis ) { | 712 | if ( act && !dis ) { |
709 | if ( !mi->isChecked() ) | 713 | if ( !mi->isChecked() ) |
710 | qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); | 714 | qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); |
711 | } | 715 | } |
712 | QRect cr( x, y, checkcol, h ); | 716 | QRect cr( x, y, checkcol, h ); |
713 | QRect pmr( 0, 0, pixw, pixh ); | 717 | QRect pmr( 0, 0, pixw, pixh ); |
714 | pmr.moveCenter( cr.center() ); | 718 | pmr.moveCenter( cr.center() ); |
715 | p->setPen( itemg.text() ); | 719 | p->setPen( itemg.text() ); |
716 | p->drawPixmap( pmr.topLeft(), pixmap ); | 720 | p->drawPixmap( pmr.topLeft(), pixmap ); |
717 | 721 | ||
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) | |||
1294 | bool act = btn->isOn() || btn->isDown(); | 1294 | bool act = btn->isOn() || btn->isDown(); |
1295 | if(act){ | 1295 | if(act){ |
1296 | ++x1, ++y1; | 1296 | ++x1, ++y1; |
1297 | } | 1297 | } |
1298 | 1298 | ||
1299 | // Draw iconset first, if any | 1299 | // Draw iconset first, if any |
1300 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) | 1300 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) |
1301 | { | 1301 | { |
1302 | QIconSet::Mode mode = btn->isEnabled() | 1302 | QIconSet::Mode mode = btn->isEnabled() |
1303 | ? QIconSet::Normal : QIconSet::Disabled; | 1303 | ? QIconSet::Normal : QIconSet::Disabled; |
1304 | if ( mode == QIconSet::Normal && btn->hasFocus() ) | 1304 | if ( mode == QIconSet::Normal && btn->hasFocus() ) |
1305 | mode = QIconSet::Active; | 1305 | mode = QIconSet::Active; |
1306 | QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); | 1306 | QPixmap pixmap; |
1307 | if ( mode == QIconSet::Disabled ) | ||
1308 | pixmap = btn->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
1309 | else | ||
1310 | pixmap = btn->iconSet()->pixmap(); | ||
1307 | int pixw = pixmap.width(); | 1311 | int pixw = pixmap.width(); |
1308 | int pixh = pixmap.height(); | 1312 | int pixh = pixmap.height(); |
1309 | 1313 | ||
1310 | p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); | 1314 | p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); |
1311 | x1 += pixw + 8; | 1315 | x1 += pixw + 8; |
1312 | w -= pixw + 8; | 1316 | w -= pixw + 8; |
1313 | } | 1317 | } |
1314 | 1318 | ||
1315 | if(act){ | 1319 | if(act){ |
1316 | QFont font = btn->font(); | 1320 | QFont font = btn->font(); |
1317 | font.setBold(true); | 1321 | font.setBold(true); |
1318 | p->setFont(font); | 1322 | p->setFont(font); |
@@ -2146,25 +2150,29 @@ static const int windowsRightBorder = 12; | |||
2146 | c = menuHandler->bgColor(); | 2150 | c = menuHandler->bgColor(); |
2147 | } | 2151 | } |
2148 | p->setPen(c.dark(140)); | 2152 | p->setPen(c.dark(140)); |
2149 | p->drawLine(x, y, x+w, y ); | 2153 | p->drawLine(x, y, x+w, y ); |
2150 | p->setPen(c.light(115)); | 2154 | p->setPen(c.light(115)); |
2151 | p->drawLine(x, y+1, x+w, y+1 ); | 2155 | p->drawLine(x, y+1, x+w, y+1 ); |
2152 | return; | 2156 | return; |
2153 | } | 2157 | } |
2154 | if(mi->iconSet()) { | 2158 | if(mi->iconSet()) { |
2155 | QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal; | 2159 | QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal; |
2156 | if (!dis) | 2160 | if (!dis) |
2157 | mode = QIconSet::Active; | 2161 | mode = QIconSet::Active; |
2158 | QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode); | 2162 | QPixmap pixmap; |
2163 | if ( mode == QIconSet::Disabled ) | ||
2164 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
2165 | else | ||
2166 | pixmap = mi->iconSet()->pixmap(); | ||
2159 | int pixw = pixmap.width(); | 2167 | int pixw = pixmap.width(); |
2160 | int pixh = pixmap.height(); | 2168 | int pixh = pixmap.height(); |
2161 | QRect cr(x, y, checkcol, h); | 2169 | QRect cr(x, y, checkcol, h); |
2162 | QRect pmr(0, 0, pixw, pixh); | 2170 | QRect pmr(0, 0, pixw, pixh); |
2163 | pmr.moveCenter( cr.center() ); | 2171 | pmr.moveCenter( cr.center() ); |
2164 | p->setPen(itemg.highlightedText()); | 2172 | p->setPen(itemg.highlightedText()); |
2165 | p->drawPixmap(pmr.topLeft(), pixmap ); | 2173 | p->drawPixmap(pmr.topLeft(), pixmap ); |
2166 | 2174 | ||
2167 | } | 2175 | } |
2168 | else if(checkable) { | 2176 | else if(checkable) { |
2169 | int mw = checkcol + motifItemFrame; | 2177 | int mw = checkcol + motifItemFrame; |
2170 | int mh = h - 2*motifItemFrame; | 2178 | int mh = h - 2*motifItemFrame; |
@@ -2227,26 +2235,25 @@ static const int windowsRightBorder = 12; | |||
2227 | 2235 | ||
2228 | int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi, | 2236 | int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi, |
2229 | const QFontMetrics &fm) | 2237 | const QFontMetrics &fm) |
2230 | { | 2238 | { |
2231 | if (mi->isSeparator()) | 2239 | if (mi->isSeparator()) |
2232 | return 2; | 2240 | return 2; |
2233 | 2241 | ||
2234 | int h = 0; | 2242 | int h = 0; |
2235 | if (mi->pixmap()) | 2243 | if (mi->pixmap()) |
2236 | h = mi->pixmap()->height(); | 2244 | h = mi->pixmap()->height(); |
2237 | 2245 | ||
2238 | if (mi->iconSet()) | 2246 | if (mi->iconSet()) |
2239 | h = QMAX(mi->iconSet()-> | 2247 | h = QMAX(mi->iconSet()->pixmap().height(), h); |
2240 | pixmap(QIconSet::Small, QIconSet::Normal).height(), h); | ||
2241 | 2248 | ||
2242 | h = QMAX(fm.height() + 4, h); | 2249 | h = QMAX(fm.height() + 4, h); |
2243 | 2250 | ||
2244 | // we want a minimum size of 18 | 2251 | // we want a minimum size of 18 |
2245 | h = QMAX(h, 18); | 2252 | h = QMAX(h, 18); |
2246 | 2253 | ||
2247 | return h; | 2254 | return h; |
2248 | } | 2255 | } |
2249 | 2256 | ||
2250 | 2257 | ||
2251 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, | 2258 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, |
2252 | const QColorGroup &g, const QColor *c, | 2259 | 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) { | |||
381 | } else { | 381 | } else { |
382 | mode = QIconSet::Disabled; | 382 | mode = QIconSet::Disabled; |
383 | } | 383 | } |
384 | 384 | ||
385 | #if 0 | 385 | #if 0 |
386 | if (button->isToggleButton() && button->isOn()) { | 386 | if (button->isToggleButton() && button->isOn()) { |
387 | state = true; | 387 | state = true; |
388 | } else { | 388 | } else { |
389 | state = false; | 389 | state = false; |
390 | } | 390 | } |
391 | #endif | 391 | #endif |
392 | 392 | ||
393 | pixmap = button->iconSet()->pixmap(QIconSet::Small, mode); | 393 | if ( mode == QIconSet::Disabled ) |
394 | pixmap = button->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
395 | else | ||
396 | pixmap = button->iconSet()->pixmap(); | ||
394 | if (button->text().isEmpty() && !button->pixmap()) { | 397 | if (button->text().isEmpty() && !button->pixmap()) { |
395 | painter->drawPixmap(x+w/2 - pixmap.width()/2, | 398 | painter->drawPixmap(x+w/2 - pixmap.width()/2, |
396 | y+h/2 - pixmap.height()/2, pixmap); | 399 | y+h/2 - pixmap.height()/2, pixmap); |
397 | } else { | 400 | } else { |
398 | painter->drawPixmap(x+4, y+h/2 - pixmap.height()/2, pixmap); | 401 | painter->drawPixmap(x+4, y+h/2 - pixmap.height()/2, pixmap); |
399 | } | 402 | } |
400 | x += pixmap.width() + 4; | 403 | x += pixmap.width() + 4; |
401 | w -= pixmap.width() + 4; | 404 | w -= pixmap.width() + 4; |
402 | } | 405 | } |
403 | 406 | ||
404 | if (active || button->isDefault()) { // default button | 407 | if (active || button->isDefault()) { // default button |
405 | for(int n=0; n<2; n++) { | 408 | for(int n=0; n<2; n++) { |
@@ -560,26 +563,25 @@ int PhaseStyle::popupMenuItemHeight ( bool , | |||
560 | h += ITEMVMARGIN*2 + ITEMFRAME*2; | 563 | h += ITEMVMARGIN*2 + ITEMFRAME*2; |
561 | }else if (mi->isSeparator() ) { | 564 | }else if (mi->isSeparator() ) { |
562 | h = 1; | 565 | h = 1; |
563 | }else { | 566 | }else { |
564 | if ( mi->pixmap() ) { | 567 | if ( mi->pixmap() ) { |
565 | h = QMAX(h, mi->pixmap()->height() + ITEMFRAME*2); | 568 | h = QMAX(h, mi->pixmap()->height() + ITEMFRAME*2); |
566 | }else { | 569 | }else { |
567 | h = QMAX(h, MINICONSIZE+ITEMFRAME*2 ); | 570 | h = QMAX(h, MINICONSIZE+ITEMFRAME*2 ); |
568 | h = QMAX(h, fm.height() | 571 | h = QMAX(h, fm.height() |
569 | + ITEMVMARGIN*2 + ITEMFRAME*2 ); | 572 | + ITEMVMARGIN*2 + ITEMFRAME*2 ); |
570 | } | 573 | } |
571 | if ( mi->iconSet() ) | 574 | if ( mi->iconSet() ) |
572 | h = QMAX(h, mi->iconSet()-> | 575 | h = QMAX(h, mi->iconSet()->pixmap().height() |
573 | pixmap(QIconSet::Small, QIconSet::Normal ).height() | ||
574 | + ITEMFRAME*2 ); | 576 | + ITEMFRAME*2 ); |
575 | } | 577 | } |
576 | 578 | ||
577 | 579 | ||
578 | return h; | 580 | return h; |
579 | } | 581 | } |
580 | 582 | ||
581 | int PhaseStyle::extraPopupMenuItemWidth(bool checkable, int maxpmw, | 583 | int PhaseStyle::extraPopupMenuItemWidth(bool checkable, int maxpmw, |
582 | QMenuItem* mi, const QFontMetrics& ) { | 584 | QMenuItem* mi, const QFontMetrics& ) { |
583 | int w = 0; | 585 | int w = 0; |
584 | if (mi->isSeparator() ) | 586 | if (mi->isSeparator() ) |
585 | return 3; | 587 | return 3; |
@@ -652,25 +654,29 @@ void PhaseStyle::drawPopupMenuItem ( QPainter * p, bool checkable, | |||
652 | p->drawLine( x+8, y-1, x+w-8, y-1 ); | 654 | p->drawLine( x+8, y-1, x+w-8, y-1 ); |
653 | p->drawPoint(x+8, y ); | 655 | p->drawPoint(x+8, y ); |
654 | return; | 656 | return; |
655 | } | 657 | } |
656 | 658 | ||
657 | // draw icon | 659 | // draw icon |
658 | QIconSet::Mode mode; | 660 | QIconSet::Mode mode; |
659 | if ( mi->iconSet() && !mi->isChecked() ) { | 661 | if ( mi->iconSet() && !mi->isChecked() ) { |
660 | if ( act ) | 662 | if ( act ) |
661 | mode = enabled ? QIconSet::Active : QIconSet::Disabled; | 663 | mode = enabled ? QIconSet::Active : QIconSet::Disabled; |
662 | else | 664 | else |
663 | mode = enabled ? QIconSet::Normal : QIconSet::Disabled; | 665 | mode = enabled ? QIconSet::Normal : QIconSet::Disabled; |
664 | QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode ); | 666 | QPixmap pixmap; |
667 | if ( mode == QIconSet::Disabled ) | ||
668 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
669 | else | ||
670 | pixmap = mi->iconSet()->pixmap(); | ||
665 | QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); | 671 | QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); |
666 | QRect cr(x, y, maxpmw, h ); | 672 | QRect cr(x, y, maxpmw, h ); |
667 | pmrect.moveCenter( cr.center() ); | 673 | pmrect.moveCenter( cr.center() ); |
668 | p->drawPixmap(pmrect.topLeft(), pixmap); | 674 | p->drawPixmap(pmrect.topLeft(), pixmap); |
669 | } | 675 | } |
670 | 676 | ||
671 | // draw check | 677 | // draw check |
672 | if(mi->isChecked() ) { | 678 | if(mi->isChecked() ) { |
673 | drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled ); | 679 | drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled ); |
674 | } | 680 | } |
675 | 681 | ||
676 | 682 | ||
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 ) | |||
1174 | x + w - dx - 2, y + 2, dx, h - 4, | 1174 | x + w - dx - 2, y + 2, dx, h - 4, |
1175 | btn->colorGroup(), | 1175 | btn->colorGroup(), |
1176 | btn->isEnabled() ); | 1176 | btn->isEnabled() ); |
1177 | w -= dx; | 1177 | w -= dx; |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | // Next, draw iconset, if any | 1180 | // Next, draw iconset, if any |
1181 | if ( btn->iconSet() && !btn->iconSet() ->isNull() ) { | 1181 | if ( btn->iconSet() && !btn->iconSet() ->isNull() ) { |
1182 | QIconSet::Mode mode = btn->isEnabled() | 1182 | QIconSet::Mode mode = btn->isEnabled() |
1183 | ? QIconSet::Normal : QIconSet::Disabled; | 1183 | ? QIconSet::Normal : QIconSet::Disabled; |
1184 | if ( mode == QIconSet::Normal && btn->hasFocus() ) | 1184 | if ( mode == QIconSet::Normal && btn->hasFocus() ) |
1185 | mode = QIconSet::Active; | 1185 | mode = QIconSet::Active; |
1186 | QPixmap pixmap = btn->iconSet() ->pixmap( QIconSet::Small, mode ); | 1186 | QPixmap pixmap = btn->iconSet() ->pixmap( QIconSet::Automatic, mode ); |
1187 | int pixw = pixmap.width(); | 1187 | int pixw = pixmap.width(); |
1188 | int pixh = pixmap.height(); | 1188 | int pixh = pixmap.height(); |
1189 | 1189 | ||
1190 | p->drawPixmap( x + 6, y + h / 2 - pixh / 2, pixmap ); | 1190 | p->drawPixmap( x + 6, y + h / 2 - pixh / 2, pixmap ); |
1191 | x += pixw + 8; | 1191 | x += pixw + 8; |
1192 | w -= pixw + 8; | 1192 | w -= pixw + 8; |
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | if ( widget == PushButtonDown ) { | 1195 | if ( widget == PushButtonDown ) { |
1196 | drawItem( p, x + buttonXShift(), y + buttonYShift(), | 1196 | drawItem( p, x + buttonXShift(), y + buttonYShift(), |
1197 | w, h, AlignCenter | ShowPrefix, *cg, btn->isEnabled(), | 1197 | w, h, AlignCenter | ShowPrefix, *cg, btn->isEnabled(), |
1198 | btn->pixmap(), btn->text(), -1, &cg->buttonText() ); | 1198 | btn->pixmap(), btn->text(), -1, &cg->buttonText() ); |
@@ -1237,26 +1237,25 @@ int OThemeStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem *mi, | |||
1237 | int offset = QMAX( decoWidth( MenuItemDown ), decoWidth( MenuItem ) ) + 4; | 1237 | int offset = QMAX( decoWidth( MenuItemDown ), decoWidth( MenuItem ) ) + 4; |
1238 | 1238 | ||
1239 | if ( mi->isSeparator() ) | 1239 | if ( mi->isSeparator() ) |
1240 | return ( 2 ); | 1240 | return ( 2 ); |
1241 | if ( mi->isChecked() ) | 1241 | if ( mi->isChecked() ) |
1242 | h = isPixmap( CheckMark ) ? uncached( CheckMark ) ->height() + offset : | 1242 | h = isPixmap( CheckMark ) ? uncached( CheckMark ) ->height() + offset : |
1243 | offset + 16; | 1243 | offset + 16; |
1244 | if ( mi->pixmap() ) { | 1244 | if ( mi->pixmap() ) { |
1245 | h2 = mi->pixmap() ->height() + offset; | 1245 | h2 = mi->pixmap() ->height() + offset; |
1246 | h = h2 > h ? h2 : h; | 1246 | h = h2 > h ? h2 : h; |
1247 | } | 1247 | } |
1248 | if ( mi->iconSet() ) { | 1248 | if ( mi->iconSet() ) { |
1249 | h2 = mi->iconSet() -> | 1249 | h2 = mi->iconSet() ->pixmap().height() + offset; |
1250 | pixmap( QIconSet::Small, QIconSet::Normal ).height() + offset; | ||
1251 | h = h2 > h ? h2 : h; | 1250 | h = h2 > h ? h2 : h; |
1252 | } | 1251 | } |
1253 | h2 = fm.height() + offset; | 1252 | h2 = fm.height() + offset; |
1254 | h = h2 > h ? h2 : h; | 1253 | h = h2 > h ? h2 : h; |
1255 | return ( h ); | 1254 | return ( h ); |
1256 | } | 1255 | } |
1257 | 1256 | ||
1258 | void OThemeStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, | 1257 | void OThemeStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, |
1259 | int tab, QMenuItem* mi, | 1258 | int tab, QMenuItem* mi, |
1260 | const QPalette& pal, bool act, | 1259 | const QPalette& pal, bool act, |
1261 | bool enabled, int x, int y, int w, int h ) | 1260 | bool enabled, int x, int y, int w, int h ) |
1262 | { | 1261 | { |
@@ -1316,25 +1315,29 @@ void OThemeStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, | |||
1316 | int mw = checkcol + motifItemFrame; | 1315 | int mw = checkcol + motifItemFrame; |
1317 | drawShade( p, x, y, mw, h, g, true, false, | 1316 | drawShade( p, x, y, mw, h, g, true, false, |
1318 | highlightWidth( MenuItemDown ), | 1317 | highlightWidth( MenuItemDown ), |
1319 | borderWidth( MenuItemDown ), shade() ); | 1318 | borderWidth( MenuItemDown ), shade() ); |
1320 | } | 1319 | } |
1321 | } | 1320 | } |
1322 | if ( !mi ) | 1321 | if ( !mi ) |
1323 | return ; | 1322 | return ; |
1324 | if ( mi->iconSet() ) { | 1323 | if ( mi->iconSet() ) { |
1325 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; | 1324 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; |
1326 | if ( act && !dis ) | 1325 | if ( act && !dis ) |
1327 | mode = QIconSet::Active; | 1326 | mode = QIconSet::Active; |
1328 | QPixmap pixmap = mi->iconSet() ->pixmap( QIconSet::Small, mode ); | 1327 | QPixmap pixmap; |
1328 | if ( mode == QIconSet::Disabled ) | ||
1329 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
1330 | else | ||
1331 | pixmap = mi->iconSet()->pixmap(); | ||
1329 | int pixw = pixmap.width(); | 1332 | int pixw = pixmap.width(); |
1330 | int pixh = pixmap.height(); | 1333 | int pixh = pixmap.height(); |
1331 | QRect cr( x, y, checkcol, h ); | 1334 | QRect cr( x, y, checkcol, h ); |
1332 | QRect pmr( 0, 0, pixw, pixh ); | 1335 | QRect pmr( 0, 0, pixw, pixh ); |
1333 | pmr.moveCenter( cr.center() ); | 1336 | pmr.moveCenter( cr.center() ); |
1334 | p->setPen( itemg.text() ); | 1337 | p->setPen( itemg.text() ); |
1335 | p->drawPixmap( pmr.topLeft(), pixmap ); | 1338 | p->drawPixmap( pmr.topLeft(), pixmap ); |
1336 | 1339 | ||
1337 | } | 1340 | } |
1338 | else if ( checkable ) { | 1341 | else if ( checkable ) { |
1339 | int mw = checkcol + motifItemFrame; | 1342 | int mw = checkcol + motifItemFrame; |
1340 | int mh = h - 2 * motifItemFrame; | 1343 | 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 @@ | |||
34 | 34 | ||
35 | #include "webstyle.h" | 35 | #include "webstyle.h" |
36 | 36 | ||
37 | static const int _indicatorSize = 9; | 37 | static const int _indicatorSize = 9; |
38 | static QButton * _highlightedButton = 0; | 38 | static QButton * _highlightedButton = 0; |
39 | static const int _scrollBarExtent = 12; | 39 | static const int _scrollBarExtent = 12; |
40 | 40 | ||
41 | static QFrame * _currentFrame = 0; | 41 | static QFrame * _currentFrame = 0; |
42 | static int _savedFrameLineWidth; | 42 | static int _savedFrameLineWidth; |
43 | static int _savedFrameMidLineWidth; | 43 | static int _savedFrameMidLineWidth; |
44 | static ulong _savedFrameStyle; | 44 | static ulong _savedFrameStyle; |
45 | 45 | ||
46 | static const int ITEMFRAME = 1; // menu stuff | ||
47 | static const int ITEMHMARGIN = 3; | ||
48 | static const int ITEMVMARGIN = 0; | ||
49 | |||
50 | static const int ARROWMARGIN = 6; | ||
51 | static const int RIGHTBORDER = 10; | ||
52 | static const int MINICONSIZE = 12; | ||
53 | |||
54 | |||
46 | static QColor contrastingForeground(const QColor & fg, const QColor & bg) | 55 | static QColor contrastingForeground(const QColor & fg, const QColor & bg) |
47 | { | 56 | { |
48 | int h, s, vbg, vfg; | 57 | int h, s, vbg, vfg; |
49 | 58 | ||
50 | bg.hsv(&h, &s, &vbg); | 59 | bg.hsv(&h, &s, &vbg); |
51 | fg.hsv(&h, &s, &vfg); | 60 | fg.hsv(&h, &s, &vfg); |
52 | 61 | ||
53 | int diff(vbg - vfg); | 62 | int diff(vbg - vfg); |
54 | 63 | ||
55 | if ((diff > -72) && (diff < 72)) | 64 | if ((diff > -72) && (diff < 72)) |
56 | { | 65 | { |
57 | return (vbg < 128) ? Qt::white : Qt::black; | 66 | return (vbg < 128) ? Qt::white : Qt::black; |
@@ -960,37 +969,148 @@ WebStyle::drawSlider | |||
960 | if( o == Qt::Vertical ) | 969 | if( o == Qt::Vertical ) |
961 | p->drawEllipse(x + w / 2 - sl / 2, y, sl, sl); | 970 | p->drawEllipse(x + w / 2 - sl / 2, y, sl, sl); |
962 | 971 | ||
963 | p->restore(); | 972 | p->restore(); |
964 | } | 973 | } |
965 | 974 | ||
966 | void | 975 | void |
967 | WebStyle::drawPopupMenuItem | 976 | WebStyle::drawPopupMenuItem |
968 | ( | 977 | ( |
969 | QPainter * p, | 978 | QPainter * p, |
970 | bool checkable, | 979 | bool checkable, |
971 | int maxpmw, | 980 | int maxpmw, |
972 | int tab, | 981 | int tabwidth, |
973 | QMenuItem * mi, | 982 | QMenuItem * mi, |
974 | const QPalette & pal, | 983 | const QPalette & pal, |
975 | bool act, | 984 | bool act, |
976 | bool enabled, | 985 | bool enabled, |
977 | int x, | 986 | int x, |
978 | int y, | 987 | int y, |
979 | int w, | 988 | int w, |
980 | int h | 989 | int h |
981 | ) | 990 | ) |
982 | { | 991 | { |
983 | // TODO | 992 | // TODO |
984 | QWindowsStyle::drawPopupMenuItem(p, checkable, maxpmw, tab, mi, pal, act, enabled, x, y, w, h); | 993 | //QWindowsStyle::drawPopupMenuItem(p, checkable, maxpmw, tab, mi, pal, act, enabled, x, y, w, h); |
994 | if ( !mi ) | ||
995 | return; | ||
996 | |||
997 | QRect rect(x, y, w, h ); | ||
998 | int x2, y2; | ||
999 | x2 = rect.right(); | ||
1000 | y2 = rect.bottom(); | ||
1001 | const QColorGroup& g = pal.active(); | ||
1002 | QColorGroup itemg = !enabled ? pal.disabled() : pal.active(); | ||
1003 | |||
1004 | if ( checkable || maxpmw ) maxpmw = QMAX(maxpmw, 20); | ||
1005 | |||
1006 | if (act && enabled ) | ||
1007 | p->fillRect(x, y, w, h, g.highlight() ); | ||
1008 | else | ||
1009 | p->fillRect(x, y, w, h, g.background() ); | ||
1010 | |||
1011 | // draw seperator | ||
1012 | if (mi->isSeparator() ) { | ||
1013 | p->setPen( g.dark() ); | ||
1014 | p->drawLine( x+8, y+1, x+w-8, y+1 ); | ||
1015 | |||
1016 | p->setPen( g.mid() ); | ||
1017 | p->drawLine( x+8, y, x+w-8, y ); | ||
1018 | p->drawPoint(x+w,y+1); | ||
1019 | |||
1020 | p->setPen( g.midlight() ); | ||
1021 | p->drawLine( x+8, y-1, x+w-8, y-1 ); | ||
1022 | p->drawPoint(x+8, y ); | ||
1023 | return; | ||
1024 | } | ||
1025 | |||
1026 | // draw icon | ||
1027 | QIconSet::Mode mode; | ||
1028 | if ( mi->iconSet() && !mi->isChecked() ) { | ||
1029 | if ( act ) | ||
1030 | mode = enabled ? QIconSet::Active : QIconSet::Disabled; | ||
1031 | else | ||
1032 | mode = enabled ? QIconSet::Normal : QIconSet::Disabled; | ||
1033 | QPixmap pixmap; | ||
1034 | if ( mode == QIconSet::Disabled ) | ||
1035 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
1036 | else | ||
1037 | pixmap = mi->iconSet()->pixmap(); | ||
1038 | QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); | ||
1039 | QRect cr(x, y, maxpmw, h ); | ||
1040 | pmrect.moveCenter( cr.center() ); | ||
1041 | p->drawPixmap(pmrect.topLeft(), pixmap); | ||
1042 | } | ||
1043 | |||
1044 | // draw check | ||
1045 | if(mi->isChecked() ) { | ||
1046 | drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled ); | ||
1047 | } | ||
1048 | |||
1049 | |||
1050 | // draw text | ||
1051 | int xm = maxpmw + 2; | ||
1052 | int xp = x + xm; | ||
1053 | int tw = w -xm - 2; | ||
1054 | |||
1055 | p->setPen( enabled ? ( act ? g.highlightedText() : g.buttonText() ) : | ||
1056 | g.mid() ); | ||
1057 | |||
1058 | |||
1059 | if ( mi->custom() ) { | ||
1060 | p->save(); | ||
1061 | mi->custom()->paint(p, g, act, enabled, | ||
1062 | xp, y+1, tw, h-2 ); | ||
1063 | p->restore(); | ||
1064 | }else { // draw label | ||
1065 | QString text = mi->text(); | ||
1066 | if (!text.isNull() ) { | ||
1067 | int t = text.find('\t'); | ||
1068 | const int tflags = AlignVCenter | DontClip | | ||
1069 | ShowPrefix | SingleLine | | ||
1070 | AlignLeft; | ||
1071 | |||
1072 | if (t >= 0) { | ||
1073 | int tabx = x + w - tabwidth - RIGHTBORDER - | ||
1074 | ITEMHMARGIN - ITEMFRAME; | ||
1075 | p->drawText(tabx, y+ITEMVMARGIN, tabwidth, | ||
1076 | h-2*ITEMVMARGIN, tflags, | ||
1077 | text.mid(t+1) ); | ||
1078 | text = text.left(t ); | ||
1079 | } | ||
1080 | |||
1081 | // draw left label | ||
1082 | p->drawText(xp, y+ITEMVMARGIN, | ||
1083 | tw, h-2*ITEMVMARGIN, | ||
1084 | tflags, text, t); | ||
1085 | }else if ( mi->pixmap() ) { // pixmap as label | ||
1086 | QPixmap pixmap = *mi->pixmap(); | ||
1087 | if ( pixmap.depth() == 1 ) | ||
1088 | p->setBackgroundMode( OpaqueMode ); | ||
1089 | |||
1090 | int dx = ((w-pixmap.width() ) /2 ) + | ||
1091 | ((w - pixmap.width()) %2 ); | ||
1092 | p->drawPixmap(x+dx, y+ITEMFRAME, pixmap ); | ||
1093 | |||
1094 | if ( pixmap.depth() == 1 ) | ||
1095 | p->setBackgroundMode( TransparentMode ); | ||
1096 | } | ||
1097 | } | ||
1098 | |||
1099 | if ( mi->popup() ) { // draw submenu arrow | ||
1100 | int dim = (h-2*ITEMFRAME) / 2; | ||
1101 | drawArrow( p, RightArrow, false, | ||
1102 | x+w-ARROWMARGIN-ITEMFRAME-dim, | ||
1103 | y+h/2-dim/2, dim, dim, g, enabled ); | ||
1104 | } | ||
985 | } | 1105 | } |
986 | 1106 | ||
987 | void | 1107 | void |
988 | WebStyle::drawFocusRect | 1108 | WebStyle::drawFocusRect |
989 | ( | 1109 | ( |
990 | QPainter * p, | 1110 | QPainter * p, |
991 | const QRect & r, | 1111 | const QRect & r, |
992 | const QColorGroup & g, | 1112 | const QColorGroup & g, |
993 | const QColor * pen, | 1113 | const QColor * pen, |
994 | bool atBorder | 1114 | bool atBorder |
995 | ) | 1115 | ) |
996 | { | 1116 | { |
@@ -1159,25 +1279,25 @@ WebStyle::popupMenuItemHeight(bool, QMenuItem * i, const QFontMetrics & fm) | |||
1159 | 1279 | ||
1160 | int h = 0; | 1280 | int h = 0; |
1161 | 1281 | ||
1162 | if (0 != i->pixmap()) | 1282 | if (0 != i->pixmap()) |
1163 | { | 1283 | { |
1164 | h = i->pixmap()->height(); | 1284 | h = i->pixmap()->height(); |
1165 | } | 1285 | } |
1166 | 1286 | ||
1167 | if (0 != i->iconSet()) | 1287 | if (0 != i->iconSet()) |
1168 | { | 1288 | { |
1169 | h = QMAX | 1289 | h = QMAX |
1170 | ( | 1290 | ( |
1171 | i->iconSet()->pixmap(QIconSet::Small, QIconSet::Normal).height(), | 1291 | i->iconSet()->pixmap().height(), |
1172 | h | 1292 | h |
1173 | ); | 1293 | ); |
1174 | } | 1294 | } |
1175 | 1295 | ||
1176 | h = QMAX(fm.height() + 4, h); | 1296 | h = QMAX(fm.height() + 4, h); |
1177 | 1297 | ||
1178 | h = QMAX(18, h); | 1298 | h = QMAX(18, h); |
1179 | 1299 | ||
1180 | return h; | 1300 | return h; |
1181 | 1301 | ||
1182 | } | 1302 | } |
1183 | 1303 | ||
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 { | |||
206 | int h, | 206 | int h, |
207 | const QColorGroup &, | 207 | const QColorGroup &, |
208 | Orientation, | 208 | Orientation, |
209 | bool tickAbove, | 209 | bool tickAbove, |
210 | bool tickBelow | 210 | bool tickBelow |
211 | ); | 211 | ); |
212 | 212 | ||
213 | void drawPopupMenuItem | 213 | void drawPopupMenuItem |
214 | ( | 214 | ( |
215 | QPainter *, | 215 | QPainter *, |
216 | bool checkable, | 216 | bool checkable, |
217 | int maxpmw, | 217 | int maxpmw, |
218 | int tab, | 218 | int tabwidth, |
219 | QMenuItem *, | 219 | QMenuItem *, |
220 | const QPalette &, | 220 | const QPalette &, |
221 | bool act, | 221 | bool act, |
222 | bool enabled, | 222 | bool enabled, |
223 | int x, | 223 | int x, |
224 | int y, | 224 | int y, |
225 | int w, | 225 | int w, |
226 | int h | 226 | int h |
227 | ); | 227 | ); |
228 | 228 | ||
229 | void drawFocusRect | 229 | void drawFocusRect |
230 | ( | 230 | ( |