From 0ee242623bc254b99d10bac9973cb375cb3aa3a9 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 8 Aug 2012 17:47:50 -0500 Subject: Update style API --- kstyles/light/lightstyle-v2.cpp | 4 ++-- kstyles/light/lightstyle-v2.h | 2 +- kstyles/light/lightstyle-v3.cpp | 4 ++-- kstyles/light/lightstyle-v3.h | 2 +- tdefx/kstyle.cpp | 21 ++++++++++++++------- tdefx/kstyle.h | 2 +- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/kstyles/light/lightstyle-v2.cpp b/kstyles/light/lightstyle-v2.cpp index 7908b2e8d..8df9606ad 100644 --- a/kstyles/light/lightstyle-v2.cpp +++ b/kstyles/light/lightstyle-v2.cpp @@ -83,9 +83,9 @@ LightStyleV2::~LightStyleV2() } } -void LightStyleV2::polishPopupMenu( TQPopupMenu * menu ) +void LightStyleV2::polishPopupMenu( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) { - KStyle::polishPopupMenu(menu); + KStyle::polishPopupMenu(ceData, elementFlags, ptr); } static void drawLightBevel(TQPainter *p, const TQRect &r, const TQColorGroup &cg, diff --git a/kstyles/light/lightstyle-v2.h b/kstyles/light/lightstyle-v2.h index 061ca915f..d4b805eb0 100644 --- a/kstyles/light/lightstyle-v2.h +++ b/kstyles/light/lightstyle-v2.h @@ -42,7 +42,7 @@ public: LightStyleV2(); virtual ~LightStyleV2(); - void polishPopupMenu( TQPopupMenu * ); + void polishPopupMenu( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ); void drawPrimitive(TQ_PrimitiveElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, diff --git a/kstyles/light/lightstyle-v3.cpp b/kstyles/light/lightstyle-v3.cpp index 22fce7149..97c9d2e0b 100644 --- a/kstyles/light/lightstyle-v3.cpp +++ b/kstyles/light/lightstyle-v3.cpp @@ -59,9 +59,9 @@ LightStyleV3::~LightStyleV3() delete basestyle; } -void LightStyleV3::polishPopupMenu( TQPopupMenu * menu) +void LightStyleV3::polishPopupMenu( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) { - KStyle::polishPopupMenu(menu); + KStyle::polishPopupMenu(ceData, elementFlags, ptr); // empty to satisy pure virtual requirements } diff --git a/kstyles/light/lightstyle-v3.h b/kstyles/light/lightstyle-v3.h index dbdb50ca0..02059350c 100644 --- a/kstyles/light/lightstyle-v3.h +++ b/kstyles/light/lightstyle-v3.h @@ -46,7 +46,7 @@ public: LightStyleV3(); virtual ~LightStyleV3(); - void polishPopupMenu( TQPopupMenu * ); + void polishPopupMenu( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ); void drawPrimitive(TQ_PrimitiveElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &, SFlags = Style_Default, diff --git a/tdefx/kstyle.cpp b/tdefx/kstyle.cpp index a983bd1d2..d95d98281 100644 --- a/tdefx/kstyle.cpp +++ b/tdefx/kstyle.cpp @@ -302,15 +302,22 @@ void KStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags ele // Style changes (should) always re-polish popups. -void KStyle::polishPopupMenu( TQPopupMenu* p ) +void KStyle::polishPopupMenu( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) { - if (!p->testWState( WState_Polished )) - p->setCheckable(true); + if ( !(ceData.windowState & WState_Polished ) ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetCheckable); + } - // Install transparency handler if the effect is enabled. - if ( d->menuHandler && - (strcmp(p->name(), "tear off menu") != 0)) - p->installEventFilter(d->menuHandler); + if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { + TQWidget* widget = reinterpret_cast(ptr); + TQPopupMenu *p = dynamic_cast(widget); + if (p) { + // Install transparency handler if the effect is enabled. + if ( d->menuHandler && (strcmp(p->name(), "tear off menu") != 0)) { + p->installEventFilter(d->menuHandler); + } + } + } } diff --git a/tdefx/kstyle.h b/tdefx/kstyle.h index c9edd25ab..0d36678cf 100644 --- a/tdefx/kstyle.h +++ b/tdefx/kstyle.h @@ -288,7 +288,7 @@ class TDEFX_EXPORT KStyle: public TQCommonStyle void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); - void polishPopupMenu( TQPopupMenu* ); + void polishPopupMenu( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ); void tqdrawPrimitive( TQ_PrimitiveElement pe, TQPainter* p, -- cgit v1.2.1