summaryrefslogtreecommitdiffstats
path: root/src/styles/qwindowsstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/styles/qwindowsstyle.cpp')
-rw-r--r--src/styles/qwindowsstyle.cpp91
1 files changed, 61 insertions, 30 deletions
diff --git a/src/styles/qwindowsstyle.cpp b/src/styles/qwindowsstyle.cpp
index 4bdb421..578b32f 100644
--- a/src/styles/qwindowsstyle.cpp
+++ b/src/styles/qwindowsstyle.cpp
@@ -225,6 +225,9 @@ void QWindowsStyle::drawPrimitive( PrimitiveElement pe,
SFlags flags,
const QStyleOption& opt ) const
{
+ bool dis = !(flags & Style_Enabled);
+ bool act = flags & Style_Active;
+
QRect rr( r );
switch (pe) {
case PE_ButtonCommand:
@@ -568,6 +571,60 @@ void QWindowsStyle::drawPrimitive( PrimitiveElement pe,
}
break;
+ case PE_MenuItemIndicatorFrame:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ QRect vrect = visualRect( QRect( x, y, w, h ), r );
+ int xvis = vrect.x();
+
+ if ( act && !dis ) {
+ qDrawShadePanel( p, xvis, y, w, h, cg, TRUE, 1, &cg.brush( QColorGroup::Button ) );
+ }
+ else {
+ QBrush fill( cg.light(), Dense4Pattern );
+ // set the brush origin for the hash pattern to the x/y coordinate
+ // of the menu item's checkmark... this way, the check marks have
+ // a consistent look
+ QPoint origin = p->brushOrigin();
+ p->setBrushOrigin( xvis, y );
+ qDrawShadePanel( p, xvis, y, w, h, cg, TRUE, 1, &fill );
+ // restore the previous brush origin
+ p->setBrushOrigin( origin );
+ }
+ }
+ break;
+
+ case PE_MenuItemIndicatorIconFrame:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ QRect vrect = visualRect( QRect( x, y, w, h ), r );
+ int xvis = vrect.x();
+
+ qDrawShadePanel( p, xvis, y, w, h, cg, FALSE, 1, &cg.brush( QColorGroup::Button ) );
+ }
+ break;
+
+ case PE_MenuItemIndicatorCheck:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ int xp = x + windowsItemFrame;
+
+ SFlags cflags = Style_Default;
+ if (! dis)
+ cflags |= Style_Enabled;
+ if (act)
+ cflags |= Style_On;
+
+ drawPrimitive(PE_CheckMark, p, ceData, elementFlags, visualRect( QRect(xp, y + windowsItemFrame, w - 2*windowsItemFrame, h - 2*windowsItemFrame), r ), cg, cflags);
+ }
+ break;
+
default:
if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) {
QPointArray a;
@@ -809,21 +866,7 @@ void QWindowsStyle::drawControl( ControlElement element,
QRect vrect = visualRect( QRect( xpos, y, checkcol, h ), r );
int xvis = vrect.x();
if ( mi->isChecked() ) {
- if ( act && !dis )
- qDrawShadePanel( p, xvis, y, checkcol, h,
- cg, TRUE, 1, &cg.brush( QColorGroup::Button ) );
- else {
- QBrush fill( cg.light(), Dense4Pattern );
- // set the brush origin for the hash pattern to the x/y coordinate
- // of the menu item's checkmark... this way, the check marks have
- // a consistent look
- QPoint origin = p->brushOrigin();
- p->setBrushOrigin( xvis, y );
- qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1,
- &fill );
- // restore the previous brush origin
- p->setBrushOrigin( origin );
- }
+ drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, QRect(x, y, checkcol, h), cg, flags);
} else if (! act)
p->fillRect(xvis, y, checkcol , h, cg.brush( QColorGroup::Button ));
@@ -839,8 +882,7 @@ void QWindowsStyle::drawControl( ControlElement element,
int pixw = pixmap.width();
int pixh = pixmap.height();
if ( act && !dis && !mi->isChecked() )
- qDrawShadePanel( p, xvis, y, checkcol, h, cg, FALSE, 1,
- &cg.brush( QColorGroup::Button ) );
+ drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, QRect(x, y, checkcol, h), cg, flags);
QRect pmr( 0, 0, pixw, pixh );
pmr.moveCenter( vrect.center() );
p->setPen( cg.text() );
@@ -851,20 +893,9 @@ void QWindowsStyle::drawControl( ControlElement element,
cg.brush( QColorGroup::Button ));
int xp = xpos + checkcol + 1;
p->fillRect( visualRect( QRect( xp, y, w - checkcol - 1, h ), r ), fill);
- } else if ( checkable ) { // just "checking"...
+ } else if ( checkable ) { // just "checking"...
if ( mi->isChecked() ) {
- int xp = xpos + windowsItemFrame;
-
- SFlags cflags = Style_Default;
- if (! dis)
- cflags |= Style_Enabled;
- if (act)
- cflags |= Style_On;
-
- drawPrimitive(PE_CheckMark, p, ceData, elementFlags,
- visualRect( QRect(xp, y + windowsItemFrame,
- checkcol - 2*windowsItemFrame,
- h - 2*windowsItemFrame), r ), cg, cflags);
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, QRect(x, y, checkcol, h), cg, flags);
}
}