diff options
Diffstat (limited to 'src/styles/qplatinumstyle.cpp')
-rw-r--r-- | src/styles/qplatinumstyle.cpp | 265 |
1 files changed, 130 insertions, 135 deletions
diff --git a/src/styles/qplatinumstyle.cpp b/src/styles/qplatinumstyle.cpp index 8f9f9ab75..2bc0e4590 100644 --- a/src/styles/qplatinumstyle.cpp +++ b/src/styles/qplatinumstyle.cpp @@ -86,6 +86,8 @@ TQPlatinumStyle::~TQPlatinumStyle() */ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, @@ -98,7 +100,7 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, // sunken... if ( flags & Style_Sunken ) flags ^= Style_Sunken; - drawPrimitive( PE_ButtonBevel, p, r, cg, flags, opt ); + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags, opt ); break; } case PE_ButtonTool: @@ -115,7 +117,7 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, fill = myCG.brush( TQColorGroup::Button ); myCG.setBrush( TQColorGroup::Mid, fill ); - drawPrimitive( PE_ButtonBevel, p, r, myCG, flags, opt ); + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, myCG, flags, opt ); break; } case PE_ButtonBevel: @@ -450,7 +452,7 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, } case PE_Indicator: { - drawPrimitive( PE_ButtonBevel, p, TQRect(r.x(), r.y(), + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect(r.x(), r.y(), r.width() - 2, r.height()), cg, flags ); p->fillRect( r.x() + r.width() - 2, r.y(), 2, r.height(), @@ -606,14 +608,14 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, } case PE_ScrollBarAddLine: { - drawPrimitive( PE_ButtonBevel, p, r, cg, + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | ((flags & Style_Down) ? Style_Sunken : Style_Raised) ); p->setPen( cg.shadow() ); p->drawRect( r ); drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight - : PE_ArrowDown), p, TQRect(r.x() + 2, + : PE_ArrowDown), p, ceData, elementFlags, TQRect(r.x() + 2, r.y() + 2, r.width() - 4, r.height() - 4), @@ -622,14 +624,14 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, } case PE_ScrollBarSubLine: { - drawPrimitive( PE_ButtonBevel, p, r, cg, + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | ((flags & Style_Down) ? Style_Sunken : Style_Raised) ); p->setPen( cg.shadow() ); p->drawRect( r ); drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft - : PE_ArrowUp ), p, TQRect(r.x() + 2, + : PE_ArrowUp ), p, ceData, elementFlags, TQRect(r.x() + 2, r.y() + 2, r.width() - 4, r.height() - 4), @@ -715,14 +717,14 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, { TQPoint bo = p->brushOrigin(); p->setBrushOrigin( r.topLeft() ); - drawPrimitive( PE_ButtonBevel, p, r, cg, Style_Raised ); + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, Style_Raised ); p->setBrushOrigin( bo ); drawRiffles( p, r.x(), r.y(), r.width(), r.height(), cg, flags & Style_Horizontal ); p->setPen( cg.shadow() ); p->drawRect( r ); if ( flags & Style_HasFocus ) { - drawPrimitive( PE_FocusRect, p, TQRect(r.x() + 2, r.y() + 2, + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, TQRect(r.x() + 2, r.y() + 2, r.width() - 5, r.height() - 5 ), cg, flags ); @@ -730,7 +732,7 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, break; } default: - TQWindowsStyle::drawPrimitive( pe, p, r, cg, flags, opt ); + TQWindowsStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); break; } @@ -740,36 +742,36 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, */ void TQPlatinumStyle::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 { switch( element ) { case CE_PushButton: { #ifndef QT_NO_PUSHBUTTON TQColorGroup myCg( cg ); - const TQPushButton *btn; int x1, y1, x2, y2; bool useBevelButton; SFlags flags; flags = Style_Default; - btn = (const TQPushButton*)widget; - p->setBrushOrigin( -widget->backgroundOffset().x(), - -widget->backgroundOffset().y() ); + p->setBrushOrigin( -ceData.bgOffset.x(), + -ceData.bgOffset.y() ); // take care of the flags based on what we know... - if ( btn->isDown() ) + if ( elementFlags & CEF_IsDown ) flags |= Style_Down; - if ( btn->isOn() ) + if ( elementFlags & CEF_IsOn ) flags |= Style_On; - if ( btn->isEnabled() ) + if ( elementFlags & CEF_IsEnabled ) flags |= Style_Enabled; - if ( btn->isDefault() ) + if ( elementFlags & CEF_IsDefault ) flags |= Style_Default; - if (! btn->isFlat() && !(flags & Style_Down)) + if (! ( elementFlags & CEF_IsFlat ) && !(flags & Style_Down)) flags |= Style_Raised; r.coords( &x1, &y1, &x2, &y2 ); @@ -778,28 +780,28 @@ void TQPlatinumStyle::drawControl( ControlElement element, p->setBrush( TQBrush(cg.button(), NoBrush) ); TQBrush fill; - if ( btn->isDown() ) { + if ( elementFlags & CEF_IsDown ) { fill = cg.brush( TQColorGroup::Dark ); // this could be done differently, but this // makes a down Bezel drawn correctly... myCg.setBrush( TQColorGroup::Mid, fill ); - } else if ( btn->isOn() ) { + } else if ( elementFlags & CEF_IsOn ) { fill = TQBrush( cg.mid(), Dense4Pattern ); myCg.setBrush( TQColorGroup::Mid, fill ); } // to quote the old TQPlatinumStlye drawPushButton... // small or square image buttons as well as toggle buttons are // bevel buttons (what a heuristic....) - if ( btn->isToggleButton() - || ( btn->pixmap() && - (btn->width() * btn->height() < 1600 || - TQABS( btn->width() - btn->height()) < 10 )) ) + if ( ( elementFlags & CEF_BiState ) + || ( (!ceData.fgPixmap.isNull()) && + (ceData.rect.width() * ceData.rect.height() < 1600 || + TQABS( ceData.rect.width() - ceData.rect.height()) < 10 )) ) useBevelButton = TRUE; else useBevelButton = FALSE; - int diw = pixelMetric( PM_ButtonDefaultIndicator, widget ); - if ( btn->isDefault() ) { + int diw = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget ); + if ( elementFlags & CEF_IsDefault ) { x1 += 1; y1 += 1; x2 -= 1; @@ -814,37 +816,37 @@ void TQPlatinumStyle::drawControl( ControlElement element, cg2.setColor( TQColorGroup::Button, cg.mid() ); if ( useBevelButton ) { - drawPrimitive( PE_ButtonBevel, p, TQRect( x1, y1, + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1 ), myCg, myFlags, opt ); } else { - drawPrimitive( PE_ButtonCommand, p, TQRect( x1, y1, + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, TQRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1 ), cg2, myFlags, opt ); } } - if ( btn->isDefault() || btn->autoDefault() ) { + if ( ( elementFlags & CEF_IsDefault ) || ( elementFlags & CEF_AutoDefault ) ) { x1 += diw; y1 += diw; x2 -= diw; y2 -= diw; } - if ( !btn->isFlat() || btn->isOn() || btn->isDown() ) { + if ( (!( elementFlags & CEF_IsFlat )) || ( elementFlags & CEF_IsOn ) || ( elementFlags & CEF_IsDown ) ) { if ( useBevelButton ) { // fix for toggle buttons... if ( flags & (Style_Down | Style_On) ) flags |= Style_Sunken; - drawPrimitive( PE_ButtonBevel, p, TQRect( x1, y1, + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1 ), myCg, flags, opt ); } else { - drawPrimitive( PE_ButtonCommand, p, TQRect( x1, y1, + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, TQRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1 ), myCg, flags, opt ); @@ -860,16 +862,14 @@ void TQPlatinumStyle::drawControl( ControlElement element, case CE_PushButtonLabel: { #ifndef QT_NO_PUSHBUTTON - const TQPushButton *btn; bool on; int x, y, w, h; SFlags flags; flags = Style_Default; - btn = (const TQPushButton*)widget; - on = btn->isDown() || btn->isOn(); + on = (( elementFlags & CEF_IsDown ) || ( elementFlags & CEF_IsOn )); r.rect( &x, &y, &w, &h ); - if ( btn->isMenuButton() ) { - int dx = pixelMetric( PM_MenuButtonIndicator, widget ); + if ( elementFlags & CEF_IsMenuWidget ) { + int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget ); TQColorGroup g = cg; int xx = x + w - dx - 4; @@ -884,23 +884,23 @@ void TQPlatinumStyle::drawControl( ControlElement element, p->setPen( g.light() ); p->drawLine( xx + 2, yy + 2, xx + 2, yy + hh - 2 ); } - if ( btn->isEnabled() ) + if ( elementFlags & CEF_IsEnabled ) flags |= Style_Enabled; - drawPrimitive( PE_ArrowDown, p, TQRect(x + w - dx - 1, y + 2, + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect(x + w - dx - 1, y + 2, dx, h - 4), g, flags, opt ); w -= dx; } #ifndef QT_NO_ICONSET - if ( btn->iconSet() && !btn->iconSet()->isNull() ) { - TQIconSet::Mode mode = btn->isEnabled() + if ( !ceData.iconSet.isNull() ) { + TQIconSet::Mode mode = ( elementFlags & CEF_IsEnabled ) ? TQIconSet::Normal : TQIconSet::Disabled; - if ( mode == TQIconSet::Normal && btn->hasFocus() ) + if ( mode == TQIconSet::Normal && ( elementFlags & CEF_HasFocus ) ) mode = TQIconSet::Active; TQIconSet::State state = TQIconSet::Off; - if ( btn->isToggleButton() && btn->isOn() ) + if ( ( elementFlags & CEF_BiState ) && ( elementFlags & CEF_IsOn ) ) state = TQIconSet::On; - TQPixmap pixmap = btn->iconSet()->pixmap( TQIconSet::Small, + TQPixmap pixmap = ceData.iconSet.pixmap( TQIconSet::Small, mode, state ); int pixw = pixmap.width(); int pixh = pixmap.height(); @@ -911,19 +911,19 @@ void TQPlatinumStyle::drawControl( ControlElement element, #endif drawItem( p, TQRect( x, y, w, h ), AlignCenter | ShowPrefix, - btn->colorGroup(), btn->isEnabled(), - btn->pixmap(), btn->text(), -1, - on ? &btn->colorGroup().brightText() - : &btn->colorGroup().buttonText() ); - if ( btn->hasFocus() ) - drawPrimitive( PE_FocusRect, p, - subRect(SR_PushButtonFocusRect, widget), + ceData.colorGroup, ( elementFlags & CEF_IsEnabled ), + (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text, -1, + on ? &ceData.colorGroup.brightText() + : &ceData.colorGroup.buttonText() ); + if ( elementFlags & CEF_HasFocus ) + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, + subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget), cg, flags ); break; #endif } default: - TQWindowsStyle::drawControl( element, p, widget, r, cg, how, opt ); + TQWindowsStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget ); break; } } @@ -932,13 +932,15 @@ void TQPlatinumStyle::drawControl( ControlElement element, */ void TQPlatinumStyle::drawComplexControl( ComplexControl control, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags how, SCFlags sub, SCFlags subActive, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget *widget ) const { switch ( control ) { case CC_ComboBox: @@ -1010,8 +1012,8 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control, p->drawPoint( x + w - 3, y + h - 3 ); if ( sub & SC_ComboBoxArrow ) { - TQRect rTmp = querySubControlMetrics( CC_ComboBox, widget, - SC_ComboBoxArrow, opt ); + TQRect rTmp = querySubControlMetrics( CC_ComboBox, ceData, elementFlags, + SC_ComboBoxArrow, opt, widget ); int xx = rTmp.x(), yy = rTmp.y(), ww = rTmp.width(), @@ -1078,21 +1080,19 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control, } #ifndef QT_NO_COMBOBOX if ( sub & SC_ComboBoxEditField ) { - const TQComboBox *cmb; - cmb = (const TQComboBox*)widget; // sadly this is pretty much the windows code, except // for the first fillRect call... TQRect re = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, - widget, - SC_ComboBoxEditField ), - widget ); - if ( cmb->hasFocus() && !cmb->editable() ) + ceData, elementFlags, + SC_ComboBoxEditField, TQStyleOption::Default, widget ), + ceData, elementFlags ); + if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) p->fillRect( re.x() + 1, re.y() + 1, re.width() - 2, re.height() - 2, cg.brush( TQColorGroup::Highlight ) ); - if ( cmb->hasFocus() ) { + if ( elementFlags & CEF_HasFocus ) { p->setPen( cg.highlightedText() ); p->setBackgroundColor( cg.highlight() ); } else { @@ -1100,16 +1100,16 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control, p->setBackgroundColor( cg.background() ); } - if ( cmb->hasFocus() && !cmb->editable() ) { + if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) { TQRect re = - TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, - cmb ), - widget ); - drawPrimitive( PE_FocusRect, p, re, cg, + TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, + widget ), + ceData, elementFlags ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg, Style_FocusAtBorder, TQStyleOption(cg.highlight())); } - if ( cmb->editable() ) { + if ( elementFlags & CEF_IsEditable ) { // need this for the moment... // was the code in comboButton rect TQRect ir( x + 3, y + 3, @@ -1128,15 +1128,14 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control, case CC_Slider: { #ifndef QT_NO_SLIDER - const TQSlider *slider = (const TQSlider *) widget; - int thickness = pixelMetric( PM_SliderControlThickness, widget ); - int len = pixelMetric( PM_SliderLength, widget ); - int ticks = slider->tickmarks(); + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); + int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); + int ticks = ceData.tickMarkSetting; - TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, - opt), - handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, - opt); + TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, + opt, widget), + handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, + opt, widget); if ((sub & SC_SliderGroove) && groove.isValid()) { p->fillRect( groove, cg.brush(TQColorGroup::Background) ); @@ -1149,16 +1148,16 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control, if ( ticks & TQSlider::Below ) mid -= len / 8; - if ( slider->orientation() == Horizontal ) { + if ( ceData.orientation == Horizontal ) { x = 0; y = groove.y() + mid - 3; - w = slider->width(); + w = ceData.rect.width(); h = 7; } else { x = groove.x() + mid - 3; y = 0; w = 7; - h = slider->height(); + h = ceData.rect.height(); } p->fillRect( x, y, w, h, cg.brush( TQColorGroup::Dark )); @@ -1209,7 +1208,7 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control, // ### end slider groove if ( how & Style_HasFocus ) - drawPrimitive( PE_FocusRect, p, groove, cg ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, groove, cg ); } if ((sub & SC_SliderHandle) && handle.isValid()) { @@ -1224,7 +1223,7 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control, int mx = handle.width() / 2; int my = handle.height() / 2; - if ( slider->orientation() == Vertical ) { + if ( ceData.orientation == Vertical ) { // Background TQBrush oldBrush = p->brush(); p->setBrush( cg.brush( TQColorGroup::Button ) ); @@ -1303,15 +1302,15 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control, } if ( sub & SC_SliderTickmarks ) - TQCommonStyle::drawComplexControl( control, p, widget, r, + TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, how, SC_SliderTickmarks, - subActive, opt ); + subActive, opt, widget ); #endif break; } default: - TQWindowsStyle::drawComplexControl( control, p, widget, r, cg, - how, sub, subActive, opt ); + TQWindowsStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, + how, sub, subActive, opt, widget ); break; } } @@ -1321,18 +1320,18 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control, /*!\reimp */ TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl sc, - const TQStyleOption& opt ) const + const TQStyleOption& opt, + const TQWidget *widget ) const { switch( control ) { #ifndef QT_NO_COMBOBOX case CC_ComboBox: - const TQComboBox *cb; - cb = (const TQComboBox *)widget; switch( sc ) { case SC_ComboBoxArrow: { - TQRect ir = cb->rect(); + TQRect ir = ceData.rect; int xx; if( TQApplication::reverseLayout() ) xx = ir.x(); @@ -1346,22 +1345,20 @@ TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control, #endif #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: { - const TQScrollBar *sb; - sb = (const TQScrollBar *)widget; - int sliderStart = sb->sliderStart(); - int sbextent = pixelMetric( PM_ScrollBarExtent, widget ); - int maxlen = ((sb->orientation() == TQt::Horizontal) ? - sb->width() : sb->height()) - ( sbextent * 2 ); + int sliderStart = ceData.startStep; + int sbextent = pixelMetric( PM_ScrollBarExtent, ceData, elementFlags, widget ); + int maxlen = ((ceData.orientation == TQt::Horizontal) ? + ceData.rect.width() : ceData.rect.height()) - ( sbextent * 2 ); int sliderlen; // calculate length - if ( sb->maxValue() != sb->minValue() ) { - uint range = sb->maxValue() - sb->minValue(); - sliderlen = ( sb->pageStep() * maxlen ) / - ( range + sb->pageStep() ); + if ( ceData.maxSteps != ceData.minSteps ) { + uint range = ceData.maxSteps - ceData.minSteps; + sliderlen = ( ceData.pageStep * maxlen ) / + ( range + ceData.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 ) @@ -1372,33 +1369,33 @@ TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control, switch ( sc ) { case SC_ScrollBarSubLine: - if ( sb->orientation() == TQt::Horizontal ) { - int buttonw = TQMIN( sb->width() / 2, sbextent ); - return TQRect( sb->width() - 2 * buttonw, 0, buttonw, sbextent ); + if ( ceData.orientation == TQt::Horizontal ) { + int buttonw = TQMIN( ceData.rect.width() / 2, sbextent ); + return TQRect( ceData.rect.width() - 2 * buttonw, 0, buttonw, sbextent ); } else { - int buttonh = TQMIN( sb->height() / 2, sbextent ); - return TQRect( 0, sb->height() - 2 * buttonh, sbextent, buttonh ); + int buttonh = TQMIN( ceData.rect.height() / 2, sbextent ); + return TQRect( 0, ceData.rect.height() - 2 * buttonh, sbextent, buttonh ); } case SC_ScrollBarAddLine: - if ( sb->orientation() == TQt::Horizontal ) { - int buttonw = TQMIN( sb->width() / 2, sbextent ); - return TQRect( sb->width() - buttonw, 0, sbextent, buttonw ); + if ( ceData.orientation == TQt::Horizontal ) { + int buttonw = TQMIN( ceData.rect.width() / 2, sbextent ); + return TQRect( ceData.rect.width() - buttonw, 0, sbextent, buttonw ); } else { - int buttonh = TQMIN( sb->height() / 2, sbextent ); - return TQRect(0, sb->height() - buttonh, sbextent, buttonh ); + int buttonh = TQMIN( ceData.rect.height() / 2, sbextent ); + return TQRect(0, ceData.rect.height() - buttonh, sbextent, buttonh ); } case SC_ScrollBarSubPage: - if ( sb->orientation() == TQt::Horizontal ) + if ( ceData.orientation == TQt::Horizontal ) return TQRect( 1, 0, sliderStart, sbextent ); return TQRect( 0, 1, sbextent, sliderStart ); case SC_ScrollBarAddPage: - if ( sb->orientation() == TQt::Horizontal ) + if ( ceData.orientation == TQt::Horizontal ) return TQRect( sliderStart + sliderlen, 0, maxlen - sliderStart - sliderlen, sbextent ); return TQRect( 0, sliderStart + sliderlen, sbextent, maxlen - sliderStart - sliderlen ); case SC_ScrollBarGroove: - if ( sb->orientation() == TQt::Horizontal ) - return TQRect( 1, 0, sb->width() - sbextent * 2, sb->height() ); - return TQRect( 0, 1, sb->width(), sb->height() - sbextent * 2 ); + if ( ceData.orientation == TQt::Horizontal ) + return TQRect( 1, 0, ceData.rect.width() - sbextent * 2, ceData.rect.height() ); + return TQRect( 0, 1, ceData.rect.width(), ceData.rect.height() - sbextent * 2 ); default: break; } @@ -1406,13 +1403,11 @@ TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control, #endif #ifndef QT_NO_SLIDER 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); int mid = thickness / 2; - int ticks = slider->tickmarks(); - int len = pixelMetric( PM_SliderLength, widget ); + int ticks = ceData.tickMarkSetting; + int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); switch ( sc ) { case SC_SliderGroove: @@ -1420,9 +1415,9 @@ TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control, mid += len / 8; if ( ticks & TQSlider::Below ) mid -= len / 8; - if ( slider->orientation() == TQSlider::Horizontal ) - return TQRect( 0, tickOffset, slider->width(), thickness ); - return TQRect( tickOffset, 0, thickness, slider->height() ); + if ( ceData.orientation == TQSlider::Horizontal ) + return TQRect( 0, tickOffset, ceData.rect.width(), thickness ); + return TQRect( tickOffset, 0, thickness, ceData.rect.height() ); default: break; } @@ -1431,13 +1426,13 @@ TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control, default: break; } - return TQWindowsStyle::querySubControlMetrics( control, widget, sc, opt ); + return TQWindowsStyle::querySubControlMetrics( control, ceData, elementFlags, sc, opt, widget ); } /*!\reimp */ -int TQPlatinumStyle::pixelMetric( PixelMetric metric, +int TQPlatinumStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const { int ret; @@ -1466,7 +1461,7 @@ int TQPlatinumStyle::pixelMetric( PixelMetric metric, ret = -1; break; default: - ret = TQWindowsStyle::pixelMetric( metric, widget ); + ret = TQWindowsStyle::pixelMetric( metric, ceData, elementFlags, widget ); break; } return ret; @@ -1474,19 +1469,19 @@ int TQPlatinumStyle::pixelMetric( PixelMetric metric, /*!\reimp */ -TQRect TQPlatinumStyle::subRect( SubRect r, const TQWidget *widget ) const +TQRect TQPlatinumStyle::subRect( SubRect r, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const { TQRect rect; switch ( r ) { case SR_ComboBoxFocusRect: { - TQRect tmpR = widget->rect(); + TQRect tmpR = ceData.rect; rect = TQRect( tmpR.x() + 4, tmpR.y() + 4, tmpR.width() - 8 - 16, tmpR.height() - 8 ); break; } default: - rect = TQWindowsStyle::subRect( r, widget ); + rect = TQWindowsStyle::subRect( r, ceData, elementFlags, widget ); break; } return rect; |