diff options
Diffstat (limited to 'src/styles/qsgistyle.cpp')
-rw-r--r-- | src/styles/qsgistyle.cpp | 66 |
1 files changed, 62 insertions, 4 deletions
diff --git a/src/styles/qsgistyle.cpp b/src/styles/qsgistyle.cpp index 8110f66de..aa00c57f0 100644 --- a/src/styles/qsgistyle.cpp +++ b/src/styles/qsgistyle.cpp @@ -398,6 +398,14 @@ int TQSGIStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceDat case PM_SplitterWidth: return TQMAX( 10, TQApplication::globalStrut().width() ); + case PM_MenuIndicatorFrameHBorder: + return (sgiItemFrame+2); + case PM_MenuIndicatorFrameVBorder: + return (sgiItemFrame+4); + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + return sgiItemFrame; + default: break; } @@ -881,7 +889,7 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe, } break; - case PE_MenuItemIndicatorCheck: + case PE_MenuItemIndicatorFrame: { int x, y, w, h; r.rect(&x, &y, &w, &h); @@ -895,6 +903,32 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe, TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) ); er.addCoords( 1, 1, -1, -1 ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, cflags, opt ); + } + 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); + + drawPanel( p, x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame, cg, TRUE, 1, &cg.brush( TQColorGroup::Light ) ); + } + break; + + case PE_MenuItemIndicatorCheck: + { + int x, y, w, h; + r.rect(&x, &y, &w, &h); + + SFlags cflags = Style_Default; + if (! dis) + cflags |= Style_Enabled; + if (act) + cflags |= Style_On; + + TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) ); + er.addCoords( 1, 1, -1, -1 ); er.addCoords( 0, 1, 1, 1 ); drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, cflags | Style_On, opt ); } @@ -1012,8 +1046,7 @@ void TQSGIStyle::drawControl( ControlElement element, if ( mi->isChecked() ) { if ( mi->iconSet() ) { - drawPanel( p, x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame, - cg, TRUE, 1, &cg.brush( TQColorGroup::Light ) ); + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); } } else { if ( !act ) @@ -1041,7 +1074,8 @@ void TQSGIStyle::drawControl( ControlElement element, } else { if ( checkable ) { if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, w, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } } @@ -1477,4 +1511,28 @@ TQRect TQSGIStyle::querySubControlMetrics( ComplexControl control, return TQMotifStyle::querySubControlMetrics( control, ceData, elementFlags, sub, opt, widget ); } +/*! \reimp */ +int TQSGIStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const +{ + int ret; + + switch (sh) { + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = ( elementFlags & CEF_IsCheckable ); + + if ( checkable ) + maxpmw = TQMAX( maxpmw, sgiCheckMarkSpace ); + ret = maxpmw; + } + break; + default: + ret = TQMotifStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w); + break; + } + + return ret; +} + #endif // QT_NO_STYLE_SGI |