| 1 | /****************************************************************************
 | 
|---|
| 2 | ** $Id: qinterlacestyle.cpp 2 2005-11-16 15:49:26Z dmik $
 | 
|---|
| 3 | **
 | 
|---|
| 4 | ** Implementation of QInterlaceStyle class
 | 
|---|
| 5 | **
 | 
|---|
| 6 | ** Created : 010122
 | 
|---|
| 7 | **
 | 
|---|
| 8 | ** Copyright (C) 1992-2001 Trolltech AS.  All rights reserved.
 | 
|---|
| 9 | **
 | 
|---|
| 10 | ** This file is part of the widgets module of the Qt GUI Toolkit.
 | 
|---|
| 11 | **
 | 
|---|
| 12 | ** This file may be distributed under the terms of the Q Public License
 | 
|---|
| 13 | ** as defined by Trolltech AS of Norway and appearing in the file
 | 
|---|
| 14 | ** LICENSE.QPL included in the packaging of this file.
 | 
|---|
| 15 | **
 | 
|---|
| 16 | ** This file may be distributed and/or modified under the terms of the
 | 
|---|
| 17 | ** GNU General Public License version 2 as published by the Free Software
 | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.GPL included in the
 | 
|---|
| 19 | ** packaging of this file.
 | 
|---|
| 20 | **
 | 
|---|
| 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
 | 
|---|
| 22 | ** licenses may use this file in accordance with the Qt Commercial License
 | 
|---|
| 23 | ** Agreement provided with the Software.
 | 
|---|
| 24 | **
 | 
|---|
| 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 | 
|---|
| 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 | 
|---|
| 27 | **
 | 
|---|
| 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 | 
|---|
| 29 | **   information about Qt Commercial License Agreements.
 | 
|---|
| 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
 | 
|---|
| 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
 | 
|---|
| 32 | **
 | 
|---|
| 33 | ** Contact info@trolltech.com if any conditions of this licensing are
 | 
|---|
| 34 | ** not clear to you.
 | 
|---|
| 35 | **
 | 
|---|
| 36 | **********************************************************************/
 | 
|---|
| 37 | 
 | 
|---|
| 38 | #if 0 // ###### not ported to new API yet
 | 
|---|
| 39 | 
 | 
|---|
| 40 | #include "qinterlacestyle.h"
 | 
|---|
| 41 | 
 | 
|---|
| 42 | #if !defined(QT_NO_STYLE_INTERLACE) || defined(QT_PLUGIN)
 | 
|---|
| 43 | 
 | 
|---|
| 44 | #include "qapplication.h"
 | 
|---|
| 45 | #include "qpainter.h"
 | 
|---|
| 46 | #include "qdrawutil.h" // for now
 | 
|---|
| 47 | #include "qpalette.h" // for now
 | 
|---|
| 48 | #include "qwidget.h"
 | 
|---|
| 49 | #include "qlabel.h"
 | 
|---|
| 50 | #include "qpushbutton.h"
 | 
|---|
| 51 | #include "qwidget.h"
 | 
|---|
| 52 | #include "qrangecontrol.h"
 | 
|---|
| 53 | #include "qscrollbar.h"
 | 
|---|
| 54 | #include "qlistbox.h"
 | 
|---|
| 55 | 
 | 
|---|
| 56 | #include <limits.h>
 | 
|---|
| 57 | 
 | 
|---|
| 58 | /*!
 | 
|---|
| 59 |   \class QInterlaceStyle qinterlacestyle.h
 | 
|---|
| 60 |   \brief The QInterlaceStyle class provides a Look and Feel suitable for interlaced displays.
 | 
|---|
| 61 |   \ingroup appearance
 | 
|---|
| 62 | 
 | 
|---|
| 63 |   This class implements a look and feel that reduces flicker as much as
 | 
|---|
| 64 |   possible on interlaced displays (i.e. television).  It is an experimental
 | 
|---|
| 65 |   style.  In addition to using this style you will need to select a font
 | 
|---|
| 66 |   that does not flicker.
 | 
|---|
| 67 | */
 | 
|---|
| 68 | 
 | 
|---|
| 69 | /*!
 | 
|---|
| 70 |   Constructs a QInterlaceStyle
 | 
|---|
| 71 | */
 | 
|---|
| 72 | QInterlaceStyle::QInterlaceStyle() : QMotifStyle()
 | 
|---|
| 73 | {
 | 
|---|
| 74 |     setUseHighlightColors( TRUE );
 | 
|---|
| 75 | }
 | 
|---|
| 76 | 
 | 
|---|
| 77 | /*! \reimp
 | 
|---|
| 78 | */
 | 
|---|
| 79 | int QInterlaceStyle::buttonDefaultIndicatorWidth() const
 | 
|---|
| 80 | {
 | 
|---|
| 81 |     return 0;
 | 
|---|
| 82 | }
 | 
|---|
| 83 | 
 | 
|---|
| 84 | /*! \reimp
 | 
|---|
| 85 | */
 | 
|---|
| 86 | int QInterlaceStyle::setSliderThickness() const
 | 
|---|
| 87 | {
 | 
|---|
| 88 |     return 18;
 | 
|---|
| 89 | }
 | 
|---|
| 90 | 
 | 
|---|
| 91 | /*! \reimp
 | 
|---|
| 92 | */
 | 
|---|
| 93 | QSize QInterlaceStyle::scrollBarExtent() const
 | 
|---|
| 94 | {
 | 
|---|
| 95 |     return QSize( 18, 18 );
 | 
|---|
| 96 | }
 | 
|---|
| 97 | 
 | 
|---|
| 98 | /*! \reimp
 | 
|---|
| 99 | */
 | 
|---|
| 100 | int QInterlaceStyle::defaultFrameWidth() const
 | 
|---|
| 101 | {
 | 
|---|
| 102 |     return 2;
 | 
|---|
| 103 | }
 | 
|---|
| 104 | 
 | 
|---|
| 105 | /*!
 | 
|---|
| 106 |   \reimp
 | 
|---|
| 107 |  */
 | 
|---|
| 108 | void QInterlaceStyle::polish( QApplication *app)
 | 
|---|
| 109 | {
 | 
|---|
| 110 |     oldPalette = app->palette();
 | 
|---|
| 111 | #if 0
 | 
|---|
| 112 |     QColor bg( 128, 64, 128 );
 | 
|---|
| 113 |     QColor btn( 255, 145, 0 );
 | 
|---|
| 114 |     QColor mid = bg.dark( 120 );
 | 
|---|
| 115 |     QColor low = mid.dark( 120 );
 | 
|---|
| 116 |     QColor fg( white );
 | 
|---|
| 117 | #else
 | 
|---|
| 118 |     QColor bg( 224, 224, 224 );
 | 
|---|
| 119 |     QColor btn = bg.dark( 105 );
 | 
|---|
| 120 |     QColor mid = bg.dark( 120 );
 | 
|---|
| 121 |     QColor low = mid.dark( 120 );
 | 
|---|
| 122 |     QColor fg( black );
 | 
|---|
| 123 | #endif
 | 
|---|
| 124 | 
 | 
|---|
| 125 |     QColorGroup cg( fg, btn, low, low, mid, black, black, white, bg );
 | 
|---|
| 126 |     cg.setColor( QColorGroup::Highlight, QColor( 255, 255, 192 ) );
 | 
|---|
| 127 |     cg.setColor( QColorGroup::HighlightedText, black );
 | 
|---|
| 128 | 
 | 
|---|
| 129 |     QColorGroup dcg( cg );
 | 
|---|
| 130 |     dcg.setColor( QColorGroup::ButtonText, low );
 | 
|---|
| 131 |     dcg.setColor( QColorGroup::Text, low );
 | 
|---|
| 132 | 
 | 
|---|
| 133 |     app->setPalette( QPalette( cg, dcg, cg ), TRUE );
 | 
|---|
| 134 | }
 | 
|---|
| 135 | 
 | 
|---|
| 136 | /*!
 | 
|---|
| 137 |   \reimp
 | 
|---|
| 138 |  */
 | 
|---|
| 139 | void QInterlaceStyle::unPolish( QApplication *app)
 | 
|---|
| 140 | {
 | 
|---|
| 141 |     app->setPalette(oldPalette, TRUE);
 | 
|---|
| 142 | }
 | 
|---|
| 143 | 
 | 
|---|
| 144 | /*!
 | 
|---|
| 145 |   \reimp
 | 
|---|
| 146 |  */
 | 
|---|
| 147 | void QInterlaceStyle::polish( QWidget* w)
 | 
|---|
| 148 | {
 | 
|---|
| 149 | 
 | 
|---|
| 150 |    // the polish function sets some widgets to transparent mode and
 | 
|---|
| 151 |     // some to translate background mode in order to get the full
 | 
|---|
| 152 |     // benefit from the nice pixmaps in the color group.
 | 
|---|
| 153 | 
 | 
|---|
| 154 |     if ( w->inherits("QLCDNumber") ){
 | 
|---|
| 155 |         return;
 | 
|---|
| 156 |     }
 | 
|---|
| 157 | 
 | 
|---|
| 158 |     if ( !w->isTopLevel() ) {
 | 
|---|
| 159 |         if ( w->inherits("QGroupBox")
 | 
|---|
| 160 |              || w->inherits("QTabWidget")
 | 
|---|
| 161 |              || w->inherits("QPushButton") ) {
 | 
|---|
| 162 |             w->setAutoMask( TRUE );
 | 
|---|
| 163 |             return;
 | 
|---|
| 164 |         }
 | 
|---|
| 165 |         if (w->inherits("QLabel")
 | 
|---|
| 166 |             || w->inherits("QSlider")
 | 
|---|
| 167 |             || w->inherits("QButton")
 | 
|---|
| 168 |             || w->inherits("QProgressBar")
 | 
|---|
| 169 |             ){
 | 
|---|
| 170 |             w->setBackgroundOrigin( QWidget::ParentOrigin );
 | 
|---|
| 171 |         }
 | 
|---|
| 172 |     }
 | 
|---|
| 173 | 
 | 
|---|
| 174 |     if ( w->inherits( "QFrame" ) ) {
 | 
|---|
| 175 |         QFrame *f = (QFrame *)w;
 | 
|---|
| 176 |         switch ( f->frameShape() ) {
 | 
|---|
| 177 |             case QFrame::WinPanel:
 | 
|---|
| 178 |                 f->setFrameShape( QFrame::StyledPanel );
 | 
|---|
| 179 | 
 | 
|---|
| 180 |             case QFrame::Panel:
 | 
|---|
| 181 |             case QFrame::Box:
 | 
|---|
| 182 |             case QFrame::StyledPanel:
 | 
|---|
| 183 |             case QFrame::PopupPanel:
 | 
|---|
| 184 |                 if ( f->frameWidth() == 1 )
 | 
|---|
| 185 |                     f->setLineWidth( 2 );
 | 
|---|
| 186 |                 break;
 | 
|---|
| 187 |             default:
 | 
|---|
| 188 |                 break;
 | 
|---|
| 189 |         }
 | 
|---|
| 190 |     }
 | 
|---|
| 191 | 
 | 
|---|
| 192 |     if ( w->inherits( "QListBox" ) ) {
 | 
|---|
| 193 |         // the list box in combos has an ugly border otherwise
 | 
|---|
| 194 |         QFrame *f = (QFrame *)w;
 | 
|---|
| 195 |         if ( f->frameShadow() == QFrame::Plain ) {
 | 
|---|
| 196 |             f->setFrameShadow( QFrame::Raised );
 | 
|---|
| 197 |             f->setLineWidth( 1 );
 | 
|---|
| 198 |         }
 | 
|---|
| 199 |     }
 | 
|---|
| 200 | }
 | 
|---|
| 201 | 
 | 
|---|
| 202 | /*!
 | 
|---|
| 203 |   \reimp
 | 
|---|
| 204 | */
 | 
|---|
| 205 | void QInterlaceStyle::unPolish( QWidget* w)
 | 
|---|
| 206 | {
 | 
|---|
| 207 | 
 | 
|---|
| 208 |    // the polish function sets some widgets to transparent mode and
 | 
|---|
| 209 |     // some to translate background mode in order to get the full
 | 
|---|
| 210 |     // benefit from the nice pixmaps in the color group.
 | 
|---|
| 211 | 
 | 
|---|
| 212 |     if ( w->inherits("QLCDNumber") ){
 | 
|---|
| 213 |         return;
 | 
|---|
| 214 |     }
 | 
|---|
| 215 | 
 | 
|---|
| 216 |     if ( !w->isTopLevel() ) {
 | 
|---|
| 217 |         if ( w->inherits("QGroupBox")
 | 
|---|
| 218 |              || w->inherits("QTabWidget")
 | 
|---|
| 219 |              || w->inherits("QPushButton" ) ) {
 | 
|---|
| 220 |             w->setAutoMask( FALSE );
 | 
|---|
| 221 |             return;
 | 
|---|
| 222 |         }
 | 
|---|
| 223 |         if (w->inherits("QLabel")
 | 
|---|
| 224 |             || w->inherits("QSlider")
 | 
|---|
| 225 |             || w->inherits("QButton")
 | 
|---|
| 226 |             || w->inherits("QProgressBar")
 | 
|---|
| 227 |             ){
 | 
|---|
| 228 |             w->setBackgroundOrigin( QWidget::WidgetOrigin );
 | 
|---|
| 229 |         }
 | 
|---|
| 230 |     }
 | 
|---|
| 231 | 
 | 
|---|
| 232 | }
 | 
|---|
| 233 | 
 | 
|---|
| 234 | /*!
 | 
|---|
| 235 |   \reimp
 | 
|---|
| 236 | */
 | 
|---|
| 237 | QRect QInterlaceStyle::pushButtonContentsRect( QPushButton *btn )
 | 
|---|
| 238 | {
 | 
|---|
| 239 |     int fw = 0;
 | 
|---|
| 240 |     if ( btn->isDefault() || btn->autoDefault() )
 | 
|---|
| 241 |         fw = buttonDefaultIndicatorWidth();
 | 
|---|
| 242 | 
 | 
|---|
| 243 |     return buttonRect( fw+5, fw, btn->width()-2*fw-10, btn->height()-2*fw );
 | 
|---|
| 244 | }
 | 
|---|
| 245 | 
 | 
|---|
| 246 | /*!
 | 
|---|
| 247 |   \reimp
 | 
|---|
| 248 | */
 | 
|---|
| 249 | void QInterlaceStyle::drawFocusRect ( QPainter *p, const QRect &/*r*/, const QColorGroup &g, const QColor * bg, bool /*atBorder*/ )
 | 
|---|
| 250 | {
 | 
|---|
| 251 |     if (bg ) {
 | 
|---|
| 252 |         int h,s,v;
 | 
|---|
| 253 |         bg->hsv(&h,&s,&v);
 | 
|---|
| 254 |         if (v >= 128)
 | 
|---|
| 255 |             p->setPen( Qt::black );
 | 
|---|
| 256 |         else
 | 
|---|
| 257 |             p->setPen( Qt::white );
 | 
|---|
| 258 |     }
 | 
|---|
| 259 |     else
 | 
|---|
| 260 |         p->setPen( g.foreground() );
 | 
|---|
| 261 | /*
 | 
|---|
| 262 |     p->setBrush( NoBrush );
 | 
|---|
| 263 |     if ( atBorder ) {
 | 
|---|
| 264 |         p->drawRect( QRect( r.x()+1, r.y()+2, r.width()-2, r.height()-4 ) );
 | 
|---|
| 265 |         p->drawRect( QRect( r.x()+2, r.y()+1, r.width()-4, r.height()-2 ) );
 | 
|---|
| 266 |     } else {
 | 
|---|
| 267 |         p->drawRect( QRect( r.x(), r.y()+1, r.width(), r.height()-2 ) );
 | 
|---|
| 268 |         p->drawRect( QRect( r.x()+1, r.y(), r.width()-2, r.height() ) );
 | 
|---|
| 269 |     }
 | 
|---|
| 270 | */
 | 
|---|
| 271 | }
 | 
|---|
| 272 | 
 | 
|---|
| 273 | /*!
 | 
|---|
| 274 |   \reimp
 | 
|---|
| 275 | */
 | 
|---|
| 276 | void QInterlaceStyle::drawButton( QPainter *p, int x, int y, int w, int h,
 | 
|---|
| 277 |                                   const QColorGroup &g, bool /* sunken */,
 | 
|---|
| 278 |                                   const QBrush *fill )
 | 
|---|
| 279 | {
 | 
|---|
| 280 |     const int lineWidth = 2;
 | 
|---|
| 281 | 
 | 
|---|
| 282 |     p->setBrush( g.brush( QColorGroup::Dark ) );
 | 
|---|
| 283 |     p->setPen( NoPen );
 | 
|---|
| 284 |     p->drawRect( x+1, y+1, 2, 2 );
 | 
|---|
| 285 |     p->drawRect( x+w-3, y+1, 2, 2 );
 | 
|---|
| 286 |     p->drawRect( x+1, y+h-3, 2, 2 );
 | 
|---|
| 287 |     p->drawRect( x+w-3, y+h-3, 2, 2 );
 | 
|---|
| 288 | 
 | 
|---|
| 289 |     p->drawRect( x+2, y, w-4, 2 );
 | 
|---|
| 290 |     p->drawRect( x+2, y+h-lineWidth, w-4, lineWidth );
 | 
|---|
| 291 |     p->drawRect( x, y+2, lineWidth, h-4 );
 | 
|---|
| 292 |     p->drawRect( x+w-lineWidth, y+2, lineWidth, h-4 );
 | 
|---|
| 293 | 
 | 
|---|
| 294 |     if ( fill ) {
 | 
|---|
| 295 |         x += 2;
 | 
|---|
| 296 |         y += 2;
 | 
|---|
| 297 |         w -= 4;
 | 
|---|
| 298 |         h -= 4;
 | 
|---|
| 299 |         p->setBrush( *fill );
 | 
|---|
| 300 |         p->setPen( NoPen );
 | 
|---|
| 301 |         p->drawRect( x+1, y, w-2, 1 );
 | 
|---|
| 302 |         p->drawRect( x, y+1, w, h-2 );
 | 
|---|
| 303 |         p->drawRect( x+1, y+h-1, w-2, 1 );
 | 
|---|
| 304 |     }
 | 
|---|
| 305 | }
 | 
|---|
| 306 | 
 | 
|---|
| 307 | /*! \reimp */
 | 
|---|
| 308 | void QInterlaceStyle::drawButtonMask( QPainter * p, int x, int y, int w, int h )
 | 
|---|
| 309 | {
 | 
|---|
| 310 |     QBrush fill( color1 );
 | 
|---|
| 311 |     QColorGroup cg;
 | 
|---|
| 312 |     cg.setBrush( QColorGroup::Dark, color1 );
 | 
|---|
| 313 |     drawButton( p, x, y, w, h, cg, FALSE, &fill );
 | 
|---|
| 314 | }
 | 
|---|
| 315 | 
 | 
|---|
| 316 | /*!
 | 
|---|
| 317 |   \reimp
 | 
|---|
| 318 | */
 | 
|---|
| 319 | void QInterlaceStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h,
 | 
|---|
| 320 |                                        const QColorGroup &g, bool sunken, const QBrush* fill )
 | 
|---|
| 321 | {
 | 
|---|
| 322 |     QInterlaceStyle::drawButton(p, x, y, w, h, g, sunken, fill);
 | 
|---|
| 323 | }
 | 
|---|
| 324 | 
 | 
|---|
| 325 | /*!
 | 
|---|
| 326 |   \reimp
 | 
|---|
| 327 | */
 | 
|---|
| 328 | void QInterlaceStyle::drawPushButton( QPushButton* btn, QPainter *p)
 | 
|---|
| 329 | {
 | 
|---|
| 330 |     QColorGroup g = btn->colorGroup();
 | 
|---|
| 331 |     int x1, y1, x2, y2;
 | 
|---|
| 332 | 
 | 
|---|
| 333 |     btn->rect().coords( &x1, &y1, &x2, &y2 );   // get coordinates
 | 
|---|
| 334 | 
 | 
|---|
| 335 |     QBrush fill( g.button() );
 | 
|---|
| 336 |     if ( btn->isDown() || btn->isOn() )
 | 
|---|
| 337 |         fill = g.mid();
 | 
|---|
| 338 | 
 | 
|---|
| 339 |     if ( btn->hasFocus() )
 | 
|---|
| 340 |         g.setBrush( QColorGroup::Dark, black );
 | 
|---|
| 341 |     drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, FALSE, &fill );
 | 
|---|
| 342 | 
 | 
|---|
| 343 |     if ( btn->isMenuButton() ) {
 | 
|---|
| 344 |         int dx = (y1-y2-4)/3;
 | 
|---|
| 345 |         drawArrow( p, DownArrow, FALSE,
 | 
|---|
| 346 |                    x2 - dx, dx, y1, y2 - y1,
 | 
|---|
| 347 |                    g, btn->isEnabled() );
 | 
|---|
| 348 |     }
 | 
|---|
| 349 | 
 | 
|---|
| 350 |     if ( p->brush().style() != NoBrush )
 | 
|---|
| 351 |         p->setBrush( NoBrush );
 | 
|---|
| 352 | }
 | 
|---|
| 353 | 
 | 
|---|
| 354 | /*!
 | 
|---|
| 355 |   \reimp
 | 
|---|
| 356 | */
 | 
|---|
| 357 | QSize QInterlaceStyle::indicatorSize () const
 | 
|---|
| 358 | {
 | 
|---|
| 359 |     return QSize(13,13);
 | 
|---|
| 360 | }
 | 
|---|
| 361 | 
 | 
|---|
| 362 | /*!
 | 
|---|
| 363 |   \reimp
 | 
|---|
| 364 | */
 | 
|---|
| 365 | void QInterlaceStyle::drawIndicator( QPainter * p, int x, int y, int w, int h, const QColorGroup &g, int s, bool down, bool enabled )
 | 
|---|
| 366 | {
 | 
|---|
| 367 |     p->fillRect( x, y, w, h, g.brush( QColorGroup::Background ) );
 | 
|---|
| 368 |     QBrush fill;
 | 
|---|
| 369 |     if ( s == QButton::NoChange ) {
 | 
|---|
| 370 |         QBrush b = p->brush();
 | 
|---|
| 371 |         QColor c = p->backgroundColor();
 | 
|---|
| 372 |         p->setBackgroundMode( TransparentMode );
 | 
|---|
| 373 |         p->setBackgroundColor( green );
 | 
|---|
| 374 |         fill = QBrush(g.base(), Dense4Pattern);
 | 
|---|
| 375 |         p->setBackgroundColor( c );
 | 
|---|
| 376 |         p->setBrush( b );
 | 
|---|
| 377 |     } else if ( down )
 | 
|---|
| 378 |         fill = g.brush( QColorGroup::Button );
 | 
|---|
| 379 |     else
 | 
|---|
| 380 |         fill = g.brush( enabled ? QColorGroup::Base : QColorGroup::Background );
 | 
|---|
| 381 | 
 | 
|---|
| 382 |     drawButton( p, x, y, w, h, g, FALSE, &fill );
 | 
|---|
| 383 | 
 | 
|---|
| 384 |     if ( s != QButton::Off ) {
 | 
|---|
| 385 |         QPointArray a( 7*2 );
 | 
|---|
| 386 |         int i, xx, yy;
 | 
|---|
| 387 |         xx = x+3;
 | 
|---|
| 388 |         yy = y+5;
 | 
|---|
| 389 |         for ( i=0; i<3; i++ ) {
 | 
|---|
| 390 |             a.setPoint( 2*i,   xx, yy );
 | 
|---|
| 391 |             a.setPoint( 2*i+1, xx, yy+2 );
 | 
|---|
| 392 |             xx++; yy++;
 | 
|---|
| 393 |         }
 | 
|---|
| 394 |         yy -= 2;
 | 
|---|
| 395 |         for ( i=3; i<7; i++ ) {
 | 
|---|
| 396 |             a.setPoint( 2*i,   xx, yy );
 | 
|---|
| 397 |             a.setPoint( 2*i+1, xx, yy+2 );
 | 
|---|
| 398 |             xx++; yy--;
 | 
|---|
| 399 |         }
 | 
|---|
| 400 |         if ( s == QButton::NoChange ) {
 | 
|---|
| 401 |             p->setPen( g.dark() );
 | 
|---|
| 402 |         } else {
 | 
|---|
| 403 |             p->setPen( g.text() );
 | 
|---|
| 404 |         }
 | 
|---|
| 405 |         p->drawLineSegments( a );
 | 
|---|
| 406 |     }
 | 
|---|
| 407 | }
 | 
|---|
| 408 | 
 | 
|---|
| 409 | /*!
 | 
|---|
| 410 |   \reimp
 | 
|---|
| 411 | */
 | 
|---|
| 412 | void QInterlaceStyle::drawIndicatorMask( QPainter *p, int x, int y, int w, int h, int )
 | 
|---|
| 413 | {
 | 
|---|
| 414 |     drawButtonMask( p, x, y, w, h );
 | 
|---|
| 415 | }
 | 
|---|
| 416 | 
 | 
|---|
| 417 | /*!
 | 
|---|
| 418 |   \reimp
 | 
|---|
| 419 | */
 | 
|---|
| 420 | QSize QInterlaceStyle::exclusiveIndicatorSize() const
 | 
|---|
| 421 | {
 | 
|---|
| 422 |     return QSize(13,13);
 | 
|---|
| 423 | }
 | 
|---|
| 424 | 
 | 
|---|
| 425 | /*!
 | 
|---|
| 426 |   \reimp
 | 
|---|
| 427 | */
 | 
|---|
| 428 | void QInterlaceStyle::drawExclusiveIndicator( QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool on, bool down, bool enabled )
 | 
|---|
| 429 | {
 | 
|---|
| 430 |     p->fillRect( x, y, w, h, g.brush( QColorGroup::Background ) );
 | 
|---|
| 431 |     p->setBrush( g.dark() );
 | 
|---|
| 432 |     p->setPen( QPen( NoPen ) );
 | 
|---|
| 433 |     p->drawEllipse( x, y, w, h );
 | 
|---|
| 434 | 
 | 
|---|
| 435 |     x += 2;
 | 
|---|
| 436 |     y += 2;
 | 
|---|
| 437 |     w -= 4;
 | 
|---|
| 438 |     h -= 4;
 | 
|---|
| 439 |     QColor fillColor = ( down || !enabled ) ? g.button() : g.base();
 | 
|---|
| 440 |     p->setBrush( fillColor );
 | 
|---|
| 441 |     p->drawEllipse( x, y, w, h );
 | 
|---|
| 442 | 
 | 
|---|
| 443 |     if ( on ) {
 | 
|---|
| 444 |         p->setBrush( g.text() );
 | 
|---|
| 445 |         p->drawEllipse( x+2, y+2, w-4, h-4 );
 | 
|---|
| 446 |     }
 | 
|---|
| 447 | }
 | 
|---|
| 448 | 
 | 
|---|
| 449 | /*!
 | 
|---|
| 450 |   \reimp
 | 
|---|
| 451 | */
 | 
|---|
| 452 | void QInterlaceStyle::drawExclusiveIndicatorMask( QPainter *p, int x, int y, int w, int h, bool )
 | 
|---|
| 453 | {
 | 
|---|
| 454 |     p->setBrush( color1 );
 | 
|---|
| 455 |     p->setPen( QPen( NoPen ) );
 | 
|---|
| 456 |     p->drawEllipse( x, y, w, h );
 | 
|---|
| 457 | }
 | 
|---|
| 458 | 
 | 
|---|
| 459 | static int get_combo_extra_width( int h, int *return_awh=0 )
 | 
|---|
| 460 | {
 | 
|---|
| 461 |     int awh;
 | 
|---|
| 462 |     if ( h < 8 ) {
 | 
|---|
| 463 |         awh = 6;
 | 
|---|
| 464 |     } else if ( h < 14 ) {
 | 
|---|
| 465 |         awh = h - 2;
 | 
|---|
| 466 |     } else {
 | 
|---|
| 467 |         awh = h/2;
 | 
|---|
| 468 |     }
 | 
|---|
| 469 |     if ( return_awh )
 | 
|---|
| 470 |         *return_awh = awh;
 | 
|---|
| 471 |     return awh*3/2;
 | 
|---|
| 472 | }
 | 
|---|
| 473 | 
 | 
|---|
| 474 | /*!
 | 
|---|
| 475 |   \reimp
 | 
|---|
| 476 | */
 | 
|---|
| 477 | QRect QInterlaceStyle::comboButtonRect ( int x, int y, int w, int h )
 | 
|---|
| 478 | {
 | 
|---|
| 479 |     QRect r = buttonRect( x, y, w, h );
 | 
|---|
| 480 |     int ew = get_combo_extra_width( r.height() );
 | 
|---|
| 481 |     return QRect(r.x(), r.y(), r.width()-ew, r.height());
 | 
|---|
| 482 | }
 | 
|---|
| 483 | 
 | 
|---|
| 484 | static void get_combo_parameters( const QRect &r,
 | 
|---|
| 485 |     int &ew, int &awh, int &ax,
 | 
|---|
| 486 |     int &ay, int &sh, int &dh,
 | 
|---|
| 487 |     int &sy )
 | 
|---|
| 488 | {
 | 
|---|
| 489 |     ew = get_combo_extra_width( r.height(), &awh );
 | 
|---|
| 490 | 
 | 
|---|
| 491 |     sh = (awh+3)/4;
 | 
|---|
| 492 |     if ( sh < 3 )
 | 
|---|
| 493 |     sh = 3;
 | 
|---|
| 494 |     dh = sh/2 + 1;
 | 
|---|
| 495 | 
 | 
|---|
| 496 |     ay = r.y() + (r.height()-awh-sh-dh)/2;
 | 
|---|
| 497 |     if ( ay < 0 ) {
 | 
|---|
| 498 |         //panic mode
 | 
|---|
| 499 |         ay = 0;
 | 
|---|
| 500 |         sy = r.height();
 | 
|---|
| 501 |     } else {
 | 
|---|
| 502 |         sy = ay+awh+dh;
 | 
|---|
| 503 |     }
 | 
|---|
| 504 |     ax = r.x() + r.width() - ew +(ew-awh)/2;
 | 
|---|
| 505 | }
 | 
|---|
| 506 | 
 | 
|---|
| 507 | /*!
 | 
|---|
| 508 |   \reimp
 | 
|---|
| 509 | */
 | 
|---|
| 510 | void QInterlaceStyle::drawComboButton( QPainter *p, int x, int y, int w, int h,
 | 
|---|
| 511 |                                 const QColorGroup &g,
 | 
|---|
| 512 |                                 bool /* sunken */,
 | 
|---|
| 513 |                                 bool /*editable*/,
 | 
|---|
| 514 |                                 bool /*enabled */,
 | 
|---|
| 515 |                                 const QBrush *fb )
 | 
|---|
| 516 | {
 | 
|---|
| 517 |     QBrush fill = fb ? *fb : g.brush( QColorGroup::Button );
 | 
|---|
| 518 | 
 | 
|---|
| 519 |     int awh, ax, ay, sh, sy, dh, ew;
 | 
|---|
| 520 |     get_combo_parameters( buttonRect(x,y,w,h), ew, awh, ax, ay, sh, dh, sy );
 | 
|---|
| 521 | 
 | 
|---|
| 522 |     drawButton( p, x, y, w, h, g, FALSE, &fill );
 | 
|---|
| 523 | 
 | 
|---|
| 524 |     qDrawArrow( p, DownArrow, MotifStyle, FALSE, ax, ay, awh, awh, g, TRUE );
 | 
|---|
| 525 | 
 | 
|---|
| 526 |     p->setPen( g.dark() );
 | 
|---|
| 527 |     p->drawRect( ax+1, sy+1, awh-1, sh-1 );
 | 
|---|
| 528 | }
 | 
|---|
| 529 | 
 | 
|---|
| 530 | /*!
 | 
|---|
| 531 |   \reimp
 | 
|---|
| 532 | */
 | 
|---|
| 533 | void QInterlaceStyle::drawPushButtonLabel( QPushButton* btn, QPainter *p)
 | 
|---|
| 534 | {
 | 
|---|
| 535 |     QRect r = btn->rect();
 | 
|---|
| 536 |     int x, y, w, h;
 | 
|---|
| 537 |     r.rect( &x, &y, &w, &h );
 | 
|---|
| 538 | 
 | 
|---|
| 539 |     int x1, y1, x2, y2;
 | 
|---|
| 540 |     btn->rect().coords( &x1, &y1, &x2, &y2 );   // get coordinates
 | 
|---|
| 541 |     int dx = 0;
 | 
|---|
| 542 |     int dy = 0;
 | 
|---|
| 543 |     if ( btn->isMenuButton() )
 | 
|---|
| 544 |         dx = (y2-y1) / 3;
 | 
|---|
| 545 |     if ( btn->isOn() || btn->isDown() ) {
 | 
|---|
| 546 | //      dx--;
 | 
|---|
| 547 | //      dy--;
 | 
|---|
| 548 |     }
 | 
|---|
| 549 |     if ( dx || dy )
 | 
|---|
| 550 |         p->translate( dx, dy );
 | 
|---|
| 551 | 
 | 
|---|
| 552 |     x += 2;  y += 2;  w -= 4;  h -= 4;
 | 
|---|
| 553 |     QColorGroup g = btn->colorGroup();
 | 
|---|
| 554 |     const QColor *col = &btn->colorGroup().buttonText();
 | 
|---|
| 555 |     if ( (btn->isDown() || btn->isOn()) )
 | 
|---|
| 556 |         col = &btn->colorGroup().brightText();
 | 
|---|
| 557 |     else if ( !btn->isEnabled() )
 | 
|---|
| 558 |         col = &btn->colorGroup().dark();
 | 
|---|
| 559 |     drawItem( p, x, y, w, h,
 | 
|---|
| 560 |               AlignCenter|ShowPrefix,
 | 
|---|
| 561 |               g, btn->isEnabled(),
 | 
|---|
| 562 |               btn->pixmap(), btn->text(), -1, col );
 | 
|---|
| 563 | 
 | 
|---|
| 564 |     if ( dx || dy )
 | 
|---|
| 565 |         p->translate( -dx, -dy );
 | 
|---|
| 566 | }
 | 
|---|
| 567 | 
 | 
|---|
| 568 | #define HORIZONTAL      (sb->orientation() == QScrollBar::Horizontal)
 | 
|---|
| 569 | #define VERTICAL        !HORIZONTAL
 | 
|---|
| 570 | #define MOTIF_BORDER    defaultFrameWidth()
 | 
|---|
| 571 | #define SLIDER_MIN      9 // ### motif says 6 but that's too small
 | 
|---|
| 572 | 
 | 
|---|
| 573 | 
 | 
|---|
| 574 | /*! \reimp */
 | 
|---|
| 575 | 
 | 
|---|
| 576 | void QInterlaceStyle::scrollBarMetrics( const QScrollBar* sb, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim )
 | 
|---|
| 577 | {
 | 
|---|
| 578 |     int maxLength;
 | 
|---|
| 579 |     int b = MOTIF_BORDER;
 | 
|---|
| 580 |     int length = HORIZONTAL ? sb->width()  : sb->height();
 | 
|---|
| 581 |     int extent = HORIZONTAL ? sb->height() : sb->width();
 | 
|---|
| 582 | 
 | 
|---|
| 583 |     if ( length > ( extent - b*2 - 1 )*2 + b*2  )
 | 
|---|
| 584 |         buttonDim = extent - b*2;
 | 
|---|
| 585 |     else
 | 
|---|
| 586 |         buttonDim = ( length - b*2 )/2 - 1;
 | 
|---|
| 587 | 
 | 
|---|
| 588 |     sliderMin = b + buttonDim;
 | 
|---|
| 589 |     maxLength  = length - b*2 - buttonDim*2;
 | 
|---|
| 590 | 
 | 
|---|
| 591 |     if ( sb->maxValue() == sb->minValue() ) {
 | 
|---|
| 592 |         sliderLength = maxLength;
 | 
|---|
| 593 |     } else {
 | 
|---|
| 594 |         uint range = sb->maxValue()-sb->minValue();
 | 
|---|
| 595 |         sliderLength = (sb->pageStep()*maxLength)/
 | 
|---|
| 596 |                         (range + sb->pageStep());
 | 
|---|
| 597 |         if ( sliderLength < SLIDER_MIN || range > INT_MAX/2 )
 | 
|---|
| 598 |             sliderLength = SLIDER_MIN;
 | 
|---|
| 599 |         if ( sliderLength > maxLength )
 | 
|---|
| 600 |             sliderLength = maxLength;
 | 
|---|
| 601 |     }
 | 
|---|
| 602 |     sliderMax = sliderMin + maxLength - sliderLength;
 | 
|---|
| 603 | 
 | 
|---|
| 604 | }
 | 
|---|
| 605 | 
 | 
|---|
| 606 | 
 | 
|---|
| 607 | /*! \reimp */
 | 
|---|
| 608 | 
 | 
|---|
| 609 | void QInterlaceStyle::drawScrollBarControls( QPainter* p, const QScrollBar* sb,
 | 
|---|
| 610 |                                          int sliderStart, uint controls,
 | 
|---|
| 611 |                                          uint activeControl )
 | 
|---|
| 612 | {
 | 
|---|
| 613 | #define ADD_LINE_ACTIVE ( activeControl == AddLine )
 | 
|---|
| 614 | #define SUB_LINE_ACTIVE ( activeControl == SubLine )
 | 
|---|
| 615 |     QColorGroup g  = sb->colorGroup();
 | 
|---|
| 616 | 
 | 
|---|
| 617 |     int sliderMin, sliderMax, sliderLength, buttonDim;
 | 
|---|
| 618 |     scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
 | 
|---|
| 619 | 
 | 
|---|
| 620 |     QBrush fill = g.brush( QColorGroup::Mid );
 | 
|---|
| 621 |     if (sb->backgroundPixmap() ){
 | 
|---|
| 622 |         fill = QBrush( g.mid(), *sb->backgroundPixmap() );
 | 
|---|
| 623 |     }
 | 
|---|
| 624 | 
 | 
|---|
| 625 |     if ( controls == (AddLine | SubLine | AddPage | SubPage | Slider | First | Last ) )
 | 
|---|
| 626 |         drawPanel( p, 0, 0, sb->width(), sb->height(), g, FALSE, 2, &fill );
 | 
|---|
| 627 | 
 | 
|---|
| 628 |     if (sliderStart > sliderMax) { // sanity check
 | 
|---|
| 629 |         sliderStart = sliderMax;
 | 
|---|
| 630 |     }
 | 
|---|
| 631 | 
 | 
|---|
| 632 |     int b = MOTIF_BORDER;
 | 
|---|
| 633 |     int dimB = buttonDim;
 | 
|---|
| 634 |     QRect addB;
 | 
|---|
| 635 |     QRect subB;
 | 
|---|
| 636 |     QRect addPageR;
 | 
|---|
| 637 |     QRect subPageR;
 | 
|---|
| 638 |     QRect sliderR;
 | 
|---|
| 639 |     int addX, addY, subX, subY;
 | 
|---|
| 640 |     int length = HORIZONTAL ? sb->width()  : sb->height();
 | 
|---|
| 641 |     int extent = HORIZONTAL ? sb->height() : sb->width();
 | 
|---|
| 642 | 
 | 
|---|
| 643 |     if ( HORIZONTAL ) {
 | 
|---|
| 644 |         subY = addY = ( extent - dimB ) / 2;
 | 
|---|
| 645 |         subX = b;
 | 
|---|
| 646 |         addX = length - dimB - b;
 | 
|---|
| 647 |     } else {
 | 
|---|
| 648 |         subX = addX = ( extent - dimB ) / 2;
 | 
|---|
| 649 |         subY = b;
 | 
|---|
| 650 |         addY = length - dimB - b;
 | 
|---|
| 651 |     }
 | 
|---|
| 652 | 
 | 
|---|
| 653 |     subB.setRect( subX,subY,dimB,dimB );
 | 
|---|
| 654 |     addB.setRect( addX,addY,dimB,dimB );
 | 
|---|
| 655 | 
 | 
|---|
| 656 |     int sliderEnd = sliderStart + sliderLength;
 | 
|---|
| 657 |     int sliderW = extent - b*2;
 | 
|---|
| 658 |     if ( HORIZONTAL ) {
 | 
|---|
| 659 |         subPageR.setRect( subB.right() + 1, b,
 | 
|---|
| 660 |                           sliderStart - subB.right() , sliderW );
 | 
|---|
| 661 |         addPageR.setRect( sliderEnd-1, b, addX - sliderEnd+1, sliderW );
 | 
|---|
| 662 |         sliderR .setRect( sliderStart, b, sliderLength, sliderW );
 | 
|---|
| 663 |     } else {
 | 
|---|
| 664 |         subPageR.setRect( b, subB.bottom()+1, sliderW,
 | 
|---|
| 665 |                           sliderStart - subB.bottom() );
 | 
|---|
| 666 |         addPageR.setRect( b, sliderEnd-1, sliderW, addY - sliderEnd + 1);
 | 
|---|
| 667 |         sliderR .setRect( b, sliderStart, sliderW, sliderLength );
 | 
|---|
| 668 |     }
 | 
|---|
| 669 | 
 | 
|---|
| 670 |     if ( controls & AddLine )
 | 
|---|
| 671 |         drawArrow( p, VERTICAL ? DownArrow : RightArrow,
 | 
|---|
| 672 |                    ADD_LINE_ACTIVE, addB.x(), addB.y(),
 | 
|---|
| 673 |                    addB.width(), addB.height(), g, TRUE );
 | 
|---|
| 674 |     if ( controls & SubLine )
 | 
|---|
| 675 |         drawArrow( p, VERTICAL ? UpArrow : LeftArrow,
 | 
|---|
| 676 |                    SUB_LINE_ACTIVE, subB.x(), subB.y(),
 | 
|---|
| 677 |                    subB.width(), subB.height(), g, TRUE );
 | 
|---|
| 678 | 
 | 
|---|
| 679 |     if ( controls & SubPage )
 | 
|---|
| 680 |         p->fillRect( subPageR, fill );
 | 
|---|
| 681 | 
 | 
|---|
| 682 |     if ( controls & AddPage )
 | 
|---|
| 683 |         p->fillRect( addPageR, fill );
 | 
|---|
| 684 | 
 | 
|---|
| 685 |     if ( controls & Slider ) {
 | 
|---|
| 686 |         QPoint bo = p->brushOrigin();
 | 
|---|
| 687 |         p->setBrushOrigin(sliderR.topLeft());
 | 
|---|
| 688 |         if ( sliderR.isValid() )
 | 
|---|
| 689 |             drawButton( p, sliderR.x(), sliderR.y(),
 | 
|---|
| 690 |                           sliderR.width(), sliderR.height(), g,
 | 
|---|
| 691 |                           FALSE, &g.brush( QColorGroup::Button ) );
 | 
|---|
| 692 |         p->setBrushOrigin(bo);
 | 
|---|
| 693 |     }
 | 
|---|
| 694 | 
 | 
|---|
| 695 | }
 | 
|---|
| 696 | 
 | 
|---|
| 697 | /*!
 | 
|---|
| 698 |   \reimp
 | 
|---|
| 699 | */
 | 
|---|
| 700 | void QInterlaceStyle::drawSlider ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, Orientation orient, bool, bool)
 | 
|---|
| 701 | {
 | 
|---|
| 702 |     p->fillRect( x, y, w, h, g.brush( QColorGroup::Background ) );
 | 
|---|
| 703 |     drawButton( p, x, y, w, h, g, FALSE, &g.brush( QColorGroup::Button ) );
 | 
|---|
| 704 |     if ( orient == Horizontal ) {
 | 
|---|
| 705 |         QCOORD mid = x + w / 2;
 | 
|---|
| 706 |         qDrawShadeLine( p, mid,  y , mid,  y + h - 2, g, TRUE, 1);
 | 
|---|
| 707 |     } else {
 | 
|---|
| 708 |         QCOORD mid = y +h / 2;
 | 
|---|
| 709 |         qDrawShadeLine( p, x, mid,  x + w - 2, mid, g, TRUE, 1);
 | 
|---|
| 710 |     }
 | 
|---|
| 711 | }
 | 
|---|
| 712 | 
 | 
|---|
| 713 | 
 | 
|---|
| 714 | /*!
 | 
|---|
| 715 |   \reimp
 | 
|---|
| 716 | */
 | 
|---|
| 717 | void QInterlaceStyle::drawSliderGroove ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, QCOORD , Orientation o)
 | 
|---|
| 718 | {
 | 
|---|
| 719 |     p->setBrush( g.brush( QColorGroup::Dark ) );
 | 
|---|
| 720 |     p->setPen( NoPen );
 | 
|---|
| 721 | 
 | 
|---|
| 722 |     if ( o == Horizontal )
 | 
|---|
| 723 |         drawButton( p, x, y+h/2-3, w, 6, g, FALSE, &g.brush( QColorGroup::Mid ) );
 | 
|---|
| 724 |     else
 | 
|---|
| 725 |         drawButton( p, x+w/2-3, y, 6, h, g, FALSE, &g.brush( QColorGroup::Mid ) );
 | 
|---|
| 726 | }
 | 
|---|
| 727 | 
 | 
|---|
| 728 | 
 | 
|---|
| 729 | /*!
 | 
|---|
| 730 |   \reimp
 | 
|---|
| 731 | */
 | 
|---|
| 732 | int QInterlaceStyle::splitterWidth() const
 | 
|---|
| 733 | {
 | 
|---|
| 734 |     return QMAX( 12, QApplication::globalStrut().width() );
 | 
|---|
| 735 | }
 | 
|---|
| 736 | 
 | 
|---|
| 737 | /*!
 | 
|---|
| 738 |   \reimp
 | 
|---|
| 739 | */
 | 
|---|
| 740 | void QInterlaceStyle::drawSplitter( QPainter *p, int x, int y, int w, int h,
 | 
|---|
| 741 |   const QColorGroup &g, Orientation orient)
 | 
|---|
| 742 | {
 | 
|---|
| 743 |     const int motifOffset = 12;
 | 
|---|
| 744 |     int sw = splitterWidth();
 | 
|---|
| 745 |     if ( orient == Horizontal ) {
 | 
|---|
| 746 |             QCOORD xPos = x + w/2;
 | 
|---|
| 747 |             QCOORD kPos = motifOffset;
 | 
|---|
| 748 |             QCOORD kSize = sw - 4;
 | 
|---|
| 749 | 
 | 
|---|
| 750 |             qDrawShadeLine( p, xPos, kPos + kSize - 1 ,
 | 
|---|
| 751 |                             xPos, h, g );
 | 
|---|
| 752 |             drawPanel( p, xPos-sw/2+2, kPos,
 | 
|---|
| 753 |                              kSize, kSize, g, FALSE, 2,
 | 
|---|
| 754 |                              &g.brush( QColorGroup::Button ));
 | 
|---|
| 755 |             qDrawShadeLine( p, xPos, 0, xPos, kPos, g );
 | 
|---|
| 756 |         } else {
 | 
|---|
| 757 |             QCOORD yPos = y + h/2;
 | 
|---|
| 758 |             QCOORD kPos = w - motifOffset - sw;
 | 
|---|
| 759 |             QCOORD kSize = sw - 4;
 | 
|---|
| 760 | 
 | 
|---|
| 761 |             qDrawShadeLine( p, 0, yPos, kPos, yPos, g );
 | 
|---|
| 762 |             drawPanel( p, kPos, yPos-sw/2+2,
 | 
|---|
| 763 |                              kSize, kSize, g, FALSE, 2,
 | 
|---|
| 764 |                              &g.brush( QColorGroup::Button ));
 | 
|---|
| 765 |             qDrawShadeLine( p, kPos + kSize -1, yPos,
 | 
|---|
| 766 |                             w, yPos, g );
 | 
|---|
| 767 |         }
 | 
|---|
| 768 | 
 | 
|---|
| 769 | }
 | 
|---|
| 770 | 
 | 
|---|
| 771 | /*!
 | 
|---|
| 772 |   \reimp
 | 
|---|
| 773 | */
 | 
|---|
| 774 | void QInterlaceStyle::drawPanel( QPainter *p, int x, int y, int w, int h,
 | 
|---|
| 775 |                             const QColorGroup &g, bool /*sunken*/,
 | 
|---|
| 776 |                             int lineWidth, const QBrush *fill )
 | 
|---|
| 777 | {
 | 
|---|
| 778 |     if ( lineWidth < 2 )
 | 
|---|
| 779 |         lineWidth = 2;
 | 
|---|
| 780 | 
 | 
|---|
| 781 |     p->setBrush( g.brush( QColorGroup::Dark ) );
 | 
|---|
| 782 |     p->setPen( NoPen );
 | 
|---|
| 783 | 
 | 
|---|
| 784 |     p->drawRect( x, y, w, lineWidth );
 | 
|---|
| 785 |     p->drawRect( x, y+h-lineWidth, w, lineWidth );
 | 
|---|
| 786 |     p->drawRect( x, y, lineWidth, h );
 | 
|---|
| 787 |     p->drawRect( x+w-lineWidth, y, lineWidth, h );
 | 
|---|
| 788 | 
 | 
|---|
| 789 |     if ( fill ) {
 | 
|---|
| 790 |         x += lineWidth;
 | 
|---|
| 791 |         y += lineWidth;
 | 
|---|
| 792 |         w -= 2*lineWidth;
 | 
|---|
| 793 |         h -= 2*lineWidth;
 | 
|---|
| 794 |         p->setBrush( *fill );
 | 
|---|
| 795 |         p->setPen( NoPen );
 | 
|---|
| 796 |         p->drawRect( x, y, w, h );
 | 
|---|
| 797 |     }
 | 
|---|
| 798 | }
 | 
|---|
| 799 | 
 | 
|---|
| 800 | #endif // QT_NO_STYLE_INTERLACE
 | 
|---|
| 801 | 
 | 
|---|
| 802 | #endif
 | 
|---|