diff options
author | Timothy Pearson <[email protected]> | 2012-08-05 01:03:33 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-08-05 01:03:33 -0500 |
commit | 8a81e3e9ade5820c2764b7c912b5115c2fd64c1c (patch) | |
tree | 3537cb7bd39e607de03618b4b646ebd8446c75e2 /style/qtcurve.cpp | |
parent | dc8692f8b3b7fd3e6c3f7be4d781adadf175a8fe (diff) | |
download | tde-style-qtcurve-8a81e3e9ade5820c2764b7c912b5115c2fd64c1c.tar.gz tde-style-qtcurve-8a81e3e9ade5820c2764b7c912b5115c2fd64c1c.zip |
Update to new style API
Diffstat (limited to 'style/qtcurve.cpp')
-rw-r--r-- | style/qtcurve.cpp | 530 |
1 files changed, 299 insertions, 231 deletions
diff --git a/style/qtcurve.cpp b/style/qtcurve.cpp index 3cc01c3..83792ec 100644 --- a/style/qtcurve.cpp +++ b/style/qtcurve.cpp @@ -263,7 +263,7 @@ static TQString kdeHome(bool trinity=false) { FILE *fpipe; - if (fpipe = (FILE*)popen(trinity ? "tde-config --localprefix 2> /dev/null" : "kde4-config --localprefix 2> /dev/null", "r")) + if ((fpipe = (FILE*)popen(trinity ? "tde-config --localprefix 2> /dev/null" : "kde4-config --localprefix 2> /dev/null", "r"))) { char line[1024]; @@ -562,11 +562,14 @@ static bool readKdeGlobals() inInactive=false; } } - if(!inPal && !inInactive) - if(!useTQt3 && 0==line.find("[Colors:Button]", false)) + if(!inPal && !inInactive) { + if(!useTQt3 && 0==line.find("[Colors:Button]", false)) { inPal=true; - else if(!useTQt3 && 0==line.find("[ColorEffects:Inactive]", false)) + } + else if(!useTQt3 && 0==line.find("[ColorEffects:Inactive]", false)) { inInactive=true; + } + } } f.close(); } @@ -1345,20 +1348,26 @@ void TQtCurveStyle::polish(TQPalette &pal) if(newComboBtn) shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsButtonCols[ORIGINAL_SHADE]), itsComboBtnCols); - if(newSortedLv) - if(SHADE_BLEND_SELECTED==opts.sortedLv) + if(newSortedLv) { + if(SHADE_BLEND_SELECTED==opts.sortedLv) { shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], opts.lvButton ? itsButtonCols[ORIGINAL_SHADE] : itsBackgroundCols[ORIGINAL_SHADE]), itsSortedLvColors); - else + } + else { shadeColors(shade(opts.lvButton ? itsButtonCols[ORIGINAL_SHADE] : itsBackgroundCols[ORIGINAL_SHADE], LV_HEADER_DARK_FACTOR), itsSortedLvColors); + } + } - if(newDefBtn) - if(IND_TINT==opts.defBtnIndicator) + if(newDefBtn) { + if(IND_TINT==opts.defBtnIndicator) { shadeColors(tint(itsButtonCols[ORIGINAL_SHADE], itsHighlightCols[ORIGINAL_SHADE], DEF_BNT_TINT), itsDefBtnCols); - else if(IND_GLOW!=opts.defBtnIndicator) + } + else if(IND_GLOW!=opts.defBtnIndicator) { shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsButtonCols[ORIGINAL_SHADE]), itsDefBtnCols); + } + } if(itsSidebarButtonsCols && SHADE_BLEND_SELECTED!=opts.shadeSliders && IND_COLORED!=opts.defBtnIndicator) @@ -1369,14 +1378,18 @@ void TQtCurveStyle::polish(TQPalette &pal) itsLighterPopupMenuBgndCol=shade(itsBackgroundCols[ORIGINAL_SHADE], TO_FACTOR(opts.lighterPopupMenuBgnd)); - if(newCheckRadioSelCols) - if(SHADE_BLEND_SELECTED==opts.crColor) + if(newCheckRadioSelCols) { + if(SHADE_BLEND_SELECTED==opts.crColor) { shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsButtonCols[ORIGINAL_SHADE]), itsCheckRadioSelCols); - else + } + else { shadeColors(shade(itsButtonCols[ORIGINAL_SHADE], LV_HEADER_DARK_FACTOR), itsCheckRadioSelCols); + } + } - if(newProgressCols) + if(newProgressCols) { shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsBackgroundCols[ORIGINAL_SHADE]), itsProgressCols); + } pal.setActive(setColorGroup(pal.active(), pal.active())); pal.setInactive(setColorGroup(pal.inactive(), pal.active())); @@ -2028,11 +2041,14 @@ bool TQtCurveStyle::eventFilter(TQObject *object, TQEvent *event) TQRect bgndRect(r.x(), r.y()-y_offset, r.width(), pr.height()); - if(!IS_FLAT(opts.toolbarAppearance)) - if(horiz) + if(!IS_FLAT(opts.toolbarAppearance)) { + if(horiz) { bgndRect.addCoords(0, -1, 0, 1); - else + } + else { bgndRect.addCoords(-1, 0, 1, 0); + } + } drawMenuOrToolBarBackground(&p, bgndRect, parent->colorGroup(), false, horiz); } @@ -2079,10 +2095,10 @@ bool TQtCurveStyle::eventFilter(TQObject *object, TQEvent *event) { TQPainter painter(frame); if (TQFrame::VLine==frame->frameShape()) - tqdrawPrimitive(PE_DockWindowSeparator, &painter, frame->rect(), + drawPrimitive(PE_DockWindowSeparator, &painter, TQStyleControlElementData(), CEF_None, frame->rect(), frame->colorGroup(), Style_Horizontal); else if (TQFrame::HLine==frame->frameShape()) - tqdrawPrimitive(PE_DockWindowSeparator, &painter, frame->rect(), + drawPrimitive(PE_DockWindowSeparator, &painter, TQStyleControlElementData(), CEF_None, frame->rect(), frame->colorGroup()); else return false; @@ -2103,7 +2119,7 @@ bool TQtCurveStyle::eventFilter(TQObject *object, TQEvent *event) r.addCoords(0, 0, 0, -tbHeight); else r.addCoords(0, tbHeight, 0, 0); - tqdrawPrimitive(PE_PanelTabWidget, &painter, r, widget->colorGroup(), + drawPrimitive(PE_PanelTabWidget, &painter, TQStyleControlElementData(), CEF_None, r, widget->colorGroup(), Style_Horizontal|Style_Enabled); return true; } @@ -2541,7 +2557,7 @@ void TQtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRe } // fill - if(br.width()>0 && br.height()>0 && (!sunken || sunkenToggleMo)) + if(br.width()>0 && br.height()>0 && (!sunken || sunkenToggleMo)) { if(plastikMouseOver) { if(WIDGET_SB_SLIDER==w) @@ -2611,6 +2627,7 @@ void TQtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRe if(round&CORNER_TR) p->drawPoint(br.right(), br.top()); } + } if(doBorder) { @@ -2637,7 +2654,7 @@ void TQtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRe w, doCorners); } - if(doEtch || glowFocus) + if(doEtch || glowFocus) { if( (!sunken || sunkenToggleMo) && ((WIDGET_OTHER!=w && WIDGET_SLIDER_TROUGH!=w && MO_GLOW==opts.coloredMouseOver && flags&Style_MouseOver) || glowFocus || @@ -2647,6 +2664,7 @@ void TQtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRe glowFocus ? itsFocusCols : 0); else drawEtch(p, rOrig, cg, EFFECT_SHADOW==opts.buttonEffect && WIDGET_BUTTON(w) && !sunken, ROUNDED_NONE==round); + } p->restore(); } @@ -2852,7 +2870,7 @@ void TQtCurveStyle::drawBorder(const TQColor &bgnd, TQPainter *p, const TQRect & p->drawLine(r.x(), r.y()+1, r.x()+1, r.y()); } } - if(doCorners) + if(doCorners) { if(itsFormMode) { if(!largeArc) @@ -2863,6 +2881,7 @@ void TQtCurveStyle::drawBorder(const TQColor &bgnd, TQPainter *p, const TQRect & p->setPen(largeArc ? bgnd : aaColor); p->drawPoint(r.x(), r.y()); } + } } else p->drawPoint(r.x(), r.y()); @@ -2884,7 +2903,7 @@ void TQtCurveStyle::drawBorder(const TQColor &bgnd, TQPainter *p, const TQRect & p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-1, r.y()+1); } } - if(doCorners) + if(doCorners) { if(itsFormMode) { if(!largeArc) @@ -2895,6 +2914,7 @@ void TQtCurveStyle::drawBorder(const TQColor &bgnd, TQPainter *p, const TQRect & p->setPen(largeArc ? bgnd : aaColor); p->drawPoint(r.x()+r.width()-1, r.y()); } + } } else p->drawPoint(r.x()+r.width()-1, r.y()); @@ -2917,7 +2937,7 @@ void TQtCurveStyle::drawBorder(const TQColor &bgnd, TQPainter *p, const TQRect & r.y()+r.height()-2); } } - if(doCorners) + if(doCorners) { if(itsFormMode) { if(!largeArc) @@ -2928,6 +2948,7 @@ void TQtCurveStyle::drawBorder(const TQColor &bgnd, TQPainter *p, const TQRect & p->setPen(largeArc ? bgnd : aaColor); p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-1); } + } } else p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-1); @@ -2949,7 +2970,7 @@ void TQtCurveStyle::drawBorder(const TQColor &bgnd, TQPainter *p, const TQRect & p->drawLine(r.x(), r.y()+r.height()-2, r.x()+1, r.y()+r.height()-1); } } - if(doCorners) + if(doCorners) { if(itsFormMode) { if(!largeArc) @@ -2960,6 +2981,7 @@ void TQtCurveStyle::drawBorder(const TQColor &bgnd, TQPainter *p, const TQRect & p->setPen(largeArc ? bgnd : aaColor); p->drawPoint(r.x(), r.y()+r.height()-1); } + } } else p->drawPoint(r.x(), r.y()+r.height()-1); @@ -3099,11 +3121,14 @@ void TQtCurveStyle::drawEntryField(TQPainter *p, const TQRect &rx, const TQColor p->fillRect(r, flags&Style_Enabled ? cg.base() : cg.background()); } - if(ENTRY_NONE!=coloration && isSpin && !opts.unifySpin) - if(reverse) + if(ENTRY_NONE!=coloration && isSpin && !opts.unifySpin) { + if(reverse) { r.addCoords(1, 0, 0, 0); - else + } + else { r.addCoords(0, 0, -1, 0); + } + } drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal), round, use, WIDGET_SCROLLVIEW==w ? w : WIDGET_ENTRY, true, isSpin && !(flags&Style_Enabled) ? BORDER_FLAT : BORDER_SUNKEN); @@ -3135,7 +3160,7 @@ void TQtCurveStyle::drawArrow(TQPainter *p, const TQRect &r, const TQColorGroup ::drawArrow(p, r, p->pen().style()==TQPen::NoPen ? col : TQColor(p->pen().color()), pe, opts, small); } -void TQtCurveStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const TQRect &r, +void TQtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, const TQStyleOption &data) const { switch(pe) @@ -3167,7 +3192,7 @@ void TQtCurveStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const } else { - bool isFirst(false), isLast(false), isTable(false), isSort(false); + bool isFirst(false), isLast(false), isSort(false); TQHeader *header(p && p->device() ? dynamic_cast<TQHeader*>(p->device()) : 0L); if (header) @@ -3176,7 +3201,6 @@ void TQtCurveStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const { TQTable *tbl((TQTable *)(header->parent())); - isTable=true; if(flags&Style_Horizontal) isFirst=tbl->columnAt(r.x()+header->offset())==0; else @@ -3444,7 +3468,7 @@ void TQtCurveStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const } TQRect checkRect(r.x()+1, r.y()+1, opts.crSize, opts.crSize); - tqdrawPrimitive(PE_Indicator, p, checkRect, cg, flags|LISTVIEW_ITEM); + drawPrimitive(PE_Indicator, p, ceData, elementFlags, checkRect, cg, flags|LISTVIEW_ITEM); } break; } @@ -3550,7 +3574,7 @@ void TQtCurveStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const } if(on) - tqdrawPrimitive(PE_CheckMark, p, rect, cg, flags); + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, rect, cg, flags); break; } case PE_CheckListExclusiveIndicator: @@ -3805,7 +3829,7 @@ void TQtCurveStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const p->setPen(backgroundColors(cg)[STD_BORDER]); p->drawLine(r2.x(), r2.y(), r2.x()+r2.width()-1, r2.y()); } - else if (FRAME_NONE!=opts.groupBox) + else if (FRAME_NONE!=opts.groupBox) { if(APP_OPENOFFICE==itsThemedApp || data.lineWidth()>0 || data.isDefault()) { const TQColor *use(backgroundColors(cg)); @@ -3813,8 +3837,10 @@ void TQtCurveStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal), opts.square&SQUARE_FRAME ? ROUNDED_NONE : ROUNDED_ALL, use, WIDGET_OTHER, true, BORDER_FLAT); } - else - TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); + else { + TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data); + } + } break; case PE_WindowFrame: if(data.lineWidth()>0 || data.isDefault()) @@ -3871,7 +3897,7 @@ void TQtCurveStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const } } else - TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); + TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data); break; case PE_PanelTabWidget: { @@ -4260,7 +4286,7 @@ void TQtCurveStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const } case PE_StatusBarSection: if(opts.drawStatusBarFrames) - BASE_STYLE::tqdrawPrimitive(pe, p, r, cg, flags, data); + BASE_STYLE::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data); break; case PE_SizeGrip: { @@ -4285,7 +4311,7 @@ void TQtCurveStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, const break; } default: - BASE_STYLE::tqdrawPrimitive(pe, p, r, cg, flags, data); + BASE_STYLE::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data); } } @@ -4306,9 +4332,9 @@ static TQString elliditide(const TQString &text, const TQFontMetrics &fontMetric return title; } -void TQtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, TQPainter *p, const TQWidget *widget, +void TQtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, - const TQStyleOption &opt) const + const TQStyleOption &opt, const TQWidget *widget) const { ELine handles(kpe!=KPE_ToolBarHandle && LINE_DASHES==opts.handles ? LINE_SUNKEN : opts.handles); @@ -4355,11 +4381,14 @@ void TQtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, TQPainter *p, const TQPainter p2; fnt.setPointSize(fnt.pointSize()-2); - if(hasClose) - if (horizontal) + if(hasClose) { + if (horizontal) { h-=15; - else + } + else { w-=15; + } + } // Draw the item on an off-screen pixmap to preserve Xft antialiasing for // vertically oriented handles. @@ -4456,13 +4485,13 @@ void TQtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, TQPainter *p, const } break; default: - BASE_STYLE::drawKStylePrimitive(kpe, p, widget, r, cg, flags, opt); + BASE_STYLE::drawKStylePrimitive(kpe, p, ceData, elementFlags, r, cg, flags, opt, widget); } } -void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWidget *widget, +void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, - const TQStyleOption &data) const + const TQStyleOption &data, const TQWidget *widget) const { if(widget==itsHoverWidget) flags|=Style_MouseOver; @@ -4531,11 +4560,14 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi p->fillRect(rx, shade(cg.background(), TO_FACTOR(opts.tabBgnd))); } - if(!active) - if(top) + if(!active) { + if(top) { tr.addCoords(0, 2, 0, 0); - else + } + else { tr.addCoords(0, 0, 0, -2); + } + } if(!firstTab && top && (APP_TORA==itsThemedApp || (APP_OPENOFFICE==itsThemedApp && !active))) tr.addCoords(-1, 0, 0, 0); @@ -4714,7 +4746,7 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi const TQTabBar *tb((const TQTabBar *) widget); TQTab *t(data.tab()); TQRect tr(r); - int shift(pixelMetric(PM_TabBarTabShiftVertical, tb)); + int shift(pixelMetric(PM_TabBarTabShiftVertical, ceData, elementFlags, tb)); if (t->identifier() == tb->currentTab()) { @@ -4727,7 +4759,7 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi if(APP_MACTOR==itsThemedApp) { - drawControl(CE_TabBarTab, p, widget, t->rect(), cg, flags, data); + drawControl(CE_TabBarTab, p, ceData, elementFlags, t->rect(), cg, flags, data, widget); if(t->iconSet()) { @@ -4744,8 +4776,8 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi if(!(flags&Style_Selected)) { - xoff = pixelMetric(PM_TabBarTabShiftHorizontal, widget); - yoff = pixelMetric(PM_TabBarTabShiftVertical, widget); + xoff = pixelMetric(PM_TabBarTabShiftHorizontal, ceData, elementFlags, widget); + yoff = pixelMetric(PM_TabBarTabShiftVertical, ceData, elementFlags, widget); } p->drawPixmap(t->rect().left()+8+xoff, t->rect().center().y()-pixh/2 + yoff, pixmap); @@ -4763,7 +4795,7 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi else fr.addCoords(0, 0, 0, -1); - tqdrawPrimitive(PE_FocusRect, p, fr, cg); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg); } break; } @@ -4781,16 +4813,16 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi // Shift button contents if pushed. if (active) { - x += pixelMetric(PM_ButtonShiftHorizontal, widget); - y += pixelMetric(PM_ButtonShiftVertical, widget); + x += pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget); + y += pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget); flags |= Style_Sunken; } // Does the button have a popup menu? if (button->isMenuButton()) { - int dx(pixelMetric(PM_MenuButtonIndicator, widget)), - margin(pixelMetric(PM_ButtonMargin, widget)); + int dx(pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags, widget)), + margin(pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget)); if(button->iconSet() && !button->iconSet()->isNull() && (dx+button->iconSet()->pixmap(TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off @@ -4876,8 +4908,8 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi // Draw a focus rect if the button has focus if (flags&Style_HasFocus && FOCUS_GLOW!=opts.focus && !(flags&Style_MouseOver && FOCUS_FULL==opts.focus && MO_NONE!=opts.coloredMouseOver)) - tqdrawPrimitive(PE_FocusRect, p, visualRect(subRect(SR_PushButtonFocusRect, - widget), widget), cg, flags); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, visualRect(subRect(SR_PushButtonFocusRect, ceData, elementFlags, + widget), ceData, elementFlags), cg, flags); break; } case CE_PopupMenuItem: @@ -4974,7 +5006,7 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi p->drawPixmap(pmr.topLeft(), pixmap); } else if(popupmenu->isCheckable() && mi->isChecked()) - tqdrawPrimitive(PE_CheckMark, p, cr, cg, + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg, (flags &(Style_Enabled|(opts.useHighlightForMenu ? Style_Active : 0)))| Style_On|MENU_ITEM); TQColor textCol(flags&Style_Enabled @@ -5081,7 +5113,7 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi drawMenuOrToolBarBackground(p, r, cg, false, Qt::Horizontal==wind->orientation()); } else - BASE_STYLE::drawControl(control, p, widget, r, cg, flags, data); + BASE_STYLE::drawControl(control, p, ceData, elementFlags, r, cg, flags, data, widget); break; case CE_ProgressBarGroove: { @@ -5147,7 +5179,7 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi } else { - TQRect cr(subRect(SR_ProgressBarContents, widget)); + TQRect cr(subRect(SR_ProgressBarContents, ceData, elementFlags, widget)); if(cr.isValid() && pb->progress()>0) { @@ -5168,7 +5200,7 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi case CE_ProgressBarLabel: { const TQProgressBar* pb = (const TQProgressBar*)widget; - TQRect cr = subRect(SR_ProgressBarContents, widget); + TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget); double progress = pb->progress(); bool reverse = TQApplication::reverseLayout(); int steps = pb->totalSteps(); @@ -5279,16 +5311,16 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi if(sidebar) flags|=NO_ETCH_BUTTON; - tqdrawPrimitive(PE_ButtonCommand, p, r, cg, flags); + drawPrimitive(PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags); if (button->isDefault() && IND_CORNER==opts.defBtnIndicator) - tqdrawPrimitive(PE_ButtonDefault, p, r, cg, flags); + drawPrimitive(PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags); itsFormMode = false; } break; } case CE_CheckBox: itsFormMode = isFormWidget(widget); - tqdrawPrimitive(PE_Indicator, p, r, cg, flags, data); + drawPrimitive(PE_Indicator, p, ceData, elementFlags, r, cg, flags, data); itsFormMode = false; break; case CE_CheckBoxLabel: @@ -5304,15 +5336,15 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi { #if 0x039999 >= 0x030200 TQRect cr(checkbox->rect()); - TQRegion r(TQRect(cr.x(), cr.y(), visualRect(subRect(SR_CheckBoxFocusRect, widget), - widget).width()+ - pixelMetric(PM_IndicatorWidth)+4, + TQRegion r(TQRect(cr.x(), cr.y(), visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, widget), + ceData, elementFlags).width()+ + pixelMetric(PM_IndicatorWidth, ceData, elementFlags)+4, cr.height())); #else TQRegion r(checkbox->rect()); #endif - r-=visualRect(subRect(SR_CheckBoxIndicator, widget), widget); + r-=visualRect(subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget), ceData, elementFlags); p->setClipRegion(r); drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.crHighlight)), p, checkbox->rect(), true, false, opts.selectionAppearance, WIDGET_SELECTION); @@ -5324,15 +5356,15 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi flags & Style_Enabled, checkbox->pixmap(), checkbox->text()); if(checkbox->hasFocus() && FOCUS_GLOW!=opts.focus) - tqdrawPrimitive(PE_FocusRect, p, visualRect(subRect(SR_CheckBoxFocusRect, widget), - widget), cg, flags); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, widget), + ceData, elementFlags), cg, flags); } else - BASE_STYLE::drawControl(control, p, widget, r, cg, flags, data); + BASE_STYLE::drawControl(control, p, ceData, elementFlags, r, cg, flags, data, widget); break; case CE_RadioButton: itsFormMode=isFormWidget(widget); - tqdrawPrimitive(PE_ExclusiveIndicator, p, r, cg, flags, data); + drawPrimitive(PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, flags, data); itsFormMode=false; break; case CE_RadioButtonLabel: @@ -5349,14 +5381,14 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi #if 0x039999 >= 0x030200 TQRect rb(radiobutton->rect()); TQRegion r(TQRect(rb.x(), rb.y(), - visualRect(subRect(SR_RadioButtonFocusRect, widget), - widget).width()+ - pixelMetric(PM_ExclusiveIndicatorWidth)+4, + visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, widget), + ceData, elementFlags).width()+ + pixelMetric(PM_ExclusiveIndicatorWidth, ceData, elementFlags)+4, rb.height())); #else TQRegion r(radiobutton->rect()); #endif - r-=visualRect(subRect(SR_RadioButtonIndicator, widget), widget); + r-=visualRect(subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget), ceData, elementFlags); p->setClipRegion(r); drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.crHighlight)), p, radiobutton->rect(), true, false, opts.selectionAppearance, WIDGET_SELECTION); @@ -5369,18 +5401,18 @@ void TQtCurveStyle::drawControl(ControlElement control, TQPainter *p, const TQWi radiobutton->pixmap(), radiobutton->text()); if(radiobutton->hasFocus() && FOCUS_GLOW!=opts.focus) - tqdrawPrimitive(PE_FocusRect, p, visualRect(subRect(SR_RadioButtonFocusRect, - widget), widget), cg, flags); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, + widget), ceData, elementFlags), cg, flags); break; } // Fall through intentional! default: - BASE_STYLE::drawControl(control, p, widget, r, cg, flags, data); + BASE_STYLE::drawControl(control, p, ceData, elementFlags, r, cg, flags, data, widget); } } -void TQtCurveStyle::drawControlMask(ControlElement control, TQPainter *p, const TQWidget *widget, - const TQRect &r, const TQStyleOption &data) const +void TQtCurveStyle::drawControlMask(ControlElement control, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, + const TQRect &r, const TQStyleOption &data, const TQWidget *widget) const { switch(control) { @@ -5401,26 +5433,26 @@ void TQtCurveStyle::drawControlMask(ControlElement control, TQPainter *p, const break; } default: - BASE_STYLE::drawControlMask(control, p, widget, r, data); + BASE_STYLE::drawControlMask(control, p, ceData, elementFlags, r, data, widget); } } -void TQtCurveStyle::drawComplexControlMask(ComplexControl control, TQPainter *p, const TQWidget *widget, - const TQRect &r, const TQStyleOption &data) const +void TQtCurveStyle::drawComplexControlMask(ComplexControl control, TQPainter *p, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, + const TQRect &r, const TQStyleOption &data, const TQWidget *widget) const { switch (control) { case CC_SpinWidget: case CC_ComboBox: case CC_ToolButton: - drawControlMask(CE_PushButton, p, widget, r, data); + drawControlMask(CE_PushButton, p, ceData, elementFlags, r, data, widget); break; default: - BASE_STYLE::drawComplexControlMask(control, p, widget, r, data); + BASE_STYLE::drawComplexControlMask(control, p, ceData, elementFlags, r, data, widget); } } -TQRect TQtCurveStyle::subRect(SubRect subrect, const TQWidget *widget)const +TQRect TQtCurveStyle::subRect(SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget)const { TQRect rect, wrect(widget->rect()); @@ -5433,7 +5465,7 @@ TQRect TQtCurveStyle::subRect(SubRect subrect, const TQWidget *widget)const rect=wrect; else { - int dbw1(pixelMetric(PM_ButtonDefaultIndicator, widget)), + int dbw1(pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget)), dbw2(dbw1*2), border(3), border2=(border*2); @@ -5462,7 +5494,7 @@ TQRect TQtCurveStyle::subRect(SubRect subrect, const TQWidget *widget)const case SR_DockWindowHandleRect: return wrect; default: - return BASE_STYLE::subRect(subrect, widget); + return BASE_STYLE::subRect(subrect, ceData, elementFlags, widget); } return rect; @@ -5477,10 +5509,10 @@ class TQTitleBar : public TQWidget TQWidget *window() const; }; -void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, const TQWidget *widget, +void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, SCFlags controls, SCFlags active, - const TQStyleOption &data) const + const TQStyleOption &data, const TQWidget *widget) const { if(widget==itsHoverWidget) flags |=Style_MouseOver; @@ -5490,15 +5522,15 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con case CC_ToolButton: { const TQToolButton *toolbutton((const TQToolButton *)widget); - TQRect button(querySubControlMetrics(control, widget, SC_ToolButton, data)), - menuarea(querySubControlMetrics(control, widget, SC_ToolButtonMenu, - data)); + TQRect button(querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, data, widget)), + menuarea(querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, + data, widget)); SFlags bflags(flags|STD_TOOLBUTTON), mflags(flags); if (APP_KORN==itsThemedApp) { - tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, data); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, data); break; } @@ -5551,16 +5583,19 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con if (!tb && !onControlButtons) bflags |= Style_Horizontal; - if(tb) - if(Qt::Vertical==tb->orientation()) + if(tb) { + if(Qt::Vertical==tb->orientation()) { bflags|=VERTICAL_TB_BUTTON; - else + } + else { bflags|=Style_Horizontal; + } + } if(toolbutton->isToggleButton()) bflags|=TOGGLE_BUTTON; - tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, data); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, data); } // Check whether to draw a background pixmap @@ -5587,11 +5622,14 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con TQRect tbr(tb->rect()); bool horiz(Qt::Horizontal==tb->orientation()); - if(!IS_FLAT(opts.toolbarAppearance)) - if(horiz) + if(!IS_FLAT(opts.toolbarAppearance)) { + if(horiz) { tbr.addCoords(0, -1, 0, 0); - else + } + else { tbr.addCoords(-1, 0, 0, 0); + } + } drawMenuOrToolBarBackground(p, tbr, cg, false, horiz); } @@ -5601,18 +5639,20 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con if(controls&SC_ToolButtonMenu) { if(mflags &(Style_Down | Style_On | Style_Raised)) - tqdrawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, data); + drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, data); ::drawArrow(p, menuarea, MO_ARROW(cg.buttonText()), PE_ArrowDown, opts, true); } if(toolbutton->hasFocus() && !toolbutton->focusProxy()) { TQRect fr(toolbutton->rect()); - if(FOCUS_FULL!=opts.focus) + if(FOCUS_FULL!=opts.focus) { fr.addCoords(2, 2,-2,-2); - if(DO_EFFECT) + } + if(DO_EFFECT) { fr.addCoords(1, 1,-1,-1); - tqdrawPrimitive(PE_FocusRect, p, fr, cg); + } + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg); } itsFormMode=false; @@ -5626,15 +5666,15 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con itsFormMode = isFormWidget(widget); const TQComboBox *combobox((const TQComboBox *)widget); - TQRect frame(TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, + TQRect frame(TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, SC_ComboBoxFrame, - data), widget)), - arrow(TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, + data, widget), ceData, elementFlags)), + arrow(TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, - data), widget)), - field(TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, + data, widget), ceData, elementFlags)), + field(TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, - data), widget)); + data, widget), ceData, elementFlags)); const TQColor *use(buttonColors(cg)); bool editable(combobox->editable()), sunken(combobox->listBox() ? combobox->listBox()->isShown() : false), @@ -5748,7 +5788,7 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con fr=frame; else if(opts.comboSplitter) { - fr=TQStyle::visualRect(subRect(SR_ComboBoxFocusRect, widget), widget); + fr=TQStyle::visualRect(subRect(SR_ComboBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags); if(reverse) fr.addCoords(3, 0, 0, 0); else @@ -5763,7 +5803,7 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con } if(!(flags&Style_MouseOver && FOCUS_FULL==opts.focus && MO_NONE!=opts.coloredMouseOver)) - tqdrawPrimitive(PE_FocusRect, p, fr, cg, flags | Style_FocusAtBorder, + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags | Style_FocusAtBorder, TQStyleOption(cg.highlight())); } } @@ -5820,8 +5860,8 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con itsFormMode = isFormWidget(widget); const TQSpinWidget *spinwidget((const TQSpinWidget *)widget); - TQRect frame(querySubControlMetrics(CC_SpinWidget, widget, SC_SpinWidgetFrame, - data)), + TQRect frame(querySubControlMetrics(CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetFrame, + data, widget)), up(spinwidget->upRect()), down(spinwidget->downRect()), all(frame.unite(up).unite(down)); @@ -5903,7 +5943,7 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con pe=PE_SpinWidgetPlus; if(!spinwidget->isUpEnabled()) upflags&=~Style_Enabled; - tqdrawPrimitive(pe, p, up, !(upflags&Style_Enabled) && spinwidget ? spinwidget->palette().disabled() : cg, + drawPrimitive(pe, p, ceData, elementFlags, up, !(upflags&Style_Enabled) && spinwidget ? spinwidget->palette().disabled() : cg, upflags |((active==SC_SpinWidgetUp) ? Style_On | Style_Sunken : Style_Raised)); } @@ -5919,7 +5959,7 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con pe=PE_SpinWidgetMinus; if(!spinwidget->isDownEnabled()) downflags&=~Style_Enabled; - tqdrawPrimitive(pe, p, down, !(downflags&Style_Enabled) && spinwidget ? spinwidget->palette().disabled() : cg, + drawPrimitive(pe, p, ceData, elementFlags, down, !(downflags&Style_Enabled) && spinwidget ? spinwidget->palette().disabled() : cg, downflags |((active==SC_SpinWidgetDown) ? Style_On | Style_Sunken : Style_Raised)); } @@ -5957,20 +5997,20 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con atMax(maxed || sb->value()==sb->maxValue()); SFlags sflags((horiz ? Style_Horizontal : Style_Default) | (maxed || !widget->isEnabled() ? Style_Default : Style_Enabled)); - TQRect subline(querySubControlMetrics(control, widget, SC_ScrollBarSubLine, - data)), - addline(querySubControlMetrics(control, widget, SC_ScrollBarAddLine, - data)), - subpage(querySubControlMetrics(control, widget, SC_ScrollBarSubPage, - data)), - addpage(querySubControlMetrics(control, widget, SC_ScrollBarAddPage, - data)), - slider(querySubControlMetrics(control, widget, SC_ScrollBarSlider, - data)), - first(querySubControlMetrics(control, widget, SC_ScrollBarFirst, - data)), - last(querySubControlMetrics(control, widget, SC_ScrollBarLast, - data)), + TQRect subline(querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, + data, widget)), + addline(querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, + data, widget)), + subpage(querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, + data, widget)), + addpage(querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, + data, widget)), + slider(querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, + data, widget)), + first(querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, + data, widget)), + last(querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, + data, widget)), subline2(addline), sbRect(sb->rect()); @@ -6005,21 +6045,27 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con } #ifndef SIMPLE_SCROLLBARS - if(sbRect.isValid() && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)) - if(horiz) + if(sbRect.isValid() && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)) { + if(horiz) { sbRect.addCoords(0, 0, -1, 0); - else + } + else { sbRect.addCoords(0, 0, 0, -1); + } + } #endif } - else if (useThreeButtonScrollBar) - if (horiz) + else if (useThreeButtonScrollBar) { + if (horiz) { subline2.moveBy(-addline.width(), 0); - else + } + else { subline2.moveBy(0, -addline.height()); + } + } - if(opts.flatSbarButtons) + if(opts.flatSbarButtons) { switch(opts.scrollbarType) { case SCROLLBAR_KDE: @@ -6048,6 +6094,7 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con default: break; } + } // Draw trough... const TQColor *trough(itsBackgroundCols); // backgroundColors(cg)); @@ -6082,11 +6129,14 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con sflags&=~(Style_Down|Style_On|Style_Sunken); - if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)) - if(horiz) + if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)) { + if(horiz) { sbRect.addCoords(0, THIN_SBAR_MOD, 0, -THIN_SBAR_MOD); - else + } + else { sbRect.addCoords(THIN_SBAR_MOD, 0, -THIN_SBAR_MOD, 0); + } + } drawLightBevel(p, sbRect, cg, sflags/*|Style_Down*/, #ifndef SIMPLE_SCROLLBARS @@ -6103,7 +6153,7 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con { bool enable=!atMin; - tqdrawPrimitive(PE_ScrollBarSubLine, p, subline, !enable && sb ? sb->palette().disabled() : cg, + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, !enable && sb ? sb->palette().disabled() : cg, sflags | //(enable ? Style_Enabled : Style_Default) | (enable && hw && HOVER_SB_SUB==itsHover @@ -6115,7 +6165,7 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con { if(IS_FLAT(opts.sbarBgndAppearance)) p->fillRect(subline2, cg.background()); - tqdrawPrimitive(PE_ScrollBarSubLine, p, subline2, !enable && sb ? sb->palette().disabled() : cg, + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, !enable && sb ? sb->palette().disabled() : cg, sflags | //(enable ? Style_Enabled : Style_Default) | (enable && hw && HOVER_SB_SUB2==itsHover @@ -6129,13 +6179,16 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con bool enable=!atMax; // See KHTML note at top of file - if(itsFormMode && SCROLLBAR_NEXT!=opts.scrollbarType) - if(horiz) + if(itsFormMode && SCROLLBAR_NEXT!=opts.scrollbarType) { + if(horiz) { addline.addCoords(0, 0, -1, 0); - else + } + else { addline.addCoords(0, 0, 0, -1); + } + } - tqdrawPrimitive(PE_ScrollBarAddLine, p, addline, !enable && sb ? sb->palette().disabled() : cg, + drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, !enable && sb ? sb->palette().disabled() : cg, sflags | //(enable ? Style_Enabled : Style_Default) | (enable && hw && HOVER_SB_ADD==itsHover @@ -6145,12 +6198,12 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con } if((controls&SC_ScrollBarFirst) && first.isValid()) - tqdrawPrimitive(PE_ScrollBarFirst, p, first, cg, sflags | + drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, sflags | //(maxed ? Style_Default : Style_Enabled) | (!maxed && SC_ScrollBarFirst==active ? Style_Down : Style_Default)); if((controls&SC_ScrollBarLast) && last.isValid()) - tqdrawPrimitive(PE_ScrollBarLast, p, last, cg, sflags | + drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, sflags | //(maxed ? Style_Default : Style_Enabled) | (!maxed && SC_ScrollBarLast==active ? Style_Down : Style_Default)); @@ -6193,15 +6246,18 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con } #endif - if(opts.thinSbarGroove) - if(opts.flatSbarButtons && SCROLLBAR_NONE!=opts.scrollbarType && ROUNDED) + if(opts.thinSbarGroove) { + if(opts.flatSbarButtons && SCROLLBAR_NONE!=opts.scrollbarType && ROUNDED) { drawBevelGradient(itsBackgroundCols[ORIGINAL_SHADE], p, slider, flags&Style_Horizontal, false, opts.sbarBgndAppearance, WIDGET_SB_BGND); + } else if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons) && - IS_FLAT(opts.sbarBgndAppearance)) + IS_FLAT(opts.sbarBgndAppearance)) { p->fillRect(slider, cg.background()); + } + } - tqdrawPrimitive(PE_ScrollBarSlider, p, slider, cg, sflags | + drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, sflags | //(maxed ? Style_Default : Style_Enabled) | (!maxed && hw && HOVER_SB_SLIDER==itsHover ? Style_MouseOver : Style_Default) | @@ -6209,9 +6265,10 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con ? Style_Down : Style_Default)); // ### perhaps this should not be able to accept focus if maxedOut? - if(sb->hasFocus()) - tqdrawPrimitive(PE_FocusRect, p, TQRect(slider.x()+2, slider.y()+2, + if(sb->hasFocus()) { + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, TQRect(slider.x()+2, slider.y()+2, slider.width()-5, slider.height()-5), cg, Style_Default); + } #ifndef SIMPLE_SCROLLBARS if(noButtons && (!atMin || !atMax) && !opts.thinSbarGroove) @@ -6272,8 +6329,8 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con { bool tb(!IS_FLAT(opts.toolbarAppearance) && widget && 0==qstrcmp(widget->name(), kdeToolbarWidget)); - TQRect groove=querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, data), - handle=querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, data); + TQRect groove=querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, data, widget), + handle=querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, data, widget); TQPixmap pix(widget->size()); TQPainter p2, *paint(tb ? p : &p2); @@ -6293,11 +6350,11 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con if((controls & SC_SliderHandle)&& handle.isValid()) drawSliderHandle(paint, handle, cg, flags, widget ? ::tqqt_cast<TQSlider *>(widget) : 0L, tb); if(controls & SC_SliderTickmarks) - TQCommonStyle::drawComplexControl(control, paint, widget, r, cg, flags, SC_SliderTickmarks, - active, data); + TQCommonStyle::drawComplexControl(control, paint, ceData, elementFlags, r, cg, flags, SC_SliderTickmarks, + active, data, widget); if(flags&Style_HasFocus && FOCUS_GLOW!=opts.focus) - tqdrawPrimitive(PE_FocusRect, paint, groove, cg); + drawPrimitive(PE_FocusRect, paint, ceData, elementFlags, groove, cg); if(!tb) { @@ -6342,7 +6399,7 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con alignment|=TQt::AlignRight; } - TQRect ir(visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarLabel), widget)), + TQRect ir(visualRect(querySubControlMetrics(CC_TitleBar, ceData, elementFlags, SC_TitleBarLabel, TQStyleOption::Default, widget), ceData, elementFlags)), textRect(full ? tb->rect().x() : ir.x(), ir.y(), full ? tb->rect().width() : ir.width(), ir.height()); EAppearance app=isActive ? opts.titlebarAppearance : opts.inactiveTitlebarAppearance; @@ -6386,9 +6443,9 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con if (controls&SC_TitleBarCloseButton) { - ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarCloseButton), widget); + ir = visualRect(querySubControlMetrics(CC_TitleBar, ceData, elementFlags, SC_TitleBarCloseButton, TQStyleOption::Default, widget), ceData, elementFlags); down = active & SC_TitleBarCloseButton; - tqdrawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); drawMdiIcon(p, textCol, shadowCol, ir, down, buttonMargin, SC_TitleBarCloseButton); } @@ -6396,54 +6453,54 @@ void TQtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, con { if (controls &SC_TitleBarMaxButton) { - ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarMaxButton), widget); + ir = visualRect(querySubControlMetrics(CC_TitleBar, ceData, elementFlags, SC_TitleBarMaxButton, TQStyleOption::Default, widget), ceData, elementFlags); down = active & SC_TitleBarMaxButton; - tqdrawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); drawMdiIcon(p, textCol, shadowCol, ir, down, buttonMargin, SC_TitleBarMaxButton); } if (controls&SC_TitleBarNormalButton || controls&SC_TitleBarMinButton) { - ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarMinButton), widget); + ir = visualRect(querySubControlMetrics(CC_TitleBar, ceData, elementFlags, SC_TitleBarMinButton, TQStyleOption::Default, widget), ceData, elementFlags); TQStyle::SubControl ctrl = (controls & SC_TitleBarNormalButton ? SC_TitleBarNormalButton : SC_TitleBarMinButton); down = active & ctrl; - tqdrawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); drawMdiIcon(p, textCol, shadowCol, ir, down, buttonMargin, ctrl); } if (controls&SC_TitleBarShadeButton) { - ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarShadeButton), widget); + ir = visualRect(querySubControlMetrics(CC_TitleBar, ceData, elementFlags, SC_TitleBarShadeButton, TQStyleOption::Default, widget), ceData, elementFlags); down = active & SC_TitleBarShadeButton; - tqdrawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); drawMdiIcon(p, textCol, shadowCol, ir, down, buttonMargin, SC_TitleBarShadeButton); } if (controls&SC_TitleBarUnshadeButton) { - ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarUnshadeButton), widget); + ir = visualRect(querySubControlMetrics(CC_TitleBar, ceData, elementFlags, SC_TitleBarUnshadeButton, TQStyleOption::Default, widget), ceData, elementFlags); down = active & SC_TitleBarUnshadeButton; - tqdrawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); drawMdiIcon(p, textCol, shadowCol, ir, down, buttonMargin, SC_TitleBarUnshadeButton); } } if (controls&SC_TitleBarSysMenu && tb->icon()) { - ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarSysMenu), widget); + ir = visualRect(querySubControlMetrics(CC_TitleBar, ceData, elementFlags, SC_TitleBarSysMenu, TQStyleOption::Default, widget), ceData, elementFlags); down = active & SC_TitleBarSysMenu; - tqdrawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, tb->colorGroup(), down ? Style_Down : Style_Raised); drawItem(p, ir, AlignCenter, tb->colorGroup(), true, tb->icon(), TQString()); } break; } default: - BASE_STYLE::drawComplexControl(control, p, widget, r, cg, flags, controls, active, data); + BASE_STYLE::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, controls, active, data, widget); } } -TQRect TQtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, const TQWidget *widget, - SubControl sc, const TQStyleOption &data) const +TQRect TQtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, TQStyleControlElementData ceData, ControlElementFlags elementFlags, + SubControl sc, const TQStyleOption &data, const TQWidget *widget) const { bool reverse(TQApplication::reverseLayout()); @@ -6454,7 +6511,7 @@ TQRect TQtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, const TQ if(!widget) return TQRect(); - int fw(pixelMetric(PM_SpinBoxFrameWidth, 0)); + int fw(pixelMetric(PM_SpinBoxFrameWidth, ceData, elementFlags, 0)); TQSize bs; bs.setHeight(widget->height()>>1); @@ -6489,7 +6546,7 @@ TQRect TQtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, const TQ } case CC_ComboBox: { - TQRect r(BASE_STYLE::querySubControlMetrics(control, widget, sc, data)); + TQRect r(BASE_STYLE::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget)); if(SC_ComboBoxFrame==sc) { @@ -6513,7 +6570,7 @@ TQRect TQtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, const TQ const TQScrollBar *sb((const TQScrollBar*)widget); bool horizontal(sb->orientation() == Qt::Horizontal); int sliderstart(sb->sliderStart()), - sbextent(pixelMetric(PM_ScrollBarExtent, widget)), + sbextent(pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget)), maxlen((horizontal ? sb->width() : sb->height()) - (noButtons ? 0 : (sbextent * (threeButtonScrollBar ? 3 : 2)))), sliderlen; @@ -6524,7 +6581,7 @@ TQRect TQtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, const TQ uint range = sb->maxValue() - sb->minValue(); sliderlen = (sb->pageStep() * maxlen) / (range + sb->pageStep()); - int slidermin = pixelMetric( PM_ScrollBarSliderMin, widget ); + int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget ); if ( sliderlen < slidermin || range > INT_MAX / 2 ) sliderlen = slidermin; if ( sliderlen > maxlen ) @@ -6641,7 +6698,7 @@ TQRect TQtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, const TQ ret.setRect(0, sliderstart, sbextent, sliderlen); break; default: - ret = TQCommonStyle::querySubControlMetrics(control, widget, sc, data); + ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget); break; } return ret; @@ -6734,10 +6791,10 @@ TQRect TQtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, const TQ break; // Remove compiler warnings... } - return BASE_STYLE::querySubControlMetrics(control, widget, sc, data); + return BASE_STYLE::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget); } -int TQtCurveStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) const +int TQtCurveStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const { switch(metric) { @@ -6756,7 +6813,7 @@ int TQtCurveStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) const ? TQTabBar::RoundedAbove==tb->shape() || TQTabBar::TriangularAbove==tb->shape() ? 1 : -1 - : BASE_STYLE::pixelMetric(metric, widget); + : BASE_STYLE::pixelMetric(metric, ceData, elementFlags, widget); } case PM_TabBarTabShiftHorizontal: return 0; @@ -6823,7 +6880,7 @@ int TQtCurveStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) const case PM_TabBarTabVSpace: return opts.highlightTab ? 11 : 9; default: - return BASE_STYLE::pixelMetric(metric, widget); + return BASE_STYLE::pixelMetric(metric, ceData, elementFlags, widget); } } @@ -6838,8 +6895,8 @@ int TQtCurveStyle::kPixelMetric(KStylePixelMetric kpm, const TQWidget *widget) c } } -TQSize TQtCurveStyle::tqsizeFromContents(ContentsType contents, const TQWidget *widget, - const TQSize &contentsSize, const TQStyleOption &data) const +TQSize TQtCurveStyle::sizeFromContents(ContentsType contents, TQStyleControlElementData ceData, ControlElementFlags elementFlags, + const TQSize &contentsSize, const TQStyleOption &data, const TQWidget *widget) const { switch(contents) { @@ -6849,8 +6906,8 @@ TQSize TQtCurveStyle::tqsizeFromContents(ContentsType contents, const TQWidget * if (button && !button->text().isEmpty()) { - int margin(2*pixelMetric(PM_ButtonMargin, widget)), - mbi(button->isMenuButton() ? pixelMetric(PM_MenuButtonIndicator, widget) : 0), + int margin(2*pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget)), + mbi(button->isMenuButton() ? pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags, widget) : 0), w(contentsSize.width() + margin + mbi + 16); // if(button->text()=="...") @@ -6873,7 +6930,7 @@ TQSize TQtCurveStyle::tqsizeFromContents(ContentsType contents, const TQWidget * } case CT_ComboBox: { - TQSize sz(BASE_STYLE::tqsizeFromContents(contents, widget, contentsSize, data)); + TQSize sz(BASE_STYLE::sizeFromContents(contents, ceData, elementFlags, contentsSize, data, widget)); return TQSize(sz.width(), sz.height()+(DO_EFFECT && !isFormWidget(widget) && !opts.thinnerBtns ? 4 : 2)); } case CT_PopupMenuItem: @@ -6930,7 +6987,7 @@ TQSize TQtCurveStyle::tqsizeFromContents(ContentsType contents, const TQWidget * } case CT_SpinBox: { - TQSize size(BASE_STYLE::tqsizeFromContents(contents, widget, contentsSize, data)); + TQSize size(BASE_STYLE::sizeFromContents(contents, ceData, elementFlags, contentsSize, data, widget)); if(!(size.height()%2)) size.setHeight(size.height()+1); @@ -6947,11 +7004,11 @@ TQSize TQtCurveStyle::tqsizeFromContents(ContentsType contents, const TQWidget * break; // Remove compiler warnings... } - return BASE_STYLE::tqsizeFromContents(contents, widget, contentsSize, data); + return BASE_STYLE::sizeFromContents(contents, ceData, elementFlags, contentsSize, data, widget); } -int TQtCurveStyle::styleHint(StyleHint stylehint, const TQWidget *widget, const TQStyleOption &option, - TQStyleHintReturn *returnData) const +int TQtCurveStyle::styleHint(StyleHint stylehint, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &option, + TQStyleHintReturn *returnData, const TQWidget *widget) const { switch(stylehint) { @@ -6993,7 +7050,7 @@ int TQtCurveStyle::styleHint(StyleHint stylehint, const TQWidget *widget, const case SH_TabBar_Alignment: return AlignLeft; default: - return BASE_STYLE::styleHint(stylehint, widget, option, returnData); + return BASE_STYLE::styleHint(stylehint, ceData, elementFlags, option, returnData, widget); } } @@ -7178,8 +7235,7 @@ void TQtCurveStyle::drawProgress(TQPainter *p, const TQRect &rx, const TQColorGr ? TQRect(rx.x()+1, rx.y()+1, rx.width()-2, rx.height()-2) : rx; int minWidth(3); - bool drawFull(r.width()>minWidth), - drawStripe(r.width()>(minWidth*1.5)); + bool drawStripe(r.width()>(minWidth*1.5)); TQRegion outer(r); if(r.width()<3) @@ -7506,11 +7562,14 @@ void TQtCurveStyle::drawSliderHandle(TQPainter *p, const TQRect &r, const TQColo int size(SLIDER_TRIANGULAR==opts.sliderStyle ? 15 : 13), borderVal(itsMouseOverCols==border ? SLIDER_MO_BORDER_VAL : BORDER_VAL(flags&Style_Enabled)); - if(SLIDER_ROUND_ROTATED!=opts.sliderStyle) - if(horiz) + if(SLIDER_ROUND_ROTATED!=opts.sliderStyle) { + if(horiz) { y++; - else + } + else { x++; + } + } TQPointArray clipRegion; @@ -7658,11 +7717,14 @@ void TQtCurveStyle::drawSliderHandle(TQPainter *p, const TQRect &r, const TQColo { TQRect sr(r); - if(!ROTATED_SLIDER) - if(horiz) + if(!ROTATED_SLIDER) { + if(horiz) { sr.addCoords(0, 1, 0, 0); - else + } + else { sr.addCoords(1, 0, 0, 0); + } + } drawSbSliderHandle(p, sr, cg, flags|(horiz ? Style_Horizontal : 0), true); } @@ -8142,6 +8204,9 @@ bool TQtCurveStyle::redrawHoverWidget(const TQPoint &pos) if(!itsHoverWidget || !itsHoverWidget->isShown() || !itsHoverWidget->isVisible()) return false; + TQStyleControlElementData ceData = populateControlElementDataFromWidget(itsHoverWidget, TQStyleOption()); + ControlElementFlags elementFlags = getControlElementFlagsForObject(itsHoverWidget, ceData.widgetObjectTypes, TQStyleOption()); + #if 0x039999 >= 0x030200 // // TQt>=3.2 sets the sensitive part of a check/radio to the image + label -> anything else @@ -8153,8 +8218,8 @@ bool TQtCurveStyle::redrawHoverWidget(const TQPoint &pos) if(rb) { TQRect rect(0, 0, - visualRect(subRect(SR_RadioButtonFocusRect, rb), rb).width()+ - pixelMetric(PM_ExclusiveIndicatorWidth)+4, itsHoverWidget->height()); + visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, rb), ceData, elementFlags).width()+ + pixelMetric(PM_ExclusiveIndicatorWidth, ceData, elementFlags)+4, itsHoverWidget->height()); itsHover=rect.contains(pos) ? HOVER_RADIO : HOVER_NONE; return (HOVER_NONE!=itsHover && !rect.contains(itsOldPos)) || @@ -8167,8 +8232,8 @@ bool TQtCurveStyle::redrawHoverWidget(const TQPoint &pos) if(cb) { TQRect rect(0, 0, - visualRect(subRect(SR_CheckBoxFocusRect, cb), cb).width()+ - pixelMetric(PM_IndicatorWidth)+4, itsHoverWidget->height()); + visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, cb), ceData, elementFlags).width()+ + pixelMetric(PM_IndicatorWidth, ceData, elementFlags)+4, itsHoverWidget->height()); itsHover=rect.contains(pos) ? HOVER_CHECK : HOVER_NONE; return (HOVER_NONE!=itsHover && !rect.contains(itsOldPos)) || (HOVER_NONE==itsHover && rect.contains(itsOldPos)); @@ -8181,19 +8246,22 @@ bool TQtCurveStyle::redrawHoverWidget(const TQPoint &pos) if(sb) // So, are we over add button, sub button, slider, or none? { bool useThreeButtonScrollBar(SCROLLBAR_KDE==opts.scrollbarType); - TQRect subline(querySubControlMetrics(CC_ScrollBar, itsHoverWidget, - SC_ScrollBarSubLine)), - addline(querySubControlMetrics(CC_ScrollBar, itsHoverWidget, - SC_ScrollBarAddLine)), - slider(querySubControlMetrics(CC_ScrollBar, itsHoverWidget, - SC_ScrollBarSlider)), + TQRect subline(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, + SC_ScrollBarSubLine, TQStyleOption::Default, itsHoverWidget)), + addline(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, + SC_ScrollBarAddLine, TQStyleOption::Default, itsHoverWidget)), + slider(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, + SC_ScrollBarSlider, TQStyleOption::Default, itsHoverWidget)), subline2(addline); - if (useThreeButtonScrollBar) - if (Qt::Horizontal==sb->orientation()) - subline2.moveBy(-addline.width(), 0); - else + if (useThreeButtonScrollBar) { + if (Qt::Horizontal==sb->orientation()) { + subline2.moveBy(-addline.width(), 0); + } + } + else { subline2.moveBy(0, -addline.height()); + } if(slider.contains(pos)) itsHover=HOVER_SB_SLIDER; @@ -8211,8 +8279,8 @@ bool TQtCurveStyle::redrawHoverWidget(const TQPoint &pos) (HOVER_SB_SUB==itsHover && !subline.contains(itsOldPos)) || (HOVER_SB_SUB!=itsHover && subline.contains(itsOldPos)) || - (useThreeButtonScrollBar && - (HOVER_SB_SUB2==itsHover && !subline2.contains(itsOldPos)) || + ((useThreeButtonScrollBar && + (HOVER_SB_SUB2==itsHover && !subline2.contains(itsOldPos))) || (HOVER_SB_SUB2!=itsHover && subline2.contains(itsOldPos))) || (HOVER_SB_ADD==itsHover && !addline.contains(itsOldPos)) || @@ -8270,10 +8338,10 @@ bool TQtCurveStyle::redrawHoverWidget(const TQPoint &pos) if(sw) // So, are we over up or down? { - TQRect up(querySubControlMetrics(CC_SpinWidget, itsHoverWidget, - SC_SpinWidgetUp)), - down(querySubControlMetrics(CC_SpinWidget, itsHoverWidget, - SC_SpinWidgetDown)); + TQRect up(querySubControlMetrics(CC_SpinWidget, ceData, elementFlags, + SC_SpinWidgetUp, TQStyleOption::Default, itsHoverWidget)), + down(querySubControlMetrics(CC_SpinWidget, ceData, elementFlags, + SC_SpinWidgetDown, TQStyleOption::Default, itsHoverWidget)); if(up.contains(pos)) itsHover=HOVER_SW_UP; @@ -8316,8 +8384,8 @@ bool TQtCurveStyle::redrawHoverWidget(const TQPoint &pos) itsHover=HOVER_CB_ARROW; else { - arrow=(querySubControlMetrics(CC_ComboBox, itsHoverWidget, - SC_ComboBoxArrow)); + arrow=(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, + SC_ComboBoxArrow, TQStyleOption::Default, itsHoverWidget)); if(arrow.contains(pos)) itsHover=HOVER_CB_ARROW; |