diff options
author | Darrell Anderson <[email protected]> | 2012-10-31 18:47:07 -0500 |
---|---|---|
committer | Darrell Anderson <[email protected]> | 2012-10-31 18:47:07 -0500 |
commit | 0a232e5b3c2875e68d97be690beec7da1ccc65ba (patch) | |
tree | ec5222b67db7ba6aad8fa337d0e25153d8fe5062 /src/styles/qmotifplusstyle.cpp | |
parent | 95354d1b5116fa9e96534bef9a2f65c1976d4c12 (diff) | |
parent | 289363b959ac4720ee604f1dfba54c624f0098c0 (diff) | |
download | qt3-0a232e5b3c2875e68d97be690beec7da1ccc65ba.tar.gz qt3-0a232e5b3c2875e68d97be690beec7da1ccc65ba.zip |
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/qt3
Diffstat (limited to 'src/styles/qmotifplusstyle.cpp')
-rw-r--r-- | src/styles/qmotifplusstyle.cpp | 81 |
1 files changed, 70 insertions, 11 deletions
diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp index 72e28a8..113716c 100644 --- a/src/styles/qmotifplusstyle.cpp +++ b/src/styles/qmotifplusstyle.cpp @@ -263,6 +263,13 @@ int QMotifPlusStyle::pixelMetric(PixelMetric metric, QStyleControlElementData ce ret = 11; break; + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + ret = 2; + break; + default: ret = QMotifStyle::pixelMetric(metric, ceData, elementFlags, widget); break; @@ -282,6 +289,9 @@ void QMotifPlusStyle::drawPrimitive( PrimitiveElement pe, SFlags flags, const QStyleOption& opt ) const { + bool dis = ! (flags & Style_Enabled); + bool act = flags & Style_Active; + switch (pe) { case PE_HeaderSection: @@ -638,6 +648,47 @@ void QMotifPlusStyle::drawPrimitive( PrimitiveElement pe, break; } + case PE_PanelScrollBar: + { + drawMotifPlusShade(p, r, cg, TRUE, FALSE, &cg.brush(QColorGroup::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); + + QRect vrect = visualRect( QRect( x+2, y+2, checkcol, h-2 ), r ); + + qDrawShadePanel( p, vrect.x(), y+2, checkcol, h-2*2, cg, TRUE, 1, &cg.brush( QColorGroup::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); + + QRect vrect = visualRect( QRect( x+2, y+2, checkcol, h-2 ), r ); + + SFlags cflags = Style_Default; + if (! dis) + cflags |= Style_Enabled; + if (act) + cflags |= Style_On; + + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, vrect, cg, cflags); + break; + } + default: QMotifStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); break; @@ -795,8 +846,7 @@ void QMotifPlusStyle::drawControl( ControlElement element, QRect vrect = visualRect( QRect( x+2, y+2, checkcol, h-2 ), r ); if ( mi->isChecked() ) { if ( mi->iconSet() ) { - qDrawShadePanel( p, vrect.x(), y+2, checkcol, h-2*2, - cg, TRUE, 1, &cg.brush( QColorGroup::Midlight ) ); + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); } } else if ( !act ) { p->fillRect(vrect, @@ -828,13 +878,7 @@ void QMotifPlusStyle::drawControl( ControlElement element, } else if (checkable) { if (mi->isChecked()) { - SFlags cflags = Style_Default; - if (! dis) - cflags |= Style_Enabled; - if (act) - cflags |= Style_On; - - drawPrimitive(PE_CheckMark, p, ceData, elementFlags, vrect, cg, cflags); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } @@ -1147,8 +1191,12 @@ void QMotifPlusStyle::drawComplexControl(ComplexControl control, if (controls == (SC_ScrollBarAddLine | SC_ScrollBarSubLine | SC_ScrollBarAddPage | SC_ScrollBarSubPage | SC_ScrollBarFirst | SC_ScrollBarLast | SC_ScrollBarSlider)) - drawMotifPlusShade(p, widget->rect(), cg, TRUE, FALSE, - &cg.brush(QColorGroup::Mid)); + drawPrimitive(PE_PanelScrollBar, p, ceData, elementFlags, ceData.rect, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarLast) ? + Style_Down : Style_Default) | + ((ceData.orientation == Qt::Horizontal) ? + Style_Horizontal : Style_Default)); if ((controls & SC_ScrollBarSubLine) && subline.isValid()) drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, @@ -1559,6 +1607,17 @@ int QMotifPlusStyle::styleHint(StyleHint hint, case SH_PopupMenu_MouseTracking: ret = 1; break; + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = (elementFlags & CEF_IsCheckable); + + if (checkable) + maxpmw = QMAX(maxpmw, 15); + + ret = maxpmw; + break; + } default: ret = QMotifStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget); break; |