diff options
-rw-r--r-- | style/baghira.h | 5 | ||||
-rw-r--r-- | style/eventfilter.cpp | 20 | ||||
-rw-r--r-- | style/polish.cpp | 50 |
3 files changed, 42 insertions, 33 deletions
diff --git a/style/baghira.h b/style/baghira.h index e0ee8a5..8f219aa 100644 --- a/style/baghira.h +++ b/style/baghira.h @@ -577,7 +577,10 @@ public: ControlElementFlags elementFlags, const TQStyleOption& = TQStyleOption::Default, const TQWidget *widget = 0 ) const; - bool eventFilter( TQObject *object, TQEvent *event ); + virtual bool objectEventHandler( const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + void* source, + TQEvent *ev ); private slots: void updateProgressPos(); diff --git a/style/eventfilter.cpp b/style/eventfilter.cpp index 4d1eb4b..8200ba1 100644 --- a/style/eventfilter.cpp +++ b/style/eventfilter.cpp @@ -4,8 +4,20 @@ #include <X11/extensions/XTest.h> #include <fixx11h.h> -bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev ) +bool LiquidStyle::objectEventHandler( const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + void* source, + TQEvent *ev ) { + if (TDEStyle::objectEventHandler(ceData, elementFlags, source, ev)) { + return true; + } + + if (!ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) { + return false; + } + TQObject* obj = reinterpret_cast<TQObject*>(source); + // tqWarning("%s, %s <- %s, %s: %d", obj->className(), obj->name(), obj->parent() ? obj->parent()->className() : "none", obj->parent()?obj->parent()->name():"none",ev->type()); switch (ev->type()) { @@ -179,8 +191,6 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev ) TQButton * btn = ( TQButton * ) obj; bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "TQStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) ); bool isRadio = obj->inherits( "TQRadioButton" ); - const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(btn, TQStyleOption()); - ControlElementFlags elementFlags = getControlElementFlagsForObject(btn, TQStyleOption()); btn->erase(); TQPainter p; p.begin( btn ); @@ -342,8 +352,6 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev ) { bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "TQStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) ); bool isRadio = obj->inherits( "TQRadioButton" ); - const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(btn, TQStyleOption()); - ControlElementFlags elementFlags = getControlElementFlagsForObject(btn, TQStyleOption()); highlightWidget = btn; TQFontMetrics fm = btn->fontMetrics(); TQSize lsz = fm.size( ShowPrefix, btn->text() ); @@ -489,8 +497,6 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev ) { bool isRadio = obj->inherits( "TQRadioButton" ); bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "TQStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) ); - const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(btn, TQStyleOption()); - ControlElementFlags elementFlags = getControlElementFlagsForObject(btn, TQStyleOption()); highlightWidget = NULL; TQFontMetrics fm = btn->fontMetrics(); TQSize lsz = fm.size( ShowPrefix, btn->text() ); diff --git a/style/polish.cpp b/style/polish.cpp index 73d1f49..f73a2b6 100644 --- a/style/polish.cpp +++ b/style/polish.cpp @@ -235,7 +235,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen // int testInt = 0; // if (w->sizePolicy().horData() == TQSizePolicy::Minimum || w->sizePolicy().horData() == TQSizePolicy::MinimumExpanding) // tqWarning("%s, \"%s\"",w->className(), w->name()); -// w->installEventFilter(this); +// installObjectEventHandler(ceData, elementFlags, ptr, this); if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { TQWidget *w = reinterpret_cast<TQWidget*>(ptr); @@ -318,7 +318,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen w->setBackgroundMode( TQWidget::PaletteBackground ); KPixmap tmpPix = TQPixmap(w->width(), 32); w->setPaletteBackgroundPixmap(KPixmapEffect::unbalancedGradient(tmpPix, optionHandler->Color(), optionHandler->Color2(),KPixmapEffect::HorizontalGradient, 100, 100, 16)); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); break; } default: @@ -350,7 +350,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen { if (!isKicker) w->installEventFilter( bmShower ); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); } } } // TopLevel Widgets @@ -368,7 +368,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen // kiconedit doesn't check for the paintevent rect size, but tries to create a (possibly) NULL Pixmap (after palette change event e.g.) // so we catch it's paint event and destroy it if the size is NULL // remove this after kiconedit corrected its code - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); goto kstpolish; } @@ -381,7 +381,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen if (qstrcmp( w->name(), "tde toolbar widget" ) == 0 ) - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); if (::tqt_cast<TQButton*>(w)) { @@ -407,13 +407,13 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen if (!(w->parent() && w->parent()->inherits("MiniBar"))) #endif w->setBackgroundMode( TQWidget::NoBackground); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); goto kstpolish; } else if (w->inherits( "TQRadioButton" ) || w->inherits( "TQCheckBox" )) { w->setBackgroundOrigin(TQWidget::WindowOrigin); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); goto kstpolish; } } @@ -427,7 +427,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen w->setBackgroundOrigin(TQWidget::WindowOrigin); if (optionHandler->style() > Panther) { - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); if (optionHandler->wmDesign == Tiger) { XChangeProperty(tqt_xdisplay(), w->topLevelWidget()->winId(), baghira_deco_design, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &(optionHandler->wmDesign), 1L); @@ -446,14 +446,14 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen } w->setBackgroundMode( TQWidget::PaletteBackground ); w->setBackgroundOrigin(TQWidget::WindowOrigin); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); goto kstpolish; } if (::tqt_cast<TQComboBox*>(w)) { w->setBackgroundMode(NoBackground); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); w->setBackgroundOrigin(TQWidget::WindowOrigin); goto kstpolish; } @@ -465,7 +465,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen } if (w->inherits("TQSpinWidget") || w->inherits("KDockWidgetAbstractHeaderDrag")){ - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); goto kstpolish; } @@ -520,7 +520,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen #endif // listen to enter events - highlightning the scrollbars w->setMouseTracking( true ); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); goto kstpolish; } @@ -530,7 +530,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen if ( qstrcmp( w->name(), "KonquerorFrameStatusBar" ) == 0 ) // konqueror resets the statusbars background to TQt::White as soon as you open a new tab - our eventfilter will block this { - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); } goto kstpolish; } @@ -538,13 +538,13 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen if (w->inherits( "TQLineEdit" ) || w->inherits("TQSplitterHandle") || w->isA( "AppletHandleDrag" ) || w->inherits( "KMiniPagerButton" )) { w->setBackgroundOrigin(TQWidget::WindowOrigin); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); goto kstpolish; } if (w->inherits( "TaskContainer" )) { - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); goto kstpolish; } @@ -609,7 +609,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen w->setPalette( pal ); } w->setBackgroundOrigin(TQWidget::WindowOrigin); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); #if 0 if (!::tqt_cast<KMenuBar*>(w)) { @@ -646,7 +646,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen { w->setPalette( tooltipPalette ); w->setBackgroundOrigin(TQWidget::WidgetOrigin); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); } } if (qstrcmp( w->name(), "backdrop" ) == 0) //kscd @@ -664,7 +664,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen else if (w->inherits( "KAnimWidget" )) { ((TQFrame *)w)->setFrameShape(TQFrame::NoFrame); - w->installEventFilter( this ); // the widget resets it's frameshape on mouseevents - looks crap! + installObjectEventHandler(ceData, elementFlags, ptr, this); // the widget resets it's frameshape on mouseevents - looks crap! goto kstpolish ; } else if (((TQFrame *)w)->frameShape() >= TQFrame::Box && ((TQFrame *)w)->frameShape() <= TQFrame::WinPanel){ @@ -678,7 +678,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen if ( w->parentWidget() && ( ( ::tqt_cast<TQListBox*>(w) && ::tqt_cast<TQPushButton*>(w->parentWidget())) || w->inherits( "TDECompletionBox" ) ) ) { TQListBox* listbox = (TQListBox*) w; listbox->setBackgroundMode( NoBackground ); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); goto kstpolish; } //if (testWidget) tqWarning("testwidget stage %d",testInt++); @@ -689,7 +689,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen // headerSortID = ((TQListView*)w->parentWidget())->sortColumn(); // if (w->parentWidget()) tqWarning(w->parentWidget()->className()); w->setBackgroundMode( NoBackground ); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); goto kstpolish; } //if (testWidget) tqWarning("testwidget stage %d",testInt++); @@ -698,7 +698,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen if (::tqt_cast<TQTabBar*>(w)){ // tqWarning("installing tab event"); w->setMouseTracking( true ); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); w->setBackgroundOrigin(TQWidget::WindowOrigin); goto kstpolish; } @@ -718,7 +718,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen } } w->setBackgroundOrigin(TQWidget::WindowOrigin); - w->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } //if (testWidget) tqWarning("testwidget stage %d",testInt++); @@ -726,7 +726,7 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen if (w->inherits("TQProgressBar")) { w->setBackgroundMode( NoBackground ); - w->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); connect(w, SIGNAL(destroyed(TQObject*)), this, SLOT(progressBarDestroyed(TQObject*))); goto kstpolish; } @@ -734,14 +734,14 @@ void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElemen if ( w->inherits( "TQDockWindow" ) ) { w->setBackgroundMode( TQWidget::PaletteBackground ); w->setBackgroundOrigin(TQWidget::WindowOrigin); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); goto kstpolish ; } if ( ::tqt_cast<TQScrollBar*>(w)) { TQCursor tmpCursor(TQt::PointingHandCursor); w->setCursor(tmpCursor); - w->installEventFilter( this ); + installObjectEventHandler(ceData, elementFlags, ptr, this); w->setBackgroundMode( TQWidget::NoBackground ); goto kstpolish ; } |