diff options
author | Timothy Pearson <[email protected]> | 2012-10-31 15:02:58 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-10-31 15:02:58 -0500 |
commit | 0be8c502f5b20a3d2dfd36f24b733faf6bc1fb38 (patch) | |
tree | 68f3501ddfce25836829732a00867fc3042eed3a /style/lipstik.cpp | |
parent | 8c8a5b7ffaf390e70751f50c278f70d23de137bc (diff) | |
download | tde-style-lipstik-0be8c502f5b20a3d2dfd36f24b733faf6bc1fb38.tar.gz tde-style-lipstik-0be8c502f5b20a3d2dfd36f24b733faf6bc1fb38.zip |
Update to new style API
Diffstat (limited to 'style/lipstik.cpp')
-rw-r--r-- | style/lipstik.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/style/lipstik.cpp b/style/lipstik.cpp index edbeb2a..f10f93f 100644 --- a/style/lipstik.cpp +++ b/style/lipstik.cpp @@ -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); } |