Update to new style API

pull/1/head
Timothy Pearson 12 years ago
parent 8c8a5b7ffa
commit 0be8c502f5

@ -2386,14 +2386,16 @@ void LipstikStyle::drawPrimitive(PrimitiveElement pe,
case PE_MenuItemIndicatorIconFrame: {
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect( x + 2, y + 2, w - 1, h - 4 ), r );
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
TQRect cr = visualRect( TQRect( x + 2, y + 2, checkcol - 1, h - 4 ), r );
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
break;
}
case PE_MenuItemIndicatorCheck: {
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect( x + 2, y + 2, w - 1, h - 4 ), r );
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
TQRect cr = visualRect( TQRect( x + 2, y + 2, checkcol - 1, h - 4 ), r );
SFlags cflags = Style_On;
if (enabled)
cflags |= Style_Enabled;
@ -2991,10 +2993,10 @@ void LipstikStyle::drawControl(ControlElement element,
// Then dont draw the icon, only the check. I believe its more
// apparent its checked, compared to an almost invisible pressed background only.
if ( checkable && /*!active &&*/ mi->isChecked() ) {
drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags);
drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags, opt);
// Draw the checkmark
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags);
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags, opt);
}
}
@ -3004,10 +3006,10 @@ void LipstikStyle::drawControl(ControlElement element,
// We only have to draw the background if the menu item is inactive -
// if it's active the "pressed" background is already drawn
// if ( ! active )
drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags);
drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags, opt);
// Draw the checkmark
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags);
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags, opt);
}
// Time to draw the menu item label...
@ -3858,6 +3860,12 @@ int LipstikStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, C
return 1;
}
case PM_MenuIndicatorFrameHBorder:
case PM_MenuIndicatorFrameVBorder:
case PM_MenuIconIndicatorFrameHBorder:
case PM_MenuIconIndicatorFrameVBorder:
return 2;
default:
return KStyle::pixelMetric(m, ceData, elementFlags, widget);
}
@ -3963,6 +3971,17 @@ int LipstikStyle::styleHint( StyleHint stylehint,
case SH_PopupMenu_SubMenuPopupDelay:
return 96; // Motif-like delay...
case SH_MenuIndicatorColumnWidth:
{
int checkcol = option.maxIconWidth();
bool checkable = (elementFlags & CEF_IsCheckable);
if ( checkable )
checkcol = TQMAX( checkcol, 20 );
return checkcol;
}
default:
return KStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
}

Loading…
Cancel
Save