diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-08-05 01:02:07 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-08-05 01:02:07 -0500 |
commit | 2ba2bd6da04b86d32ce1d3a3680a00810938cf9c (patch) | |
tree | f1134ea213a90d50b465a9dbf38bafc63445e470 /kstyles | |
parent | e9f29cfb2a76657f150ec585fa6775f372d7e460 (diff) | |
download | tdelibs-2ba2bd6da04b86d32ce1d3a3680a00810938cf9c.tar.gz tdelibs-2ba2bd6da04b86d32ce1d3a3680a00810938cf9c.zip |
Update to new style API
Diffstat (limited to 'kstyles')
-rw-r--r-- | kstyles/asteroid/asteroid.cpp | 202 | ||||
-rw-r--r-- | kstyles/asteroid/asteroid.h | 57 | ||||
-rw-r--r-- | kstyles/highcolor/highcolor.cpp | 164 | ||||
-rw-r--r-- | kstyles/highcolor/highcolor.h | 52 | ||||
-rw-r--r-- | kstyles/highcontrast/highcontrast.cpp | 130 | ||||
-rw-r--r-- | kstyles/highcontrast/highcontrast.h | 50 | ||||
-rw-r--r-- | kstyles/keramik/keramik.cpp | 224 | ||||
-rw-r--r-- | kstyles/keramik/keramik.h | 60 | ||||
-rw-r--r-- | kstyles/kthemestyle/kthemebase.h | 68 | ||||
-rw-r--r-- | kstyles/kthemestyle/kthemestyle.cpp | 154 | ||||
-rw-r--r-- | kstyles/kthemestyle/kthemestyle.h | 44 | ||||
-rw-r--r-- | kstyles/light/lightstyle-v2.cpp | 198 | ||||
-rw-r--r-- | kstyles/light/lightstyle-v2.h | 40 | ||||
-rw-r--r-- | kstyles/light/lightstyle-v3.cpp | 226 | ||||
-rw-r--r-- | kstyles/light/lightstyle-v3.h | 41 | ||||
-rw-r--r-- | kstyles/plastik/plastik.cpp | 172 | ||||
-rw-r--r-- | kstyles/plastik/plastik.h | 52 |
17 files changed, 1088 insertions, 846 deletions
diff --git a/kstyles/asteroid/asteroid.cpp b/kstyles/asteroid/asteroid.cpp index 0cad09ecc..9da74e237 100644 --- a/kstyles/asteroid/asteroid.cpp +++ b/kstyles/asteroid/asteroid.cpp @@ -174,11 +174,13 @@ void AsteroidStyle::renderMenuBlendPixmap(KPixmap &pix, void AsteroidStyle::drawKStylePrimitive(KStylePrimitive ksp, TQPainter *p, - const TQWidget *w, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags sf, - const TQStyleOption &o) const + const TQStyleOption &o, + const TQWidget *w) const { switch (ksp) { @@ -284,15 +286,17 @@ void AsteroidStyle::drawKStylePrimitive(KStylePrimitive ksp, } default: { - KStyle::drawKStylePrimitive(ksp, p, w, r, cg, sf, o); + KStyle::drawKStylePrimitive(ksp, p, ceData, elementFlags, r, cg, sf, o, w); } } } int AsteroidStyle::styleHint( TQ_StyleHint stylehint, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQStyleOption &option, - TQStyleHintReturn* returnData ) const + TQStyleHintReturn* returnData, + const TQWidget *widget ) const { switch (stylehint) { case SH_EtchDisabledText: @@ -309,12 +313,14 @@ int AsteroidStyle::styleHint( TQ_StyleHint stylehint, return 1; default: - return KStyle::styleHint(stylehint, widget, option, returnData); + return KStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget); } } -void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, +void AsteroidStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags sf, @@ -724,13 +730,13 @@ void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, p->setPen(cg.foreground()); if (sf & Style_Enabled) { - tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, r, cg, sf); + drawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags, r, cg, sf); } else { TQPen oldPen = p->pen(); p->setPen(cg.light()); - tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, TQRect(x+1, y+1, w, h), cg, sf); + drawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags, TQRect(x+1, y+1, w, h), cg, sf); p->setPen(cg.dark()); - tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, r, cg, sf); + drawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags, r, cg, sf); p->setPen(oldPen); } break; @@ -758,13 +764,13 @@ void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, p->setPen(cg.foreground()); if (sf & Style_Enabled) { - tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, r, cg, sf); + drawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags, r, cg, sf); } else { TQPen oldPen = p->pen(); p->setPen(cg.light()); - tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, TQRect(x+1, y+1, w, h), cg, sf); + drawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags, TQRect(x+1, y+1, w, h), cg, sf); p->setPen(cg.dark()); - tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, r, cg, sf); + drawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags, r, cg, sf); p->setPen(oldPen); } break; @@ -907,8 +913,8 @@ void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, } if (sf & Style_Down) { - p->translate(pixelMetric(PM_ButtonShiftHorizontal), - pixelMetric(PM_ButtonShiftVertical)); + p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags)); } a.translate((x + w/2), (y + (h-1)/2)); @@ -916,26 +922,28 @@ void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, p->drawPoint(a[6]); if (sf & Style_Down) { - p->translate(-pixelMetric(PM_ButtonShiftHorizontal), - -pixelMetric(PM_ButtonShiftVertical)); + p->translate(-pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags), + -pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags)); } break; } default: { - KStyle::tqdrawPrimitive(pe, p, r, cg, sf, o); + KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, sf, o); } } } void AsteroidStyle::drawControl(TQ_ControlElement ce, TQPainter *p, - const TQWidget *w, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags sf, - const TQStyleOption &o) const + const TQStyleOption &o, + const TQWidget *w) const { int x, y, x2, y2, sw, sh; r.coords(&x, &y, &x2, &y2); @@ -1016,7 +1024,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, p->drawLine( x2, r2.top() + 2, x2, r2.bottom() - (selected ? (lastTab ? 0:1) :2)); } else if ( tb->shape() == TQTabBar::RoundedBelow ) { - bool rightAligned = styleHint( SH_TabBar_Alignment, tb ) == TQt::AlignRight; + bool rightAligned = styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, tb ) == TQt::AlignRight; bool firstTab = tb->indexOf( t->identifier() ) == 0; if ( selected ) { p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1), @@ -1060,7 +1068,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2), r2.left(), r2.bottom() - 2 ); } else { - TQCommonStyle::drawControl(ce, p, w, r, cg, sf, o); + TQCommonStyle::drawControl(ce, p, ceData, elementFlags, r, cg, sf, o, w); } break; } @@ -1074,15 +1082,15 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, TQTab * t = o.tab(); const bool enabled = sf & Style_Enabled; - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); TQRect tr = r; if ( t->identifier() == tb->currentTab() ) tr.setBottom( tr.bottom() - - pixelMetric( TQStyle::PM_DefaultFrameWidth, tb ) ); + pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, tb ) ); int alignment = TQt::AlignCenter | TQt::ShowPrefix; - if (!styleHint(SH_UnderlineAccelerator, w, TQStyleOption::Default, 0)) + if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, w)) alignment |= TQt::NoAccel; tr.setWidth(tr.width()+4); // Compensate for text appearing too far to the left // TQRect tr_offset = TQRect(tr.x()+ETCH_X_OFFSET, tr.y()+ETCH_Y_OFFSET, tr.width(), tr.height()); @@ -1115,7 +1123,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, } if ( (sf & Style_HasFocus) && !t->text().isEmpty() ) - tqdrawPrimitive( TQStyle::PE_FocusRect, p, r, cg ); + drawPrimitive( TQStyle::PE_FocusRect, p, ceData, elementFlags, r, cg ); break; } #endif // TQT_NO_TABBAR @@ -1126,10 +1134,10 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, const TQCheckBox *checkbox = (const TQCheckBox *) w; const bool enabled = sf & Style_Enabled; - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); int alignment = TQApplication::reverseLayout() ? TQt::AlignRight : TQt::AlignLeft; - if (!styleHint(SH_UnderlineAccelerator, w, TQStyleOption::Default, 0)) + if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, w)) alignment |= TQt::NoAccel; //TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height()); @@ -1162,8 +1170,8 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, } if (sf & Style_HasFocus) { - TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, w), w); - tqdrawPrimitive(TQStyle::PE_FocusRect, p, fr, cg, sf); + TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, w), ceData, elementFlags); + drawPrimitive(TQStyle::PE_FocusRect, p, ceData, elementFlags, fr, cg, sf); } #endif break; @@ -1175,10 +1183,10 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, const TQRadioButton *radiobutton = (const TQRadioButton *) w; const bool enabled = sf & Style_Enabled; - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); int alignment = TQApplication::reverseLayout() ? TQt::AlignRight : TQt::AlignLeft; - if (!styleHint(SH_UnderlineAccelerator, w, TQStyleOption::Default, 0)) + if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, w)) alignment |= TQt::NoAccel; // TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height()); @@ -1209,8 +1217,8 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, drawItem(p, r, alignment | TQt::AlignVCenter | TQt::ShowPrefix, cg, enabled, radiobutton->pixmap(), radiobutton->text()); if (sf & Style_HasFocus) { - TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, w), w); - tqdrawPrimitive(TQStyle::PE_FocusRect, p, fr, cg, sf); + TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, w), ceData, elementFlags); + drawPrimitive(TQStyle::PE_FocusRect, p, ceData, elementFlags, fr, cg, sf); } #endif break; @@ -1228,7 +1236,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, // ### Take into account totalSteps() for busy indicator const TQProgressBar* pb = (const TQProgressBar*)w; - TQRect cr = subRect(SR_ProgressBarContents, w); + TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, w); double progress = pb->progress(); bool reverse = TQApplication::reverseLayout(); int steps = pb->totalSteps(); @@ -1283,15 +1291,15 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, } case CE_CheckBox: { - tqdrawPrimitive(PE_Indicator, p, r, cg, sf); + drawPrimitive(PE_Indicator, p, ceData, elementFlags, r, cg, sf); if (sf & Style_On) { - tqdrawPrimitive(PE_CheckMark, p, r, cg, sf); + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, sf); } break; } case CE_RadioButton: { - tqdrawPrimitive(PE_ExclusiveIndicator, p, r, cg, sf); + drawPrimitive(PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, sf); if (sf & Style_On) { TQCOORD center[] = { 4, 5, 4, 6, 5, 7, 6, 7, 7, 6, 7, 5, 6, 4, 5, 4 }; TQPointArray c(8, center); @@ -1328,10 +1336,10 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, } else { if (pb->isDefault()) { - tqdrawPrimitive(PE_ButtonDefault, p, r, cg, sf); - tqdrawPrimitive(PE_ButtonBevel, p, TQRect(x+1, y+1, sw-2, sh-2), cg, sf); + drawPrimitive(PE_ButtonDefault, p, ceData, elementFlags, r, cg, sf); + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, TQRect(x+1, y+1, sw-2, sh-2), cg, sf); } else { - tqdrawPrimitive(PE_ButtonBevel, p, r, cg, sf); + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, sf); } } @@ -1343,7 +1351,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, bool focused = sf & Style_HasFocus; bool down = sf & Style_Down; bool enabled = sf & Style_Enabled; - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); const int text_flags = AlignVCenter | AlignHCenter | ShowPrefix | DontClip | SingleLine; if (active && focused) { @@ -1390,13 +1398,13 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, case CE_PushButtonLabel: { const TQPushButton *pb = dynamic_cast<const TQPushButton *>(w); const bool enabled = sf & Style_Enabled; - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); const int text_flags = AlignVCenter | AlignHCenter | ShowPrefix | DontClip | SingleLine; int dx = 0; if (sf & Style_Down) { - p->translate(pixelMetric(PM_ButtonShiftHorizontal), - pixelMetric(PM_ButtonShiftVertical)); + p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags)); } if (pb->iconSet() && !pb->iconSet()->isNull()) { @@ -1458,7 +1466,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, const TQHeader *hw = dynamic_cast<const TQHeader *>(w); int hs = o.headerSection(); const bool enabled = sf & Style_Enabled; - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); const int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine; TQIconSet *is = hw->iconSet(hs); @@ -1513,7 +1521,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, bool disabled = !mi->isEnabled(); bool checkable = pum->isCheckable(); bool enabled = mi->isEnabled(); - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); int xpos = x; int xm = itemFrame + checkcol + itemHMargin; @@ -1575,7 +1583,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, rr = visualRect(rr, r); } - tqdrawPrimitive(PE_CheckMark, p, rr, cg, cflags); + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, rr, cg, cflags); } } @@ -1668,7 +1676,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, } if (mi->popup()) { - int dim = pixelMetric(PM_MenuButtonIndicator); + int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags); xpos = x + sw - arrowHMargin - 2 * itemFrame - dim; @@ -1681,23 +1689,25 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, TQRect rr = TQRect(xpos, y + sh/2 - dim/2, dim, dim); if (backwards) rr = visualRect(rr, r); - tqdrawPrimitive((backwards ? PE_ArrowLeft : PE_ArrowRight), p, rr, cg, Style_Enabled); + drawPrimitive((backwards ? PE_ArrowLeft : PE_ArrowRight), p, ceData, elementFlags, rr, cg, Style_Enabled); } break; } default: { - KStyle::drawControl(ce, p, w, r, cg, sf, o); + KStyle::drawControl(ce, p, ceData, elementFlags, r, cg, sf, o, w); } } } void AsteroidStyle::drawControlMask(TQ_ControlElement ce, TQPainter *p, - const TQWidget *w, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &o) const + const TQStyleOption &o, + const TQWidget *w) const { switch (ce) { /* @@ -1733,20 +1743,22 @@ void AsteroidStyle::drawControlMask(TQ_ControlElement ce, CE_HeaderLabel */ default: { - KStyle::drawControlMask(ce, p, w, r, o); + KStyle::drawControlMask(ce, p, ceData, elementFlags, r, o, w); } } } void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, TQPainter *p, - const TQWidget *w, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags sf, SCFlags sc, SCFlags sa, - const TQStyleOption &o) const + const TQStyleOption &o, + const TQWidget *w) const { switch (cc) { /* TQ_ComplexControls available are: @@ -1762,7 +1774,7 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, case CC_ListView: { if ( sc & SC_ListView ) { - TQCommonStyle::drawComplexControl( cc, p, w, r, cg, sf, sc, sa, o ); + TQCommonStyle::drawComplexControl( cc, p, ceData, elementFlags, r, cg, sf, sc, sa, o, w ); } if ( sc & ( SC_ListViewBranch | SC_ListViewExpand ) ) { if (o.isDefault()) @@ -1953,7 +1965,7 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, p->drawLine(x2-1, y2-1, x+1, y2-1); // Fill in the area behind the text. - p->fillRect(querySubControlMetrics(cc, w, SC_ComboBoxEditField), cg.base()); + p->fillRect(querySubControlMetrics(cc, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, w), cg.base()); p->setBrush(cg.background()); // Draw the box on the right. @@ -2008,8 +2020,8 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, if ( toolbutton->backgroundMode() != TQt::PaletteButton ) c.setBrush( TQColorGroup::Button, toolbutton->paletteBackgroundColor() ); TQRect button, menuarea; - button = visualRect( querySubControlMetrics(cc, w, SC_ToolButton, o), w ); - menuarea = visualRect( querySubControlMetrics(cc, w, SC_ToolButtonMenu, o), w ); + button = visualRect( querySubControlMetrics(cc, ceData, elementFlags, SC_ToolButton, o, w), ceData, elementFlags ); + menuarea = visualRect( querySubControlMetrics(cc, ceData, elementFlags, SC_ToolButtonMenu, o, w), ceData, elementFlags ); SFlags bflags = sf; SFlags mflags = sf; @@ -2021,7 +2033,7 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, if (sc & SC_ToolButton) { if (bflags & (Style_Down | Style_On | Style_Raised)) { - tqdrawPrimitive(TQStyle::PE_ButtonTool, p, button, c, bflags, o); + drawPrimitive(TQStyle::PE_ButtonTool, p, ceData, elementFlags, button, c, bflags, o); } else if ( toolbutton->parentWidget() && toolbutton->parentWidget()->backgroundPixmap() && ! toolbutton->parentWidget()->backgroundPixmap()->isNull() ) { TQPixmap pixmap = *(toolbutton->parentWidget()->backgroundPixmap()); @@ -2032,14 +2044,14 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, if (sc & SC_ToolButtonMenu) { if (mflags & (Style_Down | Style_On | Style_Raised)) - tqdrawPrimitive(TQStyle::PE_ButtonDropDown, p, menuarea, c, mflags, o); - tqdrawPrimitive(TQStyle::PE_ArrowDown, p, menuarea, c, mflags, o); + drawPrimitive(TQStyle::PE_ButtonDropDown, p, ceData, elementFlags, menuarea, c, mflags, o); + drawPrimitive(TQStyle::PE_ArrowDown, p, ceData, elementFlags, menuarea, c, mflags, o); } if (toolbutton->hasFocus() && !toolbutton->focusProxy()) { TQRect fr = toolbutton->rect(); fr.addCoords(3, 3, -3, -3); - tqdrawPrimitive(TQStyle::PE_FocusRect, p, fr, c); + drawPrimitive(TQStyle::PE_FocusRect, p, ceData, elementFlags, fr, c); } break; @@ -2048,8 +2060,8 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, case CC_Slider: { const TQSlider* slider = (const TQSlider*)w; - TQRect groove = querySubControlMetrics(CC_Slider, w, SC_SliderGroove, o); - TQRect handle = querySubControlMetrics(CC_Slider, w, SC_SliderHandle, o); + TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, o, w); + TQRect handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, o, w); // Double-buffer slider for no flicker TQPixmap pix(w->size()); @@ -2066,11 +2078,11 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, // Draw slider groove if ((sc & SC_SliderGroove) && groove.isValid()) { - drawKStylePrimitive( KPE_SliderGroove, &p2, w, groove, cg, sf, o ); + drawKStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, sf, o, w ); // Draw the focus rect around the groove if (slider->hasFocus()) - tqdrawPrimitive(PE_FocusRect, &p2, groove, cg); + drawPrimitive(PE_FocusRect, &p2, ceData, elementFlags, groove, cg); } @@ -2084,7 +2096,7 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, if ((sc & SC_SliderHandle) && handle.isValid()) { if (sa == SC_SliderHandle) sf |= Style_Active; - drawKStylePrimitive( KPE_SliderHandle, &p2, w, handle, cg, sf, o ); + drawKStylePrimitive( KPE_SliderHandle, &p2, ceData, elementFlags, handle, cg, sf, o, w ); } p2.end(); @@ -2114,10 +2126,10 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, // Draw the arrow buttons p->drawLine(x2-aw-1, y+2, x2-aw-1, y2-1); - tqdrawPrimitive(PE_ButtonBevel, p, arrowup, cg, sf, o); - tqdrawPrimitive(PE_ButtonBevel, p, arrowdn, cg, sf, o); - tqdrawPrimitive(PE_SpinWidgetUp, p, arrowup, cg, sf, o); - tqdrawPrimitive(PE_SpinWidgetDown, p, arrowdn, cg, sf, o); + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, arrowup, cg, sf, o); + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, arrowdn, cg, sf, o); + drawPrimitive(PE_SpinWidgetUp, p, ceData, elementFlags, arrowup, cg, sf, o); + drawPrimitive(PE_SpinWidgetDown, p, ceData, elementFlags, arrowdn, cg, sf, o); break; @@ -2126,16 +2138,18 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, default: { - KStyle::drawComplexControl(cc, p, w, r, cg, sf, sc, sa, o); + KStyle::drawComplexControl(cc, p, ceData, elementFlags, r, cg, sf, sc, sa, o, w); } } } void AsteroidStyle::drawComplexControlMask(TQ_ComplexControl cc, TQPainter *p, - const TQWidget *w, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &o) const + const TQStyleOption &o, + const TQWidget *w) const { switch (cc) { /* TQ_ComplexControls available are: @@ -2149,12 +2163,12 @@ void AsteroidStyle::drawComplexControlMask(TQ_ComplexControl cc, CC_ListView */ default: { - KStyle::drawComplexControlMask(cc, p, w, r, o); + KStyle::drawComplexControlMask(cc, p, ceData, elementFlags, r, o, w); } } } -int AsteroidStyle::pixelMetric(PixelMetric pm, const TQWidget *w) const +int AsteroidStyle::pixelMetric(PixelMetric pm, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *w) const { switch (pm) { /* PixelMetrics available are: @@ -2248,7 +2262,7 @@ int AsteroidStyle::pixelMetric(PixelMetric pm, const TQWidget *w) const if (w && w->inherits(TQPOPUPMENU_OBJECT_NAME_STRING)) { return 3; } else { - return KStyle::pixelMetric(pm, w); + return KStyle::pixelMetric(pm, ceData, elementFlags, w); } } @@ -2274,12 +2288,12 @@ int AsteroidStyle::pixelMetric(PixelMetric pm, const TQWidget *w) const return TQMAX( 4, TQApplication::globalStrut().width() ); default: { - return KStyle::pixelMetric(pm, w); + return KStyle::pixelMetric(pm, ceData, elementFlags, w); } } } -TQRect AsteroidStyle::subRect(SubRect sr, const TQWidget *w) const +TQRect AsteroidStyle::subRect(SubRect sr, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *w) const { switch (sr) { /* SubRects to calculate are: @@ -2318,15 +2332,17 @@ TQRect AsteroidStyle::subRect(SubRect sr, const TQWidget *w) const SR_DialogButtonCustom */ default: { - return KStyle::subRect(sr, w); + return KStyle::subRect(sr, ceData, elementFlags, w); } } } TQRect AsteroidStyle::querySubControlMetrics(TQ_ComplexControl cc, - const TQWidget *w, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl sc, - const TQStyleOption &o) const + const TQStyleOption &o, + const TQWidget *w) const { switch (cc) { /* Available SubControls are: @@ -2382,7 +2398,7 @@ TQRect AsteroidStyle::querySubControlMetrics(TQ_ComplexControl cc, return TQRect(r.x()+2, r.y()+2, r.width()-20, r.height()-4); } default: { - return KStyle::querySubControlMetrics(cc, w, sc, o); + return KStyle::querySubControlMetrics(cc, ceData, elementFlags, sc, o, w); } } @@ -2390,15 +2406,17 @@ TQRect AsteroidStyle::querySubControlMetrics(TQ_ComplexControl cc, } default: { - return KStyle::querySubControlMetrics(cc, w, sc, o); + return KStyle::querySubControlMetrics(cc, ceData, elementFlags, sc, o, w); } } } -TQSize AsteroidStyle::tqsizeFromContents(ContentsType ct, - const TQWidget *w, +TQSize AsteroidStyle::sizeFromContents(ContentsType ct, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &s, - const TQStyleOption &o) const + const TQStyleOption &o, + const TQWidget *w) const { switch (ct) { /* ContentsType values can be: @@ -2422,7 +2440,7 @@ TQSize AsteroidStyle::tqsizeFromContents(ContentsType ct, case CT_PushButton: { const TQPushButton *pb = dynamic_cast<const TQPushButton *>(w); - const TQSize ret = KStyle::tqsizeFromContents(ct, w, s, o); + const TQSize ret = KStyle::sizeFromContents(ct, ceData, elementFlags, s, o, w); int rw = ret.width(), rh = ret.height(); int mw; int mh; @@ -2454,7 +2472,7 @@ TQSize AsteroidStyle::tqsizeFromContents(ContentsType ct, } case CT_ComboBox: { - int padding = (pixelMetric(PM_DefaultFrameWidth, w) * 2) + 1; + int padding = (pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, w) * 2) + 1; return TQSize(s.width() + 21, s.height() + padding); } @@ -2522,7 +2540,7 @@ TQSize AsteroidStyle::tqsizeFromContents(ContentsType ct, } default: { - return KStyle::tqsizeFromContents(ct, w, s, o); + return KStyle::sizeFromContents(ct, ceData, elementFlags, s, o, w); } } } diff --git a/kstyles/asteroid/asteroid.h b/kstyles/asteroid/asteroid.h index cbffa7112..9b8450084 100644 --- a/kstyles/asteroid/asteroid.h +++ b/kstyles/asteroid/asteroid.h @@ -36,18 +36,23 @@ public: void drawKStylePrimitive(KStylePrimitive, TQPainter *, - const TQWidget *, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, - const TQStyleOption & = TQStyleOption::Default) const; + const TQStyleOption & = TQStyleOption::Default, + const TQWidget * = 0) const; - int styleHint(TQ_StyleHint, const TQWidget * = 0, + int styleHint(TQ_StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, - TQStyleHintReturn * = 0 ) const; + TQStyleHintReturn * = 0, + const TQWidget * = 0 ) const; - void tqdrawPrimitive(TQ_PrimitiveElement, + void drawPrimitive(TQ_PrimitiveElement, TQPainter *, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, @@ -55,49 +60,61 @@ public: void drawControl(TQ_ControlElement, TQPainter *, - const TQWidget *, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, - const TQStyleOption & = TQStyleOption::Default) const; + const TQStyleOption & = TQStyleOption::Default, + const TQWidget * = 0) const; void drawControlMask(TQ_ControlElement, TQPainter *, - const TQWidget *, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &, - const TQStyleOption &) const; + const TQStyleOption &, + const TQWidget * = 0) const; void drawComplexControl(TQ_ComplexControl, TQPainter *, - const TQWidget *, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, SCFlags controls = SC_All, SCFlags active = SC_None, - const TQStyleOption & = TQStyleOption::Default) const; + const TQStyleOption & = TQStyleOption::Default, + const TQWidget * = 0) const; void drawComplexControlMask(TQ_ComplexControl, TQPainter *, - const TQWidget *, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption & = TQStyleOption::Default) const; + const TQStyleOption & = TQStyleOption::Default, + const TQWidget * = 0) const; - int pixelMetric(PixelMetric, const TQWidget * = 0) const; + int pixelMetric(PixelMetric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * = 0) const; int kPixelMetric( KStylePixelMetric kpm, const TQWidget* /* widget */) const; - TQRect subRect(SubRect, const TQWidget *) const; + TQRect subRect(SubRect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *) const; TQRect querySubControlMetrics(TQ_ComplexControl, - const TQWidget *, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl, - const TQStyleOption & = TQStyleOption::Default) const; + const TQStyleOption & = TQStyleOption::Default, + const TQWidget * = 0) const; - TQSize tqsizeFromContents(ContentsType, - const TQWidget *, + TQSize sizeFromContents(ContentsType, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &, - const TQStyleOption &) const; + const TQStyleOption &, + const TQWidget * = 0) const; protected: bool eventFilter(TQObject *, TQEvent *); diff --git a/kstyles/highcolor/highcolor.cpp b/kstyles/highcolor/highcolor.cpp index f42ff4061..4087ecc37 100644 --- a/kstyles/highcolor/highcolor.cpp +++ b/kstyles/highcolor/highcolor.cpp @@ -246,8 +246,10 @@ void HighColorStyle::renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup &cg // This function draws primitive elements as well as their masks. -void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, +void HighColorStyle::drawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, @@ -458,7 +460,7 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, // Small hack to ensure scrollbar gradients are drawn the right way. flags ^= Style_Horizontal; - tqdrawPrimitive(PE_ButtonBevel, p, r, cg, flags | Style_Enabled | Style_Raised); + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags | Style_Enabled | Style_Raised); // Draw a scrollbar riffle (note direction after above changes) if ( type != B3 ) { @@ -597,21 +599,21 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, case PE_ScrollBarAddLine: { - tqdrawPrimitive( PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) | + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | ((flags & Style_Down) ? Style_Down : Style_Raised) ); - tqdrawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), - p, r, cg, flags ); + drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), + p, ceData, elementFlags, r, cg, flags ); break; } case PE_ScrollBarSubLine: { - tqdrawPrimitive( PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) | + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | ((flags & Style_Down) ? Style_Down : Style_Raised) ); - tqdrawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), - p, r, cg, flags ); + drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), + p, ceData, elementFlags, r, cg, flags ); break; } @@ -764,7 +766,7 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, case PE_WindowFrame: case PE_PanelLineEdit: { bool sunken = flags & Style_Sunken; - int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) + int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) : opt.lineWidth(); if (lw == 2) { @@ -787,7 +789,7 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, p->drawLine(x+1, y+1, x+1, y2-1); p->setPen(oldPen); } else - KStyle::tqdrawPrimitive(pe, p, r, cg, flags, opt); + KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); break; } @@ -799,7 +801,7 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, case PE_PanelDockWindow: { // Toolbar int x2 = r.x()+r.width()-1; int y2 = r.y()+r.height()-1; - int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) + int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) : opt.lineWidth(); if (lw) @@ -893,8 +895,8 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, p->save(); if ( flags & Style_Down ) - p->translate( pixelMetric( PM_ButtonShiftHorizontal ), - pixelMetric( PM_ButtonShiftVertical ) ); + p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ), + pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) ); if ( flags & Style_Enabled ) { a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 ); @@ -911,7 +913,7 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, p->restore(); } else - KStyle::tqdrawPrimitive( pe, p, r, cg, flags, opt ); + KStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); } } } @@ -919,11 +921,13 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, void HighColorStyle::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 ) { @@ -1091,18 +1095,20 @@ void HighColorStyle::drawKStylePrimitive( KStylePrimitive kpe, } default: - KStyle::drawKStylePrimitive( kpe, p, widget, r, cg, flags, opt); + KStyle::drawKStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget); } } void HighColorStyle::drawControl( TQ_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) { @@ -1119,17 +1125,17 @@ void HighColorStyle::drawControl( TQ_ControlElement element, if ( btnDefault || button->autoDefault() ) { // Compensate for default indicator - static int di = pixelMetric( PM_ButtonDefaultIndicator ); + static int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags ); br.addCoords( di, di, -di, -di ); } if ( btnDefault ) - tqdrawPrimitive( PE_ButtonDefault, p, r, cg, flags ); + drawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags ); - tqdrawPrimitive( PE_ButtonCommand, p, br, cg, flags ); + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags ); } else - tqdrawPrimitive( PE_ButtonCommand, p, r, cg, flags ); + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags ); break; } @@ -1145,15 +1151,15 @@ void HighColorStyle::drawControl( TQ_ControlElement element, // 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 ); - tqdrawPrimitive( PE_ArrowDown, p, TQRect(x + w - dx - 2, y + 2, dx, h - 4), + int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget ); + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect(x + w - dx - 2, y + 2, dx, h - 4), cg, flags, opt ); w -= dx; } @@ -1210,8 +1216,8 @@ void HighColorStyle::drawControl( TQ_ControlElement element, // Draw a focus rect if the button has focus if ( flags & Style_HasFocus ) - tqdrawPrimitive( PE_FocusRect, p, - TQStyle::visualRect(subRect(SR_PushButtonFocusRect, widget), widget), + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, + TQStyle::visualRect(subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget), ceData, elementFlags), cg, flags ); break; } @@ -1297,7 +1303,7 @@ void HighColorStyle::drawControl( TQ_ControlElement element, bool enabled = mi->isEnabled(); bool checkable = popupmenu->isCheckable(); bool active = flags & Style_Active; - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); bool reverse = TQApplication::reverseLayout(); int x, y, w, h; r.rect( &x, &y, &w, &h ); @@ -1362,7 +1368,7 @@ void HighColorStyle::drawControl( TQ_ControlElement element, SFlags cflags = Style_Default; cflags |= active ? Style_Enabled : Style_On; - tqdrawPrimitive( PE_CheckMark, p, TQRect( cx + itemFrame, y + itemFrame, + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame, checkcol - itemFrame*2, h - itemFrame*2), cg, cflags ); } @@ -1463,7 +1469,7 @@ void HighColorStyle::drawControl( TQ_ControlElement element, // Does the menu item have a submenu? if ( mi->popup() ) { TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; - int dim = pixelMetric(PM_MenuButtonIndicator); + int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags); TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim, y + h / 2 - dim / 2, dim, dim), r ); @@ -1475,25 +1481,27 @@ void HighColorStyle::drawControl( TQ_ControlElement element, TQColorGroup g2( discol, cg.highlight(), white, white, enabled ? white : discol, discol, white ); - tqdrawPrimitive( arrow, p, vr, g2, Style_Enabled ); + drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled ); } else - tqdrawPrimitive( arrow, p, vr, cg, + drawPrimitive( arrow, p, ceData, elementFlags, vr, cg, enabled ? Style_Enabled : Style_Default ); } break; } default: - KStyle::drawControl(element, p, widget, r, cg, flags, opt); + KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); } } void HighColorStyle::drawControlMask( TQ_ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget *widget ) const { switch (element) { @@ -1510,20 +1518,22 @@ void HighColorStyle::drawControlMask( TQ_ControlElement element, } default: - KStyle::drawControlMask(element, p, widget, r, opt); + KStyle::drawControlMask(element, p, ceData, elementFlags, r, opt, widget); } } void HighColorStyle::drawComplexControl( TQ_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) { @@ -1567,8 +1577,8 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control, // Get the button bounding box TQRect ar = TQStyle::visualRect( - querySubControlMetrics(CC_ComboBox, widget, SC_ComboBoxArrow), - widget ); + querySubControlMetrics(CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget), + ceData, elementFlags ); // Are we enabled? if ( widget->isEnabled() ) @@ -1578,7 +1588,7 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control, if ( active & Style_Sunken ) flags |= Style_Sunken; - tqdrawPrimitive(PE_ArrowDown, p, ar, cg, flags); + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags); } // Draw an edit field if required @@ -1586,8 +1596,8 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control, { const TQComboBox * cb = (const TQComboBox *) widget; TQRect re = TQStyle::visualRect( - querySubControlMetrics( CC_ComboBox, widget, - SC_ComboBoxEditField), widget ); + querySubControlMetrics( CC_ComboBox, ceData, elementFlags, + SC_ComboBoxEditField, TQStyleOption::Default, widget), ceData, elementFlags ); // Draw the indent if (cb->editable()) { @@ -1610,9 +1620,9 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control, cg.brush( TQColorGroup::Highlight ) ); TQRect re = TQStyle::visualRect( - subRect(SR_ComboBoxFocusRect, cb), widget); + subRect(SR_ComboBoxFocusRect, ceData, elementFlags, cb), ceData, elementFlags); - tqdrawPrimitive( PE_FocusRect, p, re, cg, + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg, Style_FocusAtBorder, TQStyleOption(cg.highlight())); } } @@ -1625,8 +1635,8 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control, const TQToolButton *toolbutton = (const TQToolButton *) widget; TQRect button, menuarea; - button = querySubControlMetrics(control, widget, SC_ToolButton, opt); - menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); + button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget); + menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget); SFlags bflags = flags, mflags = flags; @@ -1640,7 +1650,7 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control, { // If we're pressed, on, or raised... if (bflags & (Style_Down | Style_On | Style_Raised)) - tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt); // Check whether to draw a background pixmap else if ( toolbutton->parentWidget() && @@ -1682,14 +1692,14 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control, if (controls & SC_ToolButtonMenu) { if (mflags & (Style_Down | Style_On | Style_Raised)) - tqdrawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, opt); - tqdrawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, opt); + drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt); + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt); } if (toolbutton->hasFocus() && !toolbutton->focusProxy()) { TQRect fr = toolbutton->rect(); fr.addCoords(3, 3, -3, -3); - tqdrawPrimitive(PE_FocusRect, p, fr, cg); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg); } break; @@ -1697,8 +1707,8 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control, default: - KStyle::drawComplexControl(control, p, widget, - r, cg, flags, controls, active, opt); + KStyle::drawComplexControl(control, p, ceData, elementFlags, + r, cg, flags, controls, active, opt, widget); break; } } @@ -1706,9 +1716,11 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control, void HighColorStyle::drawComplexControlMask( TQ_ComplexControl control, TQPainter *p, - const TQWidget *widget, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget *widget ) const { switch (control) { @@ -1726,7 +1738,7 @@ void HighColorStyle::drawComplexControlMask( TQ_ComplexControl control, } default: - KStyle::drawComplexControlMask(control, p, widget, r, opt); + KStyle::drawComplexControlMask(control, p, ceData, elementFlags, r, opt, widget); } } @@ -1758,7 +1770,7 @@ void HighColorStyle::drawItem( TQPainter *p, } -TQRect HighColorStyle::subRect(SubRect r, const TQWidget *widget) const +TQRect HighColorStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const { // We want the focus rect for buttons to be adjusted from // the Qt3 defaults to be similar to Qt 2's defaults. @@ -1769,11 +1781,11 @@ TQRect HighColorStyle::subRect(SubRect r, const TQWidget *widget) const int dbw1 = 0, dbw2 = 0; if (button->isDefault() || button->autoDefault()) { - dbw1 = pixelMetric(PM_ButtonDefaultIndicator, widget); + dbw1 = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); dbw2 = dbw1 * 2; } - int dfw1 = pixelMetric(PM_DefaultFrameWidth, widget) * 2, + int dfw1 = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2, dfw2 = dfw1 * 2; return TQRect(wrect.x() + dfw1 + dbw1 + 1, @@ -1781,11 +1793,11 @@ TQRect HighColorStyle::subRect(SubRect r, const TQWidget *widget) const wrect.width() - dfw2 - dbw2 - 1, wrect.height() - dfw2 - dbw2 - 1); } else - return KStyle::subRect(r, widget); + return KStyle::subRect(r, ceData, elementFlags, widget); } -int HighColorStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const +int HighColorStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const { switch(m) { @@ -1818,15 +1830,17 @@ int HighColorStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const } default: - return KStyle::pixelMetric(m, widget); + return KStyle::pixelMetric(m, ceData, elementFlags, widget); } } -TQSize HighColorStyle::tqsizeFromContents( ContentsType contents, - const TQWidget* widget, +TQSize HighColorStyle::sizeFromContents( ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentSize, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget* widget ) const { switch (contents) { @@ -1836,8 +1850,8 @@ TQSize HighColorStyle::tqsizeFromContents( ContentsType contents, const TQPushButton* button = (const TQPushButton*) widget; int w = contentSize.width(); int h = contentSize.height(); - int bm = pixelMetric( PM_ButtonMargin, widget ); - int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2; + int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ); + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2; w += bm + fw + 6; // ### Add 6 to make way for bold font. h += bm + fw; @@ -1849,7 +1863,7 @@ TQSize HighColorStyle::tqsizeFromContents( ContentsType contents, if ( type != HighColor ) { // Compensate for default indicator - int di = pixelMetric( PM_ButtonDefaultIndicator ); + int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags ); w += di * 2; h += di * 2; } @@ -1921,15 +1935,17 @@ TQSize HighColorStyle::tqsizeFromContents( ContentsType contents, default: - return KStyle::tqsizeFromContents( contents, widget, contentSize, opt ); + return KStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget ); } } // Fix Qt's wacky image alignment TQPixmap HighColorStyle::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_TitleBarMinButton: @@ -1940,7 +1956,7 @@ TQPixmap HighColorStyle::stylePixmap(StylePixmap stylepixmap, break; } - return KStyle::stylePixmap(stylepixmap, widget, opt); + return KStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget); } diff --git a/kstyles/highcolor/highcolor.h b/kstyles/highcolor/highcolor.h index ff0fce2d7..d5b6f526c 100644 --- a/kstyles/highcolor/highcolor.h +++ b/kstyles/highcolor/highcolor.h @@ -73,14 +73,18 @@ class HighColorStyle : public KStyle void drawKStylePrimitive( KStylePrimitive kpe, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; - void tqdrawPrimitive( TQ_PrimitiveElement pe, + void drawPrimitive( TQ_PrimitiveElement pe, TQPainter* p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, @@ -88,33 +92,41 @@ class HighColorStyle : public KStyle void drawControl( TQ_ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; void drawControlMask( TQ_ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; void drawComplexControl( TQ_ComplexControl control, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, SCFlags controls = SC_All, SCFlags active = SC_None, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; void drawComplexControlMask( TQ_ComplexControl control, TQPainter *p, - const TQWidget *widget, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; void drawItem( TQPainter *p, const TQRect &r, @@ -126,21 +138,25 @@ class HighColorStyle : public KStyle int len = -1, const TQColor *penColor = 0 ) const; - int pixelMetric( PixelMetric m, + int pixelMetric( PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; - TQSize tqsizeFromContents( ContentsType contents, - const TQWidget *widget, + TQSize sizeFromContents( ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentSize, - const TQStyleOption& opt ) const; + const TQStyleOption& opt, + const TQWidget *widget ) const; - TQRect subRect( SubRect r, + TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const; // Fix Qt3's wacky image positions TQPixmap stylePixmap( StylePixmap stylepixmap, - const TQWidget *widget = 0, - const TQStyleOption& = TQStyleOption::Default ) const; + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; protected: bool eventFilter( TQObject *object, TQEvent *event ); diff --git a/kstyles/highcontrast/highcontrast.cpp b/kstyles/highcontrast/highcontrast.cpp index e6c3be350..8d4629677 100644 --- a/kstyles/highcontrast/highcontrast.cpp +++ b/kstyles/highcontrast/highcontrast.cpp @@ -327,6 +327,8 @@ void HighContrastStyle::drawArrow (TQPainter* p, TQRect r, TQ_PrimitiveElement a // This function draws primitive elements void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe, TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, @@ -574,7 +576,7 @@ void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe, setColorsText (p, cg, flags, 0); drawRoundRect (p, r); if (flags & (Style_HasFocus | Style_Active)) - tqdrawPrimitive (PE_FocusRect, p, r, cg, flags, TQStyleOption (p->backgroundColor())); + tqdrawPrimitive (PE_FocusRect, p, ceData, elementFlags, r, cg, flags, TQStyleOption (p->backgroundColor())); break; } case PE_PanelTabWidget: @@ -634,7 +636,7 @@ void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe, } default: { - KStyle::tqdrawPrimitive( pe, p, r, cg, flags, opt ); + KStyle::tqdrawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); } } } @@ -642,11 +644,13 @@ void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe, void HighContrastStyle::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 { if ( widget == hoverWidget ) flags |= Style_MouseOver; @@ -728,18 +732,20 @@ void HighContrastStyle::drawKStylePrimitive (KStylePrimitive kpe, // TODO Draw (thick) dotted line. Check kstyle.cpp // Fall down for now default: - KStyle::drawKStylePrimitive( kpe, p, widget, r, cg, flags, opt); + KStyle::drawKStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget); } } void HighContrastStyle::drawControl (TQ_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 { if ( widget == hoverWidget ) flags |= Style_MouseOver; @@ -793,14 +799,14 @@ void HighContrastStyle::drawControl (TQ_ControlElement element, if (( btnDefault || button->autoDefault() ) && (button->isEnabled())) { // Compensate for default indicator - static int di = pixelMetric( PM_ButtonDefaultIndicator ); + static int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags ); addOffset (&br, di); } if ( btnDefault && (button->isEnabled())) - tqdrawPrimitive( PE_ButtonDefault, p, r, cg, flags ); + tqdrawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags ); - tqdrawPrimitive( PE_ButtonCommand, p, br, cg, flags ); + tqdrawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags ); break; } @@ -864,7 +870,7 @@ void HighContrastStyle::drawControl (TQ_ControlElement element, // Does the button have a popup menu? if (popup) { - int dx = pixelMetric (PM_MenuButtonIndicator, widget); + int dx = pixelMetric (PM_MenuButtonIndicator, ceData, elementFlags, widget); drawArrow (p, TQRect(x + w - dx - 2, y + 2, dx, h - 4), PE_ArrowDown); w -= dx; } @@ -886,7 +892,7 @@ void HighContrastStyle::drawControl (TQ_ControlElement element, // Draw a focus rect if the button has focus if (flags & Style_HasFocus) - tqdrawPrimitive (PE_FocusRect, p, r, cg, flags, TQStyleOption (p->backgroundColor())); + tqdrawPrimitive (PE_FocusRect, p, ceData, elementFlags, r, cg, flags, TQStyleOption (p->backgroundColor())); // Draw the label itself TQColor color = p->pen().color(); @@ -931,14 +937,14 @@ void HighContrastStyle::drawControl (TQ_ControlElement element, // CHECKBOX // ------------------------------------------------------------------- case CE_CheckBox: { - tqdrawPrimitive (PE_Indicator, p, r, cg, flags); + tqdrawPrimitive (PE_Indicator, p, ceData, elementFlags, r, cg, flags); break; } // RADIOBUTTON // ------------------------------------------------------------------- case CE_RadioButton: { - tqdrawPrimitive (PE_ExclusiveIndicator, p, r, cg, flags); + tqdrawPrimitive (PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, flags); break; } @@ -1122,7 +1128,7 @@ void HighContrastStyle::drawControl (TQ_ControlElement element, // Does the menu item have a submenu? if ( mi->popup() ) { TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; - int dim = pixelMetric(PM_MenuButtonIndicator); + int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags); TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim, y + h / 2 - dim / 2, dim, dim), r ); @@ -1133,15 +1139,17 @@ void HighContrastStyle::drawControl (TQ_ControlElement element, } default: - KStyle::drawControl(element, p, widget, r, cg, flags, opt); + KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); } } void HighContrastStyle::drawControlMask (TQ_ControlElement element, TQPainter *p, - const TQWidget *w, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &opt) const + const TQStyleOption &opt, + const TQWidget *w) const { switch (element) { case CE_PushButton: @@ -1161,7 +1169,7 @@ void HighContrastStyle::drawControlMask (TQ_ControlElement element, } default: { - KStyle::drawControlMask (element, p, w, r, opt); + KStyle::drawControlMask (element, p, ceData, elementFlags, r, opt, w); } } } @@ -1182,13 +1190,15 @@ static TQListViewItem* nextVisibleSibling(TQListViewItem* item) void HighContrastStyle::drawComplexControl (TQ_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 { if ( widget == hoverWidget ) flags |= Style_MouseOver; @@ -1201,7 +1211,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, setColorsText (p, cg, flags); drawRoundRect (p, r); - TQRect r2 = TQStyle::visualRect (querySubControlMetrics (CC_ComboBox, widget, SC_ComboBoxArrow), widget); + TQRect r2 = TQStyle::visualRect (querySubControlMetrics (CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget), ceData, elementFlags); if (flags & Style_HasFocus) { TQRect r3 (r); if (r2.left() > 0) @@ -1209,7 +1219,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, else r3.setLeft (r2.right()-basicLineWidth+1); - tqdrawPrimitive (PE_FocusRect, p, r3, cg, flags, TQStyleOption (p->backgroundColor())); + tqdrawPrimitive (PE_FocusRect, p, ceData, elementFlags, r3, cg, flags, TQStyleOption (p->backgroundColor())); } setColorsButton (p, cg, flags); @@ -1230,18 +1240,18 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, setColorsText (p, cg, flags); drawRoundRect (p, r); if (flags & Style_HasFocus) - tqdrawPrimitive(PE_FocusRect, p, r, cg, flags, TQStyleOption (p->backgroundColor())); + tqdrawPrimitive(PE_FocusRect, p, ceData, elementFlags, r, cg, flags, TQStyleOption (p->backgroundColor())); } setColorsButton (p, cg, flags); // Draw arrows if required if (controls & SC_SpinWidgetDown) { - TQRect r2 = TQStyle::visualRect (querySubControlMetrics ((TQ_ComplexControl)CC_SpinWidget, widget, SC_SpinWidgetDown), widget); + TQRect r2 = TQStyle::visualRect (querySubControlMetrics ((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetDown, TQStyleOption::Default, widget), ceData, elementFlags); drawRoundRect (p, r2); drawArrow (p, r2, PE_SpinWidgetDown, 2*basicLineWidth); } if (controls & SC_SpinWidgetUp) { - TQRect r2 = TQStyle::visualRect (querySubControlMetrics ((TQ_ComplexControl)CC_SpinWidget, widget, SC_SpinWidgetUp), widget); + TQRect r2 = TQStyle::visualRect (querySubControlMetrics ((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetUp, TQStyleOption::Default, widget), ceData, elementFlags); drawRoundRect (p, r2); drawArrow (p, r2, PE_SpinWidgetUp, 2*basicLineWidth); } @@ -1259,8 +1269,8 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, p->fillRect (r, p->backgroundColor ()); TQRect button, menuarea; - button = querySubControlMetrics(control, widget, SC_ToolButton, opt); - menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); + button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget); + menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget); SFlags bflags = flags, mflags = flags; @@ -1274,7 +1284,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, { // If we're pressed, on, or raised... if (bflags & (Style_Down | Style_On | Style_Raised)) - tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); + tqdrawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt); // Check whether to draw a background pixmap else if ( toolbutton->parentWidget() && @@ -1290,14 +1300,14 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, if (controls & SC_ToolButtonMenu) { if (mflags & (Style_Down | Style_On | Style_Raised)) - tqdrawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, opt); + tqdrawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt); drawArrow (p, menuarea, PE_ArrowDown); } if (toolbutton->hasFocus() && !toolbutton->focusProxy()) { TQRect fr = toolbutton->rect(); addOffset (&fr, 3); - tqdrawPrimitive(PE_FocusRect, p, fr, cg, flags, TQStyleOption (p->backgroundColor())); + tqdrawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags, TQStyleOption (p->backgroundColor())); } break; @@ -1316,7 +1326,7 @@ void HighContrastStyle::drawComplexControl (TQ_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) ) @@ -1384,7 +1394,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, boxflags = child->isOpen() ? TQStyle::Style_Off : TQStyle::Style_On; // KStyle 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() ); @@ -1438,7 +1448,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, branchflags = TQStyle::Style_Horizontal; // KStyle 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 @@ -1454,7 +1464,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, branchflags = TQStyle::Style_Default; // KStyle 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 ); } } } @@ -1462,17 +1472,19 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, } default: - KStyle::drawComplexControl(control, p, widget, - r, cg, flags, controls, active, opt); + KStyle::drawComplexControl(control, p, ceData, elementFlags, + r, cg, flags, controls, active, opt, widget); break; } } void HighContrastStyle::drawComplexControlMask(TQ_ComplexControl c, TQPainter *p, - const TQWidget *w, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &o) const + const TQStyleOption &o, + const TQWidget *w) const { switch (c) { case CC_SpinWidget: @@ -1482,7 +1494,7 @@ void HighContrastStyle::drawComplexControlMask(TQ_ComplexControl c, break; } default: { - KStyle::drawComplexControlMask (c, p, w, r, o); + KStyle::drawComplexControlMask (c, p, ceData, elementFlags, r, o, w); } } } @@ -1512,14 +1524,16 @@ void HighContrastStyle::drawItem( TQPainter *p, } TQRect HighContrastStyle::querySubControlMetrics( TQ_ComplexControl control, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget* widget ) const { switch (control) { case CC_ComboBox : { - int arrow = pixelMetric (PM_ScrollBarExtent, widget); + int arrow = pixelMetric (PM_ScrollBarExtent, ceData, elementFlags, widget); switch (subcontrol) { case SC_ComboBoxFrame: @@ -1535,7 +1549,7 @@ TQRect HighContrastStyle::querySubControlMetrics( TQ_ComplexControl control, break; } case CC_SpinWidget : { - int arrow = pixelMetric (PM_ScrollBarExtent, 0); + int arrow = pixelMetric (PM_ScrollBarExtent, ceData, elementFlags, 0); switch (subcontrol) { case SC_SpinWidgetFrame: @@ -1559,11 +1573,11 @@ TQRect HighContrastStyle::querySubControlMetrics( TQ_ComplexControl control, default: break; } - return KStyle::querySubControlMetrics (control, widget, subcontrol, opt); + return KStyle::querySubControlMetrics (control, ceData, elementFlags, subcontrol, opt, widget); } -int HighContrastStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const +int HighContrastStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const { //### TODO: Use the tab metrics changes from Ker. switch(m) @@ -1647,7 +1661,7 @@ int HighContrastStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const } default: - return KStyle::pixelMetric(m, widget); + return KStyle::pixelMetric(m, ceData, elementFlags, widget); } } @@ -1663,10 +1677,12 @@ int HighContrastStyle::kPixelMetric( KStylePixelMetric kpm, const TQWidget *widg } } -TQSize HighContrastStyle::tqsizeFromContents( ContentsType contents, - const TQWidget* widget, +TQSize HighContrastStyle::sizeFromContents( ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentSize, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget* widget ) const { switch (contents) { @@ -1676,8 +1692,8 @@ TQSize HighContrastStyle::tqsizeFromContents( ContentsType contents, const TQPushButton* button = (const TQPushButton*) widget; int w = contentSize.width(); int h = contentSize.height(); - int bm = pixelMetric( PM_ButtonMargin, widget ); - int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2; + int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ); + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2; w += bm + fw + 6; // ### Add 6 to make way for bold font. h += bm + fw; @@ -1688,7 +1704,7 @@ TQSize HighContrastStyle::tqsizeFromContents( ContentsType contents, w = 80; // Compensate for default indicator - int di = pixelMetric( PM_ButtonDefaultIndicator ); + int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags ); w += di * 2; h += di * 2; } @@ -1713,7 +1729,7 @@ TQSize HighContrastStyle::tqsizeFromContents( ContentsType contents, case CT_ComboBox: { const TQComboBox *cb = static_cast< const TQComboBox* > (widget); int borderSize = (cb->editable() ? 4 : 2) * basicLineWidth; - int arrowSize = pixelMetric (PM_ScrollBarExtent, cb); + int arrowSize = pixelMetric (PM_ScrollBarExtent, ceData, elementFlags, cb); return TQSize(borderSize + basicLineWidth + arrowSize, borderSize) + contentSize; } @@ -1783,11 +1799,11 @@ TQSize HighContrastStyle::tqsizeFromContents( ContentsType contents, default: - return KStyle::tqsizeFromContents( contents, widget, contentSize, opt ); + return KStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget ); } } -TQRect HighContrastStyle::subRect (SubRect subrect, const TQWidget * widget) const +TQRect HighContrastStyle::subRect (SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget * widget) const { switch (subrect) { case SR_ProgressBarGroove: @@ -1795,7 +1811,7 @@ TQRect HighContrastStyle::subRect (SubRect subrect, const TQWidget * widget) con case SR_ProgressBarLabel: return widget->rect(); default: - return KStyle::subRect (subrect, widget); + return KStyle::subRect (subrect, ceData, elementFlags, widget); } } diff --git a/kstyles/highcontrast/highcontrast.h b/kstyles/highcontrast/highcontrast.h index 48a7c6e92..4d853e705 100644 --- a/kstyles/highcontrast/highcontrast.h +++ b/kstyles/highcontrast/highcontrast.h @@ -61,14 +61,18 @@ class HighContrastStyle : public KStyle void drawKStylePrimitive( KStylePrimitive kpe, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; void tqdrawPrimitive( TQ_PrimitiveElement pe, TQPainter* p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, @@ -76,38 +80,48 @@ class HighContrastStyle : public KStyle void drawControl( TQ_ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; void drawControlMask( TQ_ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; void drawComplexControl( TQ_ComplexControl control, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, SCFlags controls = SC_All, SCFlags active = SC_None, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; void drawComplexControlMask( TQ_ComplexControl control, TQPainter *p, - const TQWidget *widget, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; TQRect querySubControlMetrics( TQ_ComplexControl control, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption& opt = TQStyleOption::Default ) const; + const TQStyleOption& opt = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; void drawItem( TQPainter *p, @@ -120,18 +134,20 @@ class HighContrastStyle : public KStyle int len = -1, const TQColor *penColor = 0 ) const; - int pixelMetric( PixelMetric m, + int pixelMetric( PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; int kPixelMetric( KStylePixelMetric m, const TQWidget *widget = 0 ) const; - TQSize tqsizeFromContents( ContentsType contents, - const TQWidget *widget, + TQSize sizeFromContents( ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentSize, - const TQStyleOption& opt ) const; + const TQStyleOption& opt, + const TQWidget *widget = 0 ) const; - TQRect subRect (SubRect subrect, const TQWidget * widget) const; + TQRect subRect (SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget * widget) const; protected: bool eventFilter( TQObject *object, TQEvent *event ); diff --git a/kstyles/keramik/keramik.cpp b/kstyles/keramik/keramik.cpp index 3156ab307..0b1ddd9a9 100644 --- a/kstyles/keramik/keramik.cpp +++ b/kstyles/keramik/keramik.cpp @@ -147,8 +147,8 @@ namespace p->save(); /*if ( down ) - p->translate( pixelMetric( PM_ButtonShiftHorizontal ), - pixelMetric( PM_ButtonShiftVertical ) ); + p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ), + pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) ); */ if ( enabled ) { @@ -189,7 +189,7 @@ void KeramikStyle::renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup &cg, } // XXX -TQRect KeramikStyle::subRect(SubRect r, const TQWidget *widget) const +TQRect KeramikStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const { // We want the focus rect for buttons to be adjusted from // the Qt3 defaults to be similar to Qt 2's defaults. @@ -215,7 +215,7 @@ TQRect KeramikStyle::subRect(SubRect r, const TQWidget *widget) const case SR_ComboBoxFocusRect: { - return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ); + return querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget ); } case SR_CheckBoxFocusRect: @@ -240,14 +240,16 @@ TQRect KeramikStyle::subRect(SubRect r, const TQWidget *widget) const } default: - return KStyle::subRect( r, widget ); + return KStyle::subRect( r, ceData, elementFlags, widget ); } } TQPixmap KeramikStyle::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_TitleBarMinButton: @@ -270,7 +272,7 @@ TQPixmap KeramikStyle::stylePixmap(StylePixmap stylepixmap, break; } - return KStyle::stylePixmap(stylepixmap, widget, opt); + return KStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget); } @@ -533,8 +535,10 @@ static void renderToolbarWidgetBackground(TQPainter* painter, const TQWidget* wi } // This function draws primitive elements as well as their masks. -void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, +void KeramikStyle::drawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, @@ -750,8 +754,8 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, case PE_HeaderArrow: if ( flags & Style_Up ) - tqdrawPrimitive( PE_ArrowUp, p, r, cg, Style_Enabled ); - else tqdrawPrimitive( PE_ArrowDown, p, r, cg, Style_Enabled ); + drawPrimitive( PE_ArrowUp, p, ceData, elementFlags, r, cg, Style_Enabled ); + else drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, r, cg, Style_Enabled ); break; @@ -972,13 +976,13 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, return; } } - KStyle::tqdrawPrimitive(pe, p, r, cg, flags, opt); + KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); break; } case PE_WindowFrame: { bool sunken = flags & Style_Sunken; - int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) + int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) : opt.lineWidth(); if (lw == 2) { @@ -1001,7 +1005,7 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, p->drawLine(x+1, y+1, x+1, y2-1); p->setPen(oldPen); } else - KStyle::tqdrawPrimitive(pe, p, r, cg, flags, opt); + KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); break; } @@ -1016,7 +1020,7 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, int x2 = r.x()+r.width()-1; int y2 = r.y()+r.height()-1; - int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) + int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) : opt.lineWidth(); if (lw) { @@ -1036,7 +1040,7 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, int y = r.y(); int x2 = r.x() + r.width() - 1; int y2 = r.y() + r.height() - 1; - int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) + int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) : opt.lineWidth(); if (lw) @@ -1142,8 +1146,8 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, p->save(); if ( flags & Style_Down ) - p->translate( pixelMetric( PM_ButtonShiftHorizontal ), - pixelMetric( PM_ButtonShiftVertical ) ); + p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ), + pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) ); if ( flags & Style_Enabled ) { @@ -1164,18 +1168,20 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, } else - KStyle::tqdrawPrimitive( pe, p, r, cg, flags, opt ); + KStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); } } } void KeramikStyle::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 { bool disabled = ( flags & Style_Enabled ) == 0; int x, y, w, h; @@ -1299,7 +1305,7 @@ void KeramikStyle::drawKStylePrimitive( KStylePrimitive kpe, default: - KStyle::drawKStylePrimitive( kpe, p, widget, r, cg, flags, opt); + KStyle::drawKStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget); } } @@ -1327,11 +1333,13 @@ bool KeramikStyle::isFormWidget(const TQWidget* widget) const void KeramikStyle::drawControl( TQ_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 { bool disabled = ( flags & Style_Enabled ) == 0; int x, y, w, h; @@ -1356,14 +1364,14 @@ void KeramikStyle::drawControl( TQ_ControlElement element, if ( btn->isDefault( ) && !flatMode ) { - tqdrawPrimitive( PE_ButtonDefault, p, r, cg, flags ); + drawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags ); } else { if (widget->parent() && widget->parent()->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) toolbarBlendWidget = widget; - tqdrawPrimitive( PE_ButtonCommand, p, r, cg, flags ); + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags ); toolbarBlendWidget = 0; } @@ -1383,15 +1391,15 @@ void KeramikStyle::drawControl( TQ_ControlElement element, // 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 ); + int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget ); if ( button->iconSet() && !button->iconSet()->isNull() && (dx + button->iconSet()->pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w ) { @@ -1399,7 +1407,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element, } else { - tqdrawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ), + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ), cg, flags, opt ); w -= dx; } @@ -1448,7 +1456,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element, } if (cornArrow) //Draw over the icon - tqdrawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ), + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ), cg, flags, opt ); } @@ -1458,8 +1466,8 @@ void KeramikStyle::drawControl( TQ_ControlElement element, &button->colorGroup().buttonText() ); if ( flags & Style_HasFocus ) - tqdrawPrimitive( PE_FocusRect, p, - visualRect( subRect( SR_PushButtonFocusRect, widget ), widget ), + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, + visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ), cg, flags ); break; } @@ -1488,7 +1496,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element, // nr.setWidth(r.width()-2); //Account for shadow } - KStyle::drawControl(element, p, widget, nr, cg, flags, opt); + KStyle::drawControl(element, p, ceData, elementFlags, nr, cg, flags, opt, widget); break; } @@ -1553,8 +1561,8 @@ void KeramikStyle::drawControl( TQ_ControlElement element, tb->orientation() == Qt::Horizontal); } else - KStyle::drawControl( (TQ_ControlElement)CE_DockWindowEmptyArea, p, - widget, r, cg, flags, opt ); + KStyle::drawControl( (TQ_ControlElement)CE_DockWindowEmptyArea, p, ceData, elementFlags, + r, cg, flags, opt, widget ); break; } case CE_MenuBarEmptyArea: @@ -1609,7 +1617,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element, bool enabled = mi->isEnabled(); bool checkable = popupmenu->isCheckable(); bool active = flags & Style_Active; - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); bool reverse = TQApplication::reverseLayout(); if ( checkable ) checkcol = QMAX( checkcol, 20 ); @@ -1682,7 +1690,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element, SFlags cflags = Style_Default; cflags |= active ? Style_Enabled : Style_On; - tqdrawPrimitive( PE_CheckMark, p, cr, cg, cflags ); + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags ); } // Time to draw the menu item label... @@ -1789,7 +1797,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element, // Does the menu item have a submenu? if ( mi->popup() ) { TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; - int dim = pixelMetric(PM_MenuButtonIndicator) - itemFrame; + int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags) - itemFrame; TQRect vr = visualRect( TQRect( x + w - arrowHMargin - itemFrame - dim, y + h / 2 - dim / 2, dim, dim), r ); @@ -1801,16 +1809,16 @@ void KeramikStyle::drawControl( TQ_ControlElement element, TQColorGroup g2( discol, cg.highlight(), white, white, enabled ? white : discol, discol, white ); - tqdrawPrimitive( arrow, p, vr, g2, Style_Enabled ); + drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled ); } else - tqdrawPrimitive( arrow, p, vr, cg, + drawPrimitive( arrow, p, ceData, elementFlags, vr, cg, enabled ? Style_Enabled : Style_Default ); } break; } case CE_ProgressBarContents: { 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(); @@ -1916,19 +1924,21 @@ void KeramikStyle::drawControl( TQ_ControlElement element, default: - KStyle::drawControl(element, p, widget, r, cg, flags, opt); + KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); } } void KeramikStyle::drawControlMask( TQ_ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget *widget ) const { p->fillRect(r, color1); maskMode = true; - drawControl( element, p, widget, r, TQApplication::palette().active(), TQStyle::Style_Default, opt); + drawControl( element, p, ceData, elementFlags, r, TQApplication::palette().active(), TQStyle::Style_Default, opt, widget); maskMode = false; } @@ -1946,13 +1956,15 @@ bool KeramikStyle::isSizeConstrainedCombo(const TQComboBox* combo) const void KeramikStyle::drawComplexControl( TQ_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 { bool disabled = ( flags & Style_Enabled ) == 0; switch(control) @@ -2016,7 +2028,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, if ( widget == hoverWidget ) flags |= Style_MouseOver; - tqdrawPrimitive( PE_ButtonCommand, p2, br, cg, flags ); + drawPrimitive( PE_ButtonCommand, p2, ceData, elementFlags, br, cg, flags ); toolbarBlendWidget = 0; } @@ -2030,18 +2042,18 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, if ( active ) flags |= Style_On; - TQRect ar = querySubControlMetrics( CC_ComboBox, widget, - SC_ComboBoxArrow ); + TQRect ar = querySubControlMetrics( CC_ComboBox, ceData, elementFlags, + SC_ComboBoxArrow, TQStyleOption::Default, widget ); if (!compact) { ar.setWidth(ar.width()-13); TQRect rr = visualRect( TQRect( ar.x(), ar.y() + 4, loader.size(keramik_ripple ).width(), ar.height() - 8 ), - widget ); + ceData, elementFlags ); ar = visualRect( TQRect( ar.x() + loader.size( keramik_ripple ).width() + 4, ar.y(), 11, ar.height() ), - widget ); + ceData, elementFlags ); TQPointArray a; @@ -2056,7 +2068,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, else //Size-constrained combo -- loose the ripple. { ar.setWidth(ar.width() - 7); - ar = visualRect( TQRect( ar.x(), ar.y(), 11, ar.height() ), widget); + ar = visualRect( TQRect( ar.x(), ar.y(), 11, ar.height() ), ceData, elementFlags); TQPointArray a; a.setPoints(TQCOORDARRLEN(keramik_combo_arrow), keramik_combo_arrow); @@ -2071,20 +2083,20 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, { if ( cb->editable() ) { - TQRect er = visualRect( querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ), widget ); + TQRect er = visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget ), ceData, elementFlags ); er.addCoords( -2, -2, 2, 2 ); p2->fillRect( er, cg.base() ); - tqdrawPrimitive( PE_PanelLineEdit, p2, er, cg ); + drawPrimitive( PE_PanelLineEdit, p2, ceData, elementFlags, er, cg ); Keramik::RectTilePainter( keramik_frame_shadow, false, false, 2, 2 ).draw( p2, er, cg.button(), Qt::black, false, pmodeFullBlend() ); } else if ( cb->hasFocus() ) { - TQRect re = TQStyle::visualRect(subRect(SR_ComboBoxFocusRect, cb), widget); + TQRect re = TQStyle::visualRect(subRect(SR_ComboBoxFocusRect, ceData, elementFlags, cb), ceData, elementFlags); if ( compact ) re.addCoords( 3, 3, 0, -3 ); p2->fillRect( re, cg.brush( TQColorGroup::Highlight ) ); - tqdrawPrimitive( PE_FocusRect, p2, re, cg, + drawPrimitive( PE_FocusRect, p2, ceData, elementFlags, re, cg, Style_FocusAtBorder, TQStyleOption( cg.highlight() ) ); } // TQComboBox draws the text on its own and uses the painter's current colors @@ -2115,7 +2127,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, case CC_SpinWidget: { const TQSpinWidget* sw = static_cast< const TQSpinWidget* >( widget ); - TQRect br = visualRect( querySubControlMetrics( (TQ_ComplexControl)CC_SpinWidget, widget, SC_SpinWidgetButtonField ), widget ); + TQRect br = visualRect( querySubControlMetrics( (TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetButtonField, TQStyleOption::Default, widget ), ceData, elementFlags ); if ( controls & SC_SpinWidgetButtonField ) { Keramik::SpinBoxPainter().draw( p, br, cg.button(), cg.background(), !sw->isEnabled() ); @@ -2130,7 +2142,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, } if ( controls & SC_SpinWidgetFrame ) - tqdrawPrimitive( PE_PanelLineEdit, p, r, cg ); + drawPrimitive( PE_PanelLineEdit, p, ceData, elementFlags, r, cg ); break; } @@ -2146,14 +2158,14 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, TQRect slider, subpage, addpage, subline, addline; if ( sb->minValue() == sb->maxValue() ) flags &= ~Style_Enabled; - slider = querySubControlMetrics( control, widget, SC_ScrollBarSlider, opt ); - subpage = querySubControlMetrics( control, widget, SC_ScrollBarSubPage, opt ); - addpage = querySubControlMetrics( control, widget, SC_ScrollBarAddPage, opt ); - subline = querySubControlMetrics( control, widget, SC_ScrollBarSubLine, opt ); - addline = querySubControlMetrics( control, widget, SC_ScrollBarAddLine, opt ); + slider = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget ); + subpage = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget ); + addpage = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget ); + subline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget ); + addline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget ); if ( controls & SC_ScrollBarSubLine ) - tqdrawPrimitive( PE_ScrollBarSubLine, p, subline, cg, + drawPrimitive( PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, flags | ( ( active & SC_ScrollBarSubLine ) ? Style_Down : 0 ) ); TQRegion clip; @@ -2174,21 +2186,21 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, p->setClipRect( slider.x(), slider.y(), addpage.right() - slider.x() + 1, slider.height() ); else p->setClipRect( slider.x(), slider.y(), slider.width(), addpage.bottom() - slider.y() + 1 ); - tqdrawPrimitive( PE_ScrollBarSlider, p, slider, cg, + drawPrimitive( PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, flags | ( ( active == SC_ScrollBarSlider ) ? Style_Down : 0 ) ); } p->setClipping( false ); if ( controls & ( SC_ScrollBarSubLine | SC_ScrollBarAddLine ) ) { - tqdrawPrimitive( PE_ScrollBarAddLine, p, addline, cg, flags ); + drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, flags ); if ( active & SC_ScrollBarSubLine ) { if ( horizontal ) p->setClipRect( TQRect( addline.x(), addline.y(), addline.width() / 2, addline.height() ) ); else p->setClipRect( TQRect( addline.x(), addline.y(), addline.width(), addline.height() / 2 ) ); - tqdrawPrimitive( PE_ScrollBarAddLine, p, addline, cg, flags | Style_Down ); + drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, flags | Style_Down ); } else if ( active & SC_ScrollBarAddLine ) { @@ -2196,7 +2208,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, p->setClipRect( TQRect( addline.x() + addline.width() / 2, addline.y(), addline.width() / 2, addline.height() ) ); else p->setClipRect( TQRect( addline.x(), addline.y() + addline.height() / 2, addline.width(), addline.height() / 2 ) ); - tqdrawPrimitive( PE_ScrollBarAddLine, p, addline, cg, flags | Style_Down ); + drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, flags | Style_Down ); } } @@ -2224,8 +2236,8 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, } TQRect button, menuarea; - button = querySubControlMetrics(control, widget, SC_ToolButton, opt); - menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); + button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget); + menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget); SFlags bflags = flags, mflags = flags; @@ -2251,7 +2263,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, if (!onToolbar && !onControlButtons) bflags |= Style_Horizontal; - tqdrawPrimitive( PE_ButtonTool, p, button, cg, + drawPrimitive( PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt); } @@ -2295,14 +2307,14 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, if (controls & SC_ToolButtonMenu) { if (mflags & (Style_Down | Style_On | Style_Raised)) - tqdrawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, opt); - tqdrawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, opt); + drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt); + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt); } if (toolbutton->hasFocus() && !toolbutton->focusProxy()) { TQRect fr = toolbutton->rect(); fr.addCoords(3, 3, -3, -3); - tqdrawPrimitive(PE_FocusRect, p, fr, cg); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg); } titleBarMode = None; @@ -2313,8 +2325,8 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, case CC_TitleBar: titleBarMode = Regular; //Handle buttons on titlebar different from toolbuttons default: - KStyle::drawComplexControl( control, p, widget, - r, cg, flags, controls, active, opt ); + KStyle::drawComplexControl( control, p, ceData, elementFlags, + r, cg, flags, controls, active, opt, widget ); titleBarMode = None; } @@ -2322,16 +2334,18 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control, void KeramikStyle::drawComplexControlMask( TQ_ComplexControl control, TQPainter *p, - const TQWidget *widget, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget *widget ) const { if (control == CC_ComboBox) { maskMode = true; - drawComplexControl(CC_ComboBox, p, widget, r, + drawComplexControl(CC_ComboBox, p, ceData, elementFlags, r, TQApplication::palette().active(), Style_Default, - SC_ComboBoxFrame,SC_None, opt); + SC_ComboBoxFrame,SC_None, opt, widget); maskMode = false; } @@ -2340,7 +2354,7 @@ void KeramikStyle::drawComplexControlMask( TQ_ComplexControl control, } -int KeramikStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const +int KeramikStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const { switch(m) { @@ -2410,15 +2424,17 @@ int KeramikStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const return titleBarH; default: - return KStyle::pixelMetric(m, widget); + return KStyle::pixelMetric(m, ceData, elementFlags, widget); } } -TQSize KeramikStyle::tqsizeFromContents( ContentsType contents, - const TQWidget* widget, +TQSize KeramikStyle::sizeFromContents( ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentSize, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget* widget ) const { switch (contents) { @@ -2428,8 +2444,8 @@ TQSize KeramikStyle::tqsizeFromContents( ContentsType contents, { const TQPushButton* btn = static_cast< const TQPushButton* >( widget ); - int w = contentSize.width() + 2 * pixelMetric( PM_ButtonMargin, widget ); - int h = contentSize.height() + 2 * pixelMetric( PM_ButtonMargin, widget ); + int w = contentSize.width() + 2 * pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ); + int h = contentSize.height() + 2 * pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ); if ( btn->text().isEmpty() && contentSize.width() < 32 ) return TQSize( w, h ); @@ -2451,7 +2467,7 @@ TQSize KeramikStyle::tqsizeFromContents( ContentsType contents, } else { - return KStyle::tqsizeFromContents( contents, widget, contentSize, opt ); + return KStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget ); } } @@ -2520,20 +2536,22 @@ TQSize KeramikStyle::tqsizeFromContents( ContentsType contents, } default: - return KStyle::tqsizeFromContents( contents, widget, contentSize, opt ); + return KStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget ); } } TQStyle::SubControl KeramikStyle::querySubControl( TQ_ComplexControl control, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQPoint& point, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget* widget ) const { - SubControl result = KStyle::querySubControl( control, widget, point, opt ); + SubControl result = KStyle::querySubControl( control, ceData, elementFlags, point, opt, widget ); if ( control == CC_ScrollBar && result == SC_ScrollBarAddLine ) { - TQRect addline = querySubControlMetrics( control, widget, result, opt ); + TQRect addline = querySubControlMetrics( control, ceData, elementFlags, result, opt, widget ); if ( static_cast< const TQScrollBar* >( widget )->orientation() == Qt::Horizontal ) { if ( point.x() < addline.center().x() ) result = SC_ScrollBarSubLine; @@ -2544,9 +2562,11 @@ TQStyle::SubControl KeramikStyle::querySubControl( TQ_ComplexControl control, } TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget* widget ) const { switch ( control ) { @@ -2623,7 +2643,7 @@ TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control, { int range = sb->maxValue() - sb->minValue(); sliderlen = ( sb->pageStep() * maxlen ) / ( range + sb->pageStep() ); - slidermin = pixelMetric( PM_ScrollBarSliderMin, sb ); + slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, sb ); if ( sliderlen < slidermin ) sliderlen = slidermin; if ( sliderlen > maxlen ) sliderlen = maxlen; } @@ -2666,9 +2686,9 @@ TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control, bool horizontal = sl->orientation() == Qt::Horizontal; TQSlider::TickSetting ticks = sl->tickmarks(); int pos = sl->sliderStart(); - int size = pixelMetric( PM_SliderControlThickness, widget ); - int handleSize = pixelMetric( PM_SliderThickness, widget ); - int len = pixelMetric( PM_SliderLength, widget ); + int size = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); + int handleSize = pixelMetric( PM_SliderThickness, ceData, elementFlags, widget ); + int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); //Shrink the metrics if the widget is too small //to fit our normal values for them. @@ -2721,7 +2741,7 @@ TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control, } default: break; } - return KStyle::querySubControlMetrics( control, widget, subcontrol, opt ); + return KStyle::querySubControlMetrics( control, ceData, elementFlags, subcontrol, opt, widget ); } diff --git a/kstyles/keramik/keramik.h b/kstyles/keramik/keramik.h index e177d56f8..c4c77b371 100644 --- a/kstyles/keramik/keramik.h +++ b/kstyles/keramik/keramik.h @@ -48,7 +48,7 @@ public: virtual ~KeramikStyle(); void renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup &cg, const TQPopupMenu* ) const; - TQPixmap stylePixmap(StylePixmap stylepixmap, const TQWidget* widget, const TQStyleOption& opt) const; + TQPixmap stylePixmap(StylePixmap stylepixmap, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption& opt, const TQWidget* widget = 0) const; void polish( TQWidget* widget ); void unPolish( TQWidget* widget ); @@ -57,14 +57,18 @@ public: void drawKStylePrimitive( KStylePrimitive kpe, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect& r, const TQColorGroup& cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; - void tqdrawPrimitive( TQ_PrimitiveElement pe, + void drawPrimitive( TQ_PrimitiveElement pe, TQPainter* p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect& r, const TQColorGroup& cg, SFlags flags = Style_Default, @@ -72,50 +76,64 @@ public: void drawControl( TQ_ControlElement element, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect& r, const TQColorGroup& cg, SFlags flags = Style_Default, - const TQStyleOption& opt = TQStyleOption::Default ) const; + const TQStyleOption& opt = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; void drawControlMask( TQ_ControlElement element, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect& r, - const TQStyleOption& opt = TQStyleOption::Default ) const; + const TQStyleOption& opt = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; void drawComplexControl( TQ_ComplexControl control, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect& r, const TQColorGroup& cg, SFlags flags = Style_Default, SCFlags controls = SC_All, SCFlags active = SC_None, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; void drawComplexControlMask( TQ_ComplexControl control, TQPainter* p, - const TQWidget* widget, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect& r, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; - int pixelMetric( PixelMetric m, const TQWidget* widget = 0 ) const; + int pixelMetric( PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget* widget = 0 ) const; - TQSize tqsizeFromContents( ContentsType contents, - const TQWidget* widget, + TQSize sizeFromContents( ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize& contentSize, - const TQStyleOption& opt ) const; + const TQStyleOption& opt, + const TQWidget* widget = 0 ) const; SubControl querySubControl( TQ_ComplexControl control, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQPoint& point, - const TQStyleOption& opt = TQStyleOption::Default ) const; + const TQStyleOption& opt = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; TQRect querySubControlMetrics( TQ_ComplexControl control, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption& opt = TQStyleOption::Default ) const; + const TQStyleOption& opt = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; private slots: //Animation slots. @@ -194,7 +212,7 @@ private: // For progress bar animation TQTimer *animationTimer; - TQRect subRect(SubRect r, const TQWidget *widget) const; + TQRect subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const; // Disable copy constructor and = operator KeramikStyle( const KeramikStyle& ); diff --git a/kstyles/kthemestyle/kthemebase.h b/kstyles/kthemestyle/kthemebase.h index 7b60b1016..b0ebbfaff 100644 --- a/kstyles/kthemestyle/kthemebase.h +++ b/kstyles/kthemestyle/kthemebase.h @@ -508,88 +508,100 @@ protected: /** These are included for fuuture extension purposes.. */ - virtual int pixelMetric ( PixelMetric metric, const TQWidget * widget = 0 ) const + virtual int pixelMetric ( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * widget = 0 ) const { - return KStyle::pixelMetric( metric, widget ); + return KStyle::pixelMetric( metric, ceData, elementFlags, widget ); } - virtual void drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRect & r, const TQColorGroup & cg, + virtual void drawPrimitive ( PrimitiveElement pe, TQPainter * p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect & r, const TQColorGroup & cg, SFlags flags = Style_Default, const TQStyleOption& option = TQStyleOption::Default ) const { - KStyle::tqdrawPrimitive ( pe, p, r, cg, + KStyle::tqdrawPrimitive ( pe, p, ceData, elementFlags, r, cg, flags, option ); } virtual void drawControl( TQ_ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags how = Style_Default, - const TQStyleOption& opt = TQStyleOption::Default ) const + const TQStyleOption& opt = TQStyleOption::Default, + const TQWidget *widget = 0 ) const { - KStyle::drawControl( element, p, widget, - r, cg, how, opt ); + KStyle::drawControl( element, p, ceData, elementFlags, + r, cg, how, opt, widget ); } virtual void drawControlMask( TQ_ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption& opt = TQStyleOption::Default ) const + const TQStyleOption& opt = TQStyleOption::Default, + const TQWidget *widget = 0 ) const { - KStyle::drawControlMask( element, p, widget, r, opt ); + KStyle::drawControlMask( element, p, ceData, elementFlags, r, opt, widget ); } virtual void drawComplexControl( TQ_ComplexControl control, TQPainter *p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, SCFlags controls = SC_All, SCFlags active = SC_None, - const TQStyleOption& opt = TQStyleOption::Default ) const + const TQStyleOption& opt = TQStyleOption::Default, + const TQWidget* widget = 0 ) const { - KStyle::drawComplexControl( control, p, widget, r, cg, flags, controls, active, opt ); + KStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget ); } virtual void drawKStylePrimitive( KStylePrimitive kpe, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& opt = TQStyleOption::Default ) const + const TQStyleOption& opt = TQStyleOption::Default, + const TQWidget* widget = 0 ) const { KStyle::drawKStylePrimitive( kpe, - p, widget, r, - cg, flags, opt ); + p, ceData, elementFlags, r, + cg, flags, opt, widget ); } - virtual int styleHint( StyleHint sh, - const TQWidget *widget = 0, + virtual int styleHint( StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption& opt = TQStyleOption::Default, - TQStyleHintReturn* returnData = 0 ) const + TQStyleHintReturn* returnData = 0, + const TQWidget *widget = 0 ) const { return KStyle::styleHint( sh, - widget, + ceData, + elementFlags, opt, - returnData ); + returnData, + widget ); } - virtual TQSize tqsizeFromContents( ContentsType contents, - const TQWidget *widget, + virtual TQSize sizeFromContents( ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentsSize, - const TQStyleOption& opt = TQStyleOption::Default ) const + const TQStyleOption& opt = TQStyleOption::Default, + const TQWidget *widget = 0 ) const { - return KStyle::tqsizeFromContents( contents, - widget, contentsSize, opt ); + return KStyle::sizeFromContents( contents, + ceData, elementFlags, contentsSize, opt, widget ); } private: diff --git a/kstyles/kthemestyle/kthemestyle.cpp b/kstyles/kthemestyle/kthemestyle.cpp index bd482cffc..3d5a7d149 100644 --- a/kstyles/kthemestyle/kthemestyle.cpp +++ b/kstyles/kthemestyle/kthemestyle.cpp @@ -161,7 +161,7 @@ public: KDE_Q_EXPORT_PLUGIN( KThemeStylePlugin ) -void kDrawWindowsArrow ( TQPainter *p, const TQStyle* style, TQStyle::PrimitiveElement pe, bool down, +void kDrawWindowsArrow ( TQPainter *p, const TQStyleControlElementData ceData, const TQStyle::ControlElementFlags elementFlags, const TQStyle* style, TQStyle::PrimitiveElement pe, bool down, int x, int y, int w, int h, const TQColorGroup &cg, bool enabled ) { @@ -186,8 +186,8 @@ void kDrawWindowsArrow ( TQPainter *p, const TQStyle* style, TQStyle::PrimitiveE p->save(); if ( down ) { - p->translate( style->pixelMetric( TQStyle::PM_ButtonShiftHorizontal ), - style->pixelMetric( TQStyle::PM_ButtonShiftVertical ) ); + p->translate( style->pixelMetric( TQStyle::PM_ButtonShiftHorizontal, ceData, elementFlags ), + style->pixelMetric( TQStyle::PM_ButtonShiftVertical, ceData, elementFlags ) ); } if ( enabled ) @@ -212,10 +212,12 @@ void kDrawWindowsArrow ( TQPainter *p, const TQStyle* style, TQStyle::PrimitiveE -TQSize KThemeStyle::tqsizeFromContents( ContentsType contents, - const TQWidget* widget, +TQSize KThemeStyle::sizeFromContents( ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentSize, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget* widget ) const { switch ( contents ) { @@ -226,8 +228,8 @@ TQSize KThemeStyle::tqsizeFromContents( ContentsType contents, const TQPushButton * button = ( const TQPushButton* ) widget; int w = contentSize.width(); int h = contentSize.height(); - int bm = pixelMetric( PM_ButtonMargin, widget ); - int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2; + int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ); + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2; w += bm + fw + 6; // ### Add 6 to make way for bold font. h += bm + fw; @@ -304,12 +306,12 @@ TQSize KThemeStyle::tqsizeFromContents( ContentsType contents, } default: - return KThemeBase::tqsizeFromContents( contents, widget, contentSize, opt ); + return KThemeBase::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget ); } } -TQRect KThemeStyle::subRect(SubRect sr, const TQWidget* widget) const +TQRect KThemeStyle::subRect(SubRect sr, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget* widget) const { if (sr == SR_CheckBoxFocusRect) { @@ -320,18 +322,18 @@ TQRect KThemeStyle::subRect(SubRect sr, const TQWidget* widget) const { TQRect bounding = cb->rect(); - int cw = pixelMetric(PM_IndicatorWidth, widget); - int ch = pixelMetric(PM_IndicatorHeight, widget); + int cw = pixelMetric(PM_IndicatorWidth, ceData, elementFlags, widget); + int ch = pixelMetric(PM_IndicatorHeight, ceData, elementFlags, widget); TQRect checkbox(bounding.x() + 2, bounding.y() + 2 + (bounding.height() - ch)/2, cw - 4, ch - 4); return checkbox; } } - return KStyle::subRect(sr, widget); + return KStyle::subRect(sr, ceData, elementFlags, widget); } -int KThemeStyle::pixelMetric ( PixelMetric metric, const TQWidget * widget ) const +int KThemeStyle::pixelMetric ( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * widget ) const { switch ( metric ) { @@ -361,26 +363,26 @@ int KThemeStyle::pixelMetric ( PixelMetric metric, const TQWidget * widget ) con if ( isPixmap( ExIndicatorOn ) ) return ( uncached( ExIndicatorOn ) ->size().width() ); else - return KThemeBase::pixelMetric ( metric, widget ); + return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget ); case PM_ExclusiveIndicatorHeight: if ( isPixmap( ExIndicatorOn ) ) return ( uncached( ExIndicatorOn ) ->size().height() ); else - return KThemeBase::pixelMetric ( metric, widget ); + return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget ); case PM_IndicatorWidth: if ( isPixmap( IndicatorOn ) ) return ( uncached( IndicatorOn ) ->size().width() ); else - return KThemeBase::pixelMetric ( metric, widget ); + return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget ); case PM_IndicatorHeight: if ( isPixmap( IndicatorOn ) ) return ( uncached( IndicatorOn ) ->size().height() ); else - return KThemeBase::pixelMetric ( metric, widget ); + return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget ); case PM_SliderLength: return ( sliderButtonLength() ); @@ -389,7 +391,7 @@ int KThemeStyle::pixelMetric ( PixelMetric metric, const TQWidget * widget ) con return ( splitWidth() ); default: - return KThemeBase::pixelMetric ( metric, widget ); + return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget ); } } @@ -700,7 +702,7 @@ void KThemeStyle::drawBaseButton( TQPainter *p, int x, int y, int w, int h, p->setPen( oldPen ); } -void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRect & r, const TQColorGroup & g_base, +void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect & r, const TQColorGroup & g_base, SFlags flags, const TQStyleOption & opt ) const { bool handled = false; @@ -761,7 +763,7 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRe // Standard arrow types if ( arrowType() == MotifArrow ) { - mtfstyle->tqdrawPrimitive( pe, p, r, g, flags, opt ); + mtfstyle->drawPrimitive( pe, p, ceData, elementFlags, r, g, flags, opt ); handled = true; } @@ -791,8 +793,8 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRe p->save(); if ( flags & Style_Down ) - p->translate( pixelMetric( PM_ButtonShiftHorizontal ), - pixelMetric( PM_ButtonShiftVertical ) ); + p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ), + pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) ); if ( flags & Style_Enabled ) { @@ -1006,7 +1008,7 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRe *colorGroup( g, down ? ScrollButtonDown : ScrollButton ), down, false, down ? ScrollButtonDown : ScrollButton ); - tqdrawPrimitive( ( horizontal ) ? PE_ArrowRight : PE_ArrowDown, p , + drawPrimitive( ( horizontal ) ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags , TQRect( r.x() + 3, r.y() + 3, r.width() - 6, r.height() - 6 ), *colorGroup( g, down ? ScrollButtonDown : ScrollButton ), flags ); @@ -1021,7 +1023,7 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRe *colorGroup( g, down ? ScrollButtonDown : ScrollButton ), down, false, down ? ScrollButtonDown : ScrollButton ); - tqdrawPrimitive( ( horizontal ) ? PE_ArrowLeft : PE_ArrowUp, p , + drawPrimitive( ( horizontal ) ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags , TQRect( r.x() + 3, r.y() + 3, r.width() - 6, r.height() - 6 ), *colorGroup( g, down ? ScrollButtonDown : ScrollButton ), flags ); @@ -1069,7 +1071,7 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRe } if ( !handled ) - KThemeBase::drawPrimitive ( pe, p, r, g, + KThemeBase::drawPrimitive ( pe, p, ceData, elementFlags, r, g, flags, opt ); } @@ -1099,11 +1101,13 @@ TQPixmap* KThemeStyle::makeMenuBarCache(int w, int h) const void KThemeStyle::drawControl( ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags how , - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget *widget ) const { bool handled = false; int x, y, w, h; @@ -1116,7 +1120,7 @@ void KThemeStyle::drawControl( ControlElement element, { const TQPushButton * btn = ( const TQPushButton* ) widget; bool sunken = btn->isOn() || btn->isDown(); - int diw = pixelMetric( PM_ButtonDefaultIndicator, btn ); + int diw = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, btn ); drawBaseButton( p, diw, diw, w - 2 * diw, h - 2 * diw, *colorGroup( btn->colorGroup(), sunken ? PushButtonDown : PushButton ), sunken, roundButton(), @@ -1135,16 +1139,16 @@ void KThemeStyle::drawControl( ControlElement element, // 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 ); how |= Style_Sunken; } // Does the button have a popup menu? if ( button->isMenuButton() ) { - int dx = pixelMetric( PM_MenuButtonIndicator, widget ); - tqdrawPrimitive( PE_ArrowDown, p, TQRect( x + w - dx - 2, y + 2, dx, h - 4 ), + int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget ); + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect( x + w - dx - 2, y + 2, dx, h - 4 ), cg, how, opt ); w -= dx; } @@ -1219,8 +1223,8 @@ void KThemeStyle::drawControl( ControlElement element, // Draw a focus rect if the button has focus if ( how & Style_HasFocus ) - tqdrawPrimitive( PE_FocusRect, p, - TQStyle::visualRect( subRect( SR_PushButtonFocusRect, widget ), widget ), + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, + TQStyle::visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ), cg, how ); handled = true; break; @@ -1229,7 +1233,7 @@ void KThemeStyle::drawControl( ControlElement element, case CE_MenuBarEmptyArea: { //Expand to cover entire region - tqdrawPrimitive(PE_PanelMenuBar, p, + drawPrimitive(PE_PanelMenuBar, p, ceData, elementFlags, TQRect(0,0,r.width()+r.x()*2, r.height()+r.y()*2), cg, Style_Default); handled = true; @@ -1440,7 +1444,7 @@ void KThemeStyle::drawControl( ControlElement element, bool enabled = (mi? mi->isEnabled():true); bool checkable = popupmenu->isCheckable(); bool active = how & Style_Active; - bool etchtext = styleHint( SH_EtchDisabledText, 0 ); + bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags, TQStyleOption::Default, 0, 0 ); bool reverse = TQApplication::reverseLayout(); const TQColorGroup& cg_ours = *colorGroup( cg, active ? MenuItemDown : MenuItem ); @@ -1531,7 +1535,7 @@ void KThemeStyle::drawControl( ControlElement element, SFlags cflags = Style_Default; cflags |= active ? Style_Enabled : Style_On; - tqdrawPrimitive( PE_CheckMark, p, TQRect( cx + itemFrame, y + itemFrame, + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame, checkcol - itemFrame * 2, h - itemFrame * 2 ), cg_ours, cflags ); } @@ -1656,10 +1660,10 @@ void KThemeStyle::drawControl( ControlElement element, TQColorGroup g2( discol, cg_ours.highlight(), white, white, enabled ? white : discol, discol, white ); - tqdrawPrimitive( arrow, p, vr, g2, Style_Enabled | Style_Down ); + drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled | Style_Down ); } else - tqdrawPrimitive( arrow, p, vr, cg_ours, + drawPrimitive( arrow, p, ceData, elementFlags, vr, cg_ours, enabled ? Style_Enabled : Style_Default ); } handled = true; @@ -1681,7 +1685,7 @@ void KThemeStyle::drawControl( ControlElement element, case CE_ProgressBarContents: { 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(); @@ -1737,15 +1741,17 @@ void KThemeStyle::drawControl( ControlElement element, if ( !handled ) KThemeBase::drawControl( element, - p, widget, r, cg, how, opt ); + p, ceData, elementFlags, r, cg, how, opt, widget ); } void KThemeStyle::drawControlMask( ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget *widget ) const { bool handled = false; int x, y, w, h; @@ -1766,18 +1772,20 @@ void KThemeStyle::drawControlMask( ControlElement element, if ( !handled ) KThemeBase::drawControlMask( element, - p, widget, r, opt ); + p, ceData, elementFlags, r, opt, widget ); } void KThemeStyle::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 { bool handled = false; int x, y, w, h; @@ -1942,8 +1950,8 @@ void KThemeStyle::drawKStylePrimitive( KStylePrimitive kpe, if ( !handled ) { - KThemeBase::drawKStylePrimitive( kpe, p, widget, - r, cg, flags, opt ); + KThemeBase::drawKStylePrimitive( kpe, p, ceData, elementFlags, + r, cg, flags, opt, widget ); } } @@ -1951,10 +1959,10 @@ void KThemeStyle::drawKStylePrimitive( KStylePrimitive kpe, -void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, const TQWidget * widget, +void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect & r, const TQColorGroup & g, SFlags how , SCFlags controls, SCFlags active, - const TQStyleOption & opt ) const + const TQStyleOption & opt, const TQWidget * widget ) const { bool handled = false; int x, y, w, h; @@ -1970,8 +1978,8 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, { const TQToolButton * toolbutton = ( const TQToolButton * ) widget; TQRect button, menu; - button = querySubControlMetrics( control, widget, SC_ToolButton, opt ); - menu = querySubControlMetrics( control, widget, SC_ToolButtonMenu, opt ); + button = querySubControlMetrics( control, ceData, elementFlags, SC_ToolButton, opt, widget ); + menu = querySubControlMetrics( control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget ); if ( controls & SC_ToolButton ) @@ -1986,12 +1994,12 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, if ( controls & SC_ToolButtonMenu ) { - tqdrawPrimitive( PE_ArrowDown, p, menu, g, how ); + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, menu, g, how ); /* if ( enabled ) - kDrawWindowsArrow(p, this, PE_ArrowDown, false, menu.x(), menu.y(), menu.width(), menu.height(), + kDrawWindowsArrow(p, ceData, elementFlags, this, PE_ArrowDown, false, menu.x(), menu.y(), menu.width(), menu.height(), g, true ); else - kDrawWindowsArrow(p, this, PE_ArrowDown, false, menu.x(), menu.y(), menu.width(), menu.height(), + kDrawWindowsArrow(p, ceData, elementFlags, this, PE_ArrowDown, false, menu.x(), menu.y(), menu.width(), menu.height(), g, false );*/ } @@ -1999,7 +2007,7 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, { TQRect fr = toolbutton->rect(); fr.addCoords( 3, 3, -3, -3 ); - tqdrawPrimitive( PE_FocusRect, p, fr, g ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, g ); } handled = true; @@ -2024,8 +2032,8 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, { bool sunken = ( active == SC_ComboBoxArrow ); TQRect ar = TQStyle::visualRect( - querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxArrow ), - widget ); + querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget ), + ceData, elementFlags ); ar.rect( &x, &y, &w, &h ); WidgetType widget = sunken ? ComboBoxDown : ComboBox; @@ -2042,7 +2050,7 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, else { - mtfstyle->tqdrawPrimitive( PE_ArrowDown, p, TQRect( x, y, w, h ), *colorGroup( g, widget ), sunken ? ( how | Style_Sunken ) : how, opt ); + mtfstyle->drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect( x, y, w, h ), *colorGroup( g, widget ), sunken ? ( how | Style_Sunken ) : how, opt ); qDrawShadeRect( p, x, y, w, h, *colorGroup( g, widget ) ); //w-14, y+7+(h-15), 10, 3, } controls ^= SC_ComboBoxArrow; @@ -2059,11 +2067,11 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, //Here, we don't do add page, subpage, etc., TQRect addline, subline, subline2, groove, slider; - subline = querySubControlMetrics( control, widget, SC_ScrollBarSubLine, opt ); - addline = querySubControlMetrics( control, widget, SC_ScrollBarAddLine, opt ); - groove = querySubControlMetrics( control, widget, SC_ScrollBarGroove, opt ); + subline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget ); + addline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget ); + groove = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarGroove, opt, widget ); - slider = querySubControlMetrics( control, widget, SC_ScrollBarSlider, opt ); + slider = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget ); subline2 = addline; TQPixmap buf( sb->width(), sb->height() ); @@ -2072,7 +2080,7 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, if ( groove.isValid() ) { p2.fillRect( groove, TQColor( 255, 0, 0 ) ); - tqdrawPrimitive( PE_ScrollBarSubPage, &p2, groove, g, + drawPrimitive( PE_ScrollBarSubPage, &p2, ceData, elementFlags, groove, g, sflags | ( ( active == SC_ScrollBarSubPage ) ? Style_Down : Style_Default ) ); } @@ -2081,19 +2089,19 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, // Draw the up/left button set if ( subline.isValid() ) { - tqdrawPrimitive( PE_ScrollBarSubLine, &p2, subline, g, + drawPrimitive( PE_ScrollBarSubLine, &p2, ceData, elementFlags, subline, g, sflags | ( active == SC_ScrollBarSubLine ? Style_Down : Style_Default ) ); } if ( addline.isValid() ) - tqdrawPrimitive( PE_ScrollBarAddLine, &p2, addline, g, + drawPrimitive( PE_ScrollBarAddLine, &p2, ceData, elementFlags, addline, g, sflags | ( ( active == SC_ScrollBarAddLine ) ? Style_Down : Style_Default ) ); if ( slider.isValid() ) { //(controls & SC_ScrollBarSlider) && - tqdrawPrimitive( PE_ScrollBarSlider, &p2, slider, g, + drawPrimitive( PE_ScrollBarSlider, &p2, ceData, elementFlags, slider, g, sflags | ( ( active == SC_ScrollBarSlider ) ? Style_Down : Style_Default ) ); // Draw focus rect @@ -2101,7 +2109,7 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, { TQRect fr( slider.x() + 2, slider.y() + 2, slider.width() - 5, slider.height() - 5 ); - tqdrawPrimitive( PE_FocusRect, &p2, fr, g, Style_Default ); + drawPrimitive( PE_FocusRect, &p2, ceData, elementFlags, fr, g, Style_Default ); } p2.end(); bitBlt( p->device(), x, y, &buf ); @@ -2116,10 +2124,10 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, if ( !handled ) { - KThemeBase::drawComplexControl ( control, p, widget, + KThemeBase::drawComplexControl ( control, p, ceData, elementFlags, r, g, how , controls, active, - opt ); + opt, widget ); } } @@ -2185,7 +2193,7 @@ void KThemeStyle::drawBaseMask( TQPainter *p, int x, int y, int w, int h, p->fillRect( x, y, w, h, fillBrush ); } -int KThemeStyle::styleHint( StyleHint sh, const TQWidget *w, const TQStyleOption &opt, TQStyleHintReturn *shr ) const +int KThemeStyle::styleHint( StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *shr, const TQWidget *w ) const { switch ( sh ) { @@ -2207,7 +2215,7 @@ int KThemeStyle::styleHint( StyleHint sh, const TQWidget *w, const TQStyleOption return NoBackground; default: - return KThemeBase::styleHint( sh, w, opt, shr ); + return KThemeBase::styleHint( sh, ceData, elementFlags, opt, shr, w ); }; } diff --git a/kstyles/kthemestyle/kthemestyle.h b/kstyles/kthemestyle/kthemestyle.h index 6c2c0e332..ea162d966 100644 --- a/kstyles/kthemestyle/kthemestyle.h +++ b/kstyles/kthemestyle/kthemestyle.h @@ -79,57 +79,69 @@ public: KThemeStyle( const TQString& configDir, const TQString &configFile = TQString::null ); ~KThemeStyle(); - virtual int pixelMetric ( PixelMetric metric, const TQWidget * widget = 0 ) const; + virtual int pixelMetric ( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * widget = 0 ) const; - virtual void drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRect & r, const TQColorGroup & cg, + virtual void drawPrimitive ( PrimitiveElement pe, TQPainter * p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect & r, const TQColorGroup & cg, SFlags flags = Style_Default, const TQStyleOption& = TQStyleOption::Default ) const; virtual void drawControl( ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags how = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; virtual void drawControlMask( ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; virtual void drawComplexControl( TQ_ComplexControl control, TQPainter *p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, SCFlags controls = SC_All, SCFlags active = SC_None, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; virtual void drawKStylePrimitive( KStylePrimitive kpe, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; virtual int styleHint( StyleHint sh, - const TQWidget *widget = 0, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQStyleOption& = TQStyleOption::Default, - TQStyleHintReturn* returnData = 0 ) const; + TQStyleHintReturn* returnData = 0, + const TQWidget *widget = 0 ) const; - virtual TQSize tqsizeFromContents( ContentsType contents, - const TQWidget *widget, + virtual TQSize sizeFromContents( ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentsSize, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; - virtual TQRect subRect(SubRect, const TQWidget *) const; + virtual TQRect subRect(SubRect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *) const; virtual void polish( TQWidget* ); virtual void unPolish( TQWidget* ); diff --git a/kstyles/light/lightstyle-v2.cpp b/kstyles/light/lightstyle-v2.cpp index d00233d95..7908b2e8d 100644 --- a/kstyles/light/lightstyle-v2.cpp +++ b/kstyles/light/lightstyle-v2.cpp @@ -129,8 +129,10 @@ static void drawLightBevel(TQPainter *p, const TQRect &r, const TQColorGroup &cg if (fill) p->fillRect(br, *fill); } -void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe, +void LightStyleV2::drawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, @@ -367,7 +369,7 @@ void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe, p->drawLine(r.left() + 6, r.top() + 2, r.right() - 6, r.top() + 2); } } else - TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); + TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data); break; } @@ -406,39 +408,39 @@ void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe, case PE_WindowFrame: { int lw = data.isDefault() ? - pixelMetric(PM_DefaultFrameWidth) : data.lineWidth(); + pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) : data.lineWidth(); if ( ! ( flags & Style_Sunken ) ) flags |= Style_Raised; if (lw == 2) drawLightBevel(p, r, cg, flags); else - TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); + TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data); break; } case PE_PanelDockWindow: { int lw = data.isDefault() ? - pixelMetric(PM_DockWindowFrameWidth) : data.lineWidth(); + pixelMetric(PM_DockWindowFrameWidth, ceData, elementFlags) : data.lineWidth(); if (lw == 2) drawLightBevel(p, r, cg, flags | Style_Raised, &cg.brush(TQColorGroup::Button)); else - TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); + TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data); break; } case PE_PanelMenuBar: { int lw = data.isDefault() ? - pixelMetric(PM_MenuBarFrameWidth) : data.lineWidth(); + pixelMetric(PM_MenuBarFrameWidth, ceData, elementFlags) : data.lineWidth(); if (lw == 2) drawLightBevel(p, r, cg, flags, &cg.brush(TQColorGroup::Button)); else - TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); + TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data); break; } @@ -463,7 +465,7 @@ void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe, p->fillRect(fr, cg.brush((flags & Style_Down) ? TQColorGroup::Midlight : TQColorGroup::Background)); - tqdrawPrimitive(pe, p, ar, cg, flags); + drawPrimitive(pe, p, ceData, elementFlags, ar, cg, flags); break; } @@ -488,7 +490,7 @@ void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe, p->fillRect(fr, cg.brush((flags & Style_Down) ? TQColorGroup::Midlight : TQColorGroup::Background)); - tqdrawPrimitive(pe, p, ar, cg, flags); + drawPrimitive(pe, p, ceData, elementFlags, ar, cg, flags); break; } @@ -611,18 +613,20 @@ void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe, } p->restore(); } else - TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); + TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data); break; } } void LightStyleV2::drawControl( TQ_ControlElement control, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, - const TQStyleOption &data ) const + const TQStyleOption &data, + const TQWidget *widget ) const { switch (control) { case CE_TabBarTab: @@ -854,7 +858,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control, p->setPen(cg.text()); 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) | Style_On); TQColor textcolor; @@ -930,7 +934,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control, } if (mi->popup()) - tqdrawPrimitive( (reverse ? PE_ArrowLeft : PE_ArrowRight), p, sr, cg, flags); + drawPrimitive( (reverse ? PE_ArrowLeft : PE_ArrowRight), p, ceData, elementFlags, sr, cg, flags); break; } @@ -969,16 +973,18 @@ void LightStyleV2::drawControl( TQ_ControlElement control, break; default: - TQCommonStyle::drawControl(control, p, widget, r, cg, flags, data); + TQCommonStyle::drawControl(control, p, ceData, elementFlags, r, cg, flags, data, widget); break; } } void LightStyleV2::drawControlMask( TQ_ControlElement control, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &data ) const + const TQStyleOption &data, + const TQWidget *widget ) const { switch (control) { case CE_PushButton: @@ -986,12 +992,12 @@ void LightStyleV2::drawControlMask( TQ_ControlElement control, break; default: - TQCommonStyle::drawControlMask(control, p, widget, r, data); + TQCommonStyle::drawControlMask(control, p, ceData, elementFlags, r, data, widget); break; } } -TQRect LightStyleV2::subRect(SubRect subrect, const TQWidget *widget) const +TQRect LightStyleV2::subRect(SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const { TQRect rect, wrect(widget->rect()); @@ -1001,7 +1007,7 @@ TQRect LightStyleV2::subRect(SubRect subrect, const TQWidget *widget) const const TQPushButton *button = (const TQPushButton *) widget; int dbw1 = 0, dbw2 = 0; if (button->isDefault() || button->autoDefault()) { - dbw1 = pixelMetric(PM_ButtonDefaultIndicator, widget); + dbw1 = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); dbw2 = dbw1 * 2; } @@ -1013,7 +1019,7 @@ TQRect LightStyleV2::subRect(SubRect subrect, const TQWidget *widget) const } default: - rect = TQCommonStyle::subRect(subrect, widget); + rect = TQCommonStyle::subRect(subrect, ceData, elementFlags, widget); } return rect; @@ -1021,13 +1027,15 @@ TQRect LightStyleV2::subRect(SubRect subrect, const TQWidget *widget) const void LightStyleV2::drawComplexControl( TQ_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 &data ) const + const TQStyleOption &data, + const TQWidget* widget ) const { switch (control) { case CC_ComboBox: @@ -1035,17 +1043,17 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control, const TQComboBox *combobox = (const TQComboBox *) widget; TQRect frame, arrow, field; frame = - TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, - SC_ComboBoxFrame, data), - widget); + TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, + SC_ComboBoxFrame, data, widget), + ceData, elementFlags); arrow = - TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, - SC_ComboBoxArrow, data), - widget); + TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, + SC_ComboBoxArrow, data, widget), + ceData, elementFlags); field = - TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, - SC_ComboBoxEditField, data), - widget); + TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, + SC_ComboBoxEditField, data, widget), + ceData, elementFlags); if ((controls & SC_ComboBoxFrame) && frame.isValid()) drawLightBevel(p, frame, cg, flags | Style_Raised, @@ -1055,7 +1063,7 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control, if (active == SC_ComboBoxArrow) p->fillRect(arrow, cg.brush(TQColorGroup::Mid)); arrow.addCoords(4, 2, -2, -2); - tqdrawPrimitive(PE_ArrowDown, p, arrow, cg, flags); + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, arrow, cg, flags); } if ((controls & SC_ComboBoxEditField) && field.isValid()) { @@ -1071,9 +1079,9 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control, if (! combobox->editable()) { p->fillRect( field, cg.brush( TQColorGroup::Highlight ) ); TQRect fr = - TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, widget ), - widget ); - tqdrawPrimitive( PE_FocusRect, p, fr, cg, + TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ), + ceData, elementFlags ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg, flags | Style_FocusAtBorder, TQStyleOption(cg.highlight())); } @@ -1091,8 +1099,8 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control, const TQSpinWidget *spinwidget = (const TQSpinWidget *) widget; TQRect frame, up, down; - frame = querySubControlMetrics((TQ_ComplexControl)CC_SpinWidget, widget, - SC_SpinWidgetFrame, data); + frame = querySubControlMetrics((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags, + SC_SpinWidgetFrame, data, widget); up = spinwidget->upRect(); down = spinwidget->downRect(); @@ -1128,7 +1136,7 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control, up.right() - 1, up.bottom()); up.addCoords(1, 0, 0, 0); - tqdrawPrimitive(pe, p, up, cg, flags | + drawPrimitive(pe, p, ceData, elementFlags, up, cg, flags | ((active == SC_SpinWidgetUp) ? Style_On | Style_Sunken : Style_Raised)); } @@ -1161,7 +1169,7 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control, down.right() - 1, down.bottom()); down.addCoords(1, 0, 0, 0); - tqdrawPrimitive(pe, p, down, cg, flags | + drawPrimitive(pe, p, ceData, elementFlags, down, cg, flags | ((active == SC_SpinWidgetDown) ? Style_On | Style_Sunken : Style_Raised)); } @@ -1175,13 +1183,13 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control, TQRect addline, subline, subline2, addpage, subpage, slider, first, last; bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue()); - 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); + 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; if (scrollbar->orientation() == Qt::Horizontal) @@ -1190,52 +1198,52 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control, subline2.moveBy(0, -addline.height()); if ((controls & SC_ScrollBarSubLine) && subline.isValid()) { - tqdrawPrimitive(PE_ScrollBarSubLine, p, subline, cg, + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, Style_Enabled | ((active == SC_ScrollBarSubLine) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if (subline2.isValid()) - tqdrawPrimitive(PE_ScrollBarSubLine, p, subline2, cg, + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, cg, Style_Enabled | ((active == SC_ScrollBarSubLine) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); } if ((controls & SC_ScrollBarAddLine) && addline.isValid()) - tqdrawPrimitive(PE_ScrollBarAddLine, p, addline, cg, + drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, Style_Enabled | ((active == SC_ScrollBarAddLine) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) - tqdrawPrimitive(PE_ScrollBarSubPage, p, subpage, cg, + drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg, Style_Enabled | ((active == SC_ScrollBarSubPage) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) - tqdrawPrimitive(PE_ScrollBarAddPage, p, addpage, cg, + drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, ((maxedOut) ? Style_Default : Style_Enabled) | ((active == SC_ScrollBarAddPage) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if ((controls & SC_ScrollBarFirst) && first.isValid()) - tqdrawPrimitive(PE_ScrollBarFirst, p, first, cg, + drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, Style_Enabled | ((active == SC_ScrollBarFirst) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if ((controls & SC_ScrollBarLast) && last.isValid()) - tqdrawPrimitive(PE_ScrollBarLast, p, last, cg, + drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, Style_Enabled | ((active == SC_ScrollBarLast) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if ((controls & SC_ScrollBarSlider) && slider.isValid()) { - tqdrawPrimitive(PE_ScrollBarSlider, p, slider, cg, + drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, Style_Enabled | ((active == SC_ScrollBarSlider) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? @@ -1245,7 +1253,7 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control, if (scrollbar->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); } } @@ -1255,14 +1263,14 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control, case CC_Slider: { const TQSlider *slider = (const TQSlider *) widget; - 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); if ((controls & SC_SliderGroove) && groove.isValid()) { if (flags & Style_HasFocus) - tqdrawPrimitive( PE_FocusRect, p, groove, cg ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, groove, cg ); if (slider->orientation() == Qt::Horizontal) { int dh = (groove.height() - 5) / 2; @@ -1285,28 +1293,30 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control, } if (controls & SC_SliderTickmarks) - TQCommonStyle::drawComplexControl(control, p, widget, r, cg, flags, - SC_SliderTickmarks, active, data ); + TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, + SC_SliderTickmarks, active, data, widget ); break; } case CC_ListView: // use the base style for CC_ListView - singleton->basestyle->drawComplexControl(control, p, widget, r, cg, flags, - controls, active, data); + singleton->basestyle->drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, + controls, active, data, widget); break; default: - TQCommonStyle::drawComplexControl(control, p, widget, r, cg, flags, - controls, active, data); + TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, + controls, active, data, widget); break; } } TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl sc, - const TQStyleOption &data ) const + const TQStyleOption &data, + const TQWidget *widget ) const { TQRect ret; @@ -1315,7 +1325,7 @@ TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control, { const TQScrollBar *scrollbar = (const TQScrollBar *) widget; int sliderstart = scrollbar->sliderStart(); - int sbextent = pixelMetric(PM_ScrollBarExtent, widget); + int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget); int maxlen = ((scrollbar->orientation() == Qt::Horizontal) ? scrollbar->width() : scrollbar->height()) - (sbextent * 3); int sliderlen; @@ -1326,7 +1336,7 @@ TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control, sliderlen = (scrollbar->pageStep() * maxlen) / (range + scrollbar->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 ) @@ -1390,7 +1400,7 @@ TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control, } default: - ret = TQCommonStyle::querySubControlMetrics(control, widget, sc, data); + ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget); break; } @@ -1398,11 +1408,13 @@ TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control, } TQStyle::SubControl LightStyleV2::querySubControl( TQ_ComplexControl control, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQPoint &pos, - const TQStyleOption &data ) const + const TQStyleOption &data, + const TQWidget *widget ) const { - TQStyle::SubControl ret = TQCommonStyle::querySubControl(control, widget, pos, data); + TQStyle::SubControl ret = TQCommonStyle::querySubControl(control, ceData, elementFlags, pos, data, widget); // this is an ugly hack, but i really don't care, it's the quickest way to // enabled the third button @@ -1413,7 +1425,7 @@ TQStyle::SubControl LightStyleV2::querySubControl( TQ_ComplexControl control, return ret; } -int LightStyleV2::pixelMetric( PixelMetric metric, +int LightStyleV2::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const { int ret; @@ -1468,7 +1480,7 @@ int LightStyleV2::pixelMetric( PixelMetric metric, case PM_SliderLength: case PM_SliderControlThickness: - ret = singleton->basestyle->pixelMetric( metric, widget ); + ret = singleton->basestyle->pixelMetric( metric, ceData, elementFlags, widget ); break; case PM_MaximumDragDistance: @@ -1476,17 +1488,19 @@ int LightStyleV2::pixelMetric( PixelMetric metric, break; default: - ret = TQCommonStyle::pixelMetric(metric, widget); + ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget); break; } return ret; } -TQSize LightStyleV2::tqsizeFromContents( ContentsType contents, - const TQWidget *widget, +TQSize LightStyleV2::sizeFromContents( ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentsSize, - const TQStyleOption &data ) const + const TQStyleOption &data, + const TQWidget *widget ) const { TQSize ret; @@ -1494,7 +1508,7 @@ TQSize LightStyleV2::tqsizeFromContents( ContentsType contents, case CT_PushButton: { const TQPushButton *button = (const TQPushButton *) widget; - ret = TQCommonStyle::tqsizeFromContents( contents, widget, contentsSize, data ); + ret = TQCommonStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, data, widget ); int w = ret.width(), h = ret.height(); // only expand the button if we are displaying text... @@ -1583,7 +1597,7 @@ TQSize LightStyleV2::tqsizeFromContents( ContentsType contents, } default: - ret = TQCommonStyle::tqsizeFromContents(contents, widget, contentsSize, data); + ret = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, data, widget); break; } @@ -1591,9 +1605,11 @@ TQSize LightStyleV2::tqsizeFromContents( ContentsType contents, } int LightStyleV2::styleHint( TQ_StyleHint stylehint, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQStyleOption &option, - TQStyleHintReturn* returnData ) const + TQStyleHintReturn* returnData, + const TQWidget *widget ) const { int ret; @@ -1615,7 +1631,7 @@ int LightStyleV2::styleHint( TQ_StyleHint stylehint, break; default: - ret = TQCommonStyle::styleHint(stylehint, widget, option, returnData); + ret = TQCommonStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget); break; } @@ -1623,9 +1639,11 @@ int LightStyleV2::styleHint( TQ_StyleHint stylehint, } TQPixmap LightStyleV2::stylePixmap( StylePixmap stylepixmap, - const TQWidget *widget, - const TQStyleOption &data ) const + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, + const TQStyleOption &data, + const TQWidget *widget ) const { - return singleton->basestyle->stylePixmap( stylepixmap, widget, data ); + return singleton->basestyle->stylePixmap( stylepixmap, ceData, elementFlags, data, widget ); } #include "lightstyle-v2.moc" diff --git a/kstyles/light/lightstyle-v2.h b/kstyles/light/lightstyle-v2.h index c4be4c0f3..061ca915f 100644 --- a/kstyles/light/lightstyle-v2.h +++ b/kstyles/light/lightstyle-v2.h @@ -44,41 +44,43 @@ public: void polishPopupMenu( TQPopupMenu * ); - void tqdrawPrimitive(TQ_PrimitiveElement, TQPainter *, const TQRect &, const TQColorGroup &, + void drawPrimitive(TQ_PrimitiveElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, const TQStyleOption & = TQStyleOption::Default ) const; - void drawControl(TQ_ControlElement, TQPainter *, const TQWidget *, const TQRect &, + void drawControl(TQ_ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, - const TQStyleOption & = TQStyleOption::Default ) const; - void drawControlMask(TQ_ControlElement, TQPainter *, const TQWidget *, const TQRect &, - const TQStyleOption & = TQStyleOption::Default) const; + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; + void drawControlMask(TQ_ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0) const; - TQRect subRect(SubRect, const TQWidget *) const; + TQRect subRect(SubRect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *) const; - void drawComplexControl(TQ_ComplexControl, TQPainter *, const TQWidget *, const TQRect &, + void drawComplexControl(TQ_ComplexControl, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, SCFlags = SC_All, SCFlags = SC_None, - const TQStyleOption & = TQStyleOption::Default ) const; + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; - TQRect querySubControlMetrics(TQ_ComplexControl, const TQWidget *, SubControl, - const TQStyleOption & = TQStyleOption::Default ) const; + TQRect querySubControlMetrics(TQ_ComplexControl, TQStyleControlElementData ceData, ControlElementFlags elementFlags, SubControl, + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; - SubControl querySubControl(TQ_ComplexControl, const TQWidget *, const TQPoint &, - const TQStyleOption &data = TQStyleOption::Default ) const; + SubControl querySubControl(TQ_ComplexControl, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQPoint &, + const TQStyleOption &data = TQStyleOption::Default, const TQWidget * = 0 ) const; - int pixelMetric(PixelMetric, const TQWidget * = 0 ) const; + int pixelMetric(PixelMetric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * = 0 ) const; - TQSize tqsizeFromContents(ContentsType, const TQWidget *, const TQSize &, - const TQStyleOption & = TQStyleOption::Default ) const; + TQSize sizeFromContents(ContentsType, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQSize &, + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; - int styleHint(TQ_StyleHint, const TQWidget * = 0, + int styleHint(TQ_StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, - TQStyleHintReturn * = 0 ) const; + TQStyleHintReturn * = 0, const TQWidget * = 0 ) const; TQPixmap stylePixmap( StylePixmap stylepixmap, - const TQWidget* widget = 0, - const TQStyleOption& = TQStyleOption::Default ) const; + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; }; diff --git a/kstyles/light/lightstyle-v3.cpp b/kstyles/light/lightstyle-v3.cpp index 2e6b24c8d..22fce7149 100644 --- a/kstyles/light/lightstyle-v3.cpp +++ b/kstyles/light/lightstyle-v3.cpp @@ -212,8 +212,10 @@ static void drawLightBevel( TQPainter *p, p->fillRect( br, *fill ); } -void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe, +void LightStyleV3::drawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, @@ -278,7 +280,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe, br.addCoords( 1, 1, -1, -1 ); } drawLightBevel( p, br, cg, flags, - pixelMetric( PM_DefaultFrameWidth ) + ( etch ? 1 : 0 ), + pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) + ( etch ? 1 : 0 ), etch, true, fill ); break; } @@ -294,7 +296,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe, fill = &cg.brush(TQColorGroup::Button); } else fill = &cg.brush(TQColorGroup::Background); - drawLightBevel( p, r, cg, flags, pixelMetric( PM_DefaultFrameWidth ), + drawLightBevel( p, r, cg, flags, pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ), false, true, fill ); break; @@ -532,7 +534,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe, case PE_PanelPopup: drawLightBevel( p, r, cg, flags, - ( data.isDefault() ? pixelMetric(PM_DefaultFrameWidth) : + ( data.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) : data.lineWidth() ), false, true ); break; @@ -545,7 +547,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe, int cover = 0; int reallw = ( data.isDefault() ? - pixelMetric( PM_DefaultFrameWidth ) : data.lineWidth() ); + pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) : data.lineWidth() ); cover = reallw - 1; if ( ! ( flags & Style_Sunken ) ) @@ -573,14 +575,14 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe, case PE_PanelDockWindow: drawLightBevel( p, r, cg, flags, ( data.isDefault() ? - pixelMetric(PM_DefaultFrameWidth) : + pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) : data.lineWidth() ), false, false, &cg.brush( TQColorGroup::Button ) ); break; case PE_PanelMenuBar: drawLightBevel( p, r, cg, flags, ( data.isDefault() ? - pixelMetric(PM_MenuBarFrameWidth) : + pixelMetric(PM_MenuBarFrameWidth, ceData, elementFlags) : data.lineWidth() ), false, false, &cg.brush( TQColorGroup::Button ) ); break; @@ -615,7 +617,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe, if ( ! br.isValid() ) break; - tqdrawPrimitive( pe, p, br, cg, flags ); + drawPrimitive( pe, p, ceData, elementFlags, br, cg, flags ); break; } @@ -649,7 +651,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe, if ( ! br.isValid() ) break; - tqdrawPrimitive( pe, p, br, cg, flags ); + drawPrimitive( pe, p, ceData, elementFlags, br, cg, flags ); break; } @@ -799,18 +801,20 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe, } p->restore(); } else - TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); + TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data); break; } } void LightStyleV3::drawControl( TQ_ControlElement control, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, - const TQStyleOption &data ) const + const TQStyleOption &data, + const TQWidget *widget ) const { switch (control) { case CE_TabBarTab: @@ -893,7 +897,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control, p->fillRect( br, cg.background() ); } else - TQCommonStyle::drawControl( control, p, widget, r, cg, flags, data ); + TQCommonStyle::drawControl( control, p, ceData, elementFlags, r, cg, flags, data, widget ); break; } @@ -974,7 +978,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control, p->setPen(cg.text()); 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) | Style_On); TQColor textcolor; @@ -1050,8 +1054,8 @@ void LightStyleV3::drawControl( TQ_ControlElement control, } if (mi->popup()) - tqdrawPrimitive( (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight), - p, sr, cg, flags); + drawPrimitive( (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight), + p, ceData, elementFlags, sr, cg, flags); break; } @@ -1079,21 +1083,23 @@ void LightStyleV3::drawControl( TQ_ControlElement control, } case CE_ProgressBarGroove: - drawLightBevel( p, r, cg, Style_Sunken, pixelMetric( PM_DefaultFrameWidth ), + drawLightBevel( p, r, cg, Style_Sunken, pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ), true, true, &cg.brush( TQColorGroup::Background ) ); break; default: - TQCommonStyle::drawControl(control, p, widget, r, cg, flags, data); + TQCommonStyle::drawControl(control, p, ceData, elementFlags, r, cg, flags, data, widget); break; } } void LightStyleV3::drawControlMask( TQ_ControlElement control, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &data ) const + const TQStyleOption &data, + const TQWidget *widget ) const { switch (control) { case CE_PushButton: @@ -1101,27 +1107,27 @@ void LightStyleV3::drawControlMask( TQ_ControlElement control, break; default: - TQCommonStyle::drawControlMask(control, p, widget, r, data); + TQCommonStyle::drawControlMask(control, p, ceData, elementFlags, r, data, widget); break; } } -TQRect LightStyleV3::subRect(SubRect subrect, const TQWidget *widget) const +TQRect LightStyleV3::subRect(SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const { TQRect rect; switch (subrect) { case SR_PushButtonFocusRect: { - rect = TQCommonStyle::subRect( SR_PushButtonContents, widget ); - int bm = pixelMetric( PM_ButtonMargin, widget ), hbm = bm / 2; + rect = TQCommonStyle::subRect( SR_PushButtonContents, ceData, elementFlags, widget ); + int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ), hbm = bm / 2; rect.addCoords( hbm, hbm, -hbm, -hbm ); break; } case SR_ComboBoxFocusRect: { - rect = TQCommonStyle::subRect( SR_ComboBoxFocusRect, widget ); + rect = TQCommonStyle::subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ); rect.addCoords( -1, -1, 1, 1 ); break; } @@ -1144,7 +1150,7 @@ TQRect LightStyleV3::subRect(SubRect subrect, const TQWidget *widget) const default: - rect = TQCommonStyle::subRect(subrect, widget); + rect = TQCommonStyle::subRect(subrect, ceData, elementFlags, widget); break; } @@ -1153,13 +1159,15 @@ TQRect LightStyleV3::subRect(SubRect subrect, const TQWidget *widget) const void LightStyleV3::drawComplexControl( TQ_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 &data ) const + const TQStyleOption &data, + const TQWidget* widget ) const { switch (control) { case CC_ComboBox: @@ -1167,37 +1175,37 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control, const TQComboBox *combobox = (const TQComboBox *) widget; TQRect frame, arrow, field; frame = - TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, - SC_ComboBoxFrame, data), - widget); + TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, + SC_ComboBoxFrame, data, widget), + ceData, elementFlags); arrow = - TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, - SC_ComboBoxArrow, data), - widget); + TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, + SC_ComboBoxArrow, data, widget), + ceData, elementFlags); field = - TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, - SC_ComboBoxEditField, data), - widget); + TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, + SC_ComboBoxEditField, data, widget), + ceData, elementFlags); if ((controls & SC_ComboBoxFrame) && frame.isValid()) - tqdrawPrimitive( PE_Panel, p, frame, cg, flags | Style_Sunken ); + drawPrimitive( PE_Panel, p, ceData, elementFlags, frame, cg, flags | Style_Sunken ); if ((controls & SC_ComboBoxArrow) && arrow.isValid()) { drawLightEtch( p, arrow, cg.button(), ( active == SC_ComboBoxArrow ) ); arrow.addCoords( 1, 1, -1, -1 ); p->fillRect( arrow, cg.brush( TQColorGroup::Button ) ); arrow.addCoords(3, 1, -1, -1); - tqdrawPrimitive(PE_ArrowDown, p, arrow, cg, flags); + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, arrow, cg, flags); } if ((controls & SC_ComboBoxEditField) && field.isValid()) { if (flags & Style_HasFocus) { if (! combobox->editable()) { TQRect fr = - TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, widget ), - widget ); + TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ), + ceData, elementFlags ); p->fillRect( fr, cg.brush( TQColorGroup::Highlight ) ); - tqdrawPrimitive( PE_FocusRect, p, fr, cg, + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg, flags | Style_FocusAtBorder, TQStyleOption(cg.highlight())); } @@ -1219,13 +1227,13 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control, const TQSpinWidget *spinwidget = (const TQSpinWidget *) widget; TQRect frame, up, down; - frame = querySubControlMetrics((TQ_ComplexControl)CC_SpinWidget, widget, - SC_SpinWidgetFrame, data); + frame = querySubControlMetrics((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags, + SC_SpinWidgetFrame, data, widget); up = spinwidget->upRect(); down = spinwidget->downRect(); if ((controls & SC_SpinWidgetFrame) && frame.isValid()) - tqdrawPrimitive( PE_Panel, p, frame, cg, flags | Style_Sunken ); + drawPrimitive( PE_Panel, p, ceData, elementFlags, frame, cg, flags | Style_Sunken ); if ((controls & SC_SpinWidgetUp) && up.isValid()) { TQ_PrimitiveElement pe = PE_SpinWidgetUp; @@ -1240,7 +1248,7 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control, drawLightEtch( p, up, cg.button(), ( active == SC_SpinWidgetUp ) ); up.addCoords( 1, 0, 0, 0 ); - tqdrawPrimitive(pe, p, up, cg, flags | + drawPrimitive(pe, p, ceData, elementFlags, up, cg, flags | ((active == SC_SpinWidgetUp) ? Style_On | Style_Sunken : Style_Raised)); } @@ -1258,7 +1266,7 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control, drawLightEtch( p, down, cg.button(), ( active == SC_SpinWidgetDown ) ); down.addCoords( 1, 0, 0, 0 ); - tqdrawPrimitive(pe, p, down, cg, flags | + drawPrimitive(pe, p, ceData, elementFlags, down, cg, flags | ((active == SC_SpinWidgetDown) ? Style_On | Style_Sunken : Style_Raised)); } @@ -1272,13 +1280,13 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control, TQRect addline, subline, subline2, addpage, subpage, slider, first, last; bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue()); - 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); + 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; if (scrollbar->orientation() == Qt::Horizontal) @@ -1287,52 +1295,52 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control, subline2.moveBy(0, -addline.height()); if ((controls & SC_ScrollBarSubLine) && subline.isValid()) { - tqdrawPrimitive(PE_ScrollBarSubLine, p, subline, cg, + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, Style_Enabled | ((active == SC_ScrollBarSubLine) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if (subline2.isValid()) - tqdrawPrimitive(PE_ScrollBarSubLine, p, subline2, cg, + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, cg, Style_Enabled | ((active == SC_ScrollBarSubLine) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); } if ((controls & SC_ScrollBarAddLine) && addline.isValid()) - tqdrawPrimitive(PE_ScrollBarAddLine, p, addline, cg, + drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, Style_Enabled | ((active == SC_ScrollBarAddLine) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) - tqdrawPrimitive(PE_ScrollBarSubPage, p, subpage, cg, + drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg, Style_Enabled | ((active == SC_ScrollBarSubPage) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) - tqdrawPrimitive(PE_ScrollBarAddPage, p, addpage, cg, + drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, ((maxedOut) ? Style_Default : Style_Enabled) | ((active == SC_ScrollBarAddPage) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if ((controls & SC_ScrollBarFirst) && first.isValid()) - tqdrawPrimitive(PE_ScrollBarFirst, p, first, cg, + drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, Style_Enabled | ((active == SC_ScrollBarFirst) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if ((controls & SC_ScrollBarLast) && last.isValid()) - tqdrawPrimitive(PE_ScrollBarLast, p, last, cg, + drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, Style_Enabled | ((active == SC_ScrollBarLast) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? Style_Horizontal : 0)); if ((controls & SC_ScrollBarSlider) && slider.isValid()) { - tqdrawPrimitive(PE_ScrollBarSlider, p, slider, cg, + drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, Style_Enabled | ((active == SC_ScrollBarSlider) ? Style_Down : Style_Default) | ((scrollbar->orientation() == Qt::Horizontal) ? @@ -1342,7 +1350,7 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control, if (scrollbar->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); } } @@ -1352,10 +1360,10 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control, case CC_Slider: { const TQSlider *slider = (const TQSlider *) widget; - 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); if ((controls & SC_SliderGroove) && groove.isValid()) { TQColor grooveColor = cg.midlight(); @@ -1374,7 +1382,7 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control, if (flags & Style_HasFocus) { groove.addCoords( -2, -2, 2, 2 ); - tqdrawPrimitive( PE_FocusRect, p, groove, cg, flags ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, groove, cg, flags ); } } @@ -1409,36 +1417,38 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control, } if (controls & SC_SliderTickmarks) - TQCommonStyle::drawComplexControl(control, p, widget, r, cg, flags, - SC_SliderTickmarks, active, data ); + TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, + SC_SliderTickmarks, active, data, widget ); break; } case CC_ListView: // use the base style for CC_ListView - basestyle->drawComplexControl(control, p, widget, r, cg, flags, - controls, active, data); + basestyle->drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, + controls, active, data, widget); break; default: - TQCommonStyle::drawComplexControl(control, p, widget, r, cg, flags, - controls, active, data); + TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, + controls, active, data, widget); break; } } TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl sc, - const TQStyleOption &data ) const + const TQStyleOption &data, + const TQWidget *widget ) const { TQRect ret; switch (control) { case CC_ComboBox: { - int fw = pixelMetric( PM_DefaultFrameWidth, widget ); - int sb = pixelMetric( PM_ScrollBarExtent ); // width of the arrow + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); + int sb = pixelMetric( PM_ScrollBarExtent, ceData, elementFlags ); // width of the arrow switch ( sc ) { case SC_ComboBoxFrame: @@ -1463,7 +1473,7 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control, { const TQScrollBar *scrollbar = (const TQScrollBar *) widget; int sliderstart = scrollbar->sliderStart(); - int sbextent = pixelMetric(PM_ScrollBarExtent, widget); + int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget); int maxlen = ((scrollbar->orientation() == Qt::Horizontal) ? scrollbar->width() : scrollbar->height()) - (sbextent * 3); int sliderlen; @@ -1474,7 +1484,7 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control, sliderlen = (scrollbar->pageStep() * maxlen) / (range + scrollbar->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 ) @@ -1538,8 +1548,8 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control, case CC_Slider: { const TQSlider *slider = (const TQSlider *) widget; - int tickOffset = pixelMetric( PM_SliderTickmarkOffset, widget ); - int thickness = pixelMetric( PM_SliderControlThickness, widget ); + int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); switch ( sc ) { case SC_SliderGroove: @@ -1552,7 +1562,7 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control, case SC_SliderHandle: { int pos = slider->sliderStart(); - int len = pixelMetric( PM_SliderLength, widget ); + int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); if ( slider->orientation() == Qt::Horizontal ) ret.setRect( pos + 2, tickOffset + 2, len - 4, thickness - 4 ); @@ -1562,7 +1572,7 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control, } default: - ret = TQCommonStyle::querySubControlMetrics(control, widget, sc, data); + ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget); break; } @@ -1570,7 +1580,7 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control, } default: - ret = TQCommonStyle::querySubControlMetrics(control, widget, sc, data); + ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget); break; } @@ -1578,12 +1588,14 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control, } TQStyle::SubControl LightStyleV3::querySubControl( TQ_ComplexControl control, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQPoint &pos, - const TQStyleOption &data ) const + const TQStyleOption &data, + const TQWidget *widget ) const { TQStyle::SubControl ret = - TQCommonStyle::querySubControl(control, widget, pos, data); + TQCommonStyle::querySubControl(control, ceData, elementFlags, pos, data, widget); // this is an ugly hack, but i really don't care, it's the quickest way to // enabled the third button @@ -1594,7 +1606,7 @@ TQStyle::SubControl LightStyleV3::querySubControl( TQ_ComplexControl control, return ret; } -int LightStyleV3::pixelMetric( PixelMetric metric, +int LightStyleV3::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const { int ret; @@ -1691,25 +1703,27 @@ int LightStyleV3::pixelMetric( PixelMetric metric, break; default: - ret = TQCommonStyle::pixelMetric(metric, widget); + ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget); break; } return ret; } -TQSize LightStyleV3::tqsizeFromContents( ContentsType contents, - const TQWidget *widget, +TQSize LightStyleV3::sizeFromContents( ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentsSize, - const TQStyleOption &data ) const + const TQStyleOption &data, + const TQWidget *widget ) const { TQSize ret; switch (contents) { case CT_ComboBox: { - int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2; - int sb = pixelMetric( PM_ScrollBarExtent ); // width of the arrow + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2; + int sb = pixelMetric( PM_ScrollBarExtent, ceData, elementFlags ); // width of the arrow int w = contentsSize.width(); int h = contentsSize.height(); @@ -1727,9 +1741,9 @@ TQSize LightStyleV3::tqsizeFromContents( ContentsType contents, case CT_PushButton: { const TQPushButton *button = (const TQPushButton *) widget; - ret = TQCommonStyle::tqsizeFromContents( contents, widget, contentsSize, data ); + ret = TQCommonStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, data, widget ); int w = ret.width(), h = ret.height(); - int dbi = pixelMetric( PM_ButtonDefaultIndicator, widget ) * 2; + int dbi = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget ) * 2; int mw = 80 - dbi, mh = 25 - dbi; // only expand the button if we are displaying text... @@ -1811,7 +1825,7 @@ TQSize LightStyleV3::tqsizeFromContents( ContentsType contents, } default: - ret = TQCommonStyle::tqsizeFromContents(contents, widget, contentsSize, data); + ret = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, data, widget); break; } @@ -1819,9 +1833,11 @@ TQSize LightStyleV3::tqsizeFromContents( ContentsType contents, } int LightStyleV3::styleHint( TQ_StyleHint stylehint, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQStyleOption &option, - TQStyleHintReturn* returnData ) const + TQStyleHintReturn* returnData, + const TQWidget *widget ) const { int ret; @@ -1847,7 +1863,7 @@ int LightStyleV3::styleHint( TQ_StyleHint stylehint, break; default: - ret = TQCommonStyle::styleHint(stylehint, widget, option, returnData); + ret = TQCommonStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget); break; } @@ -1855,9 +1871,11 @@ int LightStyleV3::styleHint( TQ_StyleHint stylehint, } TQPixmap LightStyleV3::stylePixmap( StylePixmap stylepixmap, - const TQWidget *widget, - const TQStyleOption &data ) const + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, + const TQStyleOption &data, + const TQWidget *widget ) const { - return basestyle->stylePixmap( stylepixmap, widget, data ); + return basestyle->stylePixmap( stylepixmap, ceData, elementFlags, data, widget ); } #include "lightstyle-v3.moc" diff --git a/kstyles/light/lightstyle-v3.h b/kstyles/light/lightstyle-v3.h index a07bf6e53..dbdb50ca0 100644 --- a/kstyles/light/lightstyle-v3.h +++ b/kstyles/light/lightstyle-v3.h @@ -48,41 +48,44 @@ public: void polishPopupMenu( TQPopupMenu * ); - void tqdrawPrimitive(TQ_PrimitiveElement, TQPainter *, const TQRect &, const TQColorGroup &, + void drawPrimitive(TQ_PrimitiveElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, const TQStyleOption & = TQStyleOption::Default ) const; - void drawControl(TQ_ControlElement, TQPainter *, const TQWidget *, const TQRect &, + void drawControl(TQ_ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, - const TQStyleOption & = TQStyleOption::Default ) const; - void drawControlMask(TQ_ControlElement, TQPainter *, const TQWidget *, const TQRect &, - const TQStyleOption & = TQStyleOption::Default) const; + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; + void drawControlMask(TQ_ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0) const; - TQRect subRect(SubRect, const TQWidget *) const; + TQRect subRect(SubRect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *) const; - void drawComplexControl(TQ_ComplexControl, TQPainter *, const TQWidget *, const TQRect &, + void drawComplexControl(TQ_ComplexControl, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, SCFlags = SC_All, SCFlags = SC_None, - const TQStyleOption & = TQStyleOption::Default ) const; + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; - TQRect querySubControlMetrics(TQ_ComplexControl, const TQWidget *, SubControl, - const TQStyleOption & = TQStyleOption::Default ) const; + TQRect querySubControlMetrics(TQ_ComplexControl, TQStyleControlElementData ceData, ControlElementFlags elementFlags, SubControl, + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; - SubControl querySubControl(TQ_ComplexControl, const TQWidget *, const TQPoint &, - const TQStyleOption &data = TQStyleOption::Default ) const; + SubControl querySubControl(TQ_ComplexControl, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQPoint &, + const TQStyleOption &data = TQStyleOption::Default, const TQWidget * = 0 ) const; - int pixelMetric(PixelMetric, const TQWidget * = 0 ) const; + int pixelMetric(PixelMetric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * = 0 ) const; - TQSize tqsizeFromContents(ContentsType, const TQWidget *, const TQSize &, - const TQStyleOption & = TQStyleOption::Default ) const; + TQSize sizeFromContents(ContentsType, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQSize &, + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; - int styleHint(TQ_StyleHint, const TQWidget * = 0, + int styleHint(TQ_StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, - TQStyleHintReturn * = 0 ) const; + TQStyleHintReturn * = 0, + const TQWidget * = 0 ) const; TQPixmap stylePixmap( StylePixmap stylepixmap, - const TQWidget* widget = 0, - const TQStyleOption& = TQStyleOption::Default ) const; + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; }; diff --git a/kstyles/plastik/plastik.cpp b/kstyles/plastik/plastik.cpp index 609ec91b2..df61ebe2c 100644 --- a/kstyles/plastik/plastik.cpp +++ b/kstyles/plastik/plastik.cpp @@ -1192,11 +1192,13 @@ void PlastikStyle::renderTab(TQPainter *p, void PlastikStyle::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 { // some "global" vars... const bool enabled = (flags & Style_Enabled); @@ -1357,9 +1359,9 @@ void PlastikStyle::drawKStylePrimitive(KStylePrimitive kpe, p->drawLine( centerx, centery - radius, centerx, centery + radius ); } else if(_drawTriangularExpander) { if( flags & Style_On ) - tqdrawPrimitive(PE_ArrowRight, p, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags); + drawPrimitive(PE_ArrowRight, p, ceData, elementFlags, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags); if( flags & Style_Off ) - tqdrawPrimitive(PE_ArrowDown, p, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags); + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags); } break; @@ -1438,13 +1440,15 @@ void PlastikStyle::drawKStylePrimitive(KStylePrimitive kpe, } default: - KStyle::drawKStylePrimitive(kpe, p, widget, r, cg, flags, opt); + KStyle::drawKStylePrimitive(kpe, p, ceData, elementFlags, r, cg, flags, opt, widget); } } -void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, +void PlastikStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, @@ -1661,7 +1665,7 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, surfaceFlags); p->setPen(cg.foreground()); - tqdrawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, r, cg, flags); + drawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, ceData, elementFlags, r, cg, flags); break; } @@ -1687,7 +1691,7 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, surfaceFlags); p->setPen(cg.foreground()); - tqdrawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, r, cg, flags); + drawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, ceData, elementFlags, r, cg, flags); break; } @@ -1716,7 +1720,7 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, renderSurface(p, TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2), cg.background(), contentColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2), surfaceFlags); - tqdrawPrimitive(PE_CheckMark, p, r, cg, flags); + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, flags); break; } @@ -2098,8 +2102,8 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, const TQWMatrix oldMatrix( p->worldMatrix() ); if (flags & Style_Down) { - p->translate(pixelMetric(PM_ButtonShiftHorizontal), - pixelMetric(PM_ButtonShiftVertical)); + p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags)); } a.translate((r.x()+r.width()/2), (r.y()+r.height()/2)); @@ -2133,7 +2137,7 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, } default: { - return KStyle::tqdrawPrimitive(pe, p, r, cg, flags, opt); + return KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); } } } @@ -2141,11 +2145,13 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, void PlastikStyle::drawControl(TQ_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 { const bool reverseLayout = TQApplication::reverseLayout(); @@ -2337,7 +2343,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element, renderTab(p, r, cg, mouseOver, selected, true, pos, false, cornerWidget); break; default: - KStyle::drawControl(element, p, widget, r, cg, flags, opt); + KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); } break; @@ -2357,12 +2363,12 @@ void PlastikStyle::drawControl(TQ_ControlElement element, TQColorGroup g2 = cg; if (isDefault) g2.setColor(TQColorGroup::Background, cg.background().dark(120) ); - tqdrawPrimitive(PE_ButtonBevel, p, + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, isDefault?TQRect(r.x()+1,r.y()+1,r.width()-2,r.height()-2):r, g2, flags, TQStyleOption(button) ); if (isDefault ) { - tqdrawPrimitive(PE_ButtonDefault, p, r, cg, flags); + drawPrimitive(PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags); } break; @@ -2380,15 +2386,15 @@ void PlastikStyle::drawControl(TQ_ControlElement element, // 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 ); + int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget ); if ( button->iconSet() && !button->iconSet()->isNull() && (dx + button->iconSet()->pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w ) { @@ -2397,7 +2403,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element, else { p->setPen(cg.buttonText()); - tqdrawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ), + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ), cg, flags, opt ); w -= dx; } @@ -2423,7 +2429,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element, p->drawPixmap( x + 4, y + h / 2 - pixmap.height() / 2, pixmap ); if (cornArrow) //Draw over the icon - tqdrawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ), + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ), cg, flags, opt ); @@ -2439,8 +2445,8 @@ void PlastikStyle::drawControl(TQ_ControlElement element, if ( flags & Style_HasFocus ) - tqdrawPrimitive( PE_FocusRect, p, - visualRect( subRect( SR_PushButtonFocusRect, widget ), widget ), + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, + visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ), cg, flags ); break; } @@ -2459,9 +2465,9 @@ void PlastikStyle::drawControl(TQ_ControlElement element, if (active && focused) { if (down) { - tqdrawPrimitive(PE_ButtonTool, p, r, cg, flags|Style_Down, opt); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, flags|Style_Down, opt); } else { - tqdrawPrimitive(PE_ButtonTool, p, r, cg, flags, opt); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, flags, opt); } } @@ -2490,7 +2496,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element, bool enabled = mi->isEnabled(); bool checkable = popupmenu->isCheckable(); bool active = flags & Style_Active; - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); bool reverse = TQApplication::reverseLayout(); if ( checkable ) checkcol = QMAX( checkcol, 20 ); @@ -2562,7 +2568,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element, SFlags cflags = Style_On; if (enabled) cflags |= Style_Enabled; - tqdrawPrimitive( PE_CheckMark, p, cr, cg, cflags ); + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags ); } // Time to draw the menu item label... @@ -2669,7 +2675,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element, // Does the menu item have a submenu? if ( mi->popup() ) { TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; - int dim = pixelMetric(PM_MenuButtonIndicator) - 1; + int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags) - 1; TQRect vr = visualRect( TQRect( r.x() + r.width() - 5 - 1 - dim, r.y() + r.height() / 2 - dim / 2, dim, dim), r ); @@ -2681,9 +2687,9 @@ void PlastikStyle::drawControl(TQ_ControlElement element, TQColorGroup g2( discol, cg.highlight(), white, white, enabled ? white : discol, discol, white ); - tqdrawPrimitive( arrow, p, vr, g2, Style_Enabled ); + drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled ); } else - tqdrawPrimitive( arrow, p, vr, cg, + drawPrimitive( arrow, p, ceData, elementFlags, vr, cg, enabled ? Style_Enabled : Style_Default ); } break; @@ -2706,15 +2712,17 @@ void PlastikStyle::drawControl(TQ_ControlElement element, break; default: - KStyle::drawControl(element, p, widget, r, cg, flags, opt); + KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); } } void PlastikStyle::drawControlMask(TQ_ControlElement element, TQPainter *p, - const TQWidget *w, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &opt) const + const TQStyleOption &opt, + const TQWidget *w) const { switch (element) { case CE_PushButton: { @@ -2725,16 +2733,18 @@ void PlastikStyle::drawControlMask(TQ_ControlElement element, } default: { - KStyle::drawControlMask (element, p, w, r, opt); + KStyle::drawControlMask (element, p, ceData, elementFlags, r, opt, w); } } } void PlastikStyle::drawComplexControlMask(TQ_ComplexControl c, TQPainter *p, - const TQWidget *w, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &o) const + const TQStyleOption &o, + const TQWidget *w) const { switch (c) { case CC_SpinWidget: @@ -2746,20 +2756,22 @@ void PlastikStyle::drawComplexControlMask(TQ_ComplexControl c, break; } default: { - KStyle::drawComplexControlMask (c, p, w, r, o); + KStyle::drawComplexControlMask (c, p, ceData, elementFlags, r, o, w); } } } void PlastikStyle::drawComplexControl(TQ_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 { const bool reverseLayout = TQApplication::reverseLayout(); @@ -2791,7 +2803,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control, if (_inputFocusHighlight && hasFocus && editable && enabled) { - TQRect editField = querySubControlMetrics(control, widget, SC_ComboBoxEditField); + TQRect editField = querySubControlMetrics(control, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget); TQRect editFrame = r; TQRect buttonFrame = r; @@ -2873,7 +2885,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control, cg.background(), buttonColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2), surfaceFlags); if (hasFocus) { - tqdrawPrimitive(PE_FocusRect, p, + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, TQRect(RcontentSurface.x() + 2, RcontentSurface.y() + 2, RcontentSurface.width() - 4, @@ -2912,7 +2924,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control, } p->setPen(cg.foreground()); - tqdrawPrimitive(PE_SpinWidgetDown, p, RbuttonSurface, cg, Style_Default|Style_Enabled|Style_Raised); + drawPrimitive(PE_SpinWidgetDown, p, ceData, elementFlags, RbuttonSurface, cg, Style_Default|Style_Enabled|Style_Raised); // TQComboBox draws the text using cg.text(), we can override this // from here @@ -2927,14 +2939,14 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control, const TQToolButton *tb = (const TQToolButton *) widget; TQRect button, menuarea; - button = querySubControlMetrics(control, widget, SC_ToolButton, opt); - menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); + button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget); + menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget); SFlags bflags = flags, mflags = flags; if (kornMode) { - tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt); break; } else { // don't want to have the buttoncolor as the background... @@ -2951,7 +2963,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control, if (controls & SC_ToolButton) { // If we're pressed, on, or raised... if (bflags & (Style_Down | Style_On | Style_Raised) || widget==hoverWidget ) { - tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt); } else if (tb->parentWidget() && tb->parentWidget()->backgroundPixmap() && !tb->parentWidget()->backgroundPixmap()->isNull()) { @@ -2963,15 +2975,15 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control, // Draw a toolbutton menu indicator if required if (controls & SC_ToolButtonMenu) { if (mflags & (Style_Down | Style_On | Style_Raised)) { - tqdrawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, opt); + drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt); } - tqdrawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, opt); + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt); } if (tb->hasFocus() && !tb->focusProxy()) { TQRect fr = tb->rect(); fr.addCoords(2, 2, -2, -2); - tqdrawPrimitive(PE_FocusRect, p, fr, cg); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg); } // Set the color for the ToolButton menu indicator @@ -3000,7 +3012,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control, const bool heightDividable = ((r.height()%2) == 0); if (_inputFocusHighlight && hasFocus && enabled) { - TQRect editField = querySubControlMetrics(control, widget, SC_SpinWidgetEditField); + TQRect editField = querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetEditField, TQStyleOption::Default, widget); TQRect editFrame = r; TQRect buttonFrame = r; @@ -3031,7 +3043,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control, } else { - renderContour(p, querySubControlMetrics(control, widget, SC_SpinWidgetFrame), + renderContour(p, querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetFrame, TQStyleOption::Default, widget), cg.background(), getColor(cg, ButtonContour, enabled) ); } p->setPen(alphaBlendColors(cg.background(), getColor(cg, ButtonContour, enabled), 50) ); @@ -3095,7 +3107,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control, else pe = PE_SpinWidgetUp; p->setPen(cg.foreground()); - tqdrawPrimitive(pe, p, upRect, cg, sflags); + drawPrimitive(pe, p, ceData, elementFlags, upRect, cg, sflags); sflags = Style_Default | Style_Enabled; if (active == SC_SpinWidgetDown) { @@ -3108,7 +3120,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control, else pe = PE_SpinWidgetDown; p->setPen(cg.foreground()); - tqdrawPrimitive(pe, p, downRect, cg, sflags); + drawPrimitive(pe, p, ceData, elementFlags, downRect, cg, sflags); // thin frame around the input area const TQRect Rcontent = TQRect(reverseLayout?r.left()+1+handleWidth+1:r.left()+1, r.top()+1, @@ -3141,19 +3153,19 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control, } default: - KStyle::drawComplexControl(control, p, widget, + KStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, controls, - active, opt); + active, opt, widget); break; } } -TQRect PlastikStyle::subRect(SubRect r, const TQWidget *widget) const +TQRect PlastikStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const { switch (r) { case SR_ComboBoxFocusRect: { - return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ); + return querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget ); } // Don't use KStyles progressbar subrect @@ -3168,15 +3180,17 @@ TQRect PlastikStyle::subRect(SubRect r, const TQWidget *widget) const } default: { - return KStyle::subRect(r, widget); + return KStyle::subRect(r, ceData, elementFlags, widget); } } } TQRect PlastikStyle::querySubControlMetrics(TQ_ComplexControl control, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption &opt) const + const TQStyleOption &opt, + const TQWidget *widget) const { if (!widget) { return TQRect(); @@ -3191,7 +3205,7 @@ TQRect PlastikStyle::querySubControlMetrics(TQ_ComplexControl control, return TQRect(r.left()+2, r.top()+2, r.width()-4-15-1, r.height()-4); } default: { - return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); + return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); } } break; @@ -3235,18 +3249,18 @@ TQRect PlastikStyle::querySubControlMetrics(TQ_ComplexControl control, return TQRect(buttonsLeft, r.top()+1, bs.width(), r.height()-2); } default: { - return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); + return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); } } break; } default: { - return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); + return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); } } } -int PlastikStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const +int PlastikStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const { switch(m) { // TABS @@ -3343,15 +3357,17 @@ int PlastikStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const } default: - return KStyle::pixelMetric(m, widget); + return KStyle::pixelMetric(m, ceData, elementFlags, widget); } } -TQSize PlastikStyle::tqsizeFromContents(ContentsType t, - const TQWidget *widget, +TQSize PlastikStyle::sizeFromContents(ContentsType t, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &s, - const TQStyleOption &opt) const + const TQStyleOption &opt, + const TQWidget *widget) const { switch (t) { case CT_PopupMenuItem: { @@ -3412,8 +3428,8 @@ TQSize PlastikStyle::tqsizeFromContents(ContentsType t, { const TQPushButton* btn = static_cast<const TQPushButton*>(widget); - int w = s.width() + 2 * pixelMetric(PM_ButtonMargin, widget); - int h = s.height() + 2 * pixelMetric(PM_ButtonMargin, widget); + int w = s.width() + 2 * pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget); + int h = s.height() + 2 * pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget); if ( btn->text().isEmpty() && s.width() < 32 ) return TQSize(w, h); return TQSize( w+25, h+5 ); @@ -3424,27 +3440,29 @@ TQSize PlastikStyle::tqsizeFromContents(ContentsType t, if(widget->parent() && ::tqqt_cast<TQToolBar*>(widget->parent()) ) return TQSize( s.width()+2*4, s.height()+2*4 ); else - return KStyle::tqsizeFromContents (t, widget, s, opt); + return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget); } default: - return KStyle::tqsizeFromContents (t, widget, s, opt); + return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget); } - return KStyle::tqsizeFromContents (t, widget, s, opt); + return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget); } int PlastikStyle::styleHint( TQ_StyleHint stylehint, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQStyleOption &option, - TQStyleHintReturn* returnData ) const + TQStyleHintReturn* returnData, + const TQWidget *widget ) const { switch (stylehint) { case SH_PopupMenu_SubMenuPopupDelay: return 96; // Motif-like delay... default: - return KStyle::styleHint(stylehint, widget, option, returnData); + return KStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget); } } diff --git a/kstyles/plastik/plastik.h b/kstyles/plastik/plastik.h index 3c670d3c0..507222412 100644 --- a/kstyles/plastik/plastik.h +++ b/kstyles/plastik/plastik.h @@ -68,14 +68,18 @@ public: void drawKStylePrimitive(KStylePrimitive kpe, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; - void tqdrawPrimitive(TQ_PrimitiveElement pe, + void drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, @@ -83,49 +87,59 @@ public: void drawControl(TQ_ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; - void drawControlMask( TQ_ControlElement, TQPainter *, const TQWidget *, const TQRect &, const TQStyleOption &) const; + void drawControlMask( TQ_ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQStyleOption &, const TQWidget * = 0) const; void drawComplexControl(TQ_ComplexControl control, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, SCFlags controls = SC_All, SCFlags active = SC_None, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; - int pixelMetric(PixelMetric m, + int pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; - TQRect subRect(SubRect r, + TQRect subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const; TQRect querySubControlMetrics(TQ_ComplexControl control, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption &opt = TQStyleOption::Default ) const; + const TQStyleOption &opt = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; void drawComplexControlMask(TQStyle::TQ_ComplexControl c, TQPainter *p, - const TQWidget *w, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &o=TQStyleOption::Default) const; + const TQStyleOption &o=TQStyleOption::Default, + const TQWidget *w = 0) const; - TQSize tqsizeFromContents(TQStyle::ContentsType t, - const TQWidget *w, + TQSize sizeFromContents(TQStyle::ContentsType t, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &s, - const TQStyleOption &o) const; + const TQStyleOption &o, + const TQWidget *w = 0) const; - int styleHint(TQ_StyleHint, const TQWidget * = 0, + int styleHint(TQ_StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, - TQStyleHintReturn * = 0 ) const; + TQStyleHintReturn * = 0, const TQWidget * = 0 ) const; protected: enum TabPosition |