diff options
Diffstat (limited to 'style/qtc_kstyle.cpp')
-rw-r--r-- | style/qtc_kstyle.cpp | 150 |
1 files changed, 82 insertions, 68 deletions
diff --git a/style/qtc_kstyle.cpp b/style/qtc_kstyle.cpp index bb55bad..5503560 100644 --- a/style/qtc_kstyle.cpp +++ b/style/qtc_kstyle.cpp @@ -169,11 +169,13 @@ TQtCKStyle::KStyleFlags TQtCKStyle::styleFlags() const void TQtCKStyle::drawKStylePrimitive( KStylePrimitive kpe, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, - const TQStyleOption& /* opt */ ) const + const TQStyleOption& /* opt */, + const TQWidget* widget ) const { switch( kpe ) { @@ -382,6 +384,8 @@ int TQtCKStyle::kPixelMetric( KStylePixelMetric kpm, const TQWidget* /* widget * void TQtCKStyle::drawPrimitive( PrimitiveElement pe, TQPainter* p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, @@ -406,30 +410,32 @@ void TQtCKStyle::drawPrimitive( PrimitiveElement pe, (parent->inherits(TQMAINWINDOW_OBJECT_NAME_STRING)) )) // Collapsed dock // Draw a toolbar handle - drawKStylePrimitive( KPE_ToolBarHandle, p, widget, r, cg, flags, opt ); + drawKStylePrimitive( KPE_ToolBarHandle, p, ceData, elementFlags, r, cg, flags, opt, widget ); else if ( widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) ) // Draw a dock window handle - drawKStylePrimitive( KPE_DockWindowHandle, p, widget, r, cg, flags, opt ); + drawKStylePrimitive( KPE_DockWindowHandle, p, ceData, elementFlags, r, cg, flags, opt, widget ); else // General handle, probably a kicker applet handle. - drawKStylePrimitive( KPE_GeneralHandle, p, widget, r, cg, flags, opt ); + drawKStylePrimitive( KPE_GeneralHandle, p, ceData, elementFlags, r, cg, flags, opt, widget ); } else - TQCommonStyle::tqdrawPrimitive( pe, p, r, cg, flags, opt ); + TQCommonStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); } void TQtCKStyle::drawControl( ControlElement element, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, - const TQStyleOption &opt ) const + const TQStyleOption &opt, + const TQWidget* widget ) const { switch (element) { @@ -601,8 +607,8 @@ void TQtCKStyle::drawControl( ControlElement element, // ------------------------------------------------------------------------ case CE_PopupMenuScroller: { p->fillRect(r, cg.background()); - tqdrawPrimitive(PE_ButtonTool, p, r, cg, Style_Enabled); - tqdrawPrimitive((flags & Style_Up) ? PE_ArrowUp : PE_ArrowDown, p, r, cg, Style_Enabled); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, Style_Enabled); + drawPrimitive((flags & Style_Up) ? PE_ArrowUp : PE_ArrowDown, p, ceData, elementFlags, r, cg, Style_Enabled); break; } @@ -610,15 +616,15 @@ void TQtCKStyle::drawControl( ControlElement element, // PROGRESSBAR // ------------------------------------------------------------------------ case CE_ProgressBarGroove: { - TQRect fr = subRect(SR_ProgressBarGroove, widget); - tqdrawPrimitive(PE_Panel, p, fr, cg, Style_Sunken, TQStyleOption::Default); + TQRect fr = subRect(SR_ProgressBarGroove, ceData, elementFlags, widget); + drawPrimitive(PE_Panel, p, ceData, elementFlags, fr, cg, Style_Sunken, TQStyleOption::Default); break; } case CE_ProgressBarContents: { // ### Take into account totalSteps() for busy indicator 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(); @@ -682,7 +688,7 @@ void TQtCKStyle::drawControl( ControlElement element, 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(); @@ -721,12 +727,12 @@ void TQtCKStyle::drawControl( ControlElement element, } default: - TQCommonStyle::drawControl(element, p, widget, r, cg, flags, opt); + TQCommonStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); } } -TQRect TQtCKStyle::subRect(SubRect r, const TQWidget* widget) const +TQRect TQtCKStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget* widget) const { switch(r) { @@ -743,12 +749,12 @@ TQRect TQtCKStyle::subRect(SubRect r, const TQWidget* widget) const } default: - return TQCommonStyle::subRect(r, widget); + return TQCommonStyle::subRect(r, ceData, elementFlags, widget); } } -int TQtCKStyle::pixelMetric(PixelMetric m, const TQWidget* widget) const +int TQtCKStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget* widget) const { switch(m) { @@ -769,7 +775,7 @@ int TQtCKStyle::pixelMetric(PixelMetric m, const TQWidget* widget) const && widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) ) return widget->fontMetrics().lineSpacing(); else - return TQCommonStyle::pixelMetric(m, widget); + return TQCommonStyle::pixelMetric(m, ceData, elementFlags, widget); } // TABS @@ -853,10 +859,10 @@ int TQtCKStyle::pixelMetric(PixelMetric m, const TQWidget* widget) const return 0; case PM_PopupMenuScrollerHeight: - return pixelMetric( PM_ScrollBarExtent, 0); + return pixelMetric( PM_ScrollBarExtent, ceData, elementFlags, 0); default: - return TQCommonStyle::pixelMetric( m, widget ); + return TQCommonStyle::pixelMetric( m, ceData, elementFlags, widget ); } } @@ -875,13 +881,15 @@ static TQListViewItem* nextVisibleSibling(TQListViewItem* item) void TQtCKStyle::drawComplexControl( ComplexControl control, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, SCFlags controls, SCFlags active, - const TQStyleOption &opt ) const + const TQStyleOption &opt, + const TQWidget* widget ) const { switch(control) { @@ -898,13 +906,13 @@ void TQtCKStyle::drawComplexControl( ComplexControl control, (maxedOut ? Style_Default : Style_Enabled)); TQRect addline, subline, subline2, addpage, subpage, slider, first, last; - subline = querySubControlMetrics(control, widget, SC_ScrollBarSubLine, opt); - addline = querySubControlMetrics(control, widget, SC_ScrollBarAddLine, opt); - subpage = querySubControlMetrics(control, widget, SC_ScrollBarSubPage, opt); - addpage = querySubControlMetrics(control, widget, SC_ScrollBarAddPage, opt); - slider = querySubControlMetrics(control, widget, SC_ScrollBarSlider, opt); - first = querySubControlMetrics(control, widget, SC_ScrollBarFirst, opt); - last = querySubControlMetrics(control, widget, SC_ScrollBarLast, opt); + subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget); + addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget); + subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget); + addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget); + slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget); + first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, opt, widget); + last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, opt, widget); subline2 = addline; if ( useThreeButtonScrollBar ) @@ -915,50 +923,50 @@ void TQtCKStyle::drawComplexControl( ComplexControl control, // Draw the up/left button set if ((controls & SC_ScrollBarSubLine) && subline.isValid()) { - tqdrawPrimitive(PE_ScrollBarSubLine, p, subline, cg, + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, sflags | (active == SC_ScrollBarSubLine ? Style_Down : Style_Default)); if (useThreeButtonScrollBar && subline2.isValid()) - tqdrawPrimitive(PE_ScrollBarSubLine, p, subline2, cg, + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, cg, sflags | (active == SC_ScrollBarSubLine ? Style_Down : Style_Default)); } if ((controls & SC_ScrollBarAddLine) && addline.isValid()) - tqdrawPrimitive(PE_ScrollBarAddLine, p, addline, cg, + drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, sflags | ((active == SC_ScrollBarAddLine) ? Style_Down : Style_Default)); if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) - tqdrawPrimitive(PE_ScrollBarSubPage, p, subpage, cg, + drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg, sflags | ((active == SC_ScrollBarSubPage) ? Style_Down : Style_Default)); if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) - tqdrawPrimitive(PE_ScrollBarAddPage, p, addpage, cg, + drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, sflags | ((active == SC_ScrollBarAddPage) ? Style_Down : Style_Default)); if ((controls & SC_ScrollBarFirst) && first.isValid()) - tqdrawPrimitive(PE_ScrollBarFirst, p, first, cg, + drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, sflags | ((active == SC_ScrollBarFirst) ? Style_Down : Style_Default)); if ((controls & SC_ScrollBarLast) && last.isValid()) - tqdrawPrimitive(PE_ScrollBarLast, p, last, cg, + drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, sflags | ((active == SC_ScrollBarLast) ? Style_Down : Style_Default)); if ((controls & SC_ScrollBarSlider) && slider.isValid()) { - tqdrawPrimitive(PE_ScrollBarSlider, p, slider, cg, + drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, sflags | ((active == SC_ScrollBarSlider) ? Style_Down : Style_Default)); // Draw focus rect if (sb->hasFocus()) { TQRect fr(slider.x() + 2, slider.y() + 2, slider.width() - 5, slider.height() - 5); - tqdrawPrimitive(PE_FocusRect, p, fr, cg, Style_Default); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default); } } break; @@ -969,8 +977,8 @@ void TQtCKStyle::drawComplexControl( ComplexControl control, // ------------------------------------------------------------------- case CC_Slider: { const TQSlider* slider = (const TQSlider*)widget; - TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, opt); - TQRect handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, opt); + TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, opt, widget); + TQRect handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, opt, widget); // Double-buffer slider for no flicker TQPixmap pix(widget->size()); @@ -987,23 +995,23 @@ void TQtCKStyle::drawComplexControl( ComplexControl control, // Draw slider groove if ((controls & SC_SliderGroove) && groove.isValid()) { - drawKStylePrimitive( KPE_SliderGroove, &p2, widget, groove, cg, flags, opt ); + drawKStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, flags, opt, widget ); // Draw the focus rect around the groove if (slider->hasFocus()) - tqdrawPrimitive(PE_FocusRect, &p2, groove, cg); + drawPrimitive(PE_FocusRect, &p2, ceData, elementFlags, groove, cg); } // Draw the tickmarks if (controls & SC_SliderTickmarks) - TQCommonStyle::drawComplexControl(control, &p2, widget, - r, cg, flags, SC_SliderTickmarks, active, opt); + TQCommonStyle::drawComplexControl(control, &p2, ceData, elementFlags, + r, cg, flags, SC_SliderTickmarks, active, opt, widget); // Draw the slider handle if ((controls & SC_SliderHandle) && handle.isValid()) { if (active == SC_SliderHandle) flags |= Style_Active; - drawKStylePrimitive( KPE_SliderHandle, &p2, widget, handle, cg, flags, opt ); + drawKStylePrimitive( KPE_SliderHandle, &p2, ceData, elementFlags, handle, cg, flags, opt, widget ); } p2.end(); @@ -1022,7 +1030,7 @@ void TQtCKStyle::drawComplexControl( ComplexControl control, // Paint the icon and text. if ( controls & SC_ListView ) - TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags, controls, active, opt ); + TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget ); // If we're have a branch or are expanded... if ( controls & (SC_ListViewBranch | SC_ListViewExpand) ) @@ -1084,7 +1092,7 @@ void TQtCKStyle::drawComplexControl( ComplexControl control, boxflags = child->isOpen() ? TQStyle::Style_Off : TQStyle::Style_On; // TQtCKStyle extension: Draw the box and expand/collapse indicator - drawKStylePrimitive( KPE_ListViewExpander, p, NULL, boxrect, cg, boxflags, opt ); + drawKStylePrimitive( KPE_ListViewExpander, p, ceData, elementFlags, boxrect, cg, boxflags, opt, NULL ); // dotlinery p->setPen( cg.mid() ); @@ -1138,7 +1146,7 @@ void TQtCKStyle::drawComplexControl( ComplexControl control, branchflags = TQStyle::Style_Horizontal; // TQtCKStyle extension: Draw the horizontal branch - drawKStylePrimitive( KPE_ListViewBranch, p, NULL, branchrect, cg, branchflags, opt ); + drawKStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL ); } else { // Vertical branch @@ -1154,7 +1162,7 @@ void TQtCKStyle::drawComplexControl( ComplexControl control, branchflags = TQStyle::Style_Default; // TQtCKStyle extension: Draw the vertical branch - drawKStylePrimitive( KPE_ListViewBranch, p, NULL, branchrect, cg, branchflags, opt ); + drawKStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL ); } } } @@ -1162,19 +1170,21 @@ void TQtCKStyle::drawComplexControl( ComplexControl control, } default: - TQCommonStyle::drawComplexControl( control, p, widget, r, cg, - flags, controls, active, opt ); + TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, + flags, controls, active, opt, widget ); break; } } TQStyle::SubControl TQtCKStyle::querySubControl( ComplexControl control, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQPoint &pos, - const TQStyleOption &opt ) const + const TQStyleOption &opt, + const TQWidget* widget ) const { - TQStyle::SubControl ret = TQCommonStyle::querySubControl(control, widget, pos, opt); + TQStyle::SubControl ret = TQCommonStyle::querySubControl(control, ceData, elementFlags, pos, opt, widget); if (d->scrollbarType == ThreeButtonScrollBar) { // Enable third button @@ -1186,9 +1196,11 @@ TQStyle::SubControl TQtCKStyle::querySubControl( ComplexControl control, TQRect TQtCKStyle::querySubControlMetrics( ComplexControl control, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl sc, - const TQStyleOption &opt ) const + const TQStyleOption &opt, + const TQWidget* widget ) const { TQRect ret; @@ -1201,7 +1213,7 @@ TQRect TQtCKStyle::querySubControlMetrics( ComplexControl control, const TQScrollBar *sb = (const TQScrollBar*)widget; bool horizontal = sb->orientation() == Qt::Horizontal; int sliderstart = sb->sliderStart(); - int sbextent = pixelMetric(PM_ScrollBarExtent, widget); + int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget); int maxlen = (horizontal ? sb->width() : sb->height()) - (sbextent * (threeButtonScrollBar ? 3 : 2)); int sliderlen; @@ -1212,7 +1224,7 @@ TQRect TQtCKStyle::querySubControlMetrics( ComplexControl control, 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 ) @@ -1319,11 +1331,11 @@ TQRect TQtCKStyle::querySubControlMetrics( ComplexControl control, } default: - ret = TQCommonStyle::querySubControlMetrics(control, widget, sc, opt); + ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, opt, widget); break; } } else - ret = TQCommonStyle::querySubControlMetrics(control, widget, sc, opt); + ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, opt, widget); return ret; } @@ -1571,8 +1583,10 @@ static const char* const critical_xpm[]={ ".............aaaaaaa............"}; TQPixmap TQtCKStyle::stylePixmap( StylePixmap stylepixmap, - const TQWidget* widget, - const TQStyleOption& opt) const + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, + const TQStyleOption& opt, + const TQWidget* widget) const { switch (stylepixmap) { case SP_TitleBarShadeButton: @@ -1598,12 +1612,12 @@ TQPixmap TQtCKStyle::stylePixmap( StylePixmap stylepixmap, default: break; } - return TQCommonStyle::stylePixmap(stylepixmap, widget, opt); + return TQCommonStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget); } -int TQtCKStyle::styleHint( StyleHint sh, const TQWidget* w, - const TQStyleOption &opt, TQStyleHintReturn* shr) const +int TQtCKStyle::styleHint( StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, + const TQStyleOption &opt, TQStyleHintReturn* shr, const TQWidget* w) const { switch (sh) { @@ -1617,7 +1631,7 @@ int TQtCKStyle::styleHint( StyleHint sh, const TQWidget* w, return d->menuAltKeyNavigation ? 1 : 0; case SH_PopupMenu_SubMenuPopupDelay: - if ( styleHint( SH_PopupMenu_SloppySubMenus, w ) ) + if ( styleHint( SH_PopupMenu_SloppySubMenus, ceData, elementFlags, TQStyleOption::Default, 0, w ) ) return TQMIN( 100, d->popupMenuDelay ); else return d->popupMenuDelay; @@ -1653,7 +1667,7 @@ int TQtCKStyle::styleHint( StyleHint sh, const TQWidget* w, } default: - return TQCommonStyle::styleHint(sh, w, opt, shr); + return TQCommonStyle::styleHint(sh, ceData, elementFlags, opt, shr, w); } } |