diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kdeext/klearlook.cpp | 646 | ||||
-rw-r--r-- | src/gui/kdeext/klearlook.h | 52 |
2 files changed, 362 insertions, 336 deletions
diff --git a/src/gui/kdeext/klearlook.cpp b/src/gui/kdeext/klearlook.cpp index 835c26a..e2fad81 100644 --- a/src/gui/kdeext/klearlook.cpp +++ b/src/gui/kdeext/klearlook.cpp @@ -518,23 +518,27 @@ hoverSect( TQTC_NO_SECT ) { shadeColors( tqApp->palette().active().button(), button ); } -void KlearlookStyle::polish( TQApplication *app ) { - if ( !qstrcmp( app->argv() [ 0 ], "kicker" ) || !qstrcmp( app->argv() [ 0 ], "appletproxy" ) ) { - themedApp = APP_KICKER; -#if TDE_VERSION >= 0x30200 - - isTransKicker = rounded && kickerIsTrans(); -#endif - - } else if ( !qstrcmp( app->argv() [ 0 ], "korn" ) ) { - themedApp = APP_KORN; -#if TDE_VERSION >= 0x30200 +void KlearlookStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) { + if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) { + TQApplication *app = reinterpret_cast<TQApplication*>(ptr); - isTransKicker = rounded && kickerIsTrans(); -#endif - - } else - themedApp = qstrcmp( tqApp->argv() [ 0 ], "soffice.bin" ) ? APP_OTHER : APP_OPENOFFICE; + if ( !qstrcmp( app->argv() [ 0 ], "kicker" ) || !qstrcmp( app->argv() [ 0 ], "appletproxy" ) ) { + themedApp = APP_KICKER; + #if TDE_VERSION >= 0x30200 + + isTransKicker = rounded && kickerIsTrans(); + #endif + + } else if ( !qstrcmp( app->argv() [ 0 ], "korn" ) ) { + themedApp = APP_KORN; + #if TDE_VERSION >= 0x30200 + + isTransKicker = rounded && kickerIsTrans(); + #endif + + } else + themedApp = qstrcmp( tqApp->argv() [ 0 ], "soffice.bin" ) ? APP_OTHER : APP_OPENOFFICE; + } } void KlearlookStyle::polish( TQPalette &pal ) { @@ -584,176 +588,188 @@ void KlearlookStyle::polish( TQPalette &pal ) { static const char * kdeToolbarWidget = "kde toolbar widget"; -void KlearlookStyle::polish( TQWidget *widget ) { - if ( ::tqqt_cast<TQRadioButton *>( widget ) - || ::tqqt_cast<TQCheckBox *>( widget ) - || ::tqqt_cast<TQSpinWidget *>( widget ) - || widget->inherits( TQSPLITTERHANDLE_OBJECT_NAME_STRING ) ) { - widget->setMouseTracking( true ); - - widget->installEventFilter( this ); - } else if ( ::tqqt_cast<TQButton *>( widget ) || ::tqqt_cast<TQComboBox *>( widget ) || - widget->inherits( "TQToolBarExtensionWidget" ) ) { - widget->setBackgroundMode( TQWidget::PaletteBackground ); - widget->installEventFilter( this ); - - } else if ( ::tqqt_cast<TQMenuBar *>( widget ) - || ::tqqt_cast<TQToolBar *>( widget ) - || ::tqqt_cast<TQPopupMenu *>( widget ) ) - widget->setBackgroundMode( TQWidget::PaletteBackground ); - - else if ( widget->inherits( "KToolBarSeparator" ) ) { - widget->setBackgroundMode( TQWidget::NoBackground ); - widget->installEventFilter( this ); - - } else if ( ::tqqt_cast<TQScrollBar *>( widget ) ) { - widget->setMouseTracking( true ); - widget->installEventFilter( this ); - widget->setBackgroundMode( TQWidget::NoBackground ); - - } else if ( ::tqqt_cast<TQSlider *>( widget ) || ::tqqt_cast<TQHeader *>( widget ) ) { - widget->setMouseTracking( true ); - widget->installEventFilter( this ); - - } else if ( 0 == qstrcmp( widget->name(), kdeToolbarWidget ) ) { - widget->installEventFilter( this ); - widget->setBackgroundMode( TQWidget::NoBackground ); // We paint the whole background. - } +void KlearlookStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) { + if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { + TQWidget *widget = reinterpret_cast<TQWidget*>(ptr); - KStyle::polish( widget ); + if ( ::tqqt_cast<TQRadioButton *>( widget ) + || ::tqqt_cast<TQCheckBox *>( widget ) + || ::tqqt_cast<TQSpinWidget *>( widget ) + || widget->inherits( TQSPLITTERHANDLE_OBJECT_NAME_STRING ) ) { + widget->setMouseTracking( true ); + + installObjectEventHandler(ceData, elementFlags, ptr, this); + } else if ( ::tqqt_cast<TQButton *>( widget ) || ::tqqt_cast<TQComboBox *>( widget ) || + widget->inherits( "TQToolBarExtensionWidget" ) ) { + widget->setBackgroundMode( TQWidget::PaletteBackground ); + installObjectEventHandler(ceData, elementFlags, ptr, this); + + } else if ( ::tqqt_cast<TQMenuBar *>( widget ) + || ::tqqt_cast<TQToolBar *>( widget ) + || ::tqqt_cast<TQPopupMenu *>( widget ) ) + widget->setBackgroundMode( TQWidget::PaletteBackground ); + + else if ( widget->inherits( "KToolBarSeparator" ) ) { + widget->setBackgroundMode( TQWidget::NoBackground ); + installObjectEventHandler(ceData, elementFlags, ptr, this); + + } else if ( ::tqqt_cast<TQScrollBar *>( widget ) ) { + widget->setMouseTracking( true ); + installObjectEventHandler(ceData, elementFlags, ptr, this); + widget->setBackgroundMode( TQWidget::NoBackground ); + + } else if ( ::tqqt_cast<TQSlider *>( widget ) || ::tqqt_cast<TQHeader *>( widget ) ) { + widget->setMouseTracking( true ); + installObjectEventHandler(ceData, elementFlags, ptr, this); + + } else if ( 0 == qstrcmp( widget->name(), kdeToolbarWidget ) ) { + installObjectEventHandler(ceData, elementFlags, ptr, this); + widget->setBackgroundMode( TQWidget::NoBackground ); // We paint the whole background. + } + } + + KStyle::polish( ceData, elementFlags, ptr ); } + +void KlearlookStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) { + if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { + TQWidget *widget = reinterpret_cast<TQWidget*>(ptr); + + if ( ::tqqt_cast<TQRadioButton *>( widget ) || + ::tqqt_cast<TQCheckBox *>( widget ) || + ::tqqt_cast<TQSpinWidget *>( widget ) || + widget->inherits( TQSPLITTERHANDLE_OBJECT_NAME_STRING ) ) { + widget->setMouseTracking( false ); + + removeObjectEventHandler(ceData, elementFlags, ptr, this); + } else if ( ::tqqt_cast<TQButton *>( widget ) || ::tqqt_cast<TQComboBox *>( widget ) || + widget->inherits( "TQToolBarExtensionWidget" ) ) { + widget->setBackgroundMode( TQWidget::PaletteButton ); + removeObjectEventHandler(ceData, elementFlags, ptr, this); + + } else if ( ::tqqt_cast<TQMenuBar *>( widget ) || + ::tqqt_cast<TQToolBar *>( widget ) || + ::tqqt_cast<TQPopupMenu *>( widget ) ) + widget->setBackgroundMode( TQWidget::PaletteBackground ); + + else if ( widget->inherits( "KToolBarSeparator" ) ) { + widget->setBackgroundMode( PaletteBackground ); + removeObjectEventHandler(ceData, elementFlags, ptr, this); + + } else if ( ::tqqt_cast<TQScrollBar *>( widget ) ) { + widget->setMouseTracking( false ); + removeObjectEventHandler(ceData, elementFlags, ptr, this); + widget->setBackgroundMode( TQWidget::PaletteButton ); + + } else if ( ::tqqt_cast<TQSlider *>( widget ) || + ::tqqt_cast<TQHeader *>( widget ) ) { + widget->setMouseTracking( false ); + removeObjectEventHandler(ceData, elementFlags, ptr, this); + + } else if ( 0 == qstrcmp( widget->name(), kdeToolbarWidget ) ) { + removeObjectEventHandler(ceData, elementFlags, ptr, this); + widget->setBackgroundMode( PaletteBackground ); + } + } -void KlearlookStyle::unPolish( TQWidget *widget ) { - if ( ::tqqt_cast<TQRadioButton *>( widget ) || - ::tqqt_cast<TQCheckBox *>( widget ) || - ::tqqt_cast<TQSpinWidget *>( widget ) || - widget->inherits( TQSPLITTERHANDLE_OBJECT_NAME_STRING ) ) { - widget->setMouseTracking( false ); - - widget->removeEventFilter( this ); - } else if ( ::tqqt_cast<TQButton *>( widget ) || ::tqqt_cast<TQComboBox *>( widget ) || - widget->inherits( "TQToolBarExtensionWidget" ) ) { - widget->setBackgroundMode( TQWidget::PaletteButton ); - widget->removeEventFilter( this ); - - } else if ( ::tqqt_cast<TQMenuBar *>( widget ) || - ::tqqt_cast<TQToolBar *>( widget ) || - ::tqqt_cast<TQPopupMenu *>( widget ) ) - widget->setBackgroundMode( TQWidget::PaletteBackground ); - - else if ( widget->inherits( "KToolBarSeparator" ) ) { - widget->setBackgroundMode( PaletteBackground ); - widget->removeEventFilter( this ); - - } else if ( ::tqqt_cast<TQScrollBar *>( widget ) ) { - widget->setMouseTracking( false ); - widget->removeEventFilter( this ); - widget->setBackgroundMode( TQWidget::PaletteButton ); - - } else if ( ::tqqt_cast<TQSlider *>( widget ) || - ::tqqt_cast<TQHeader *>( widget ) ) { - widget->setMouseTracking( false ); - widget->removeEventFilter( this ); - - } else if ( 0 == qstrcmp( widget->name(), kdeToolbarWidget ) ) { - widget->removeEventFilter( this ); - widget->setBackgroundMode( PaletteBackground ); - } - - KStyle::unPolish( widget ); + KStyle::unPolish( ceData, elementFlags, ptr ); } -bool KlearlookStyle::eventFilter( TQObject *object, TQEvent *event ) { - if ( object->parent() && 0 == qstrcmp( object->name(), kdeToolbarWidget ) ) { - // Draw background for custom widgets in the toolbar that have specified a "kde toolbar widget" name. - if ( TQEvent::Paint == event->type() ) { - TQWidget * widget = TQT_TQWIDGET( object ), - *parent = TQT_TQWIDGET( object->parent() ); -#ifdef TQTC_GRADIENT_TOOLBARS_AND_MENUBARS - // Find the top-level toolbar of this widget, since it may be nested in other - // widgets that are on the toolbar. - int x_offset = widget->x(), - y_offset = widget->y(); - - while ( parent && parent->parent() && !qstrcmp( parent->name(), kdeToolbarWidget ) ) { - x_offset += parent->x(); - y_offset += parent->y(); - parent = TQT_TQWIDGET( parent->parent() ); - } - - TQRect pr( parent->rect() ); - bool horiz_grad = pr.width() < pr.height(); - - // Check if the parent is a TQToolbar, and use its orientation, else guess. - TQToolBar *toolbar = dynamic_cast<TQToolBar*>( parent ); - - if ( toolbar ) - horiz_grad = toolbar->orientation() == TQt::Vertical; - - drawBevelGradient( parent->colorGroup().background(), true, 1, &TQPainter( widget ), - TQRect( x_offset, y_offset, pr.width(), pr.height() ), - horiz_grad, SHADE_BAR_LIGHT, SHADE_BAR_DARK ); -#else - - TQPainter( widget ).fillRect( widget->rect(), parent->colorGroup().background() ); -#endif - - return false; // Now draw the contents - } - } else if ( object->inherits( "KToolBarSeparator" ) && TQEvent::Paint == event->type() ) { - TQFrame * frame = dynamic_cast<TQFrame*>( object ); - - if ( frame && TQFrame::NoFrame != frame->frameShape() ) { - TQPainter painter( frame ); - if ( TQFrame::VLine == frame->frameShape() ) - tqdrawPrimitive( PE_DockWindowSeparator, &painter, - frame->rect(), frame->colorGroup(), Style_Horizontal ); - else if ( TQFrame::HLine == frame->frameShape() ) - tqdrawPrimitive( PE_DockWindowSeparator, &painter, - frame->rect(), frame->colorGroup() ); - else - return false; - return true; // been drawn! - } - } - switch ( event->type() ) { - case TQEvent::Enter: - if ( object->isWidgetType() ) { - hoverWidget = ( TQWidget * ) object; - if ( hoverWidget && hoverWidget->isEnabled() ) { - if ( redrawHoverWidget() ) { - hoverWidget->repaint( false ); - if ( APP_KICKER == themedApp ) - hover = HOVER_NONE; - } - oldCursor = TQCursor::pos(); - } else - hoverWidget = NULL; - } - break; - case TQEvent::Leave: - if ( hoverWidget && TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(hoverWidget) ) { - oldCursor.setX( -1 ); - oldCursor.setY( -1 ); - hoverWidget = NULL; - ( ( TQWidget * ) object ) ->repaint( false ); - } - break; - case TQEvent::MouseMove: - if ( hoverWidget && object->isWidgetType() ) { - if ( redrawHoverWidget() ) { - hoverWidget->repaint( false ); - if ( APP_KICKER == themedApp ) - hover = HOVER_NONE; - } - oldCursor = TQCursor::pos(); - } - break; - default: - break; - } +bool KlearlookStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event ) { + if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) { + TQObject* object = reinterpret_cast<TQObject*>(source); + + if ( object->parent() && 0 == qstrcmp( object->name(), kdeToolbarWidget ) ) { + // Draw background for custom widgets in the toolbar that have specified a "kde toolbar widget" name. + if ( TQEvent::Paint == event->type() ) { + TQWidget * widget = TQT_TQWIDGET( object ), + *parent = TQT_TQWIDGET( object->parent() ); + #ifdef TQTC_GRADIENT_TOOLBARS_AND_MENUBARS + // Find the top-level toolbar of this widget, since it may be nested in other + // widgets that are on the toolbar. + int x_offset = widget->x(), + y_offset = widget->y(); + + while ( parent && parent->parent() && !qstrcmp( parent->name(), kdeToolbarWidget ) ) { + x_offset += parent->x(); + y_offset += parent->y(); + parent = TQT_TQWIDGET( parent->parent() ); + } + + TQRect pr( parent->rect() ); + bool horiz_grad = pr.width() < pr.height(); + + // Check if the parent is a TQToolbar, and use its orientation, else guess. + TQToolBar *toolbar = dynamic_cast<TQToolBar*>( parent ); + + if ( toolbar ) + horiz_grad = toolbar->orientation() == TQt::Vertical; + + drawBevelGradient( parent->colorGroup().background(), true, 1, &TQPainter( widget ), + TQRect( x_offset, y_offset, pr.width(), pr.height() ), + horiz_grad, SHADE_BAR_LIGHT, SHADE_BAR_DARK ); + #else + + TQPainter( widget ).fillRect( widget->rect(), parent->colorGroup().background() ); + #endif + + return false; // Now draw the contents + } + } else if ( object->inherits( "KToolBarSeparator" ) && TQEvent::Paint == event->type() ) { + TQFrame * frame = dynamic_cast<TQFrame*>( object ); + + if ( frame && TQFrame::NoFrame != frame->frameShape() ) { + TQPainter painter( frame ); + if ( TQFrame::VLine == frame->frameShape() ) + drawPrimitive( PE_DockWindowSeparator, &painter, ceData, elementFlags, + frame->rect(), frame->colorGroup(), Style_Horizontal ); + else if ( TQFrame::HLine == frame->frameShape() ) + drawPrimitive( PE_DockWindowSeparator, &painter, ceData, elementFlags, + frame->rect(), frame->colorGroup() ); + else + return false; + return true; // been drawn! + } + } + switch ( event->type() ) { + case TQEvent::Enter: + if ( object->isWidgetType() ) { + hoverWidget = ( TQWidget * ) object; + if ( hoverWidget && hoverWidget->isEnabled() ) { + if ( redrawHoverWidget() ) { + hoverWidget->repaint( false ); + if ( APP_KICKER == themedApp ) + hover = HOVER_NONE; + } + oldCursor = TQCursor::pos(); + } else + hoverWidget = NULL; + } + break; + case TQEvent::Leave: + if ( hoverWidget && TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(hoverWidget) ) { + oldCursor.setX( -1 ); + oldCursor.setY( -1 ); + hoverWidget = NULL; + ( ( TQWidget * ) object ) ->repaint( false ); + } + break; + case TQEvent::MouseMove: + if ( hoverWidget && object->isWidgetType() ) { + if ( redrawHoverWidget() ) { + hoverWidget->repaint( false ); + if ( APP_KICKER == themedApp ) + hover = HOVER_NONE; + } + oldCursor = TQCursor::pos(); + } + break; + default: + break; + } + } - return KStyle::eventFilter( object, event ); + return KStyle::objectEventHandler( ceData, elementFlags, source, event ); } void KlearlookStyle::drawLightBevelButton( @@ -1280,7 +1296,7 @@ void KlearlookStyle::drawArrow( TQPainter *p, const TQRect &r, const TQColorGrou p->restore(); } -void KlearlookStyle::tqdrawPrimitiveMenu( TQ_PrimitiveElement pe, TQPainter *p, const TQRect &r, const TQColorGroup &cg, +void KlearlookStyle::drawPrimitiveMenu( TQ_PrimitiveElement pe, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, const TQStyleOption &data ) const { switch ( pe ) { case PE_CheckMark: @@ -1315,11 +1331,11 @@ void KlearlookStyle::tqdrawPrimitiveMenu( TQ_PrimitiveElement pe, TQPainter *p, break; default: - KStyle::tqdrawPrimitive( pe, p, r, cg, flags, data ); + KStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, data ); } } -void KlearlookStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, const TQRect &r, const TQColorGroup &cg, +void KlearlookStyle::drawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, const TQStyleOption &data ) const { int x, y, w, h; @@ -1520,7 +1536,7 @@ void KlearlookStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, cons p->setBrush( cg.brush( TQColorGroup::Button ) ); p->drawRect( r.x() + lv->itemMargin(), r.y() + 2, r.width() - 4, r.width() - 4 ); if ( flags & TQStyle::Style_On || !( flags & Style_Off ) ) - tqdrawPrimitive( PE_CheckMark, p, TQRect( r.x() + lv->itemMargin(), + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( r.x() + lv->itemMargin(), r.y() + 2, r.width() - 4, r.width() - 4 ), cg, flags ); } break; @@ -1530,7 +1546,7 @@ void KlearlookStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, cons bool on = flags & TQStyle::Style_On || !( flags & Style_Off ); if ( APPEARANCE_FLAT != appearance ) - tqdrawPrimitive( PE_ButtonTool, p, r, cg, flags ); + drawPrimitive( PE_ButtonTool, p, ceData, elementFlags, r, cg, flags ); else { p->fillRect( r.x() + 1, r.y() + 2, TQTC_CHECK_SIZE - 2, TQTC_CHECK_SIZE - 2, flags & Style_Enabled ? cg.base() : cg.background() ); @@ -1555,7 +1571,7 @@ void KlearlookStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, cons p->drawRect( r.x(), r.y(), TQTC_CHECK_SIZE, TQTC_CHECK_SIZE ); if ( on ) - tqdrawPrimitive( PE_CheckMark, p, r, cg, flags ); + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, r, cg, flags ); break; } case PE_CheckListExclusiveIndicator: { @@ -1964,7 +1980,7 @@ void KlearlookStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, cons PE_ArrowDown == pe ? ROUNDED_BOTTOM : PE_ArrowUp == pe ? ROUNDED_TOP : ROUNDED_NONE, getFill( flags, use ), use ); - tqdrawPrimitive( pe, p, r, cg, flags ); + drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags ); break; } case PE_ScrollBarSubPage: @@ -2033,12 +2049,12 @@ void KlearlookStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, cons break; } default: - KStyle::tqdrawPrimitive( pe, p, r, cg, flags, data ); + KStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, data ); } } -void KlearlookStyle::drawKStylePrimitive( KStylePrimitive kpe, TQPainter *p, const TQWidget *widget, const TQRect &r, - const TQColorGroup &cg, SFlags flags, const TQStyleOption &opt ) const { +void KlearlookStyle::drawKStylePrimitive( KStylePrimitive kpe, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, + const TQColorGroup &cg, SFlags flags, const TQStyleOption &opt, const TQWidget *widget ) const { switch ( kpe ) { case KPE_ToolBarHandle: case KPE_GeneralHandle: @@ -2048,7 +2064,7 @@ void KlearlookStyle::drawKStylePrimitive( KStylePrimitive kpe, TQPainter *p, con APPEARANCE_LIGHT_GRADIENT == appearance ); break; case KPE_SliderGroove: - drawSliderGroove( p, r, flags, widget ); + drawSliderGroove( p, ceData, elementFlags, r, flags, widget ); break; case KPE_SliderHandle: drawSliderHandle( p, r, cg, flags ); @@ -2192,16 +2208,17 @@ void KlearlookStyle::drawKStylePrimitive( KStylePrimitive kpe, TQPainter *p, con } break; default: - KStyle::drawKStylePrimitive( kpe, p, widget, r, cg, flags, opt ); + KStyle::drawKStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget ); } } void KlearlookStyle::drawControl( ControlElement control, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQColorGroup &cg, SFlags flags, const TQStyleOption &data ) const + const TQColorGroup &cg, SFlags flags, const TQStyleOption &data, const TQWidget *widget ) const { if ( widget == hoverWidget ) flags |= Style_MouseOver; @@ -2375,7 +2392,7 @@ void KlearlookStyle::drawControl( p->fillRect( fr, flags & Style_Selected ? cg.background() : gray[ 2 ] ); break; default: - KStyle::drawControl( control, p, widget, r, cg, flags, data ); + KStyle::drawControl( control, p, ceData, elementFlags, r, cg, flags, data, widget ); } } else { TQRect br( r ); @@ -2466,15 +2483,15 @@ void KlearlookStyle::drawControl( if ( t->identifier() == tb->currentTab() ) { if ( TQTabBar::RoundedAbove == tb->shape() || TQTabBar::TriangularAbove == tb->shape() ) - tr.setBottom( tr.bottom() - pixelMetric( TQStyle::PM_TabBarTabShiftVertical, tb ) ); + tr.setBottom( tr.bottom() - pixelMetric( TQStyle::PM_TabBarTabShiftVertical, ceData, elementFlags, tb ) ); } else if ( TQTabBar::RoundedBelow == tb->shape() || TQTabBar::TriangularBelow == tb->shape() ) - tr.setTop( tr.top() + pixelMetric( TQStyle::PM_TabBarTabShiftVertical, tb ) ); + tr.setTop( tr.top() + pixelMetric( TQStyle::PM_TabBarTabShiftVertical, ceData, elementFlags, tb ) ); drawItem( p, tr, AlignCenter | ShowPrefix, cg, flags & Style_Enabled, 0, t->text() ); if ( ( flags & Style_HasFocus ) && !t->text().isEmpty() ) - tqdrawPrimitive( PE_FocusRect, p, r, cg ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, r, cg ); break; } case CE_PushButtonLabel: // Taken from Highcolour and Plastik... @@ -2489,23 +2506,23 @@ void KlearlookStyle::drawControl( // Shift button contents if pushed. if ( active ) { - x += pixelMetric( PM_ButtonShiftHorizontal, widget ); - y += pixelMetric( PM_ButtonShiftVertical, widget ); + x += pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags, widget ); + y += pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags, widget ); flags |= Style_Sunken; } // Does the button have a popup menu? if ( button->isMenuButton() ) { - int dx = pixelMetric( PM_MenuButtonIndicator, widget ), - margin = pixelMetric( PM_ButtonMargin, widget ); + int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget ), + margin = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ); if ( button->iconSet() && !button->iconSet() ->isNull() && ( dx + button->iconSet() ->pixmap ( TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width() ) >= w ) cornArrow = true; //To little room. Draw the arrow in the corner, don't adjust the widget else { - tqdrawPrimitive( PE_ArrowDown, - p, visualRect( TQRect( + drawPrimitive( PE_ArrowDown, + p, ceData, elementFlags, visualRect( TQRect( ( x + w ) - ( dx + margin ), y, dx, h ), r ), cg, flags, data ); @@ -2547,7 +2564,7 @@ void KlearlookStyle::drawControl( } 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, data ); if ( xo && iw ) { @@ -2574,8 +2591,8 @@ void KlearlookStyle::drawControl( //Draw a focus rect if the button has focus if ( flags & Style_HasFocus ) - tqdrawPrimitive( PE_FocusRect, p, - TQStyle::visualRect( subRect( SR_PushButtonFocusRect, widget ), widget ), cg, flags ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, + TQStyle::visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ), cg, flags ); break; } @@ -2680,7 +2697,7 @@ void KlearlookStyle::drawControl( ir.setCoords( cr.right() + 2, r.top(), tr.right() - 4, r.bottom() ); TQBrush brush( mi->isEnabled() ? cg.highlightedText() : cg.background() ); - tqdrawPrimitiveMenu( PE_CheckMark, p, cr, cg, + drawPrimitiveMenu( PE_CheckMark, p, ceData, elementFlags, cr, cg, ( flags & ( Style_Enabled | Style_Active ) ) | Style_On ); } @@ -2834,7 +2851,7 @@ void KlearlookStyle::drawControl( case CE_ProgressBarContents: { // ### Take into account totalSteps()for busy indicator const TQProgressBar *pb = ( const TQProgressBar* ) widget; - TQRect cr = subRect( SR_ProgressBarContents, widget ); + TQRect cr = subRect( SR_ProgressBarContents, ceData, elementFlags, widget ); double progress = pb->progress(); bool reverse = TQApplication::reverseLayout(); int steps = pb->totalSteps(); @@ -2879,7 +2896,7 @@ void KlearlookStyle::drawControl( case CE_PushButton: { const TQPushButton *button = static_cast<const TQPushButton *>( widget ); TQRect br( r ); - int dbi = pixelMetric( PM_ButtonDefaultIndicator, widget ); + int dbi = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget ); if ( rounded && isFormWidget( widget ) ) formMode = true; @@ -2895,15 +2912,15 @@ void KlearlookStyle::drawControl( p->save(); p->setBrushOrigin( -widget->backgroundOffset().x(), -widget->backgroundOffset().y() ); // draw button - tqdrawPrimitive( PE_ButtonCommand, p, br, cg, flags ); + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags ); if ( button->isDefault() && IND_FONT_COLOUR != defBtnIndicator ) - tqdrawPrimitive( PE_ButtonDefault, p, r, cg, flags ); + drawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags ); p->restore(); formMode = false; break; } case CE_CheckBox: - tqdrawPrimitive( PE_Indicator, p, r, cg, flags, data ); + drawPrimitive( PE_Indicator, p, ceData, elementFlags, r, cg, flags, data ); break; case CE_CheckBoxLabel: if ( crLabelHighlight ) { @@ -2914,10 +2931,10 @@ void KlearlookStyle::drawControl( !isFormWidget( widget ) ) { TQRect cr( checkbox->rect() ); TQRegion r( TQRect( cr.x(), cr.y(), - visualRect( subRect( SR_CheckBoxFocusRect, widget ), widget ).width() + - pixelMetric( PM_IndicatorWidth ) + 4, cr.height() ) ); + visualRect( subRect( SR_CheckBoxFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ).width() + + pixelMetric( PM_IndicatorWidth, ceData, elementFlags ) + 4, cr.height() ) ); - r -= visualRect( subRect( SR_CheckBoxIndicator, widget ), widget ); + r -= visualRect( subRect( SR_CheckBoxIndicator, ceData, elementFlags, widget ), ceData, elementFlags ); p->setClipRegion( r ); p->fillRect( checkbox->rect(), cg.background().light( TQTC_HIGHLIGHT_FACTOR ) ); p->setClipping( false ); @@ -2928,14 +2945,14 @@ void KlearlookStyle::drawControl( flags & Style_Enabled, checkbox->pixmap(), checkbox->text() ); if ( checkbox->hasFocus() ) - tqdrawPrimitive( PE_FocusRect, p, - visualRect( subRect( SR_CheckBoxFocusRect, widget ), widget ), cg, flags ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, + visualRect( subRect( SR_CheckBoxFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ), cg, flags ); } else - KStyle::drawControl( control, p, widget, r, cg, flags, data ); + KStyle::drawControl( control, p, ceData, elementFlags, r, cg, flags, data, widget ); break; case CE_RadioButton: formMode = isFormWidget( widget ); - tqdrawPrimitive( PE_ExclusiveIndicator, p, r, cg, flags, data ); + drawPrimitive( PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, flags, data ); formMode = false; break; case CE_RadioButtonLabel: @@ -2947,10 +2964,10 @@ void KlearlookStyle::drawControl( !isFormWidget( widget ) ) { TQRect rb( radiobutton->rect() ); TQRegion r( TQRect( rb.x(), rb.y(), - visualRect( subRect( SR_RadioButtonFocusRect, widget ), widget ).width() + - pixelMetric( PM_ExclusiveIndicatorWidth ) + 4, rb.height() ) ); + visualRect( subRect( SR_RadioButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ).width() + + pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ) + 4, rb.height() ) ); - r -= visualRect( subRect( SR_RadioButtonIndicator, widget ), widget ); + r -= visualRect( subRect( SR_RadioButtonIndicator, ceData, elementFlags, widget ), ceData, elementFlags ); p->setClipRegion( r ); p->fillRect( radiobutton->rect(), cg.background().light( TQTC_HIGHLIGHT_FACTOR ) ); p->setClipping( false ); @@ -2962,17 +2979,17 @@ void KlearlookStyle::drawControl( flags & Style_Enabled, radiobutton->pixmap(), radiobutton->text() ); if ( radiobutton->hasFocus() ) - tqdrawPrimitive( PE_FocusRect, p, - visualRect( subRect( SR_RadioButtonFocusRect, widget ), widget ), cg, flags ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, + visualRect( subRect( SR_RadioButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ), cg, flags ); break; } default: - KStyle::drawControl( control, p, widget, r, cg, flags, data ); + KStyle::drawControl( control, p, ceData, elementFlags, r, cg, flags, data, widget ); } } -void KlearlookStyle::drawControlMask( ControlElement control, TQPainter *p, const TQWidget *widget, const TQRect &r, - const TQStyleOption &data ) const { +void KlearlookStyle::drawControlMask( ControlElement control, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, + const TQStyleOption &data, const TQWidget *widget ) const { switch ( control ) { case CE_PushButton: if ( rounded ) { @@ -2991,23 +3008,23 @@ void KlearlookStyle::drawControlMask( ControlElement control, TQPainter *p, cons p->fillRect( r, color1 ); break; default: - KStyle::drawControlMask( control, p, widget, r, data ); + KStyle::drawControlMask( control, p, ceData, elementFlags, r, data, widget ); } } -void KlearlookStyle::drawComplexControlMask( ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, - const TQStyleOption &data ) const { +void KlearlookStyle::drawComplexControlMask( ComplexControl control, TQPainter *p, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQRect &r, + const TQStyleOption &data, const TQWidget *widget ) const { switch ( control ) { case CC_ToolButton: case CC_ComboBox: - drawControlMask( CE_PushButton, p, widget, r, data ); + drawControlMask( CE_PushButton, p, ceData, elementFlags, r, data, widget ); break; default: - KStyle::drawComplexControlMask( control, p, widget, r, data ); + KStyle::drawComplexControlMask( control, p, ceData, elementFlags, r, data, widget ); } } -TQRect KlearlookStyle::subRect( SubRect subrect, const TQWidget *widget ) const { +TQRect KlearlookStyle::subRect( SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const { TQRect rect, wrect( widget->rect() ); @@ -3019,7 +3036,7 @@ TQRect KlearlookStyle::subRect( SubRect subrect, const TQWidget *widget ) const // if(button->isDefault() || button->autoDefault()) // { - dbw1 = pixelMetric( PM_ButtonDefaultIndicator, widget ); + dbw1 = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget ); dbw2 = dbw1 * 2; // } @@ -3030,20 +3047,20 @@ TQRect KlearlookStyle::subRect( SubRect subrect, const TQWidget *widget ) const break; } case SR_CheckBoxIndicator: { - int h = pixelMetric( PM_IndicatorHeight ); + int h = pixelMetric( PM_IndicatorHeight, ceData, elementFlags ); rect.setRect( ( widget->rect().height() - h ) >> 1, ( widget->rect().height() - h ) >> 1, - pixelMetric( PM_IndicatorWidth ), + pixelMetric( PM_IndicatorWidth, ceData, elementFlags ), h ); break; } case SR_RadioButtonIndicator: { - int h = pixelMetric( PM_ExclusiveIndicatorHeight ); + int h = pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags ); rect.setRect( ( widget->rect().height() - h ) >> 1, ( widget->rect().height() - h ) >> 1, - pixelMetric( PM_ExclusiveIndicatorWidth ), h ); + pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ), h ); break; } case SR_ProgressBarContents: @@ -3053,7 +3070,7 @@ TQRect KlearlookStyle::subRect( SubRect subrect, const TQWidget *widget ) const wrect.height() - 2 ); break; default: - rect = KStyle::subRect( subrect, widget ); + rect = KStyle::subRect( subrect, ceData, elementFlags, widget ); } return rect; @@ -3062,13 +3079,15 @@ TQRect KlearlookStyle::subRect( SubRect subrect, const TQWidget *widget ) const void KlearlookStyle::drawComplexControl( ComplexControl control, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, SCFlags controls, SCFlags active, - const TQStyleOption &data ) const + const TQStyleOption &data, + const TQWidget *widget ) const { if ( widget == hoverWidget ) flags |= Style_MouseOver; @@ -3077,13 +3096,13 @@ void KlearlookStyle::drawComplexControl( case CC_ToolButton: { const TQToolButton * toolbutton = ( const TQToolButton * ) widget; - TQRect button ( querySubControlMetrics( control, widget, SC_ToolButton, data ) ), - menuarea( querySubControlMetrics( control, widget, SC_ToolButtonMenu, data ) ); + TQRect button ( querySubControlMetrics( control, ceData, elementFlags, SC_ToolButton, data, widget ) ), + menuarea( querySubControlMetrics( control, ceData, elementFlags, SC_ToolButtonMenu, data, widget ) ); SFlags bflags = flags, mflags = flags; if ( APP_KORN == themedApp ) { - tqdrawPrimitive( PE_ButtonTool, p, button, cg, bflags, data ); + drawPrimitive( PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, data ); break; } @@ -3118,7 +3137,7 @@ void KlearlookStyle::drawComplexControl( if ( !onToolbar && !onControlButtons ) bflags |= Style_Horizontal; - tqdrawPrimitive( PE_ButtonTool, p, button, cg, bflags, data ); + drawPrimitive( PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, data ); } // Check whether to draw a background pixmap @@ -3159,14 +3178,14 @@ void KlearlookStyle::drawComplexControl( if ( controls & SC_ToolButtonMenu ) { if ( mflags & ( Style_Down | Style_On | Style_Raised ) ) - tqdrawPrimitive( PE_ButtonDropDown, p, menuarea, cg, mflags, data ); - tqdrawPrimitive( PE_ArrowDown, p, menuarea, cg, mflags, data ); + drawPrimitive( PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, data ); + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, data ); } 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; } @@ -3174,13 +3193,13 @@ void KlearlookStyle::drawComplexControl( const TQComboBox *combobox = ( const TQComboBox * ) widget; TQRect frame( TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, - widget,SC_ComboBoxFrame,data ),widget ) ), + ceData,elementFlags,SC_ComboBoxFrame,data,widget ),ceData, elementFlags ) ), arrow( TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, - widget,SC_ComboBoxArrow,data),widget)), + ceData,elementFlags,SC_ComboBoxArrow,data,widget),ceData, elementFlags)), field( TQStyle::visualRect( querySubControlMetrics(CC_ComboBox, - widget,SC_ComboBoxEditField,data),widget)); + ceData,elementFlags,SC_ComboBoxEditField,data,widget),ceData, elementFlags)); const TQColor *use = buttonColors( cg ); @@ -3203,7 +3222,7 @@ void KlearlookStyle::drawComplexControl( } if ( controls & SC_ComboBoxArrow && arrow.isValid() ) { - tqdrawPrimitive( PE_ArrowDown, p, arrow, cg, flags & ~Style_MouseOver ); + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, arrow, cg, flags & ~Style_MouseOver ); p->setPen( use[ 4 ].light(70) ); arrow.addCoords( -1, -1, -1, 1 ); p->drawLine( arrow.left(), arrow.top(), arrow.left(), arrow.bottom() ); @@ -3211,11 +3230,11 @@ void KlearlookStyle::drawComplexControl( if ( controls & SC_ComboBoxEditField && field.isValid() ) { if ( ( flags & Style_HasFocus ) && ( ! combobox->editable() ) ) { - TQRect fr = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, widget ), widget ); + TQRect fr = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ); fr.addCoords( 0, 0, -2, 0 ); - tqdrawPrimitive( PE_FocusRect, - p, fr, cg, flags | Style_FocusAtBorder, TQStyleOption( cg.highlight() ) ); + drawPrimitive( PE_FocusRect, + p, ceData, elementFlags, fr, cg, flags | Style_FocusAtBorder, TQStyleOption( cg.highlight() ) ); } } @@ -3225,7 +3244,7 @@ void KlearlookStyle::drawComplexControl( } case CC_SpinWidget: { const TQSpinWidget *spinwidget = ( const TQSpinWidget * ) widget; - TQRect frame( querySubControlMetrics( CC_SpinWidget, widget, SC_SpinWidgetFrame, data ) ), + TQRect frame( querySubControlMetrics( CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetFrame, data, widget ) ), up( spinwidget->upRect() ), down( spinwidget->downRect() ); @@ -3236,7 +3255,7 @@ void KlearlookStyle::drawComplexControl( qDrawShadePanel( p, r, TQColorGroup( gray[ 5 ], gray[ NUM_SHADES ], gray[ 0 ], gray[ 5 ], gray[ 2 ], cg.text(), gray[ NUM_SHADES ] ), - true, pixelMetric( PM_SpinBoxFrameWidth ) + true, pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags ) ); if ( ( controls & SC_SpinWidgetUp ) && up.isValid() ) { @@ -3247,8 +3266,8 @@ void KlearlookStyle::drawComplexControl( pe = PE_SpinWidgetPlus; if ( !spinwidget->isUpEnabled() ) upflags ^= Style_Enabled; - tqdrawPrimitive( - pe, p, up, cg, + drawPrimitive( + pe, p, ceData, elementFlags, up, cg, upflags | ( ( active == SC_SpinWidgetUp ) ? Style_On | Style_Sunken : Style_Raised ) ); } @@ -3261,8 +3280,8 @@ void KlearlookStyle::drawComplexControl( pe = PE_SpinWidgetMinus; if ( !spinwidget->isDownEnabled() ) downflags ^= Style_Enabled; - tqdrawPrimitive( - pe, p, down, cg, + drawPrimitive( + pe, p, ceData, elementFlags, down, cg, downflags | ( ( active == SC_SpinWidgetDown ) ? Style_On | Style_Sunken : Style_Raised ) ); } @@ -3274,52 +3293,52 @@ void KlearlookStyle::drawComplexControl( case CC_ScrollBar: { const TQScrollBar *scrollbar = ( const TQScrollBar * ) widget; bool hw = hoverWidget == scrollbar; - TQRect subline( querySubControlMetrics( control, widget, SC_ScrollBarSubLine, data ) ), - addline( querySubControlMetrics( control, widget, SC_ScrollBarAddLine, data ) ), - subpage( querySubControlMetrics( control, widget, SC_ScrollBarSubPage, data ) ), - addpage( querySubControlMetrics( control, widget, SC_ScrollBarAddPage, data ) ), - slider( querySubControlMetrics( control, widget, SC_ScrollBarSlider, data ) ), - first( querySubControlMetrics( control, widget, SC_ScrollBarFirst, data ) ), - last( querySubControlMetrics( control, widget, SC_ScrollBarLast, data ) ); + TQRect subline( querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSubLine, data, widget ) ), + addline( querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarAddLine, data, widget ) ), + subpage( querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSubPage, data, widget ) ), + addpage( querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarAddPage, data, widget ) ), + slider( querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSlider, data, widget ) ), + first( querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarFirst, data, widget ) ), + last( querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarLast, data, widget ) ); if ( ( controls & SC_ScrollBarSubLine ) && subline.isValid() ) - tqdrawPrimitive( - PE_ScrollBarSubLine, p, subline, cg, + drawPrimitive( + PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, ( hw && HOVER_SB_SUB == hover ? Style_MouseOver : Style_Default ) | Style_Enabled | ( ( active == SC_ScrollBarSubLine ) ? Style_Down : Style_Default ) | ( ( scrollbar->orientation() == Qt::Horizontal ) ? Style_Horizontal : Style_Default ) ); if ( ( controls & SC_ScrollBarAddLine ) && addline.isValid() ) - tqdrawPrimitive( - PE_ScrollBarAddLine, p, addline, cg, + drawPrimitive( + PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, ( hw && HOVER_SB_ADD == hover ? Style_MouseOver : Style_Default ) | Style_Enabled | ( ( active == SC_ScrollBarAddLine ) ? Style_Down : Style_Default ) | ( ( scrollbar->orientation() == Qt::Horizontal ) ? Style_Horizontal : Style_Default ) ); 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 : Style_Default ) ); if ( ( controls & SC_ScrollBarAddPage ) && addpage.isValid() ) - tqdrawPrimitive( PE_ScrollBarAddPage, p, addpage, cg, + drawPrimitive( PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, ( ( scrollbar->minValue() == scrollbar->maxValue() ) ? Style_Default : Style_Enabled ) | ( ( active == SC_ScrollBarAddPage ) ? Style_Down : Style_Default ) | ( ( scrollbar->orientation() == Qt::Horizontal ) ? Style_Horizontal : Style_Default ) ); 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 : Style_Default ) ); 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 : Style_Default ) ); if ( ( controls & SC_ScrollBarSlider ) && slider.isValid() ) { - tqdrawPrimitive( PE_ScrollBarSlider, p, slider, cg, + drawPrimitive( PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, ( hw && HOVER_SB_SLIDER == hover ? Style_MouseOver : Style_Default ) | Style_Enabled | ( ( active == SC_ScrollBarSlider ) ? Style_Down : Style_Default ) | @@ -3327,39 +3346,39 @@ void KlearlookStyle::drawComplexControl( // ### perhaps this should not be able to accept focus if maxedOut? if ( scrollbar->hasFocus() ) - tqdrawPrimitive( PE_FocusRect, p, + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, TQRect( slider.x() + 2, slider.y() + 2, slider.width() - 5, slider.height() - 5 ), cg, Style_Default ); } break; } case CC_Slider: { - 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() ) - drawSliderGroove( p, groove, flags, widget ); + drawSliderGroove( p, ceData, elementFlags, groove, flags, widget ); if ( ( controls & SC_SliderHandle ) && handle.isValid() ) drawSliderHandle( p, handle, cg, flags ); if ( controls & SC_SliderTickmarks ) TQCommonStyle::drawComplexControl( - control, p, widget, r, cg, flags, SC_SliderTickmarks, active, data + control, p, ceData, elementFlags, r, cg, flags, SC_SliderTickmarks, active, data, widget ); break; } default: - KStyle::drawComplexControl( control, p, widget, r, cg, flags, controls, active, data ); + KStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, data, widget ); } } -TQRect KlearlookStyle::querySubControlMetrics( TQ_ComplexControl control, const TQWidget *widget, SubControl sc, - const TQStyleOption &data ) const { +TQRect KlearlookStyle::querySubControlMetrics( TQ_ComplexControl control, TQStyleControlElementData ceData, ControlElementFlags elementFlags, SubControl sc, + const TQStyleOption &data, const TQWidget *widget ) const { switch ( control ) { case CC_SpinWidget: { if ( !widget ) return TQRect(); - int fw = pixelMetric( PM_SpinBoxFrameWidth, 0 ); + int fw = pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags, 0 ); TQSize bs; bs.setHeight( widget->height() >> 1 ); @@ -3391,11 +3410,11 @@ TQRect KlearlookStyle::querySubControlMetrics( TQ_ComplexControl control, const } } default: - return KStyle::querySubControlMetrics( control, widget, sc, data ); + return KStyle::querySubControlMetrics( control, ceData, elementFlags, sc, data, widget ); } } -int KlearlookStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) const { +int KlearlookStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const { switch ( metric ) { case PM_MenuButtonIndicator: return 7; @@ -3467,23 +3486,25 @@ int KlearlookStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) co case PM_MaximumDragDistance: return -1; default: - return KStyle::pixelMetric( metric, widget ); + return KStyle::pixelMetric( metric, ceData, elementFlags, widget ); } } -int KlearlookStyle::kPixelMetric( KStylePixelMetric kpm, const TQWidget *widget ) const { +int KlearlookStyle::kPixelMetric( KStylePixelMetric kpm, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const { switch ( kpm ) { case KPM_MenuItemSeparatorHeight: return 4; default: - return KStyle::kPixelMetric( kpm, widget ); + return KStyle::kPixelMetric( kpm, ceData, elementFlags, widget ); } } -TQSize KlearlookStyle::tqsizeFromContents( ContentsType t, - const TQWidget *widget, +TQSize KlearlookStyle::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: { if ( !widget || opt.isDefault() ) @@ -3546,8 +3567,8 @@ TQSize KlearlookStyle::tqsizeFromContents( ContentsType t, case CT_PushButton: { 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 button size @@ -3558,20 +3579,20 @@ TQSize KlearlookStyle::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 KlearlookStyle::styleHint( StyleHint stylehint, const TQWidget *widget, const TQStyleOption &option, TQStyleHintReturn *returnData ) const { +int KlearlookStyle::styleHint( StyleHint stylehint, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &option, TQStyleHintReturn *returnData, const TQWidget *widget ) const { switch ( stylehint ) { case SH_EtchDisabledText: case SH_Slider_SnapToValue: @@ -3593,7 +3614,7 @@ int KlearlookStyle::styleHint( StyleHint stylehint, const TQWidget *widget, cons case SH_PopupMenu_AllowActiveAndDisabled: return 0; default: - return KStyle::styleHint( stylehint, widget, option, returnData ); + return KStyle::styleHint( stylehint, ceData, elementFlags, option, returnData, widget ); } } @@ -3818,6 +3839,8 @@ void KlearlookStyle::drawSliderHandle( void KlearlookStyle::drawSliderGroove ( TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, TQStyle::SFlags flags, const TQWidget *widget ) const @@ -3829,7 +3852,7 @@ void KlearlookStyle::drawSliderGroove TQRect fr( groove ); fr.addCoords( -1, -1, 1, 1 ); - tqdrawPrimitive( PE_FocusRect, p, fr, TQColorGroup() ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, TQColorGroup() ); } if ( Qt::Horizontal == slider->orientation() ) { @@ -3882,6 +3905,9 @@ bool KlearlookStyle::redrawHoverWidget() { if ( !hoverWidget ) return false; + TQStyleControlElementData hoverCeData = populateControlElementDataFromWidget(hoverWidget, TQStyleOption()); + ControlElementFlags hoverElementFlags = getControlElementFlagsForObject(hoverWidget, hoverCeData.widgetObjectTypes, TQStyleOption()); + TQPoint cursor( TQCursor::pos() ), widgetZero( hoverWidget->mapToGlobal( TQPoint( 0, 0 ) ) ); @@ -3895,8 +3921,8 @@ bool KlearlookStyle::redrawHoverWidget() { if ( rb ) { TQRect rect( widgetZero.x(), widgetZero.y(), - visualRect( subRect( SR_RadioButtonFocusRect, rb ), rb ).width() + - pixelMetric( PM_ExclusiveIndicatorWidth ) + 4, hoverWidget->height() ); + visualRect( subRect( SR_RadioButtonFocusRect, hoverCeData, hoverElementFlags, rb ), hoverCeData, hoverElementFlags ).width() + + pixelMetric( PM_ExclusiveIndicatorWidth, hoverCeData, hoverElementFlags ) + 4, hoverWidget->height() ); hover = rect.contains( cursor ) ? HOVER_RADIO : HOVER_NONE; return ( HOVER_NONE != hover && !rect.contains( oldCursor ) ) || @@ -3906,8 +3932,8 @@ bool KlearlookStyle::redrawHoverWidget() { if ( cb ) { TQRect rect( widgetZero.x(), widgetZero.y(), - visualRect( subRect( SR_CheckBoxFocusRect, cb ), cb ).width() + - pixelMetric( PM_IndicatorWidth ) + 4, hoverWidget->height() ); + visualRect( subRect( SR_CheckBoxFocusRect, hoverCeData, hoverElementFlags, cb ), hoverCeData, hoverElementFlags ).width() + + pixelMetric( PM_IndicatorWidth, hoverCeData, hoverElementFlags ) + 4, hoverWidget->height() ); hover = rect.contains( cursor ) ? HOVER_CHECK : HOVER_NONE; return ( HOVER_NONE != hover && !rect.contains( oldCursor ) ) || @@ -3917,9 +3943,9 @@ bool KlearlookStyle::redrawHoverWidget() { if ( sb ) // So, are we over add button, sub button, slider, or none? { - TQRect subline( querySubControlMetrics( CC_ScrollBar, hoverWidget, SC_ScrollBarSubLine ) ), - addline( querySubControlMetrics( CC_ScrollBar, hoverWidget, SC_ScrollBarAddLine ) ), - slider( querySubControlMetrics( CC_ScrollBar, hoverWidget, SC_ScrollBarSlider ) ); + TQRect subline( querySubControlMetrics( CC_ScrollBar, hoverCeData, hoverElementFlags, SC_ScrollBarSubLine, TQStyleOption::Default, hoverWidget ) ), + addline( querySubControlMetrics( CC_ScrollBar, hoverCeData, hoverElementFlags, SC_ScrollBarAddLine, TQStyleOption::Default, hoverWidget ) ), + slider( querySubControlMetrics( CC_ScrollBar, hoverCeData, hoverElementFlags, SC_ScrollBarSlider, TQStyleOption::Default, hoverWidget ) ); subline.moveLeft( subline.x() + widgetZero.x() ); subline.moveTop( subline.y() + widgetZero.y() ); diff --git a/src/gui/kdeext/klearlook.h b/src/gui/kdeext/klearlook.h index 43db6b6..d98b45b 100644 --- a/src/gui/kdeext/klearlook.h +++ b/src/gui/kdeext/klearlook.h @@ -244,44 +244,44 @@ class KlearlookStyle : public KStyle { virtual ~KlearlookStyle() {} - void polish( TQApplication *app ); + void applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ); void polish( TQPalette &pal ); - void polish( TQWidget *widget ); - void unPolish( TQWidget *widget ); + void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); + void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); void drawLightBevel( TQPainter *p, const TQRect &r, const TQColorGroup &cg, TQStyle::SFlags flags, bool useGrad, ERound round, const TQColor &fill, const TQColor *custom = NULL, bool light = false ) const; void drawLightBevelButton( TQPainter *p, const TQRect &r, const TQColorGroup &cg, TQStyle::SFlags flags, bool useGrad, ERound round, const TQColor &fill, const TQColor *custom = NULL, bool light = false ) const; void drawArrow( TQPainter *p, const TQRect &r, const TQColorGroup &cg, TQStyle::SFlags flags, TQStyle::TQ_PrimitiveElement pe, bool small = false, bool checkActive = false ) const; - void tqdrawPrimitive( TQ_PrimitiveElement, TQPainter *, const TQRect &, const TQColorGroup &, SFlags = Style_Default, + void drawPrimitive( TQ_PrimitiveElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, const TQStyleOption & = TQStyleOption::Default ) const; - void tqdrawPrimitiveMenu( TQ_PrimitiveElement, TQPainter *, const TQRect &, const TQColorGroup &, SFlags = Style_Default, + void drawPrimitiveMenu( TQ_PrimitiveElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, const TQStyleOption & = TQStyleOption::Default ) const; - void drawKStylePrimitive( KStylePrimitive kpe, TQPainter* p, const TQWidget* widget, const TQRect &r, - const TQColorGroup &cg, SFlags flags, const TQStyleOption &opt ) const; - void drawControl( ControlElement, TQPainter *, const TQWidget *, const TQRect &, const TQColorGroup &, - SFlags = Style_Default, const TQStyleOption & = TQStyleOption::Default ) const; - void drawControlMask( ControlElement, TQPainter *, const TQWidget *, const TQRect &, - const TQStyleOption & = TQStyleOption::Default ) const; - void drawComplexControlMask( ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, - const TQStyleOption &data ) const; - TQRect subRect( SubRect, const TQWidget * ) const; - void drawComplexControl( ComplexControl, TQPainter *, const TQWidget *, const TQRect &, const TQColorGroup &, + void drawKStylePrimitive( KStylePrimitive kpe, TQPainter* p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, + const TQColorGroup &cg, SFlags flags, const TQStyleOption &opt, const TQWidget* widget = 0 ) const; + void drawControl( ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, + SFlags = Style_Default, const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; + void drawControlMask( ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; + void drawComplexControlMask( ComplexControl control, TQPainter *p, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQRect &r, + const TQStyleOption &data, const TQWidget *widget = 0 ) const; + TQRect subRect( SubRect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget * ) const; + void drawComplexControl( ComplexControl, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, SCFlags = SC_All, SCFlags = SC_None, - const TQStyleOption & = TQStyleOption::Default ) const; - TQRect querySubControlMetrics( TQ_ComplexControl, const TQWidget *, SubControl, - const TQStyleOption & = TQStyleOption::Default ) const; - int pixelMetric( PixelMetric, const TQWidget *widget = 0 ) const; - int kPixelMetric( KStylePixelMetric kpm, const TQWidget *widget ) const; - TQSize tqsizeFromContents( ContentsType, const TQWidget *, const TQSize &, - const TQStyleOption & = TQStyleOption::Default ) const; - int styleHint( StyleHint, const TQWidget *widget = 0, const TQStyleOption & = TQStyleOption::Default, - TQStyleHintReturn *returnData = 0 ) const; + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; + TQRect querySubControlMetrics( TQ_ComplexControl, TQStyleControlElementData ceData, ControlElementFlags elementFlags, SubControl, + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; + int pixelMetric( PixelMetric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; + int kPixelMetric( KStylePixelMetric kpm, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const; + TQSize sizeFromContents( ContentsType, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQSize &, + const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const; + int styleHint( StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, + TQStyleHintReturn *returnData = 0, const TQWidget *widget = 0 ) const; protected: - bool eventFilter( TQObject *object, TQEvent *event ); + virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); void drawPBarOrMenu( TQPainter *p, TQRect const &r, bool horiz, const TQColorGroup &cg, bool menu = false ) const; void drawPBarOrMenu2( TQPainter *p, TQRect const &r, bool horiz, const TQColorGroup &cg, bool menu = false ) const; void drawGradientWithBorder( TQPainter *p, TQRect const &r, bool horiz = true ) const; @@ -292,7 +292,7 @@ class KlearlookStyle : public KStyle { void drawSliderHandle( TQPainter *p, const TQRect &r, const TQColorGroup &cg, TQStyle::SFlags flags ) const; void drawPopupRect( TQPainter *p, const TQRect &r, const TQColorGroup &cg) const ; - void drawSliderGroove( TQPainter *p, const TQRect &r, TQStyle::SFlags flags, const TQWidget *widget ) const; + void drawSliderGroove( TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, TQStyle::SFlags flags, const TQWidget *widget ) const; private: |