summaryrefslogtreecommitdiffstats
path: root/src/styles/qmotifplusstyle.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-10-31 12:39:27 -0500
committerTimothy Pearson <[email protected]>2012-10-31 12:39:27 -0500
commita5ced706e9295f4f3c1e95c829750dff0d808935 (patch)
treecd1851fcfaa1639c8ab9fc3b8ee166b13a745257 /src/styles/qmotifplusstyle.cpp
parent69429dcfc35d449c78b346bdce536f17d926c755 (diff)
downloadqt3-a5ced706e9295f4f3c1e95c829750dff0d808935.tar.gz
qt3-a5ced706e9295f4f3c1e95c829750dff0d808935.zip
Add new style hints for enhanced third party style compatibility
Diffstat (limited to 'src/styles/qmotifplusstyle.cpp')
-rw-r--r--src/styles/qmotifplusstyle.cpp44
1 files changed, 40 insertions, 4 deletions
diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp
index 86db691..113716c 100644
--- a/src/styles/qmotifplusstyle.cpp
+++ b/src/styles/qmotifplusstyle.cpp
@@ -263,6 +263,13 @@ int QMotifPlusStyle::pixelMetric(PixelMetric metric, QStyleControlElementData ce
ret = 11;
break;
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ ret = 2;
+ break;
+
default:
ret = QMotifStyle::pixelMetric(metric, ceData, elementFlags, widget);
break;
@@ -647,11 +654,30 @@ void QMotifPlusStyle::drawPrimitive( PrimitiveElement pe,
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+2, y+2, checkcol, h-2 ), r );
+
+ qDrawShadePanel( p, vrect.x(), y+2, checkcol, h-2*2, 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+2, y+2, w, h-2 ), r );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+
+ QRect vrect = visualRect( QRect( x+2, y+2, checkcol, h-2 ), r );
SFlags cflags = Style_Default;
if (! dis)
@@ -820,8 +846,7 @@ void QMotifPlusStyle::drawControl( ControlElement element,
QRect vrect = visualRect( QRect( x+2, y+2, checkcol, h-2 ), r );
if ( mi->isChecked() ) {
if ( mi->iconSet() ) {
- qDrawShadePanel( p, vrect.x(), y+2, checkcol, h-2*2,
- cg, TRUE, 1, &cg.brush( QColorGroup::Midlight ) );
+ drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
}
} else if ( !act ) {
p->fillRect(vrect,
@@ -853,7 +878,7 @@ void QMotifPlusStyle::drawControl( ControlElement element,
} else if (checkable) {
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);
}
}
@@ -1582,6 +1607,17 @@ int QMotifPlusStyle::styleHint(StyleHint hint,
case SH_PopupMenu_MouseTracking:
ret = 1;
break;
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int maxpmw = opt.maxIconWidth();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+
+ if (checkable)
+ maxpmw = QMAX(maxpmw, 15);
+
+ ret = maxpmw;
+ break;
+ }
default:
ret = QMotifStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
break;