diff options
Diffstat (limited to 'src/styles/qmotifstyle.cpp')
-rw-r--r-- | src/styles/qmotifstyle.cpp | 90 |
1 files changed, 74 insertions, 16 deletions
diff --git a/src/styles/qmotifstyle.cpp b/src/styles/qmotifstyle.cpp index b404dc917..3225e0e29 100644 --- a/src/styles/qmotifstyle.cpp +++ b/src/styles/qmotifstyle.cpp @@ -211,6 +211,9 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe, SFlags flags, const TQStyleOption& opt ) const { + bool dis = ! (flags & Style_Enabled); + bool act = flags & Style_Active; + switch( pe ) { #ifndef QT_NO_LISTVIEW case PE_CheckListExclusiveIndicator: { @@ -761,6 +764,52 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe, r.height() - 4, cg.brush(TQColorGroup::Highlight)); break; + case PE_PanelScrollBar: + qDrawShadePanel(p, r, cg, TRUE, + pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags), + &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 ); + 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 = checkcol; + int mh = h - 2*motifItemFrame; + + SFlags cflags = Style_Default; + if (! dis) + cflags |= Style_Enabled; + if (act) + cflags |= Style_On; + + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, TQRect(xvis, y+motifItemFrame, mw, mh), cg, cflags); + break; + } + default: TQCommonStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); break; @@ -1050,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, @@ -1076,18 +1124,8 @@ void TQMotifStyle::drawControl( ControlElement element, p->drawPixmap( pmr.topLeft(), pixmap ); } else if ( checkable ) { // just "checking"... - int mw = checkcol; - int mh = h - 2*motifItemFrame; if ( mi->isChecked() ) { - SFlags cflags = Style_Default; - 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_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } @@ -1339,9 +1377,10 @@ void TQMotifStyle::drawComplexControl( ComplexControl control, if (sub == (SC_ScrollBarAddLine | SC_ScrollBarSubLine | SC_ScrollBarAddPage | SC_ScrollBarSubPage | SC_ScrollBarFirst | SC_ScrollBarLast | SC_ScrollBarSlider)) - qDrawShadePanel(p, ceData.rect, cg, TRUE, - pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget), - &cg.brush(TQColorGroup::Mid)); + drawPrimitive(PE_PanelScrollBar, p, ceData, elementFlags, ceData.rect, cg, + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : Style_Default)); + TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, sub, subActive, opt, widget); break; @@ -1538,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; @@ -2346,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; |