00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "lightstyle.h"
00021
00022 #if QT_VERSION < 300
00023
00024 #define INCLUDE_MENUITEM_DEF
00025 #include "qmenubar.h"
00026 #include "qapplication.h"
00027 #include "qpainter.h"
00028 #include "qpalette.h"
00029 #include "qframe.h"
00030 #include "qpushbutton.h"
00031 #include "qdrawutil.h"
00032 #include "qscrollbar.h"
00033 #include "qtabbar.h"
00034 #include "qguardedptr.h"
00035 #include "qlayout.h"
00036 #include "qlineedit.h"
00037
00038
00039 class LightStylePrivate
00040 {
00041 public:
00042 LightStylePrivate()
00043 : hoverWidget(0), ref(1), savePalette(0)
00044 {
00045 }
00046
00047 QGuardedPtr<QWidget> hoverWidget;
00048 QPalette oldPalette, hoverPalette;
00049 int ref;
00050 QPoint mousePos;
00051 QPalette *savePalette;
00052 };
00053
00054
00055 static LightStylePrivate *singleton = 0;
00056
00057
00058 LightStyle::LightStyle()
00059 : QWindowsStyle()
00060 {
00061 if (! singleton) {
00062 singleton = new LightStylePrivate;
00063
00064 QPalette pal = QApplication::palette();
00065 singleton->oldPalette = pal;
00066
00067 QColor bg = pal.color(QPalette::Active, QColorGroup::Background);
00068 QColor prelight;
00069
00070 if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128)
00071 prelight = pal.color(QPalette::Active,
00072 QColorGroup::Background).light(110);
00073 else
00074 prelight = pal.color(QPalette::Active,
00075 QColorGroup::Background).light(120);
00076
00077 QColorGroup active2(pal.color(QPalette::Active,
00078 QColorGroup::Foreground),
00079 prelight,
00080 prelight.light(),
00081 prelight.dark(),
00082 prelight.dark(120),
00083 pal.color(QPalette::Active,
00084 QColorGroup::Text),
00085 pal.color(QPalette::Active,
00086 QColorGroup::BrightText),
00087 pal.color(QPalette::Active,
00088 QColorGroup::Base),
00089 bg);
00090 active2.setColor(QColorGroup::Highlight,
00091 pal.color(QPalette::Active, QColorGroup::Highlight));
00092
00093 singleton->hoverPalette = pal;
00094 singleton->hoverPalette.setActive(active2);
00095 singleton->hoverPalette.setInactive(active2);
00096 } else
00097 singleton->ref++;
00098 }
00099
00100
00101 LightStyle::~LightStyle()
00102 {
00103 if (singleton && singleton->ref-- <= 0) {
00104 delete singleton;
00105 singleton = 0;
00106 }
00107 }
00108
00109
00110 QSize LightStyle::scrollBarExtent() const
00111 {
00112 return QSize(12 + defaultFrameWidth(), 12 + defaultFrameWidth());
00113 }
00114
00115
00116 int LightStyle::buttonDefaultIndicatorWidth() const
00117 {
00118 return 2;
00119 }
00120
00121
00122 int LightStyle::sliderThickness() const
00123 {
00124 return 16;
00125 }
00126
00127 int LightStyle::sliderLength() const
00128 {
00129 return 13;
00130 }
00131
00132
00133 int LightStyle::buttonMargin() const
00134 {
00135 return 4;
00136 }
00137
00138
00139 QSize LightStyle::exclusiveIndicatorSize() const
00140 {
00141 return QSize(13, 13);
00142 }
00143
00144
00145 int LightStyle::defaultFrameWidth() const
00146 {
00147 return 2;
00148 }
00149
00150
00151 QSize LightStyle::indicatorSize() const
00152 {
00153 return QSize(13, 13);
00154 }
00155
00156
00157 void LightStyle::polish(QWidget *widget)
00158 {
00159 if (widget->inherits("QPushButton"))
00160 widget->installEventFilter(this);
00161
00162 #if QT_VERSION >= 300
00163 if (widget->inherits("QLineEdit")) {
00164 QLineEdit *lineedit = (QLineEdit *) widget;
00165 lineedit->setFrameShape(QFrame::StyledPanel);
00166 lineedit->setLineWidth(2);
00167 }
00168 #endif
00169
00170 QWindowsStyle::polish(widget);
00171 }
00172
00173
00174 void LightStyle::unPolish(QWidget *widget)
00175 {
00176 if (widget->inherits("QPushButton"))
00177 widget->removeEventFilter(this);
00178
00179 #if QT_VERSION >= 300
00180 if (widget->inherits("QLineEdit")) {
00181 QLineEdit *lineedit = (QLineEdit *) widget;
00182 lineedit->setLineWidth(1);
00183 lineedit->setFrameShape(QFrame::WinPanel);
00184 }
00185 #endif
00186
00187 QWindowsStyle::unPolish(widget);
00188 }
00189
00190
00191 void LightStyle::polish(QApplication *app)
00192 {
00193 QPalette pal = app->palette();
00194
00195 QColorGroup active(pal.color(QPalette::Active,
00196 QColorGroup::Foreground),
00197 pal.color(QPalette::Active,
00198 QColorGroup::Button),
00199 pal.color(QPalette::Active,
00200 QColorGroup::Background).light(),
00201 pal.color(QPalette::Active,
00202 QColorGroup::Background).dark(175),
00203 pal.color(QPalette::Active,
00204 QColorGroup::Background).dark(110),
00205 pal.color(QPalette::Active,
00206 QColorGroup::Text),
00207 pal.color(QPalette::Active,
00208 QColorGroup::BrightText),
00209 pal.color(QPalette::Active,
00210 QColorGroup::Base),
00211 pal.color(QPalette::Active,
00212 QColorGroup::Background)),
00213
00214
00215 disabled(pal.color(QPalette::Disabled,
00216 QColorGroup::Foreground),
00217 pal.color(QPalette::Disabled,
00218 QColorGroup::Button),
00219 pal.color(QPalette::Disabled,
00220 QColorGroup::Background).light(),
00221 pal.color(QPalette::Disabled,
00222 QColorGroup::Background).dark(),
00223 pal.color(QPalette::Disabled,
00224 QColorGroup::Background).dark(110),
00225 pal.color(QPalette::Disabled,
00226 QColorGroup::Text),
00227 pal.color(QPalette::Disabled,
00228 QColorGroup::BrightText),
00229 pal.color(QPalette::Disabled,
00230 QColorGroup::Base),
00231 pal.color(QPalette::Disabled,
00232 QColorGroup::Background));
00233
00234 active.setColor(QColorGroup::Highlight,
00235 pal.color(QPalette::Active, QColorGroup::Highlight));
00236 disabled.setColor(QColorGroup::Highlight,
00237 pal.color(QPalette::Disabled, QColorGroup::Highlight));
00238
00239 active.setColor(QColorGroup::HighlightedText,
00240 pal.color(QPalette::Active, QColorGroup::HighlightedText));
00241 disabled.setColor(QColorGroup::HighlightedText,
00242 pal.color(QPalette::Disabled, QColorGroup::HighlightedText));
00243
00244 pal.setActive(active);
00245 pal.setInactive(active);
00246 pal.setDisabled(disabled);
00247
00248 singleton->oldPalette = pal;
00249
00250 QColor bg = pal.color(QPalette::Active, QColorGroup::Background);
00251 QColor prelight;
00252
00253 if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128)
00254 prelight = pal.color(QPalette::Active,
00255 QColorGroup::Background).light(110);
00256 else
00257 prelight = pal.color(QPalette::Active,
00258 QColorGroup::Background).light(120);
00259
00260 QColorGroup active2(pal.color(QPalette::Active,
00261 QColorGroup::Foreground),
00262 prelight,
00263 prelight.light(),
00264 prelight.dark(),
00265 prelight.dark(120),
00266 pal.color(QPalette::Active,
00267 QColorGroup::Text),
00268 pal.color(QPalette::Active,
00269 QColorGroup::BrightText),
00270 pal.color(QPalette::Active,
00271 QColorGroup::Base),
00272 bg);
00273 active2.setColor(QColorGroup::Highlight,
00274 pal.color(QPalette::Active, QColorGroup::Highlight));
00275
00276 singleton->hoverPalette = pal;
00277 singleton->hoverPalette.setActive(active2);
00278 singleton->hoverPalette.setInactive(active2);
00279
00280 app->setPalette(pal);
00281 }
00282
00283
00284 void LightStyle::unPolish(QApplication *app)
00285 {
00286 app->setPalette(singleton->oldPalette);
00287 }
00288
00289
00290 void LightStyle::polishPopupMenu(QPopupMenu *menu)
00291 {
00292 menu->setMouseTracking(TRUE);
00293 }
00294
00295
00296 void LightStyle::drawPushButton(QPushButton *button, QPainter *p)
00297 {
00298 int x1, y1, x2, y2;
00299 button->rect().coords(&x1, &y1, &x2, &y2);
00300
00301 if (button->isDefault()) {
00302 p->save();
00303 p->setPen(button->palette().active().color(QColorGroup::Highlight));
00304 p->setBrush(button->palette().active().brush(QColorGroup::Highlight));
00305 p->drawRoundRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1, 15, 15);
00306 p->restore();
00307 }
00308
00309 if (button->isDefault() || button->autoDefault()) {
00310 x1 += buttonDefaultIndicatorWidth();
00311 y1 += buttonDefaultIndicatorWidth();
00312 x2 -= buttonDefaultIndicatorWidth();
00313 y2 -= buttonDefaultIndicatorWidth();
00314
00315 if (button->isDefault()) {
00316 QPointArray pa(8);
00317 pa.setPoint(0, x1 + 2, y1 );
00318 pa.setPoint(1, x2 - 1, y1 );
00319 pa.setPoint(2, x2 + 1, y1 + 2);
00320 pa.setPoint(3, x2 + 1, y2 - 2);
00321 pa.setPoint(4, x2 - 2, y2 + 1);
00322 pa.setPoint(5, x1 + 2, y2 + 1);
00323 pa.setPoint(6, x1, y2 - 1);
00324 pa.setPoint(7, x1, y1 + 2);
00325 QRegion r(pa);
00326 p->setClipRegion(r);
00327 }
00328 }
00329
00330 QBrush fill;
00331 if (button->isDown() || button->isOn())
00332 fill = button->colorGroup().brush(QColorGroup::Mid);
00333 else
00334 fill = button->colorGroup().brush(QColorGroup::Button);
00335
00336 if ( !button->isFlat() || button->isOn() || button->isDown() )
00337 drawButton(p, x1, y1, x2 - x1 + 1, y2 - y1 + 1,
00338 button->colorGroup(), button->isOn() || button->isDown(), &fill);
00339 }
00340
00341
00342 void LightStyle::drawButton(QPainter *p, int x, int y, int w, int h,
00343 const QColorGroup &g,
00344 bool sunken, const QBrush *fill)
00345 {
00346 p->save();
00347 if ( fill )
00348 p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill);
00349 else
00350 p->fillRect(x + 2, y + 2, w - 4, h - 4,
00351 QBrush(sunken ? g.mid() : g.button()));
00352
00353
00354 p->setPen(g.dark());
00355 p->drawLine(x, y + 2, x, y + h - 3);
00356 p->drawLine(x + 2, y, x + w - 3, y);
00357 p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3);
00358 p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1);
00359 p->drawPoint(x + 1, y + 1);
00360 p->drawPoint(x + 1, y + h - 2);
00361 p->drawPoint(x + w - 2, y + 1);
00362 p->drawPoint(x + w - 2, y + h - 2);
00363
00364
00365 if (sunken)
00366 p->setPen(g.mid());
00367 else
00368 p->setPen(g.light());
00369
00370 p->drawLine(x + 1, y + 2, x + 1, y + h - 3);
00371 p->drawLine(x + 2, y + 1, x + w - 3, y + 1);
00372
00373 if (sunken)
00374 p->setPen(g.light());
00375 else
00376 p->setPen(g.mid());
00377
00378 p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3);
00379 p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2);
00380
00381 p->restore();
00382 }
00383
00384
00385 void LightStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h,
00386 const QColorGroup &g,
00387 bool sunken, const QBrush *fill)
00388 {
00389 drawButton(p, x, y, w, h, g, sunken, fill);
00390 }
00391
00392
00393 void LightStyle::getButtonShift(int &x, int &y) const
00394 {
00395 x = y = 0;
00396 }
00397
00398
00399 void LightStyle::drawComboButton(QPainter *p, int x, int y, int w, int h,
00400 const QColorGroup &g, bool,
00401 bool editable, bool,
00402 const QBrush *fill)
00403 {
00404 drawButton(p, x, y, w, h, g, FALSE, fill);
00405
00406 if (editable) {
00407 QRect r = comboButtonRect(x, y, w, h);
00408 qDrawShadePanel(p, r.x() - 1, r.y() - 1,
00409 r.width() + defaultFrameWidth(),
00410 r.height() + defaultFrameWidth(),
00411 g, TRUE);
00412 }
00413
00414 int indent = ((y + h) / 2) - 3;
00415 int xpos = x;
00416
00417 #if QT_VERSION >= 300
00418 if( QApplication::reverseLayout() )
00419 xpos += indent;
00420 else
00421 #endif
00422 xpos += w - indent - 5;
00423
00424 drawArrow(p, Qt::DownArrow, TRUE, xpos, indent, 5, 5, g, TRUE, fill);
00425 }
00426
00427
00428 QRect LightStyle::comboButtonRect( int x, int y, int w, int h ) const
00429 {
00430 QRect r(x + 3, y + 3, w - 6, h - 6);
00431 int indent = ((y + h) / 2) - 3;
00432 r.setRight(r.right() - indent - 10);
00433
00434 #if QT_VERSION >= 300
00435 if( QApplication::reverseLayout() )
00436 r.moveBy( indent + 10, 0 );
00437 #endif
00438
00439 return r;
00440 }
00441
00442
00443 QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h ) const
00444 {
00445 return comboButtonRect(x, y, w, h);
00446 }
00447
00448
00449 void LightStyle::drawPanel(QPainter *p, int x, int y, int w, int h,
00450 const QColorGroup &g, bool sunken,
00451 int lw, const QBrush *fill)
00452 {
00453 if (lw >= 2) {
00454 if ( fill )
00455 p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill);
00456
00457 QPen oldpen = p->pen();
00458
00459
00460 p->setPen(g.dark());
00461 p->drawLine(x, y + 2, x, y + h - 3);
00462 p->drawLine(x + 2, y, x + w - 3, y);
00463 p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3);
00464 p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1);
00465 p->drawPoint(x + 1, y + 1);
00466 p->drawPoint(x + 1, y + h - 2);
00467 p->drawPoint(x + w - 2, y + 1);
00468 p->drawPoint(x + w - 2, y + h - 2);
00469
00470
00471 if (sunken)
00472 p->setPen(g.mid());
00473 else
00474 p->setPen(g.light());
00475
00476 p->drawLine(x + 1, y + 2, x + 1, y + h - 3);
00477 p->drawLine(x + 2, y + 1, x + w - 3, y + 1);
00478
00479 if (sunken)
00480 p->setPen(g.light());
00481 else
00482 p->setPen(g.mid());
00483
00484 p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3);
00485 p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2);
00486
00487
00488 p->setPen(g.background());
00489 p->drawLine(x, y, x + 1, y);
00490 p->drawLine(x, y + h - 1, x + 1, y + h - 1);
00491 p->drawLine(x + w - 2, y, x + w - 1, y);
00492 p->drawLine(x + w - 2, y + h - 1, x + w - 1, y + h - 1);
00493 p->drawPoint(x, y + 1);
00494 p->drawPoint(x, y + h - 2);
00495 p->drawPoint(x + w - 1, y + 1);
00496 p->drawPoint(x + w - 1, y + h - 2);
00497
00498 p->setPen(oldpen);
00499 } else
00500 qDrawShadePanel(p, x, y, w, h, g, sunken, lw, fill);
00501 }
00502
00503
00504 void LightStyle::drawIndicator(QPainter *p, int x, int y ,int w, int h,
00505 const QColorGroup &g, int state,
00506 bool down, bool)
00507 {
00508 drawButton(p, x, y, w, h, g, TRUE,
00509 &g.brush(down ? QColorGroup::Mid : QColorGroup::Base));
00510
00511 p->save();
00512
00513 p->setPen(g.foreground());
00514 if (state == QButton::NoChange) {
00515 p->drawLine(x + 3, y + h / 2, x + w - 4, y + h / 2);
00516 p->drawLine(x + 3, y + 1 + h / 2, x + w - 4, y + 1 + h / 2);
00517 p->drawLine(x + 3, y - 1 + h / 2, x + w - 4, y - 1 + h / 2);
00518 } else if (state == QButton::On) {
00519 p->drawLine(x + 4, y + 3, x + w - 4, y + h - 5);
00520 p->drawLine(x + 3, y + 3, x + w - 4, y + h - 4);
00521 p->drawLine(x + 3, y + 4, x + w - 5, y + h - 4);
00522 p->drawLine(x + 3, y + h - 5, x + w - 5, y + 3);
00523 p->drawLine(x + 3, y + h - 4, x + w - 4, y + 3);
00524 p->drawLine(x + 4, y + h - 4, x + w - 4, y + 4);
00525 }
00526
00527 p->restore();
00528 }
00529
00530
00531 void LightStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, int h,
00532 const QColorGroup &g, bool on,
00533 bool down, bool)
00534 {
00535 p->save();
00536
00537 p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
00538
00539 p->setPen(g.dark());
00540 p->drawArc(x, y, w, h, 0, 16*360);
00541 p->setPen(g.mid());
00542 p->drawArc(x + 1, y + 1, w - 2, h - 2, 45*16, 180*16);
00543 p->setPen(g.light());
00544 p->drawArc(x + 1, y + 1, w - 2, h - 2, 235*16, 180*16);
00545
00546 p->setPen(down ? g.mid() : g.base());
00547 p->setBrush(down ? g.mid() : g.base());
00548 p->drawEllipse(x + 2, y + 2, w - 4, h - 4);
00549
00550 if (on) {
00551 p->setBrush(g.foreground());
00552 p->drawEllipse(x + 3, y + 3, w - x - 6, h - y - 6);
00553 }
00554
00555 p->restore();
00556 }
00557
00558
00559
00560 #if 1
00561
00562 void LightStyle::drawTab( QPainter *p, const QTabBar *tb, QTab *t, bool selected )
00563 {
00564 #if 0
00565
00566
00567 QFont f = tb->font();
00568 f.setBold( selected );
00569 p->setFont( f );
00570 #endif
00571 QRect r( t->rect() );
00572 if ( tb->shape() == QTabBar::RoundedAbove ) {
00573 p->setPen( tb->colorGroup().light() );
00574 p->drawLine( r.left(), r.bottom(), r.right(), r.bottom() );
00575 if ( r.left() == 0 )
00576 p->drawPoint( tb->rect().bottomLeft() );
00577 else {
00578 p->setPen( tb->colorGroup().light() );
00579 p->drawLine( r.left(), r.bottom(), r.right(), r.bottom() );
00580 }
00581
00582 if ( selected ) {
00583 p->setPen( tb->colorGroup().background() );
00584 p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 );
00585 p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-2),
00586 tb->colorGroup().brush( QColorGroup::Background ));
00587
00588 } else {
00589 r.setRect( r.left() + 2, r.top() + 2,
00590 r.width() - 4, r.height() - 2 );
00591 p->setPen( tb->colorGroup().button() );
00592 p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 );
00593 p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-3),
00594 tb->colorGroup().brush( QColorGroup::Button ));
00595
00596 QColor bg = tb->colorGroup().button();
00597
00598
00599 int n = r.height()/2;
00600 int dark = 100;
00601 for ( int i = 1; i < n; i++ ) {
00602 dark = (dark * (100+(i*15)/n) )/100;
00603 p->setPen( bg.dark( dark ) );
00604 int y = r.bottom()-n+i;
00605 int x1 = r.left()+1;
00606 int x2 = r.right()-1;
00607 p->drawLine( x1, y, x2, y );
00608 }
00609
00610 }
00611
00612 p->setPen( tb->colorGroup().light() );
00613 p->drawLine( r.left(), r.bottom()-1, r.left(), r.top() + 2 );
00614 p->drawPoint( r.left()+1, r.top() + 1 );
00615 p->drawLine( r.left()+2, r.top(),
00616 r.right() - 2, r.top() );
00617
00618 p->setPen( tb->colorGroup().dark() );
00619 p->drawPoint( r.right() - 1, r.top() + 1 );
00620 p->drawLine( r.right(), r.top() + 2, r.right(), r.bottom() - 1);
00621 } else if ( tb->shape() == QTabBar::RoundedBelow ) {
00622 if ( selected ) {
00623 p->setPen( tb->colorGroup().background() );
00624 p->drawLine( r.left()+2, r.bottom()-1, r.right()-2, r.bottom()-1 );
00625 p->fillRect( QRect( r.left()+1, r.top(), r.width()-2, r.height()-2),
00626 tb->palette().normal().brush( QColorGroup::Background ));
00627 } else {
00628 p->setPen( tb->colorGroup().dark() );
00629 p->drawLine( r.left(), r.top(),
00630 r.right(), r.top() );
00631 r.setRect( r.left() + 2, r.top(),
00632 r.width() - 4, r.height() - 2 );
00633 p->setPen( tb->colorGroup().button() );
00634 p->drawLine( r.left()+2, r.bottom()-1, r.right()-2, r.bottom()-1 );
00635 p->fillRect( QRect( r.left()+1, r.top()+1, r.width()-2, r.height()-3),
00636 tb->palette().normal().brush( QColorGroup::Button ));
00637 }
00638
00639 p->setPen( tb->colorGroup().dark() );
00640 p->drawLine( r.right(), r.top(),
00641 r.right(), r.bottom() - 2 );
00642 p->drawPoint( r.right() - 1, r.bottom() - 1 );
00643 p->drawLine( r.right() - 2, r.bottom(),
00644 r.left() + 2, r.bottom() );
00645
00646 p->setPen( tb->colorGroup().light() );
00647 p->drawLine( r.left(), r.top()+1,
00648 r.left(), r.bottom() - 2 );
00649 p->drawPoint( r.left() + 1, r.bottom() - 1 );
00650 if ( r.left() == 0 )
00651 p->drawPoint( tb->rect().topLeft() );
00652
00653 } else {
00654 QCommonStyle::drawTab( p, tb, t, selected );
00655 }
00656 }
00657
00658 #else
00659
00660 void LightStyle::drawTab(QPainter *p, const QTabBar *tabbar, QTab *tab,
00661 bool selected)
00662 {
00663 p->save();
00664
00665 QColorGroup g = tabbar->colorGroup();
00666 QRect fr(tab->r);
00667 fr.setLeft(fr.left() + 2);
00668
00669 if (! selected) {
00670 if (tabbar->shape() == QTabBar::RoundedAbove ||
00671 tabbar->shape() == QTabBar::TriangularAbove) {
00672
00673 fr.setTop(fr.top() + 2);
00674 } else {
00675 fr.setBottom(fr.bottom() - 2);
00676 }
00677 }
00678
00679 QRegion tabr(tab->r);
00680
00681 QPointArray cliptri(4);
00682 cliptri.setPoint(0, fr.left(), fr.top());
00683 cliptri.setPoint(1, fr.left(), fr.top() + 5);
00684 cliptri.setPoint(2, fr.left() + 5, fr.top());
00685 cliptri.setPoint(3, fr.left(), fr.top());
00686 QRegion trir(cliptri);
00687 p->setClipRegion(tabr - trir);
00688
00689 p->setPen( NoPen );
00690 p->setBrush(g.brush(selected ? QColorGroup::Background : QColorGroup::Mid));
00691
00692 fr.setWidth(fr.width() - 1);
00693 p->drawRect(fr.left() + 1, fr.top() + 1, fr.width() - 2, fr.height() - 2);
00694
00695 if (tabbar->shape() == QTabBar::RoundedAbove) {
00696
00697 fr.setBottom(fr.bottom() - 1);
00698
00699 p->setPen(g.dark());
00700 p->drawLine(fr.left(), fr.top() + 5, fr.left(), fr.bottom() - 1);
00701 p->drawLine(fr.left(), fr.top() + 5, fr.left() + 5, fr.top());
00702 p->drawLine(fr.left() + 5, fr.top(), fr.right() - 1, fr.top());
00703 p->drawLine(fr.right(), fr.top() + 1, fr.right(), fr.bottom() - 1);
00704
00705 if (selected) {
00706 p->drawLine(fr.right(), fr.bottom(), fr.right() + 2, fr.bottom());
00707 p->drawPoint(fr.left(), fr.bottom());
00708 } else
00709 p->drawLine(fr.left(), fr.bottom(), fr.right() + 2, fr.bottom());
00710
00711 if (fr.left() == 2) {
00712 p->drawPoint(fr.left() - 1, fr.bottom() + 1);
00713 p->drawPoint(fr.left() - 2, fr.bottom() + 2);
00714 }
00715
00716 if (selected) {
00717 p->setPen(g.mid());
00718 p->drawLine(fr.right() - 1, fr.top() + 1, fr.right() - 1, fr.bottom() - 2);
00719 }
00720
00721 p->setPen(g.light()); p->setPen(red);
00722 p->drawLine(fr.left() + 1, fr.top() + 6, fr.left() + 1,
00723 fr.bottom() - (selected ? 0 : 1));
00724 p->drawLine(fr.left() + 1, fr.top() + 5, fr.left() + 5, fr.top() + 1);
00725 p->drawLine(fr.left() + 6, fr.top() + 1, fr.right() - 3, fr.top() + 1);
00726 if (selected) {
00727 p->drawLine(fr.right() + 1, fr.bottom() + 1,
00728 fr.right() + 2, fr.bottom() + 1);
00729 p->drawLine(fr.left(), fr.bottom() + 1, fr.left() + 1, fr.bottom() + 1);
00730 } else
00731 p->drawLine(fr.left(), fr.bottom() + 1,
00732 fr.right() + 2, fr.bottom() + 1);
00733 } else if (tabbar->shape() == QTabBar::RoundedBelow) {
00734
00735 fr.setTop(fr.top() + 1);
00736
00737 p->setPen(g.dark());
00738 p->drawLine(fr.left(), fr.top(), fr.left(), fr.bottom() - 1);
00739 p->drawLine(fr.left() + 1, fr.bottom(), fr.right() - 1, fr.bottom());
00740 p->drawLine(fr.right(), fr.top(), fr.right(), fr.bottom() - 1);
00741
00742 if (! selected)
00743 p->drawLine(fr.left(), fr.top(), fr.right() + 3, fr.top());
00744 else
00745 p->drawLine(fr.right(), fr.top(), fr.right() + 3, fr.top());
00746
00747 p->setPen(g.mid());
00748 if (selected)
00749 p->drawLine(fr.right() - 1, fr.top() + 1, fr.right() - 1, fr.bottom() - 1);
00750 else
00751 p->drawLine(fr.left(), fr.top() - 1, fr.right() + 3, fr.top() - 1);
00752
00753 p->setPen(g.light());
00754 p->drawLine(fr.left() + 1, fr.top() + (selected ? -1 : 2),
00755 fr.left() + 1, fr.bottom() - 1);
00756
00757 } else {
00758
00759 QCommonStyle::drawTab(p, tabbar, tab, selected);
00760 }
00761
00762 p->restore();
00763 }
00764 #endif
00765
00766 void LightStyle::drawSlider(QPainter *p, int x, int y, int w, int h,
00767 const QColorGroup &g, Qt::Orientation orientation,
00768 bool above, bool below)
00769 {
00770 drawButton(p, x, y, w, h, g, FALSE, &g.brush(QColorGroup::Button));
00771
00772 if (orientation == Horizontal) {
00773 if (above && below) {
00774 drawArrow(p, Qt::UpArrow, FALSE, x + 1, y + 1, w, h / 2, g, TRUE);
00775 drawArrow(p, Qt::DownArrow, FALSE, x + 1, y + (h / 2) - 1,
00776 w, h / 2, g, TRUE);
00777 } else
00778 drawArrow(p, (above) ? Qt::UpArrow : Qt::DownArrow,
00779 FALSE, x + 1, y, w, h, g, TRUE);
00780 } else {
00781 if (above && below) {
00782 drawArrow(p, Qt::LeftArrow, FALSE, x + 1, y, w / 2, h, g, TRUE);
00783 drawArrow(p, Qt::RightArrow, FALSE, x + (w / 2) - 2, y, w / 2, h, g, TRUE);
00784 } else
00785 drawArrow(p, (above) ? Qt::LeftArrow : Qt::RightArrow,
00786 FALSE, x, y, w, h, g, TRUE);
00787 }
00788 }
00789
00790
00791 void LightStyle::drawSliderGroove(QPainter *p, int x, int y, int w, int h,
00792 const QColorGroup& g, QCOORD c,
00793 Qt::Orientation orientation)
00794 {
00795 if (orientation == Horizontal)
00796 drawButton(p, x, y+c - 3, w, 6, g, TRUE, &g.brush(QColorGroup::Mid));
00797 else
00798 drawButton(p, x+c - 3, y, 6, h, g, TRUE, &g.brush(QColorGroup::Mid));
00799 }
00800
00801
00802 void LightStyle::scrollBarMetrics(const QScrollBar *scrollbar,
00803 int &sliderMin, int &sliderMax,
00804 int &sliderLength, int &buttonDim) const
00805 {
00806 int maxLength;
00807 int length = ((scrollbar->orientation() == Horizontal) ?
00808 scrollbar->width() : scrollbar->height());
00809 int extent = ((scrollbar->orientation() == Horizontal) ?
00810 scrollbar->height() : scrollbar->width());
00811 extent--;
00812
00813 if (length > (extent + defaultFrameWidth() - 1) * 2 + defaultFrameWidth())
00814 buttonDim = extent - defaultFrameWidth();
00815 else
00816 buttonDim = (length - defaultFrameWidth()) / 2 - 1;
00817
00818 sliderMin = buttonDim;
00819 maxLength = length - buttonDim * 3;
00820
00821 if (scrollbar->maxValue() != scrollbar->minValue()) {
00822 uint range = scrollbar->maxValue() - scrollbar->minValue();
00823 sliderLength = (scrollbar->pageStep() * maxLength) /
00824 (range + scrollbar->pageStep());
00825
00826 if (sliderLength < buttonDim || range > INT_MAX / 2)
00827 sliderLength = buttonDim;
00828 if (sliderLength > maxLength)
00829 sliderLength = maxLength;
00830 } else
00831 sliderLength = maxLength;
00832
00833 sliderMax = sliderMin + maxLength - sliderLength;
00834 }
00835
00836
00837 QStyle::ScrollControl LightStyle::scrollBarPointOver(const QScrollBar *scrollbar,
00838 int sliderStart, const QPoint &p)
00839 {
00840 if (! scrollbar->rect().contains(p))
00841 return NoScroll;
00842
00843 int sliderMin, sliderMax, sliderLength, buttonDim, pos;
00844 scrollBarMetrics( scrollbar, sliderMin, sliderMax, sliderLength, buttonDim );
00845
00846 if (scrollbar->orientation() == Horizontal)
00847 pos = p.x();
00848 else
00849 pos = p.y();
00850
00851 if (pos < buttonDim)
00852 return SubLine;
00853 if (pos < sliderStart)
00854 return SubPage;
00855 if (pos < sliderStart + sliderLength)
00856 return Slider;
00857 if (pos < sliderMax + sliderLength)
00858 return AddPage;
00859 if (pos < sliderMax + sliderLength + buttonDim)
00860 return SubLine;
00861 return AddLine;
00862 }
00863
00864
00865
00866 void LightStyle::drawScrollBarControls( QPainter* p, const QScrollBar* scrollbar,
00867 int sliderStart, uint controls,
00868 uint activeControl )
00869 {
00870 QColorGroup g = scrollbar->colorGroup();
00871
00872 int sliderMin, sliderMax, sliderLength, buttonDim;
00873 scrollBarMetrics( scrollbar, sliderMin, sliderMax, sliderLength, buttonDim );
00874
00875 if (sliderStart > sliderMax) {
00876 sliderStart = sliderMax;
00877 }
00878
00879 QRect addR, subR, subR2, addPageR, subPageR, sliderR;
00880 int length = ((scrollbar->orientation() == Horizontal) ?
00881 scrollbar->width() : scrollbar->height());
00882 int extent = ((scrollbar->orientation() == Horizontal) ?
00883 scrollbar->height() : scrollbar->width());
00884
00885
00886 int fudge = 3;
00887
00888 if (scrollbar->orientation() == Horizontal) {
00889 subR.setRect(0, defaultFrameWidth(),
00890 buttonDim + fudge, buttonDim);
00891 subR2.setRect(length - (buttonDim * 2), defaultFrameWidth() ,
00892 buttonDim, buttonDim);
00893 addR.setRect(length - buttonDim, defaultFrameWidth(),
00894 buttonDim, buttonDim);
00895 } else {
00896 subR.setRect(defaultFrameWidth() + 1, 0,
00897 buttonDim, buttonDim + fudge);
00898 subR2.setRect(defaultFrameWidth() + 1, length - (buttonDim * 2),
00899 buttonDim, buttonDim);
00900 addR.setRect(defaultFrameWidth() + 1, length - buttonDim,
00901 buttonDim, buttonDim);
00902 }
00903
00904 int sliderEnd = sliderStart + sliderLength;
00905 int sliderW = extent - defaultFrameWidth() - 1;
00906 if (scrollbar->orientation() == Horizontal) {
00907 subPageR.setRect( subR.right() + 1, defaultFrameWidth(),
00908 sliderStart - subR.right() - 1 , sliderW );
00909 addPageR.setRect( sliderEnd, defaultFrameWidth(),
00910 subR2.left() - sliderEnd, sliderW );
00911 sliderR.setRect( sliderStart, defaultFrameWidth(), sliderLength, sliderW );
00912 } else {
00913 subPageR.setRect( defaultFrameWidth(), subR.bottom() + 1,
00914 sliderW, sliderStart - subR.bottom() - 1 );
00915 addPageR.setRect( defaultFrameWidth(), sliderEnd,
00916 sliderW, subR2.top() - sliderEnd );
00917 sliderR .setRect( defaultFrameWidth(), sliderStart,
00918 sliderW, sliderLength );
00919 }
00920
00921 if ( controls == ( AddLine | SubLine | AddPage | SubPage |
00922 Slider | First | Last ) ) {
00923 if (scrollbar->orientation() == Horizontal)
00924 qDrawShadePanel(p, 0, 0, length, 2, g, TRUE, 1,
00925 &g.brush(QColorGroup::Background));
00926 else
00927 qDrawShadePanel(p, 0, 0, 2, length, g, TRUE, 1,
00928 &g.brush(QColorGroup::Background));
00929 }
00930
00931 if ( controls & AddLine )
00932 drawArrow( p, (scrollbar->orientation() == Vertical) ? DownArrow : RightArrow,
00933 FALSE, addR.x(), addR.y(),
00934 addR.width(), addR.height(),
00935 (( activeControl == AddLine ) ?
00936 singleton->hoverPalette.active() : g),
00937 TRUE, &g.brush(QColorGroup::Background));
00938 if ( controls & SubLine ) {
00939 drawArrow( p, (scrollbar->orientation() == Vertical) ? UpArrow : LeftArrow,
00940 FALSE, subR.x(), subR.y(),
00941 subR.width(), subR.height(),
00942 (( activeControl == SubLine ) ?
00943 singleton->hoverPalette.active() : g),
00944 TRUE, &g.brush(QColorGroup::Background));
00945 drawArrow( p, (scrollbar->orientation() == Vertical) ? UpArrow : LeftArrow,
00946 FALSE, subR2.x(), subR2.y(),
00947 subR2.width(), subR2.height(),
00948 (( activeControl == SubLine ) ?
00949 singleton->hoverPalette.active() : g),
00950 TRUE, &g.brush(QColorGroup::Background));
00951 }
00952
00953 if ( controls & SubPage )
00954 p->fillRect( subPageR,
00955 ((activeControl == SubPage) ?
00956 g.brush( QColorGroup::Dark ) :
00957 g.brush( QColorGroup::Mid )));
00958 if ( controls & AddPage )
00959 p->fillRect( addPageR,
00960 ((activeControl == AddPage) ?
00961 g.brush( QColorGroup::Dark ) :
00962 g.brush( QColorGroup::Mid )));
00963
00964 if ( controls & Slider ) {
00965
00966 QPoint bo = p->brushOrigin();
00967 p->setBrushOrigin(sliderR.topLeft());
00968 if ( sliderR.isValid() ) {
00969 p->fillRect( sliderR.x(), sliderR.y(), 2, 2,
00970 g.brush( QColorGroup::Mid ));
00971 p->fillRect( sliderR.x() + sliderR.width() - 2,
00972 sliderR.y(), 2, 2,
00973 g.brush( QColorGroup::Mid ));
00974 p->fillRect( sliderR.x() + sliderR.width() - 2,
00975 sliderR.y() + sliderR.height() - 2, 2, 2,
00976 g.brush( QColorGroup::Mid ));
00977 p->fillRect( sliderR.x(),
00978 sliderR.y() + sliderR.height() - 2, 2, 2,
00979 g.brush( QColorGroup::Mid ));
00980
00981 QColorGroup cg( g );
00982 cg.setBrush( QColorGroup::Background, g.brush( QColorGroup::Mid ) );
00983 drawBevelButton( p, sliderR.x(), sliderR.y(),
00984 sliderR.width(), sliderR.height(),
00985 cg, FALSE, &g.brush( QColorGroup::Button ) );
00986 }
00987
00988 p->setBrushOrigin(bo);
00989 }
00990 }
00991
00992
00993 void LightStyle::drawToolBarHandle(QPainter *p, const QRect &rect,
00994 Qt::Orientation orientation,
00995 bool, const QColorGroup &g, bool)
00996 {
00997 p->save();
00998 p->setPen(g.mid());
00999 p->setBrush(g.brush(QColorGroup::Mid));
01000
01001 if (orientation == Qt::Horizontal) {
01002 QRect l, r;
01003 l.setRect(rect.x() + 1, rect.y() + 1, rect.width() - 5, rect.height() - 2);
01004 r.setRect(l.right() + 1, l.y(), 3, l.height());
01005
01006 p->drawRect(l);
01007 qDrawShadePanel(p, r, g, FALSE);
01008 } else {
01009 QRect t, b;
01010 t.setRect(rect.x() + 1, rect.y() + 1, rect.width() - 2, rect.height() - 5);
01011 b.setRect(t.x(), t.bottom() + 1, t.width(), 3);
01012
01013 p->drawRect(t);
01014 qDrawShadePanel(p, b, g, FALSE);
01015 }
01016
01017 p->restore();
01018 }
01019
01020
01021 bool LightStyle::eventFilter(QObject *object, QEvent *event)
01022 {
01023 switch(event->type()) {
01024 case QEvent::Enter:
01025 {
01026 if (! object->isWidgetType() ||
01027 ! object->inherits("QPushButton"))
01028 break;
01029
01030 singleton->hoverWidget = (QWidget *) object;
01031 if (! singleton->hoverWidget->isEnabled()) {
01032 singleton->hoverWidget = 0;
01033 break;
01034 }
01035
01036 QPalette pal = singleton->hoverWidget->palette();
01037 if (singleton->hoverWidget->ownPalette())
01038 singleton->savePalette = new QPalette(pal);
01039
01040 singleton->hoverWidget->setPalette(singleton->hoverPalette);
01041
01042 break;
01043 }
01044
01045 case QEvent::Leave:
01046 {
01047 if (object != singleton->hoverWidget)
01048 break;
01049
01050 if (singleton->savePalette) {
01051 singleton->hoverWidget->setPalette(*(singleton->savePalette));
01052 delete singleton->savePalette;
01053 singleton->savePalette = 0;
01054 } else
01055 singleton->hoverWidget->unsetPalette();
01056
01057 singleton->hoverWidget = 0;
01058
01059 break;
01060 }
01061
01062 default:
01063 {
01064 ;
01065 }
01066 }
01067
01068 return QWindowsStyle::eventFilter(object, event);
01069 }
01070
01071
01072 static const int motifItemFrame = 1;
01073 static const int motifSepHeight = 2;
01074 static const int motifItemHMargin = 1;
01075 static const int motifItemVMargin = 2;
01076 static const int motifArrowHMargin = 0;
01077 static const int motifTabSpacing = 12;
01078 static const int motifCheckMarkHMargin = 1;
01079 static const int windowsRightBorder = 8;
01080 static const int windowsCheckMarkWidth = 2;
01081
01084 int LightStyle::extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem* mi, const QFontMetrics& )
01085 {
01086 #ifndef QT_NO_MENUDATA
01087 int w = 2*motifItemHMargin + 2*motifItemFrame;
01088
01089 if ( mi->isSeparator() )
01090 return 10;
01091 else if ( mi->pixmap() )
01092 w += mi->pixmap()->width();
01093
01094 if ( !mi->text().isNull() ) {
01095 if ( mi->text().find('\t') >= 0 )
01096 w += motifTabSpacing;
01097 }
01098
01099 if ( maxpmw ) {
01100 w += maxpmw;
01101 w += 6;
01102 }
01103
01104 if ( checkable && maxpmw < windowsCheckMarkWidth ) {
01105 w += windowsCheckMarkWidth - maxpmw;
01106 }
01107
01108 if ( maxpmw > 0 || checkable )
01109 w += motifCheckMarkHMargin;
01110
01111 w += windowsRightBorder;
01112
01113 return w;
01114 #endif
01115 }
01116
01119 int LightStyle::popupMenuItemHeight( bool , QMenuItem* mi, const QFontMetrics& fm )
01120 {
01121 #ifndef QT_NO_MENUDATA
01122 int h = 0;
01123 if ( mi->isSeparator() )
01124 h = motifSepHeight;
01125 else if ( mi->pixmap() )
01126 h = mi->pixmap()->height() + 2*motifItemFrame;
01127 else
01128 h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame;
01129
01130 if ( !mi->isSeparator() && mi->iconSet() != 0 ) {
01131 h = QMAX( h, mi->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height() + 2*motifItemFrame );
01132 }
01133 if ( mi->custom() )
01134 h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1;
01135 return h;
01136 #endif
01137 }
01138
01139 void LightStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi,
01140 const QPalette& pal,
01141 bool act, bool enabled, int x, int y, int w, int h)
01142 {
01143 #ifndef QT_NO_MENUDATA
01144 const QColorGroup & g = pal.active();
01145 bool dis = !enabled;
01146 QColorGroup itemg = dis ? pal.disabled() : pal.active();
01147
01148 if ( checkable )
01149 maxpmw = QMAX( maxpmw, 8 );
01150
01151 int checkcol = maxpmw;
01152
01153 if ( mi && mi->isSeparator() ) {
01154 p->setPen( g.dark() );
01155 p->drawLine( x, y, x+w, y );
01156 p->setPen( g.light() );
01157 p->drawLine( x, y+1, x+w, y+1 );
01158 return;
01159 }
01160
01161 QBrush fill = act? g.brush( QColorGroup::Highlight ) :
01162 g.brush( QColorGroup::Button );
01163 p->fillRect( x, y, w, h, fill);
01164
01165 if ( !mi )
01166 return;
01167
01168 if ( mi->isChecked() ) {
01169 if ( act && !dis ) {
01170 qDrawShadePanel( p, x, y, checkcol, h,
01171 g, TRUE, 1, &g.brush( QColorGroup::Button ) );
01172 } else {
01173 qDrawShadePanel( p, x, y, checkcol, h,
01174 g, TRUE, 1, &g.brush( QColorGroup::Midlight ) );
01175 }
01176 } else if ( !act ) {
01177 p->fillRect(x, y, checkcol , h,
01178 g.brush( QColorGroup::Button ));
01179 }
01180
01181 if ( mi->iconSet() ) {
01182 QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal;
01183 if (act && !dis )
01184 mode = QIconSet::Active;
01185 QPixmap pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode );
01186 int pixw = pixmap.width();
01187 int pixh = pixmap.height();
01188 if ( act && !dis ) {
01189 if ( !mi->isChecked() )
01190 qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) );
01191 }
01192 QRect cr( x, y, checkcol, h );
01193 QRect pmr( 0, 0, pixw, pixh );
01194 pmr.moveCenter( cr.center() );
01195 p->setPen( itemg.text() );
01196 p->drawPixmap( pmr.topLeft(), pixmap );
01197
01198 QBrush fill = act? g.brush( QColorGroup::Highlight ) :
01199 g.brush( QColorGroup::Button );
01200 p->fillRect( x+checkcol + 1, y, w - checkcol - 1, h, fill);
01201 } else if ( checkable ) {
01202 int mw = checkcol + motifItemFrame;
01203 int mh = h - 2*motifItemFrame;
01204 if ( mi->isChecked() ) {
01205 drawCheckMark( p, x + motifItemFrame + 2,
01206 y+motifItemFrame, mw, mh, itemg, act, dis );
01207 }
01208 }
01209
01210 p->setPen( act ? g.highlightedText() : g.buttonText() );
01211
01212 QColor discol;
01213 if ( dis ) {
01214 discol = itemg.text();
01215 p->setPen( discol );
01216 }
01217
01218 int xm = motifItemFrame + checkcol + motifItemHMargin;
01219
01220 if ( mi->custom() ) {
01221 int m = motifItemVMargin;
01222 p->save();
01223 if ( dis && !act ) {
01224 p->setPen( g.light() );
01225 mi->custom()->paint( p, itemg, act, enabled,
01226 x+xm+1, y+m+1, w-xm-tab+1, h-2*m );
01227 p->setPen( discol );
01228 }
01229 mi->custom()->paint( p, itemg, act, enabled,
01230 x+xm, y+m, w-xm-tab+1, h-2*m );
01231 p->restore();
01232 }
01233 QString s = mi->text();
01234 if ( !s.isNull() ) {
01235 int t = s.find( '\t' );
01236 int m = motifItemVMargin;
01237 const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine;
01238 if ( t >= 0 ) {
01239 if ( dis && !act ) {
01240 p->setPen( g.light() );
01241 p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1,
01242 y+m+1, tab, h-2*m, text_flags, s.mid( t+1 ));
01243 p->setPen( discol );
01244 }
01245 p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame,
01246 y+m, tab, h-2*m, text_flags, s.mid( t+1 ) );
01247 }
01248 if ( dis && !act ) {
01249 p->setPen( g.light() );
01250 p->drawText( x+xm+1, y+m+1, w-xm+1, h-2*m, text_flags, s, t );
01251 p->setPen( discol );
01252 }
01253 p->drawText( x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t );
01254 } else if ( mi->pixmap() ) {
01255 QPixmap *pixmap = mi->pixmap();
01256 if ( pixmap->depth() == 1 )
01257 p->setBackgroundMode( OpaqueMode );
01258 p->drawPixmap( x+xm, y+motifItemFrame, *pixmap );
01259 if ( pixmap->depth() == 1 )
01260 p->setBackgroundMode( TransparentMode );
01261 }
01262 if ( mi->popup() ) {
01263 int dim = (h-2*motifItemFrame) / 2;
01264 if ( act ) {
01265 if ( !dis )
01266 discol = white;
01267 QColorGroup g2( discol, g.highlight(),
01268 white, white,
01269 dis ? discol : white,
01270 discol, white );
01271 drawArrow( p, RightArrow, FALSE,
01272 x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2,
01273 dim, dim, g2, TRUE );
01274 } else {
01275 drawArrow( p, RightArrow,
01276 FALSE,
01277 x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2,
01278 dim, dim, g, mi->isEnabled() );
01279 }
01280 }
01281 #endif
01282 }
01283
01284 #endif