From 960121b347f839e9fafb5cf3ee2cdc4ed37dfb86 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 31 Oct 2012 15:12:59 -0500 Subject: Update to new style API --- style/qtcurve.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'style/qtcurve.cpp') diff --git a/style/qtcurve.cpp b/style/qtcurve.cpp index 701c877..b4a36f4 100644 --- a/style/qtcurve.cpp +++ b/style/qtcurve.cpp @@ -4345,7 +4345,11 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, TQStyleCo { int x, y, w, h; r.rect( &x, &y, &w, &h ); - TQRect cr=visualRect(TQRect(x, y, w, h), r); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, data, NULL, NULL); + + TQRect cr=visualRect(TQRect(x, y, checkcol, h), r); + bool reverse = TQApplication::reverseLayout(); + if (reverse) cr=visualRect(cr, r); drawLightBevel((flags & Style_Active)&&(flags & Style_Enabled) ? itsHighlightCols[ORIGINAL_SHADE] @@ -4359,7 +4363,11 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, TQStyleCo { int x, y, w, h; r.rect( &x, &y, &w, &h ); - TQRect cr=visualRect(TQRect(x, y, w, h), r); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, data, NULL, NULL); + + TQRect cr=visualRect(TQRect(x, y, checkcol, h), r); + bool reverse = TQApplication::reverseLayout(); + if (reverse) cr=visualRect(cr, r); drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg, (flags &(Style_Enabled|(opts.useHighlightForMenu ? Style_Active : 0)))| Style_On|MENU_ITEM); @@ -5041,7 +5049,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleCont // Do we have an icon and are checked at the same time? // Then draw a "pressed" background behind the icon if((elementFlags & CEF_IsCheckable) && mi->isChecked()) - drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, maxpmw, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, data); // Draw the icon TQPixmap pixmap(mi->iconSet()->pixmap(TQIconSet::Small, mode)); @@ -5051,7 +5059,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleCont p->drawPixmap(pmr.topLeft(), pixmap); } else if((elementFlags & CEF_IsCheckable) && mi->isChecked()) - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, maxpmw, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, data); TQColor textCol(flags&Style_Enabled ? flags&Style_Active && opts.useHighlightForMenu @@ -6921,6 +6929,11 @@ int QtCurveStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceDa return -1; case PM_TabBarTabVSpace: return opts.highlightTab ? 11 : 9; + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + return 0; default: return BASE_STYLE::pixelMetric(metric, ceData, elementFlags, widget); } @@ -7090,6 +7103,12 @@ int QtCurveStyle::styleHint(StyleHint stylehint, TQStyleControlElementData ceDat return opts.menubarMouseOver ? 1 : 0; case SH_TabBar_Alignment: return AlignLeft; + case SH_MenuIndicatorColumnWidth: + { + int checkcol = option.maxIconWidth(); + checkcol = TQMAX(checkcol, constMenuPixmapWidth); + return checkcol; + } default: return BASE_STYLE::styleHint(stylehint, ceData, elementFlags, option, returnData, widget); } -- cgit v1.2.3