1
/****************************************************************************
2
** $Id: qmusewindowsstyle.cpp,v 1.1 2002/04/19 20:07:59 kobras Exp $
4
** Implementation of Windows-like style class
5
** 2002-04-19 Modified for inclusion into muse source tree.
10
** Copyright (C) 1998-2000 Trolltech AS. All rights reserved.
12
** This file is part of the widgets module of the Qt GUI Toolkit.
14
** This file may be distributed under the terms of the Q Public License
15
** as defined by Trolltech AS of Norway and appearing in the file
16
** LICENSE.QPL included in the packaging of this file.
18
** This file may be distributed and/or modified under the terms of the
19
** GNU General Public License version 2 as published by the Free Software
20
** Foundation and appearing in the file LICENSE.GPL included in the
21
** packaging of this file.
23
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
24
** licenses may use this file in accordance with the Qt Commercial License
25
** Agreement provided with the Software.
27
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
31
** information about Qt Commercial License Agreements.
32
** See http://www.trolltech.com/qpl/ for QPL licensing information.
33
** See http://www.trolltech.com/gpl/ for GPL licensing information.
35
** Contact info@trolltech.com if any conditions of this licensing are
38
**********************************************************************/
40
#include "qmusewindowsstyle.h"
42
#include <qpopupmenu.h>
43
#include <qapplication.h>
45
#include <qdrawutil.h> // for now
46
#include <qpixmap.h> // for now
50
#include <qpushbutton.h>
51
#include <qcombobox.h>
54
#include <qrangecontrol.h>
55
#include <qscrollbar.h>
57
#include <qtabwidget.h>
59
#include <qlistview.h>
61
#include <qcleanuphandler.h>
64
#include "qt_windows.h"
70
static const int windowsItemFrame = 2; // menu item frame width
71
static const int windowsSepHeight = 2; // separator item height
72
static const int windowsItemHMargin = 3; // menu item hor text margin
73
static const int windowsItemVMargin = 2; // menu item ver text margin
74
static const int windowsArrowHMargin = 6; // arrow horizontal margin
75
static const int windowsTabSpacing = 12; // space between text and tab
76
static const int windowsCheckMarkHMargin = 2; // horiz. margins of check mark
77
static const int windowsRightBorder = 12; // right border on windows
78
static const int windowsCheckMarkWidth = 12; // checkmarks width on windows
80
static bool use2000style = TRUE;
82
enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
85
\class QMuseWindowsStyle qmusewindowsstyle.h
86
\brief The QMuseWindowsStyle class provides a Microsoft Windows-like look and feel.
89
This style is Qt's default GUI style on Windows.
93
Constructs a QMuseWindowsStyle
95
QMuseWindowsStyle::QMuseWindowsStyle() : QCommonStyle()
97
#if defined(Q_OS_WIN32)
98
if ( qWinVersion() != Qt::WV_NT &&
99
qWinVersion() != Qt::WV_95 )
102
use2000style = FALSE;
109
QMuseWindowsStyle::~QMuseWindowsStyle()
114
void QMuseWindowsStyle::drawPrimitive( PrimitiveElement pe,
117
const QColorGroup &cg,
119
const QStyleOption& opt ) const
122
case PE_ButtonCommand:
126
if (! (flags & Style_Down) && (flags & Style_On))
127
fill = QBrush(cg.light(), Dense4Pattern);
129
fill = cg.brush(QColorGroup::Button);
131
if (flags & Style_ButtonDefault && flags & Style_Down) {
132
p->setPen(cg.dark());
135
} else if (flags & (Style_Raised | Style_Down | Style_On | Style_Sunken))
136
qDrawWinButton(p, r, cg, flags & (Style_Sunken | Style_Down |
139
p->fillRect(r, fill);
144
case PE_HeaderSection:
148
if (! (flags & Style_Down) && (flags & Style_On))
149
fill = QBrush(cg.light(), Dense4Pattern);
151
fill = cg.brush(QColorGroup::Button);
153
if (flags & (Style_Raised | Style_Down | Style_On | Style_Sunken))
154
qDrawWinButton(p, r, cg, flags & (Style_Down | Style_On), &fill);
156
p->fillRect(r, fill);
160
case PE_ButtonDefault:
161
p->setPen(cg.shadow());
168
bool stippled = FALSE;
170
if (! (flags & (Style_Down | Style_MouseOver)) &&
171
(flags & Style_On) &&
173
fill = QBrush(cg.light(), Dense4Pattern);
176
fill = cg.brush(QColorGroup::Button);
178
if (flags & (Style_Raised | Style_Down | Style_On)) {
179
if (flags & Style_AutoRaise) {
180
qDrawShadePanel(p, r, cg, flags & (Style_Down | Style_On),
184
p->setPen(cg.button());
185
p->drawRect(r.x() + 1, r.y() + 1, r.width() - 2, r.height() - 2);
188
qDrawWinButton(p, r, cg, flags & (Style_Down | Style_On),
191
p->fillRect(r, fill);
198
p->drawWinFocusRect(r);
200
p->drawWinFocusRect(r, opt.color());
207
if (flags & Style_NoChange) {
208
QBrush b = p->brush();
209
QColor c = p->backgroundColor();
210
p->setBackgroundMode( TransparentMode );
211
p->setBackgroundColor( green );
212
fill = QBrush(cg.base(), Dense4Pattern);
213
p->setBackgroundColor( c );
215
} else if (flags & Style_Down)
216
fill = cg.brush( QColorGroup::Button );
217
else if (flags & Style_Enabled)
218
fill = cg.brush( QColorGroup::Base );
220
fill = cg.brush( QColorGroup::Background );
222
qDrawWinPanel( p, r, cg, TRUE, &fill );
223
if (! (flags & Style_Off)) {
224
QPointArray a( 7*2 );
229
for ( i=0; i<3; i++ ) {
230
a.setPoint( 2*i, xx, yy );
231
a.setPoint( 2*i+1, xx, yy+2 );
236
for ( i=3; i<7; i++ ) {
237
a.setPoint( 2*i, xx, yy );
238
a.setPoint( 2*i+1, xx, yy+2 );
242
if (flags & Style_NoChange)
243
p->setPen( cg.dark() );
245
p->setPen( cg.text() );
247
p->drawLineSegments( a );
253
case PE_ExclusiveIndicator:
255
#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
256
static const QCOORD pts1[] = { // dark lines
257
1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 };
258
static const QCOORD pts2[] = { // black lines
259
2,8, 1,7, 1,4, 2,3, 2,2, 3,2, 4,1, 7,1, 8,2, 9,2 };
260
static const QCOORD pts3[] = { // background lines
261
2,9, 3,9, 4,10, 7,10, 8,9, 9,9, 9,8, 10,7, 10,4, 9,3 };
262
static const QCOORD pts4[] = { // white lines
263
2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7,
265
static const QCOORD pts5[] = { // inner fill
266
4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 };
268
// make sure the indicator is square
271
if (r.width() < r.height()) {
272
ir.setTop(r.top() + (r.height() - r.width()) / 2);
273
ir.setHeight(r.width());
274
} else if (r.height() < r.width()) {
275
ir.setLeft(r.left() + (r.width() - r.height()) / 2);
276
ir.setWidth(r.height());
280
bool down = flags & Style_Down;
281
bool enabled = flags & Style_Enabled;
282
bool on = flags & Style_On;
284
a.setPoints( QCOORDARRLEN(pts1), pts1 );
285
a.translate( ir.x(), ir.y() );
286
p->setPen( cg.dark() );
287
p->drawPolyline( a );
288
a.setPoints( QCOORDARRLEN(pts2), pts2 );
289
a.translate( ir.x(), ir.y() );
290
p->setPen( cg.shadow() );
291
p->drawPolyline( a );
292
a.setPoints( QCOORDARRLEN(pts3), pts3 );
293
a.translate( ir.x(), ir.y() );
294
p->setPen( cg.midlight() );
295
p->drawPolyline( a );
296
a.setPoints( QCOORDARRLEN(pts4), pts4 );
297
a.translate( ir.x(), ir.y() );
298
p->setPen( cg.light() );
299
p->drawPolyline( a );
300
a.setPoints( QCOORDARRLEN(pts5), pts5 );
301
a.translate( ir.x(), ir.y() );
302
QColor fillColor = ( down || !enabled ) ? cg.button() : cg.base();
303
p->setPen( fillColor );
304
p->setBrush( fillColor ) ;
308
p->setBrush( cg.text() );
309
p->drawRect( ir.x() + 5, ir.y() + 4, 2, 4 );
310
p->drawRect( ir.x() + 4, ir.y() + 5, 4, 2 );
318
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth)
322
qDrawWinPanel(p, r, cg, flags & Style_Sunken);
324
QCommonStyle::drawPrimitive(pe, p, r, cg, flags, opt);
329
case PE_DockWindowResizeHandle:
330
qDrawWinPanel( p, r.x(), r.y(), r.width(), r.height(), cg );
333
case PE_ScrollBarSubLine:
335
if (flags & Style_Down) {
336
p->setPen( cg.dark() );
337
p->setBrush( cg.brush( QColorGroup::Button ) );
340
drawPrimitive(PE_ButtonBevel, p, r, cg, flags | Style_Raised);
342
drawPrimitive(PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) |
343
((flags & Style_Down) ? Style_Down : Style_Raised));
345
drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp),
349
case PE_ScrollBarAddLine:
351
if (flags & Style_Down) {
352
p->setPen( cg.dark() );
353
p->setBrush( cg.brush( QColorGroup::Button ) );
356
drawPrimitive(PE_ButtonBevel, p, r, cg, flags | Style_Raised);
358
drawPrimitive(PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) |
359
((flags & Style_Down) ? Style_Down : Style_Raised));
361
drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown),
365
case PE_ScrollBarAddPage:
366
case PE_ScrollBarSubPage:
369
QColor c = p->backgroundColor();
372
p->setBackgroundMode(OpaqueMode);
374
if (flags & Style_Down) {
375
br = QBrush(cg.shadow(), Dense4Pattern);
376
p->setBackgroundColor( cg.dark() );
377
p->setBrush( QBrush(cg.shadow(), Dense4Pattern) );
379
br = (cg.brush(QColorGroup::Light).pixmap() ?
380
cg.brush(QColorGroup::Light) :
381
QBrush(cg.light(), Dense4Pattern));
386
p->setBackgroundColor(c);
390
case PE_ScrollBarSlider:
391
if (! (flags & Style_Enabled)) {
392
QBrush br = (cg.brush(QColorGroup::Light).pixmap() ?
393
cg.brush(QColorGroup::Light) :
394
QBrush(cg.light(), Dense4Pattern));
397
p->setBackgroundMode(OpaqueMode);
400
drawPrimitive(PE_ButtonBevel, p, r, cg, Style_Enabled | Style_Raised);
404
if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) {
409
a.setPoints( 7, -4,1, 2,1, -3,0, 1,0, -2,-1, 0,-1, -1,-2 );
413
a.setPoints( 7, -4,-2, 2,-2, -3,-1, 1,-1, -2,0, 0,0, -1,1 );
417
a.setPoints( 7, -2,-3, -2,3, -1,-2, -1,2, 0,-1, 0,1, 1,0 );
421
a.setPoints( 7, 0,-3, 0,3, -1,-2, -1,2, -2,-1, -2,1, -3,0 );
432
if ( flags & Style_Down )
433
p->translate( pixelMetric( PM_ButtonShiftHorizontal ),
434
pixelMetric( PM_ButtonShiftVertical ) );
436
if ( flags & Style_Enabled ) {
437
a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
438
p->setPen( cg.buttonText() );
439
p->drawLineSegments( a, 0, 3 ); // draw arrow
440
p->drawPoint( a[6] );
442
a.translate( r.x() + r.width() / 2 + 1, r.y() + r.height() / 2 + 1 );
443
p->setPen( cg.light() );
444
p->drawLineSegments( a, 0, 3 ); // draw arrow
445
p->drawPoint( a[6] );
446
a.translate( -1, -1 );
447
p->setPen( cg.mid() );
448
p->drawLineSegments( a, 0, 3 ); // draw arrow
449
p->drawPoint( a[6] );
453
QCommonStyle::drawPrimitive(pe, p, r, cg, flags, opt);
461
void QMuseWindowsStyle::drawControl( ControlElement element,
463
const QWidget *widget,
465
const QColorGroup &cg,
467
const QStyleOption& opt ) const
473
if ( !widget || !widget->parentWidget() || !opt.tab() )
476
const QTabBar * tb = (const QTabBar *) widget;
477
const QTab * t = opt.tab();
478
bool selected = flags & Style_Selected;
479
bool lastTab = (tb->indexOf( t->identifier() ) == tb->count()-1) ?
482
if ( tb->shape() == QTabBar::RoundedAbove ) {
483
p->setPen( cg.midlight() );
485
p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() );
486
p->setPen( cg.light() );
487
p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 );
488
if ( r2.left() == 0 )
489
p->drawPoint( tb->rect().bottomLeft() );
492
p->fillRect( QRect( r2.left()+1, r2.bottom()-1, r2.width()-3, 2),
493
cg.brush( QColorGroup::Background ));
494
p->setPen( cg.background() );
495
p->drawLine( r2.left()+1, r2.bottom(), r2.left()+1, r2.top()+2 );
496
p->setPen( cg.light() );
498
p->setPen( cg.light() );
499
r2.setRect( r2.left() + 2, r2.top() + 2,
500
r2.width() - 4, r2.height() - 2 );
506
p->drawLine( x1, r2.bottom()-1, x1, r2.top() + 2 );
508
p->drawPoint( x1, r2.top() + 1 );
510
p->drawLine( x1, r2.top(), x2, r2.top() );
511
if ( r2.left() > 0 ) {
512
p->setPen( cg.midlight() );
515
p->drawPoint( x1, r2.bottom());
517
p->setPen( cg.midlight() );
519
p->drawLine( x1, r2.bottom(), x1, r2.top() + 2 );
521
p->drawLine( x1, r2.top()+1, x2, r2.top()+1 );
523
p->setPen( cg.dark() );
525
p->drawLine( x2, r2.top() + 2, x2, r2.bottom() - 1 +
527
p->setPen( cg.shadow() );
528
p->drawPoint( x2, r2.top() + 1 );
529
p->drawPoint( x2, r2.top() + 1 );
531
p->drawLine( x2, r2.top() + 2, x2, r2.bottom() -
532
(selected ? (lastTab ? 0:1) :2));
533
} else if ( tb->shape() == QTabBar::RoundedBelow ) {
534
bool rightAligned = styleHint( SH_TabBar_Alignment, tb ) == AlignRight;
535
bool firstTab = tb->indexOf( t->identifier() ) == 0;
537
p->fillRect( QRect( r2.left()+1, r2.top(), r2.width()-3, 1),
538
tb->palette().active().brush( QColorGroup::Background ));
539
p->setPen( cg.background() );
540
p->drawLine( r2.left()+1, r2.top(), r2.left()+1, r2.bottom()-2 );
541
p->setPen( cg.dark() );
543
p->setPen( cg.shadow() );
544
p->drawLine( r2.left() +
545
(rightAligned && firstTab ? 0 : 1),
547
r2.right() - (lastTab ? 0 : 2),
550
if ( rightAligned && lastTab )
551
p->drawPoint( r2.right(), r2.top() );
552
p->setPen( cg.dark() );
553
p->drawLine( r2.left(), r2.top(), r2.right() - 1,
555
r2.setRect( r2.left() + 2, r2.top(),
556
r2.width() - 4, r2.height() - 2 );
559
p->drawLine( r2.right() - 1, r2.top() + (selected ? 0: 2),
560
r2.right() - 1, r2.bottom() - 2 );
561
p->drawPoint( r2.right() - 2, r2.bottom() - 2 );
562
p->drawLine( r2.right() - 2, r2.bottom() - 1,
563
r2.left() + 1, r2.bottom() - 1 );
565
p->setPen( cg.midlight() );
566
p->drawLine( r2.left() + 1, r2.bottom() - 2,
567
r2.left() + 1, r2.top() + (selected ? 0 : 2) );
569
p->setPen( cg.shadow() );
570
p->drawLine( r2.right(),
571
r2.top() + (lastTab && rightAligned &&
573
r2.right(), r2.bottom() - 1 );
574
p->drawPoint( r2.right() - 1, r2.bottom() - 1 );
575
p->drawLine( r2.right() - 1, r2.bottom(),
576
r2.left() + 2, r2.bottom() );
578
p->setPen( cg.light() );
579
p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2),
580
r2.left(), r2.bottom() - 2 );
582
QCommonStyle::drawControl(element, p, widget, r, cg, flags, opt);
586
#endif // QT_NO_TABBAR
588
#ifndef QT_NO_POPUPMENU
589
case CE_PopupMenuItem:
591
if (! widget || opt.isDefault())
594
const QPopupMenu *popupmenu = (const QPopupMenu *) widget;
595
QMenuItem *mi = opt.menuItem();
599
int tab = opt.tabWidth();
600
int maxpmw = opt.maxIconWidth();
601
bool dis = ! mi->isEnabled();
602
bool checkable = popupmenu->isCheckable();
603
bool act = flags & Style_Active;
606
r.rect(&x, &y, &w, &h);
609
// space for the checkmarks
611
maxpmw = QMAX( maxpmw, 20 );
613
maxpmw = QMAX( maxpmw, 12 );
616
int checkcol = maxpmw;
618
if ( mi && mi->isSeparator() ) { // draw separator
619
p->setPen( cg.dark() );
620
p->drawLine( x, y, x+w, y );
621
p->setPen( cg.light() );
622
p->drawLine( x, y+1, x+w, y+1 );
627
cg.brush( QColorGroup::Highlight ) :
628
cg.brush( QColorGroup::Button ));
629
p->fillRect( x, y, w, h, fill);
635
QRect vrect = visualRect( QRect( xpos, y, checkcol, h ), r );
636
int xvis = vrect.x();
637
if ( mi->isChecked() ) {
639
qDrawShadePanel( p, xvis, y, checkcol, h,
640
cg, TRUE, 1, &cg.brush( QColorGroup::Button ) );
642
QBrush fill( cg.light(), Dense4Pattern );
643
// set the brush origin for the hash pattern to the x/y coordinate
644
// of the menu item's checkmark... this way, the check marks have
646
QPoint origin = p->brushOrigin();
647
p->setBrushOrigin( xvis, y );
648
qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1,
650
// restore the previous brush origin
651
p->setBrushOrigin( origin );
654
p->fillRect(xvis, y, checkcol , h, cg.brush( QColorGroup::Button ));
656
if ( mi->iconSet() ) { // draw iconset
657
QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal;
659
mode = QIconSet::Active;
661
if ( checkable && mi->isChecked() )
662
pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode, QIconSet::On );
664
pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode );
665
int pixw = pixmap.width();
666
int pixh = pixmap.height();
667
if ( act && !dis && !mi->isChecked() )
668
qDrawShadePanel( p, xvis, y, checkcol, h, cg, FALSE, 1,
669
&cg.brush( QColorGroup::Button ) );
670
QRect pmr( 0, 0, pixw, pixh );
671
pmr.moveCenter( vrect.center() );
672
p->setPen( cg.text() );
673
p->drawPixmap( pmr.topLeft(), pixmap );
676
cg.brush( QColorGroup::Highlight ) :
677
cg.brush( QColorGroup::Button ));
678
int xp = xpos + checkcol + 1;
679
p->fillRect( visualRect( QRect( xp, y, w - checkcol - 1, h ), r ), fill);
680
} else if ( checkable ) { // just "checking"...
681
if ( mi->isChecked() ) {
682
int xp = xpos + windowsItemFrame;
684
SFlags cflags = Style_Default;
686
cflags |= Style_Enabled;
690
drawPrimitive(PE_CheckMark, p,
691
visualRect( QRect(xp, y + windowsItemFrame,
692
checkcol - 2*windowsItemFrame,
693
h - 2*windowsItemFrame), r ), cg, cflags);
697
p->setPen( act ? cg.highlightedText() : cg.buttonText() );
705
int xm = windowsItemFrame + checkcol + windowsItemHMargin;
708
vrect = visualRect( QRect( xpos, y+windowsItemVMargin, w-xm-tab+1, h-2*windowsItemVMargin ), r );
710
if ( mi->custom() ) {
713
p->setPen( cg.light() );
714
mi->custom()->paint( p, cg, act, !dis,
715
xvis+1, y+windowsItemVMargin+1, w-xm-tab+1, h-2*windowsItemVMargin );
718
mi->custom()->paint( p, cg, act, !dis,
719
xvis, y+windowsItemVMargin, w-xm-tab+1, h-2*windowsItemVMargin );
722
QString s = mi->text();
723
if ( !s.isNull() ) { // draw text
724
int t = s.find( '\t' );
725
int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine;
726
text_flags |= (QApplication::reverseLayout() ? AlignRight : AlignLeft );
727
if ( t >= 0 ) { // draw tab text
729
xp = x + w - tab - ((use2000style) ? 20 : windowsRightBorder) -
730
windowsItemHMargin - windowsItemFrame + 1;
731
int xoff = visualRect( QRect( xp, y+windowsItemVMargin, tab, h-2*windowsItemVMargin ), r ).x();
733
p->setPen( cg.light() );
734
p->drawText( xoff+1, y+windowsItemVMargin+1, tab, h-2*windowsItemVMargin, text_flags, s.mid( t+1 ));
737
p->drawText( xoff, y+windowsItemVMargin, tab, h-2*windowsItemVMargin, text_flags, s.mid( t+1 ) );
741
p->setPen( cg.light() );
742
p->drawText( xvis+1, y+windowsItemVMargin+1, w-xm-tab+1, h-2*windowsItemVMargin, text_flags, s, t );
745
p->drawText( xvis, y+windowsItemVMargin, w-xm-tab+1, h-2*windowsItemVMargin, text_flags, s, t );
746
} else if ( mi->pixmap() ) { // draw pixmap
747
QPixmap *pixmap = mi->pixmap();
748
if ( pixmap->depth() == 1 )
749
p->setBackgroundMode( OpaqueMode );
750
p->drawPixmap( xvis, y+windowsItemFrame, *pixmap );
751
if ( pixmap->depth() == 1 )
752
p->setBackgroundMode( TransparentMode );
754
if ( mi->popup() ) { // draw sub menu arrow
755
int dim = (h-2*windowsItemFrame) / 2;
756
PrimitiveElement arrow;
757
arrow = ( QApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight );
758
xpos = x+w - windowsArrowHMargin - windowsItemFrame - dim;
759
vrect = visualRect( QRect(xpos, y + h / 2 - dim / 2, dim, dim), r );
763
QColorGroup g2( discol, cg.highlight(),
765
dis ? discol : white,
768
drawPrimitive(arrow, p, vrect,
771
drawPrimitive(arrow, p, vrect,
772
cg, mi->isEnabled() ? Style_Enabled : Style_Default);
782
bool active = flags & Style_Active;
783
bool hasFocus = flags & Style_HasFocus;
784
bool down = flags & Style_Down;
787
p->fillRect( r, cg.brush( QColorGroup::Button ) );
788
if ( active || hasFocus ) {
789
QBrush b = cg.brush( QColorGroup::Button );
790
if ( active && down )
791
p->setBrushOrigin(p->brushOrigin() + QPoint(1,1));
792
if ( active && hasFocus )
793
qDrawShadeRect( p, r.x(), r.y(), r.width(), r.height(),
794
cg, active && down, 1, 0, &b );
795
if ( active && down ) {
796
pr.setRect( r.x() + 2 + pixelMetric(PM_ButtonShiftHorizontal,
798
r.y() + 2 + pixelMetric(PM_ButtonShiftVertical,
800
r.width()-4, r.height()-4 );
801
p->setBrushOrigin(p->brushOrigin() - QPoint(1,1));
804
QCommonStyle::drawControl(element, p, widget, pr, cg, flags, opt);
809
QCommonStyle::drawControl(element, p, widget, r, cg, flags, opt);
817
int QMuseWindowsStyle::pixelMetric(PixelMetric metric, const QWidget *widget) const
822
case PM_ButtonDefaultIndicator:
823
case PM_ButtonShiftHorizontal:
824
case PM_ButtonShiftVertical:
828
case PM_MaximumDragDistance:
833
case PM_SliderLength:
837
// Returns the number of pixels to use for the business part of the
838
// slider (i.e., the non-tickmark portion). The remaining space is shared
839
// equally between the tickmark regions.
840
case PM_SliderControlThickness:
842
const QSlider * sl = (const QSlider *) widget;
843
int space = (sl->orientation() == Horizontal) ? sl->height()
845
int ticks = sl->tickmarks();
847
if ( ticks & QSlider::Above ) n++;
848
if ( ticks & QSlider::Below ) n++;
854
int thick = 6; // Magic constant to get 5 + 16 + 5
855
if ( ticks != QSlider::Both && ticks != QSlider::NoMarks )
856
thick += pixelMetric( PM_SliderLength, sl ) / 4;
859
//### the two sides may be unequal in size
861
thick += (space * 2) / (n + 2);
865
#endif // QT_NO_SLIDER
867
case PM_MenuBarFrameWidth:
871
#if defined(Q_WS_WIN)
872
case PM_TitleBarHeight:
873
if ( widget && ( widget->testWFlags( WStyle_Tool ) || widget->inherits( "QDockWindow" ) ) ) {
874
ret = GetSystemMetrics( SM_CYSMCAPTION );
876
ret = GetSystemMetrics( SM_CYCAPTION );
881
case PM_SplitterWidth:
882
ret = QMAX( 6, QApplication::globalStrut().width() );
886
ret = QCommonStyle::pixelMetric(metric, widget);
897
QSize QMuseWindowsStyle::sizeFromContents( ContentsType contents,
898
const QWidget *widget,
899
const QSize &contentsSize,
900
const QStyleOption& opt ) const
902
QSize sz(contentsSize);
907
#ifndef QT_NO_PUSHBUTTON
908
const QPushButton *button = (const QPushButton *) widget;
909
sz = QCommonStyle::sizeFromContents(contents, widget, contentsSize, opt);
910
int w = sz.width(), h = sz.height();
913
if (button->isDefault() || button->autoDefault())
914
defwidth = 2*pixelMetric( PM_ButtonDefaultIndicator, widget );
916
if (w < 80+defwidth && !button->pixmap())
926
case CT_PopupMenuItem:
928
#ifndef QT_NO_POPUPMENU
929
if (! widget || opt.isDefault())
932
const QPopupMenu *popup = (const QPopupMenu *) widget;
933
bool checkable = popup->isCheckable();
934
QMenuItem *mi = opt.menuItem();
935
int maxpmw = opt.maxIconWidth();
936
int w = sz.width(), h = sz.height();
939
w = mi->custom()->sizeHint().width();
940
h = mi->custom()->sizeHint().height();
941
if (! mi->custom()->fullSpan())
942
h += 2*windowsItemVMargin + 2*windowsItemFrame;
943
} else if ( mi->widget() ) {
944
} else if (mi->isSeparator()) {
946
h = windowsSepHeight;
949
h = QMAX(h, mi->pixmap()->height() + 2*windowsItemFrame);
950
else if (! mi->text().isNull())
951
h = QMAX(h, popup->fontMetrics().height() + 2*windowsItemVMargin +
954
if (mi->iconSet() != 0)
955
h = QMAX(h, mi->iconSet()->pixmap(QIconSet::Small,
956
QIconSet::Normal).height() +
960
if (! mi->text().isNull() && mi->text().find('\t') >= 0)
961
w += windowsTabSpacing;
962
else if (mi->popup())
963
w += 2*windowsArrowHMargin;
966
if (checkable && maxpmw < 20)
969
if (checkable && maxpmw < windowsCheckMarkWidth)
970
w += windowsCheckMarkWidth - maxpmw;
974
if (checkable || maxpmw > 0)
975
w += windowsCheckMarkHMargin;
979
w += windowsRightBorder;
987
sz = QCommonStyle::sizeFromContents(contents, widget, sz, opt);
996
void QMuseWindowsStyle::polishPopupMenu( QPopupMenu* p)
998
#ifndef QT_NO_POPUPMENU
999
if ( !p->testWState( WState_Polished ) )
1000
p->setCheckable( TRUE );
1004
#ifndef QT_NO_IMAGEIO_XPM
1005
static const char * const qt_close_xpm[] = {
1022
static const char * const qt_maximize_xpm[]={
1040
static const char * const qt_minimize_xpm[] = {
1057
#if 0 // ### not used???
1058
static const char * const qt_normalize_xpm[] = {
1076
static const char * const qt_normalizeup_xpm[] = {
1094
static const char * const qt_shade_xpm[] = {
1111
static const char * const qt_unshade_xpm[] = {
1128
static const char * dock_window_close_xpm[] = {
1141
// Message box icons, from page 210 of the Windows style guide.
1143
// Hand-drawn to resemble Microsoft's icons, but in the Mac/Netscape
1144
// palette. The "question mark" icon, which Microsoft recommends not
1145
// using but a lot of people still use, is left out.
1148
static const char * const information_xpm[]={
1155
"...........********.............",
1156
"........***aaaaaaaa***..........",
1157
"......**aaaaaaaaaaaaaa**........",
1158
".....*aaaaaaaaaaaaaaaaaa*.......",
1159
"....*aaaaaaaabbbbaaaaaaaac......",
1160
"...*aaaaaaaabbbbbbaaaaaaaac.....",
1161
"..*aaaaaaaaabbbbbbaaaaaaaaac....",
1162
".*aaaaaaaaaaabbbbaaaaaaaaaaac...",
1163
".*aaaaaaaaaaaaaaaaaaaaaaaaaac*..",
1164
"*aaaaaaaaaaaaaaaaaaaaaaaaaaaac*.",
1165
"*aaaaaaaaaabbbbbbbaaaaaaaaaaac*.",
1166
"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**",
1167
"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**",
1168
"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**",
1169
"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**",
1170
"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**",
1171
".*aaaaaaaaaaabbbbbaaaaaaaaaac***",
1172
".*aaaaaaaaaaabbbbbaaaaaaaaaac***",
1173
"..*aaaaaaaaaabbbbbaaaaaaaaac***.",
1174
"...caaaaaaabbbbbbbbbaaaaaac****.",
1175
"....caaaaaaaaaaaaaaaaaaaac****..",
1176
".....caaaaaaaaaaaaaaaaaac****...",
1177
"......ccaaaaaaaaaaaaaacc****....",
1178
".......*cccaaaaaaaaccc*****.....",
1179
"........***cccaaaac*******......",
1180
"..........****caaac*****........",
1181
".............*caaac**...........",
1182
"...............caac**...........",
1183
"................cac**...........",
1184
".................cc**...........",
1185
"..................***...........",
1186
"...................**..........."};
1188
static const char* const warning_xpm[]={
1194
".............***................",
1195
"............*aaa*...............",
1196
"...........*aaaaa*b.............",
1197
"...........*aaaaa*bb............",
1198
"..........*aaaaaaa*bb...........",
1199
"..........*aaaaaaa*bb...........",
1200
".........*aaaaaaaaa*bb..........",
1201
".........*aaaaaaaaa*bb..........",
1202
"........*aaaaaaaaaaa*bb.........",
1203
"........*aaaa***aaaa*bb.........",
1204
".......*aaaa*****aaaa*bb........",
1205
".......*aaaa*****aaaa*bb........",
1206
"......*aaaaa*****aaaaa*bb.......",
1207
"......*aaaaa*****aaaaa*bb.......",
1208
".....*aaaaaa*****aaaaaa*bb......",
1209
".....*aaaaaa*****aaaaaa*bb......",
1210
"....*aaaaaaaa***aaaaaaaa*bb.....",
1211
"....*aaaaaaaa***aaaaaaaa*bb.....",
1212
"...*aaaaaaaaa***aaaaaaaaa*bb....",
1213
"...*aaaaaaaaaa*aaaaaaaaaa*bb....",
1214
"..*aaaaaaaaaaa*aaaaaaaaaaa*bb...",
1215
"..*aaaaaaaaaaaaaaaaaaaaaaa*bb...",
1216
".*aaaaaaaaaaaa**aaaaaaaaaaa*bb..",
1217
".*aaaaaaaaaaa****aaaaaaaaaa*bb..",
1218
"*aaaaaaaaaaaa****aaaaaaaaaaa*bb.",
1219
"*aaaaaaaaaaaaa**aaaaaaaaaaaa*bb.",
1220
"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb",
1221
"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb",
1222
".*aaaaaaaaaaaaaaaaaaaaaaaaa*bbbb",
1223
"..*************************bbbbb",
1224
"....bbbbbbbbbbbbbbbbbbbbbbbbbbb.",
1225
".....bbbbbbbbbbbbbbbbbbbbbbbbb.."};
1227
static const char* const critical_xpm[]={
1233
"...........********.............",
1234
".........************...........",
1235
".......****************.........",
1236
"......******************........",
1237
".....********************a......",
1238
"....**********************a.....",
1239
"...************************a....",
1240
"..*******b**********b*******a...",
1241
"..******bbb********bbb******a...",
1242
".******bbbbb******bbbbb******a..",
1243
".*******bbbbb****bbbbb*******a..",
1244
"*********bbbbb**bbbbb*********a.",
1245
"**********bbbbbbbbbb**********a.",
1246
"***********bbbbbbbb***********aa",
1247
"************bbbbbb************aa",
1248
"************bbbbbb************aa",
1249
"***********bbbbbbbb***********aa",
1250
"**********bbbbbbbbbb**********aa",
1251
"*********bbbbb**bbbbb*********aa",
1252
".*******bbbbb****bbbbb*******aa.",
1253
".******bbbbb******bbbbb******aa.",
1254
"..******bbb********bbb******aaa.",
1255
"..*******b**********b*******aa..",
1256
"...************************aaa..",
1257
"....**********************aaa...",
1258
"....a********************aaa....",
1259
".....a******************aaa.....",
1260
"......a****************aaa......",
1261
".......aa************aaaa.......",
1262
".........aa********aaaaa........",
1263
"...........aaaaaaaaaaa..........",
1264
".............aaaaaaa............"};
1266
#endif //QT_NO_IMAGEIO_XPM
1271
QPixmap QMuseWindowsStyle::stylePixmap(StylePixmap stylepixmap,
1272
const QWidget *widget,
1273
const QStyleOption& opt) const
1275
#ifndef QT_NO_IMAGEIO_XPM
1276
switch (stylepixmap) {
1277
case SP_TitleBarShadeButton:
1278
return QPixmap((const char **)qt_shade_xpm);
1279
case SP_TitleBarUnshadeButton:
1280
return QPixmap((const char **)qt_unshade_xpm);
1281
case SP_TitleBarNormalButton:
1282
return QPixmap((const char **)qt_normalizeup_xpm);
1283
case SP_TitleBarMinButton:
1284
return QPixmap((const char **)qt_minimize_xpm);
1285
case SP_TitleBarMaxButton:
1286
return QPixmap((const char **)qt_maximize_xpm);
1287
case SP_TitleBarCloseButton:
1288
return QPixmap((const char **)qt_close_xpm);
1289
case SP_DockWindowCloseButton:
1290
return QPixmap((const char **)dock_window_close_xpm );
1291
case SP_MessageBoxInformation:
1292
return QPixmap((const char **)information_xpm);
1293
case SP_MessageBoxWarning:
1294
return QPixmap((const char **)warning_xpm);
1295
case SP_MessageBoxCritical:
1296
return QPixmap((const char **)critical_xpm);
1300
#endif //QT_NO_IMAGEIO_XPM
1301
return QCommonStyle::stylePixmap(stylepixmap, widget, opt);
1306
void QMuseWindowsStyle::drawComplexControl( ComplexControl ctrl, QPainter *p,
1307
const QWidget *widget,
1309
const QColorGroup &cg,
1313
const QStyleOption& opt ) const
1316
#ifndef QT_NO_LISTVIEW
1319
if ( sub & SC_ListView ) {
1320
QCommonStyle::drawComplexControl( ctrl, p, widget, r, cg, flags, sub, subActive, opt );
1322
if ( sub & ( SC_ListViewBranch | SC_ListViewExpand ) ) {
1323
if (opt.isDefault())
1326
QListViewItem *item = opt.listViewItem(),
1327
*child = item->firstChild();
1332
QPointArray dotlines;
1333
if ( subActive == SC_All && sub == SC_ListViewExpand ) {
1336
dotlines[0] = QPoint( r.right(), r.top() );
1337
dotlines[1] = QPoint( r.right(), r.bottom() );
1339
int linetop = 0, linebot = 0;
1340
// each branch needs at most two lines, ie. four end points
1341
dotoffset = (item->itemPos() + item->height() - y) %2;
1342
dotlines.resize( item->childCount() * 4 );
1345
// skip the stuff above the exposed rectangle
1346
while ( child && y + child->height() <= 0 ) {
1347
y += child->totalHeight();
1348
child = child->nextSibling();
1351
int bx = r.width() / 2;
1353
// paint stuff in the magical area
1354
QListView* v = item->listView();
1356
if ( !item->multiLinesEnabled() )
1357
lh = child ? child->height() : 0;
1359
lh = p->fontMetrics().height() + 2 * v->itemMargin();
1360
lh = QMAX( lh, QApplication::globalStrut().height() );
1363
while ( child && y < r.height() ) {
1365
if ( (child->isExpandable() || child->childCount()) &&
1366
(child->height() > 0) ) {
1368
p->setPen( cg.mid() );
1369
p->drawRect( bx-4, linebot-4, 9, 9 );
1371
p->setPen( cg.text() );
1372
p->drawLine( bx - 2, linebot, bx + 2, linebot );
1373
if ( !child->isOpen() )
1374
p->drawLine( bx, linebot - 2, bx, linebot + 2 );
1376
p->setPen( cg.mid() );
1377
dotlines[c++] = QPoint( bx, linetop );
1378
dotlines[c++] = QPoint( bx, linebot - 4 );
1379
dotlines[c++] = QPoint( bx + 5, linebot );
1380
dotlines[c++] = QPoint( r.width(), linebot );
1381
linetop = linebot + 5;
1384
dotlines[c++] = QPoint( bx+1, linebot );
1385
dotlines[c++] = QPoint( r.width(), linebot );
1388
y += child->totalHeight();
1389
child = child->nextSibling();
1392
if ( child ) // there's a child, so move linebot to edge of rectangle
1393
linebot = r.height();
1395
if ( linetop < linebot ) {
1396
dotlines[c++] = QPoint( bx, linetop );
1397
dotlines[c++] = QPoint( bx, linebot );
1400
p->setPen( cg.text() );
1402
static QBitmap *verticalLine = 0, *horizontalLine = 0;
1403
static QCleanupHandler<QBitmap> qlv_cleanup_bitmap;
1404
if ( !verticalLine ) {
1405
// make 128*1 and 1*128 bitmaps that can be used for
1406
// drawing the right sort of lines.
1407
verticalLine = new QBitmap( 1, 129, TRUE );
1408
horizontalLine = new QBitmap( 128, 1, TRUE );
1409
QPointArray a( 64 );
1411
p.begin( verticalLine );
1413
for( i=0; i<64; i++ )
1414
a.setPoint( i, 0, i*2+1 );
1418
QApplication::flushX();
1419
verticalLine->setMask( *verticalLine );
1420
p.begin( horizontalLine );
1421
for( i=0; i<64; i++ )
1422
a.setPoint( i, i*2+1, 0 );
1426
QApplication::flushX();
1427
horizontalLine->setMask( *horizontalLine );
1428
qlv_cleanup_bitmap.add( &verticalLine );
1429
qlv_cleanup_bitmap.add( &horizontalLine );
1432
int line; // index into dotlines
1433
for( line = 0; line < c; line += 2 ) {
1434
// assumptions here: lines are horizontal or vertical.
1435
// lines always start with the numerically lowest
1438
// point ... relevant coordinate of current point
1439
// end ..... same coordinate of the end of the current line
1440
// other ... the other coordinate of the current point/line
1441
if ( dotlines[line].y() == dotlines[line+1].y() ) {
1442
int end = dotlines[line+1].x();
1443
int point = dotlines[line].x();
1444
int other = dotlines[line].y();
1445
while( point < end ) {
1447
if ( i+point > end )
1449
p->drawPixmap( point, other, *horizontalLine,
1454
int end = dotlines[line+1].y();
1455
int point = dotlines[line].y();
1456
int other = dotlines[line].x();
1457
int pixmapoffset = ((point & 1) != dotoffset ) ? 1 : 0;
1458
while( point < end ) {
1460
if ( i+point > end )
1462
p->drawPixmap( other, point, *verticalLine,
1463
0, pixmapoffset, 1, i );
1471
#endif //QT_NO_LISTVIEW
1473
#ifndef QT_NO_COMBOBOX
1475
if ( sub & SC_ComboBoxArrow ) {
1476
SFlags flags = Style_Default;
1478
qDrawWinPanel( p, r, cg, TRUE, widget->isEnabled() ?
1479
&cg.brush( QColorGroup::Base ):
1480
&cg.brush( QColorGroup::Background ) );
1483
QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget,
1484
SC_ComboBoxArrow ), widget );
1485
if ( subActive == SC_ComboBoxArrow ) {
1486
p->setPen( cg.dark() );
1487
p->setBrush( cg.brush( QColorGroup::Button ) );
1490
qDrawWinPanel( p, ar, cg, FALSE,
1491
&cg.brush( QColorGroup::Button ) );
1493
ar.addCoords( 2, 2, -2, -2 );
1494
if ( widget->isEnabled() )
1495
flags |= Style_Enabled;
1497
if ( subActive & Style_Sunken ) {
1498
flags |= Style_Sunken;
1500
drawPrimitive( PE_ArrowDown, p, ar, cg, flags );
1503
if ( sub & SC_ComboBoxEditField ) {
1504
const QComboBox * cb = (const QComboBox *) widget;
1506
QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget,
1507
SC_ComboBoxEditField ), widget );
1508
if ( cb->hasFocus() && !cb->editable() )
1509
p->fillRect( re.x(), re.y(), re.width(), re.height(),
1510
cg.brush( QColorGroup::Highlight ) );
1512
if ( cb->hasFocus() ) {
1513
p->setPen( cg.highlightedText() );
1514
p->setBackgroundColor( cg.highlight() );
1517
p->setPen( cg.text() );
1518
p->setBackgroundColor( cg.background() );
1521
if ( cb->hasFocus() && !cb->editable() ) {
1523
QStyle::visualRect( subRect( SR_ComboBoxFocusRect, cb ), widget );
1524
drawPrimitive( PE_FocusRect, p, re, cg, Style_FocusAtBorder, QStyleOption(cg.highlight()));
1529
#endif // QT_NO_COMBOBOX
1531
#ifndef QT_NO_SLIDER
1534
const QSlider *sl = (const QSlider *) widget;
1535
int thickness = pixelMetric( PM_SliderControlThickness, widget );
1536
int len = pixelMetric( PM_SliderLength, widget );
1537
int ticks = sl->tickmarks();
1539
QRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove,
1541
handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle,
1544
if ((sub & SC_SliderGroove) && groove.isValid()) {
1545
int mid = thickness / 2;
1547
if ( ticks & QSlider::Above )
1549
if ( ticks & QSlider::Below )
1552
p->setPen( cg.shadow() );
1553
if ( sl->orientation() == Horizontal ) {
1554
qDrawWinPanel( p, groove.x(), groove.y() + mid - 2,
1555
groove.width(), 4, cg, TRUE );
1556
p->drawLine( groove.x() + 1, groove.y() + mid - 1,
1557
groove.x() + groove.width() - 3, groove.y() + mid - 1 );
1559
qDrawWinPanel( p, groove.x() + mid - 2, groove.y(),
1560
4, groove.height(), cg, TRUE );
1561
p->drawLine( groove.x() + mid - 1, groove.y() + 1,
1562
groove.x() + mid - 1,
1563
groove.y() + groove.height() - 3 );
1567
if (sub & SC_SliderTickmarks)
1568
QCommonStyle::drawComplexControl(ctrl, p, widget, r, cg, flags,
1569
SC_SliderTickmarks, subActive,
1572
if ( sub & SC_SliderHandle ) {
1582
const QColor c0 = cg.shadow();
1583
const QColor c1 = cg.dark();
1584
// const QColor c2 = g.button();
1585
const QColor c3 = cg.midlight();
1586
const QColor c4 = cg.light();
1588
int x = handle.x(), y = handle.y(),
1589
wi = handle.width(), he = handle.height();
1596
Orientation orient = sl->orientation();
1597
bool tickAbove = sl->tickmarks() == QSlider::Above;
1598
bool tickBelow = sl->tickmarks() == QSlider::Below;
1600
p->fillRect( x, y, wi, he, cg.brush( QColorGroup::Background ) );
1602
if ( sl->hasFocus() ) {
1603
QRect re = subRect( SR_SliderFocusRect, sl );
1604
drawPrimitive( PE_FocusRect, p, re, cg );
1607
if ( (tickAbove && tickBelow) || (!tickAbove && !tickBelow) ) {
1608
qDrawWinButton( p, QRect(x,y,wi,he), cg, FALSE,
1609
&cg.brush( QColorGroup::Button ) );
1613
QSliderDirection dir;
1615
if ( orient == Horizontal )
1632
d = (wi + 1) / 2 - 1;
1633
a.setPoints(5, x1,y1, x1,y2, x2,y2, x2,y1, x1+d,y1-d );
1637
d = (wi + 1) / 2 - 1;
1638
a.setPoints(5, x1,y1, x1,y2, x1+d,y2+d, x2,y2, x2,y1 );
1641
d = (he + 1) / 2 - 1;
1643
a.setPoints(5, x1,y1, x1-d,y1+d, x1,y2, x2,y2, x2,y1);
1646
d = (he + 1) / 2 - 1;
1648
a.setPoints(5, x1,y1, x1,y2, x2,y2, x2+d,y1+d, x2,y1 );
1652
QBrush oldBrush = p->brush();
1653
p->setBrush( cg.brush( QColorGroup::Button ) );
1655
p->drawRect( x1, y1, x2-x1+1, y2-y1+1 );
1656
p->drawPolygon( a );
1657
p->setBrush( oldBrush );
1659
if ( dir != SlUp ) {
1661
p->drawLine( x1, y1, x2, y1 );
1663
p->drawLine( x1, y1+1, x2, y1+1 );
1665
if ( dir != SlLeft ) {
1667
p->drawLine( x1+1, y1+1, x1+1, y2 );
1669
p->drawLine( x1, y1, x1, y2 );
1671
if ( dir != SlRight ) {
1673
p->drawLine( x2, y1, x2, y2 );
1675
p->drawLine( x2-1, y1+1, x2-1, y2-1 );
1677
if ( dir != SlDown ) {
1679
p->drawLine( x1, y2, x2, y2 );
1681
p->drawLine( x1+1, y2-1, x2-1, y2-1 );
1687
p->drawLine( x1, y1, x1+d, y1-d);
1690
p->drawLine( x2, y1, x2-d, y1-d);
1693
p->drawLine( x1+1, y1, x1+1+d, y1-d );
1695
p->drawLine( x2-1, y1, x2-1-d, y1-d);
1699
p->drawLine( x1, y2, x1+d, y2+d);
1702
p->drawLine( x2, y2, x2-d, y2+d);
1705
p->drawLine( x1+1, y2, x1+1+d, y2+d );
1707
p->drawLine( x2-1, y2, x2-1-d, y2+d);
1711
p->drawLine( x1, y1, x1-d, y1+d);
1714
p->drawLine( x1, y2, x1-d, y2-d);
1717
p->drawLine( x1, y1+1, x1-d, y1+1+d );
1719
p->drawLine( x1, y2-1, x1-d, y2-1-d);
1723
p->drawLine( x2, y1, x2+d, y1+d);
1726
p->drawLine( x2, y2, x2+d, y2-d);
1729
p->drawLine( x2, y1+1, x2+d, y1+1+d );
1731
p->drawLine( x2, y2-1, x2+d, y2-1-d);
1738
#endif // QT_NO_SLIDER
1741
QCommonStyle::drawComplexControl( ctrl, p, widget, r, cg, flags, sub,
1749
int QMuseWindowsStyle::styleHint( StyleHint hint,
1750
const QWidget *widget,
1751
const QStyleOption &opt,
1752
QStyleHintReturn *returnData ) const
1757
case SH_EtchDisabledText:
1758
case SH_Slider_SnapToValue:
1759
case SH_PrintDialog_RightAlignButtons:
1760
case SH_MainWindow_SpaceBelowMenuBar:
1761
case SH_FontDialog_SelectAssociatedText:
1762
case SH_PopupMenu_AllowActiveAndDisabled:
1763
case SH_MenuBar_AltKeyNavigation:
1764
case SH_MenuBar_MouseTracking:
1765
case SH_PopupMenu_MouseTracking:
1766
case SH_ComboBox_ListMouseTracking:
1770
case SH_ItemView_ChangeHighlightOnFocus:
1771
#if defined(Q_WS_WIN)
1772
if ( qWinVersion() != WV_95 && qWinVersion() != WV_NT )
1780
ret = QCommonStyle::styleHint(hint, widget, opt, returnData);