diff options
Diffstat (limited to 'src/styles/qmotifstyle.cpp')
-rw-r--r-- | src/styles/qmotifstyle.cpp | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/src/styles/qmotifstyle.cpp b/src/styles/qmotifstyle.cpp index ea4da2073..3225e0e29 100644 --- a/src/styles/qmotifstyle.cpp +++ b/src/styles/qmotifstyle.cpp @@ -770,22 +770,44 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe, &cg.brush(TQColorGroup::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); + + TQRect vrect = visualRect( TQRect( 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( TQColorGroup::Midlight ) ); + break; + } + case PE_MenuItemIndicatorCheck: { int x, y, w, h; r.rect( &x, &y, &w, &h ); - TQRect vrect = visualRect( TQRect( x+motifItemFrame, y+motifItemFrame, w, h-2*motifItemFrame ), r ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + TQRect vrect = visualRect( TQRect( 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, TQRect(xvis, y+motifItemFrame, mw, mh), cg, cflags); + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, TQRect(xvis, y+motifItemFrame, mw, mh), cg, cflags); + break; } default: @@ -1077,8 +1099,7 @@ void TQMotifStyle::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( TQColorGroup::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 TQMotifStyle::drawControl( ControlElement element, } else if ( checkable ) { // just "checking"... if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } @@ -1556,6 +1577,13 @@ int TQMotifStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceD ret = 13; break; + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + ret = motifItemFrame; + break; + default: ret = TQCommonStyle::pixelMetric( metric, ceData, elementFlags, widget ); break; @@ -2364,6 +2392,18 @@ int TQMotifStyle::styleHint(StyleHint hint, ret = 0; break; + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = (elementFlags & CEF_IsCheckable); + + if ( checkable ) + maxpmw = TQMAX( maxpmw, motifCheckMarkSpace ); + + ret = maxpmw; + break; + } + default: ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget); break; |