summaryrefslogtreecommitdiffstats
path: root/src/styles/qmotifstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/styles/qmotifstyle.cpp')
-rw-r--r--src/styles/qmotifstyle.cpp60
1 files changed, 50 insertions, 10 deletions
diff --git a/src/styles/qmotifstyle.cpp b/src/styles/qmotifstyle.cpp
index 422dacb..826cd16 100644
--- a/src/styles/qmotifstyle.cpp
+++ b/src/styles/qmotifstyle.cpp
@@ -770,22 +770,44 @@ void QMotifStyle::drawPrimitive( PrimitiveElement pe,
&cg.brush(QColorGroup::Mid));
break;
+ case PE_MenuItemIndicatorFrame:
+ {
+ // Draw nothing
+ break;
+ }
+
+ case PE_MenuItemIndicatorIconFrame:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+
+ QRect vrect = visualRect( QRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r );
+ int xvis = vrect.x();
+
+ qDrawShadePanel( p, xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame, cg, TRUE, 1, &cg.brush( QColorGroup::Midlight ) );
+ break;
+ }
+
case PE_MenuItemIndicatorCheck:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
- QRect vrect = visualRect( QRect( x+motifItemFrame, y+motifItemFrame, w, h-2*motifItemFrame ), r );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+
+ QRect vrect = visualRect( QRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r );
int xvis = vrect.x();
- int mw = w;
+ int mw = checkcol;
int mh = h - 2*motifItemFrame;
SFlags cflags = Style_Default;
- if (! dis)
- cflags |= Style_Enabled;
- if (act)
- cflags |= Style_On;
+ if (! dis)
+ cflags |= Style_Enabled;
+ if (act)
+ cflags |= Style_On;
- drawPrimitive(PE_CheckMark, p, ceData, elementFlags, QRect(xvis, y+motifItemFrame, mw, mh), cg, cflags);
+ drawPrimitive(PE_CheckMark, p, ceData, elementFlags, QRect(xvis, y+motifItemFrame, mw, mh), cg, cflags);
+ break;
}
default:
@@ -1077,8 +1099,7 @@ void QMotifStyle::drawControl( ControlElement element,
int xvis = vrect.x();
if ( mi->isChecked() ) {
if ( mi->iconSet() ) {
- qDrawShadePanel( p, xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame,
- cg, TRUE, 1, &cg.brush( QColorGroup::Midlight ) );
+ drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
}
} else if ( !act ) {
p->fillRect(xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame,
@@ -1104,7 +1125,7 @@ void QMotifStyle::drawControl( ControlElement element,
} else if ( checkable ) { // just "checking"...
if ( mi->isChecked() ) {
- drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, QRect(x, y, checkcol, h), cg, flags);
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt);
}
}
@@ -1556,6 +1577,13 @@ int QMotifStyle::pixelMetric( PixelMetric metric, QStyleControlElementData ceDat
ret = 13;
break;
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ ret = motifItemFrame;
+ break;
+
default:
ret = QCommonStyle::pixelMetric( metric, ceData, elementFlags, widget );
break;
@@ -2364,6 +2392,18 @@ int QMotifStyle::styleHint(StyleHint hint,
ret = 0;
break;
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int maxpmw = opt.maxIconWidth();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+
+ if ( checkable )
+ maxpmw = QMAX( maxpmw, motifCheckMarkSpace );
+
+ ret = maxpmw;
+ break;
+ }
+
default:
ret = QCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
break;