TQStyle API update

pull/1/head
Timothy Pearson 12 years ago
parent 8a81e3e9ad
commit 4fc58f393f

@ -119,27 +119,35 @@ TQString TQtCKStyle::defaultStyle()
} }
void TQtCKStyle::polish( TQWidget* widget ) void TQtCKStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{ {
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
if ( d->useFilledFrameWorkaround ) if ( d->useFilledFrameWorkaround )
{ {
if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) { if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) {
TQFrame::Shape shape = frame->frameShape(); TQFrame::Shape shape = frame->frameShape();
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel) if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
}
} }
} }
} }
void TQtCKStyle::unPolish( TQWidget* widget ) void TQtCKStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{ {
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
if ( d->useFilledFrameWorkaround ) if ( d->useFilledFrameWorkaround )
{ {
if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) { if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) {
TQFrame::Shape shape = frame->frameShape(); TQFrame::Shape shape = frame->frameShape();
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel) if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
}
} }
} }
} }
@ -1671,9 +1679,11 @@ int TQtCKStyle::styleHint( StyleHint sh, TQStyleControlElementData ceData, Contr
} }
} }
bool TQtCKStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
bool TQtCKStyle::eventFilter( TQObject* object, TQEvent* event )
{ {
if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
TQObject* object = reinterpret_cast<TQObject*>(source);
if ( d->useFilledFrameWorkaround ) if ( d->useFilledFrameWorkaround )
{ {
// Make the TQMenuBar/TQToolBar paintEvent() cover a larger area to // Make the TQMenuBar/TQToolBar paintEvent() cover a larger area to
@ -1718,6 +1728,7 @@ bool TQtCKStyle::eventFilter( TQObject* object, TQEvent* event )
return true; return true;
} }
} }
}
return false; return false;
} }

@ -253,8 +253,8 @@ class TQtCKStyle: public TQCommonStyle
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
void polish( TQWidget* widget ); void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void unPolish( TQWidget* widget ); void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void polishPopupMenu( TQPopupMenu* ); void polishPopupMenu( TQPopupMenu* );
void drawPrimitive( PrimitiveElement pe, void drawPrimitive( PrimitiveElement pe,
@ -320,7 +320,7 @@ class TQtCKStyle: public TQCommonStyle
const TQWidget* w = 0 ) const; const TQWidget* w = 0 ) const;
protected: protected:
bool eventFilter( TQObject* object, TQEvent* event ); virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
private: private:
// Disable copy constructor and = operator // Disable copy constructor and = operator

@ -1154,8 +1154,11 @@ static TQString getFile(const TQString &f)
return d; return d;
} }
void TQtCurveStyle::polish(TQApplication *app) void TQtCurveStyle::applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{ {
if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) {
TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
TQString appName(getFile(app->argv()[0])); TQString appName(getFile(app->argv()[0]));
if(NULL!=getenv("QTCURVE_DEBUG")) if(NULL!=getenv("QTCURVE_DEBUG"))
@ -1164,9 +1167,9 @@ void TQtCurveStyle::polish(TQApplication *app)
if ("kicker"==appName || "appletproxy"==appName) if ("kicker"==appName || "appletproxy"==appName)
{ {
itsThemedApp=APP_KICKER; itsThemedApp=APP_KICKER;
#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200 #if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
itsIsTransKicker=kickerIsTrans(); itsIsTransKicker=kickerIsTrans();
#endif #endif
} }
else if ("kontact"==appName) else if ("kontact"==appName)
itsThemedApp=APP_KONTACT; itsThemedApp=APP_KONTACT;
@ -1199,9 +1202,9 @@ void TQtCurveStyle::polish(TQApplication *app)
else if ("korn"==appName) else if ("korn"==appName)
{ {
itsThemedApp=APP_KORN; itsThemedApp=APP_KORN;
#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200 #if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
itsIsTransKicker=kickerIsTrans(); itsIsTransKicker=kickerIsTrans();
#endif #endif
} }
else if ("mactor"==appName) else if ("mactor"==appName)
{ {
@ -1223,11 +1226,11 @@ void TQtCurveStyle::polish(TQApplication *app)
{ {
TQMetaObject *meta=(TQMetaObject *)metaObject(); TQMetaObject *meta=(TQMetaObject *)metaObject();
#ifdef USE_QT4 #ifdef USE_QT4
#warning Qt4 does not allow the metaobject classname to be set (skipping) #warning Qt4 does not allow the metaobject classname to be set (skipping)
#else // USE_QT4 #else // USE_QT4
meta->classname="HighContrastStyle"; meta->classname="HighContrastStyle";
#endif // USE_QT4 #endif // USE_QT4
} }
if(opts.scrollbarType==SCROLLBAR_NEXT) if(opts.scrollbarType==SCROLLBAR_NEXT)
@ -1239,10 +1242,11 @@ void TQtCurveStyle::polish(TQApplication *app)
if(SHADE_NONE!=opts.menuStripe && opts.noMenuStripeApps.contains(appName)) if(SHADE_NONE!=opts.menuStripe && opts.noMenuStripeApps.contains(appName))
opts.menuStripe=SHADE_NONE; opts.menuStripe=SHADE_NONE;
#ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT #ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
if(opts.fixParentlessDialogs && (opts.noDlgFixApps.contains(appName) || opts.noDlgFixApps.contains("kde"))) if(opts.fixParentlessDialogs && (opts.noDlgFixApps.contains(appName) || opts.noDlgFixApps.contains("kde")))
opts.fixParentlessDialogs=false; opts.fixParentlessDialogs=false;
#endif #endif
}
} }
void TQtCurveStyle::polish(TQPalette &pal) void TQtCurveStyle::polish(TQPalette &pal)
@ -1458,8 +1462,11 @@ TQColorGroup TQtCurveStyle::setColorGroup(const TQColorGroup &old, const TQColor
static const char * kdeToolbarWidget="kde toolbar widget"; static const char * kdeToolbarWidget="kde toolbar widget";
void TQtCurveStyle::polish(TQWidget *widget) void TQtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{ {
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
bool enableFilter(opts.highlightFactor || opts.coloredMouseOver); bool enableFilter(opts.highlightFactor || opts.coloredMouseOver);
if(::isKhtmlFormWidget(widget)) if(::isKhtmlFormWidget(widget))
@ -1472,7 +1479,7 @@ void TQtCurveStyle::polish(TQWidget *widget)
connect(widget, TQT_SIGNAL(destroyed(TQObject *)), this, TQT_SLOT(hoverWidgetDestroyed(TQObject *))); connect(widget, TQT_SIGNAL(destroyed(TQObject *)), this, TQT_SLOT(hoverWidgetDestroyed(TQObject *)));
if(isWindowDragWidget(TQT_TQOBJECT(widget))) if(isWindowDragWidget(TQT_TQOBJECT(widget)))
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
if(APPEARANCE_STRIPED==opts.bgndAppearance && (::tqqt_cast<TQDialog *>(widget) || ::tqqt_cast<TQMainWindow *>(widget))) if(APPEARANCE_STRIPED==opts.bgndAppearance && (::tqqt_cast<TQDialog *>(widget) || ::tqqt_cast<TQMainWindow *>(widget)))
setBgndProp(widget, APPEARANCE_STRIPED); setBgndProp(widget, APPEARANCE_STRIPED);
@ -1480,23 +1487,23 @@ void TQtCurveStyle::polish(TQWidget *widget)
if(widget->parentWidget() && ::tqqt_cast<TQScrollView *>(widget) && ::tqqt_cast<TQComboBox *>(widget->parentWidget())) if(widget->parentWidget() && ::tqqt_cast<TQScrollView *>(widget) && ::tqqt_cast<TQComboBox *>(widget->parentWidget()))
{ {
TQPalette pal(widget->palette()); TQPalette pal(widget->palette());
#if 0 #if 0
TQPalette orig(pal); TQPalette orig(pal);
#endif #endif
TQColorGroup act(pal.active()); TQColorGroup act(pal.active());
#if 0 #if 0
if(opts.gtkComboMenus) if(opts.gtkComboMenus)
act.setColor(TQColorGroup::Base, USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]); act.setColor(TQColorGroup::Base, USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]);
act.setColor(TQColorGroup::Background, opts.gtkComboMenus act.setColor(TQColorGroup::Background, opts.gtkComboMenus
? USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE] ? USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]
: TQApplication::palette().active().base()); : TQApplication::palette().active().base());
#endif #endif
act.setColor(TQColorGroup::Foreground, itsBackgroundCols[STD_BORDER]); act.setColor(TQColorGroup::Foreground, itsBackgroundCols[STD_BORDER]);
pal.setActive(act); pal.setActive(act);
widget->setPalette(pal); widget->setPalette(pal);
#if 0 #if 0
//((TQScrollView *)widget)->setMargin(1); //((TQScrollView *)widget)->setMargin(1);
const TQObjectList *children(widget->children()); const TQObjectList *children(widget->children());
@ -1510,7 +1517,7 @@ void TQtCurveStyle::polish(TQWidget *widget)
if(::tqqt_cast<TQWidget *>(*it)) if(::tqqt_cast<TQWidget *>(*it))
((TQWidget *)(*it))->setPalette(orig); ((TQWidget *)(*it))->setPalette(orig);
} }
#endif #endif
} }
if (APP_MACTOR==itsThemedApp && itsMactorPal && !widget->inherits("TQTipLabel")) if (APP_MACTOR==itsThemedApp && itsMactorPal && !widget->inherits("TQTipLabel"))
@ -1522,11 +1529,11 @@ void TQtCurveStyle::polish(TQWidget *widget)
((TQHBox *)widget)->setLineWidth(0); ((TQHBox *)widget)->setLineWidth(0);
if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::tqqt_cast<const TQPopupMenu *>(widget)) if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::tqqt_cast<const TQPopupMenu *>(widget))
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
#if 0 #if 0
if(opts.menubarHiding && ::tqqt_cast<TQMainWindow *>(widget) && static_cast<TQMainWindow *>(widget)->menuBar()) if(opts.menubarHiding && ::tqqt_cast<TQMainWindow *>(widget) && static_cast<TQMainWindow *>(widget)->menuBar())
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
#endif #endif
if ((opts.square&SQUARE_SCROLLVIEW) && widget && if ((opts.square&SQUARE_SCROLLVIEW) && widget &&
@ -1550,10 +1557,10 @@ void TQtCurveStyle::polish(TQWidget *widget)
if(framelessGroupBoxCheckBox || enableFilter) if(framelessGroupBoxCheckBox || enableFilter)
{ {
#if 0x039999 >= 0x030200 #if 0x039999 >= 0x030200
if(!isFormWidget(widget)) if(!isFormWidget(widget))
widget->setMouseTracking(true); widget->setMouseTracking(true);
#endif #endif
if(framelessGroupBoxCheckBox) if(framelessGroupBoxCheckBox)
{ {
TQFont fnt(widget->font()); TQFont fnt(widget->font());
@ -1561,7 +1568,7 @@ void TQtCurveStyle::polish(TQWidget *widget)
fnt.setBold(true); fnt.setBold(true);
widget->setFont(fnt); widget->setFont(fnt);
} }
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
} }
} }
else if (::tqqt_cast<TQHeader *>(widget) || ::tqqt_cast<TQTabBar *>(widget) || ::tqqt_cast<TQSpinWidget *>(widget)/* || else if (::tqqt_cast<TQHeader *>(widget) || ::tqqt_cast<TQTabBar *>(widget) || ::tqqt_cast<TQSpinWidget *>(widget)/* ||
@ -1570,7 +1577,7 @@ void TQtCurveStyle::polish(TQWidget *widget)
if(enableFilter) if(enableFilter)
{ {
widget->setMouseTracking(true); widget->setMouseTracking(true);
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
} }
} }
else if (::tqqt_cast<TQToolButton *>(widget)) else if (::tqqt_cast<TQToolButton *>(widget))
@ -1579,10 +1586,10 @@ void TQtCurveStyle::polish(TQWidget *widget)
widget->setBackgroundMode(PaletteBackground); widget->setBackgroundMode(PaletteBackground);
if(enableFilter) if(enableFilter)
{ {
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
#if defined TDE_VERSION && TDE_VERSION >= 0x30400 && TDE_VERSION < 0x30500 #if defined TDE_VERSION && TDE_VERSION >= 0x30400 && TDE_VERSION < 0x30500
widget->setMouseTracking(true); widget->setMouseTracking(true);
#endif #endif
} }
} }
else if (::tqqt_cast<TQButton *>(widget) || widget->inherits("TQToolBarExtensionWidget")) else if (::tqqt_cast<TQButton *>(widget) || widget->inherits("TQToolBarExtensionWidget"))
@ -1592,13 +1599,13 @@ void TQtCurveStyle::polish(TQWidget *widget)
else*/ if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget)) else*/ if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
widget->setBackgroundMode(PaletteBackground); widget->setBackgroundMode(PaletteBackground);
if(enableFilter) if(enableFilter)
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
} }
else if (::tqqt_cast<TQComboBox *>(widget)) else if (::tqqt_cast<TQComboBox *>(widget))
{ {
if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget)) if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
widget->setBackgroundMode(PaletteBackground); widget->setBackgroundMode(PaletteBackground);
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
if(DO_EFFECT && onToolBar(widget)) if(DO_EFFECT && onToolBar(widget))
widget->setName(kdeToolbarWidget); widget->setName(kdeToolbarWidget);
@ -1608,13 +1615,15 @@ void TQtCurveStyle::polish(TQWidget *widget)
if(((TQComboBox *)widget)->listBox()) if(((TQComboBox *)widget)->listBox())
((TQComboBox *)widget)->listBox()->installEventFilter(this); ((TQComboBox *)widget)->listBox()->installEventFilter(this);
// FIXME
// installObjectEventHandler(ceData, elementFlags, ptr, this);
} }
else if(::tqqt_cast<TQMenuBar *>(widget)) else if(::tqqt_cast<TQMenuBar *>(widget))
{ {
if(NoBackground!=widget->backgroundMode()) if(NoBackground!=widget->backgroundMode())
widget->setBackgroundMode(PaletteBackground); widget->setBackgroundMode(PaletteBackground);
if(SHADE_NONE!=opts.shadeMenubars) if(SHADE_NONE!=opts.shadeMenubars)
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
if(BLEND_TITLEBAR || opts.windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR) if(BLEND_TITLEBAR || opts.windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR)
emitMenuSize(widget, widget->rect().height()); emitMenuSize(widget, widget->rect().height());
if(SHADE_WINDOW_BORDER==opts.shadeMenubars) if(SHADE_WINDOW_BORDER==opts.shadeMenubars)
@ -1664,28 +1673,28 @@ void TQtCurveStyle::polish(TQWidget *widget)
{ {
widget->setName(kdeToolbarWidget); widget->setName(kdeToolbarWidget);
widget->setBackgroundMode(NoBackground); widget->setBackgroundMode(NoBackground);
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
} }
else if (::tqqt_cast<TQScrollBar *>(widget)) else if (::tqqt_cast<TQScrollBar *>(widget))
{ {
if(enableFilter) if(enableFilter)
{ {
widget->setMouseTracking(true); widget->setMouseTracking(true);
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
} }
//widget->setBackgroundMode(NoBackground); //widget->setBackgroundMode(NoBackground);
} }
else if (::tqqt_cast<TQSlider *>(widget)) else if (::tqqt_cast<TQSlider *>(widget))
{ {
if(enableFilter) if(enableFilter)
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
if(widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent())) if(widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent()))
{ {
widget->setName(kdeToolbarWidget); widget->setName(kdeToolbarWidget);
widget->setBackgroundMode(NoBackground); // We paint whole background. widget->setBackgroundMode(NoBackground); // We paint whole background.
if(!enableFilter) if(!enableFilter)
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
} }
// This bit stolen form polyester... // This bit stolen form polyester...
@ -1694,7 +1703,7 @@ void TQtCurveStyle::polish(TQWidget *widget)
} }
else if (::tqqt_cast<TQLineEdit*>(widget) || ::tqqt_cast<TQTextEdit*>(widget)) else if (::tqqt_cast<TQLineEdit*>(widget) || ::tqqt_cast<TQTextEdit*>(widget))
{ {
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
if(onToolBar(widget)) if(onToolBar(widget))
widget->setName(kdeToolbarWidget); widget->setName(kdeToolbarWidget);
if(widget && widget->parentWidget() && if(widget && widget->parentWidget() &&
@ -1705,7 +1714,7 @@ void TQtCurveStyle::polish(TQWidget *widget)
else if (widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || widget->inherits("TQDockWindowResizeHandle")) else if (widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || widget->inherits("TQDockWindowResizeHandle"))
{ {
if(enableFilter) if(enableFilter)
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
} }
else if (0==qstrcmp(widget->name(), kdeToolbarWidget)) else if (0==qstrcmp(widget->name(), kdeToolbarWidget))
{ {
@ -1714,14 +1723,14 @@ void TQtCurveStyle::polish(TQWidget *widget)
"KListViewSearchLineWidget") || "KListViewSearchLineWidget") ||
onToolBar(widget)) onToolBar(widget))
{ {
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
widget->setBackgroundMode(NoBackground); // We paint whole background. widget->setBackgroundMode(NoBackground); // We paint whole background.
} }
} }
if (widget->parentWidget() && ::tqqt_cast<TQMenuBar *>(widget->parentWidget()) && !qstrcmp(widget->className(), TQFRAME_OBJECT_NAME_STRING)) if (widget->parentWidget() && ::tqqt_cast<TQMenuBar *>(widget->parentWidget()) && !qstrcmp(widget->className(), TQFRAME_OBJECT_NAME_STRING))
{ {
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
widget->setBackgroundMode(NoBackground); // We paint whole background. widget->setBackgroundMode(NoBackground); // We paint whole background.
} }
else if (TQt::X11ParentRelative!=widget->backgroundMode() && else if (TQt::X11ParentRelative!=widget->backgroundMode() &&
@ -1732,7 +1741,7 @@ void TQtCurveStyle::polish(TQWidget *widget)
"MainWindow") || onToolBar(widget))) "MainWindow") || onToolBar(widget)))
{ {
widget->setName(kdeToolbarWidget); widget->setName(kdeToolbarWidget);
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
widget->setBackgroundMode(NoBackground); // We paint the whole background. widget->setBackgroundMode(NoBackground); // We paint the whole background.
} }
else if(::tqqt_cast<TQProgressBar *>(widget)) else if(::tqqt_cast<TQProgressBar *>(widget))
@ -1746,7 +1755,7 @@ void TQtCurveStyle::polish(TQWidget *widget)
if(opts.animatedProgress) if(opts.animatedProgress)
{ {
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
itsProgAnimWidgets[widget] = 0; itsProgAnimWidgets[widget] = 0;
connect(widget, TQT_SIGNAL(destroyed(TQObject *)), this, TQT_SLOT(progressBarDestroyed(TQObject *))); connect(widget, TQT_SIGNAL(destroyed(TQObject *)), this, TQT_SLOT(progressBarDestroyed(TQObject *)));
if (!itsAnimationTimer->isActive()) if (!itsAnimationTimer->isActive())
@ -1754,7 +1763,7 @@ void TQtCurveStyle::polish(TQWidget *widget)
} }
} }
else if(opts.highlightScrollViews && ::tqqt_cast<TQScrollView*>(widget)) else if(opts.highlightScrollViews && ::tqqt_cast<TQScrollView*>(widget))
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
else if(!qstrcmp(widget->className(), "KonqFrameStatusBar")) else if(!qstrcmp(widget->className(), "KonqFrameStatusBar"))
{ {
// This disables the white background of the KonquerorFrameStatusBar. // This disables the white background of the KonquerorFrameStatusBar.
@ -1769,13 +1778,13 @@ void TQtCurveStyle::polish(TQWidget *widget)
TQApplication::setPalette(pal); TQApplication::setPalette(pal);
} }
else if(widget->inherits("KTabCtl")) else if(widget->inherits("KTabCtl"))
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
else if(NO_FRAME(opts.groupBox) && ::tqqt_cast<TQGroupBox *>(widget)) else if(NO_FRAME(opts.groupBox) && ::tqqt_cast<TQGroupBox *>(widget))
{ {
((TQGroupBox *)widget)->setFlat(false); ((TQGroupBox *)widget)->setFlat(false);
((TQGroupBox *)widget)->setFrameShape(TQFrame::NoFrame); ((TQGroupBox *)widget)->setFrameShape(TQFrame::NoFrame);
} }
#ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT #ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
else if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(widget)) else if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(widget))
{ {
TQDialog *dlg=(TQDialog *)widget; TQDialog *dlg=(TQDialog *)widget;
@ -1785,7 +1794,7 @@ void TQtCurveStyle::polish(TQWidget *widget)
if( (SKIP_TASKBAR && !dlg->parentWidget()) || if( (SKIP_TASKBAR && !dlg->parentWidget()) ||
( (!dlg->parentWidget() || !dlg->parentWidget()->isShown())// && ( (!dlg->parentWidget() || !dlg->parentWidget()->isShown())// &&
/*(dlg->isModal() || ::tqqt_cast<TQProgressDialog *>(widget))*/) ) /*(dlg->isModal() || ::tqqt_cast<TQProgressDialog *>(widget))*/) )
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
} }
if(opts.fixParentlessDialogs && (APP_KPRINTER==itsThemedApp || APP_KDIALOG==itsThemedApp || if(opts.fixParentlessDialogs && (APP_KPRINTER==itsThemedApp || APP_KDIALOG==itsThemedApp ||
@ -1804,7 +1813,7 @@ void TQtCurveStyle::polish(TQWidget *widget)
(index+17)==(int)cap.length())) ) (index+17)==(int)cap.length())) )
widget->TQWidget::setCaption(cap.left(index)); widget->TQWidget::setCaption(cap.left(index));
} }
#endif #endif
if(APP_SYSTEMSETTINGS==itsThemedApp) if(APP_SYSTEMSETTINGS==itsThemedApp)
{ {
@ -1833,61 +1842,68 @@ void TQtCurveStyle::polish(TQWidget *widget)
if(APPEARANCE_STRIPED==opts.bgndAppearance) if(APPEARANCE_STRIPED==opts.bgndAppearance)
widget->setBackgroundOrigin(TQWidget::WindowOrigin); widget->setBackgroundOrigin(TQWidget::WindowOrigin);
BASE_STYLE::polish(widget); }
BASE_STYLE::polish(ceData, elementFlags, ptr);
} }
void TQtCurveStyle::unPolish(TQWidget *widget) void TQtCurveStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{ {
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
if(isFormWidget(widget)) if(isFormWidget(widget))
itsKhtmlWidgets.remove(widget); itsKhtmlWidgets.remove(widget);
if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::tqqt_cast<const TQPopupMenu *>(widget)) if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::tqqt_cast<const TQPopupMenu *>(widget))
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
#if 0 #if 0
if(opts.menubarHiding && ::tqqt_cast<TQMainWindow *>(widget) && static_cast<TQMainWindow *>(widget)->menuBar()) if(opts.menubarHiding && ::tqqt_cast<TQMainWindow *>(widget) && static_cast<TQMainWindow *>(widget)->menuBar())
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
#endif #endif
if(isWindowDragWidget(TQT_TQOBJECT(widget))) if(isWindowDragWidget(TQT_TQOBJECT(widget)))
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
if (::tqqt_cast<TQRadioButton *>(widget) || ::tqqt_cast<TQCheckBox *>(widget)) if (::tqqt_cast<TQRadioButton *>(widget) || ::tqqt_cast<TQCheckBox *>(widget))
{ {
#if 0x039999 >= 0x030200 #if 0x039999 >= 0x030200
widget->setMouseTracking(false); widget->setMouseTracking(false);
#endif #endif
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
} }
else if (::tqqt_cast<TQHeader *>(widget) || ::tqqt_cast<TQTabBar *>(widget) || ::tqqt_cast<TQSpinWidget *>(widget) /*|| else if (::tqqt_cast<TQHeader *>(widget) || ::tqqt_cast<TQTabBar *>(widget) || ::tqqt_cast<TQSpinWidget *>(widget) /*||
::tqqt_cast<TQDateTimeEditBase*>(widget)*/) ::tqqt_cast<TQDateTimeEditBase*>(widget)*/)
{ {
widget->setMouseTracking(false); widget->setMouseTracking(false);
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
} }
else if (::tqqt_cast<TQButton *>(widget) || widget->inherits("TQToolBarExtensionWidget")) else if (::tqqt_cast<TQButton *>(widget) || widget->inherits("TQToolBarExtensionWidget"))
{ {
if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget)) if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
widget->setBackgroundMode(PaletteButton); widget->setBackgroundMode(PaletteButton);
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
} }
else if (::tqqt_cast<TQToolButton *>(widget)) else if (::tqqt_cast<TQToolButton *>(widget))
{ {
if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget)) if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
widget->setBackgroundMode(PaletteButton); widget->setBackgroundMode(PaletteButton);
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
#if defined TDE_VERSION && TDE_VERSION >= 0x30400 && TDE_VERSION < 0x30500 #if defined TDE_VERSION && TDE_VERSION >= 0x30400 && TDE_VERSION < 0x30500
widget->setMouseTracking(false); widget->setMouseTracking(false);
#endif #endif
} }
else if (::tqqt_cast<TQComboBox *>(widget)) else if (::tqqt_cast<TQComboBox *>(widget))
{ {
if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget)) if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
widget->setBackgroundMode(PaletteButton); widget->setBackgroundMode(PaletteButton);
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
widget->setMouseTracking(false); widget->setMouseTracking(false);
if(((TQComboBox *)widget)->listBox()) if(((TQComboBox *)widget)->listBox())
((TQComboBox *)widget)->listBox()->removeEventFilter(this); ((TQComboBox *)widget)->listBox()->removeEventFilter(this);
// FIXME
// removeObjectEventHandler(ceData, elementFlags, ptr, this);
} }
else if (::tqqt_cast<TQToolBar *>(widget) || ::tqqt_cast<TQPopupMenu *>(widget)) else if (::tqqt_cast<TQToolBar *>(widget) || ::tqqt_cast<TQPopupMenu *>(widget))
{ {
@ -1899,7 +1915,7 @@ void TQtCurveStyle::unPolish(TQWidget *widget)
if(NoBackground!=widget->backgroundMode()) if(NoBackground!=widget->backgroundMode())
widget->setBackgroundMode(PaletteBackground); widget->setBackgroundMode(PaletteBackground);
if(SHADE_NONE!=opts.shadeMenubars) if(SHADE_NONE!=opts.shadeMenubars)
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
if(SHADE_WINDOW_BORDER==opts.shadeMenubars || opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars || if(SHADE_WINDOW_BORDER==opts.shadeMenubars || opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars ||
SHADE_SELECTED==opts.shadeMenubars || (SHADE_CUSTOM==opts.shadeMenubars &&TOO_DARK(itsMenubarCols[ORIGINAL_SHADE]))) SHADE_SELECTED==opts.shadeMenubars || (SHADE_CUSTOM==opts.shadeMenubars &&TOO_DARK(itsMenubarCols[ORIGINAL_SHADE])))
widget->setPalette(TQApplication::palette()); widget->setPalette(TQApplication::palette());
@ -1907,49 +1923,50 @@ void TQtCurveStyle::unPolish(TQWidget *widget)
else if (widget->inherits("KToolBarSeparator")) else if (widget->inherits("KToolBarSeparator"))
{ {
widget->setBackgroundMode(PaletteBackground); widget->setBackgroundMode(PaletteBackground);
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
} }
else if (::tqqt_cast<TQScrollBar *>(widget)) else if (::tqqt_cast<TQScrollBar *>(widget))
{ {
widget->setMouseTracking(false); widget->setMouseTracking(false);
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
widget->setBackgroundMode(PaletteButton); widget->setBackgroundMode(PaletteButton);
} }
else if (::tqqt_cast<TQSlider *>(widget)) else if (::tqqt_cast<TQSlider *>(widget))
{ {
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
if(widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent())) if(widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent()))
widget->setBackgroundMode(PaletteBackground); widget->setBackgroundMode(PaletteBackground);
} }
else if (::tqqt_cast<TQLineEdit*>(widget) || ::tqqt_cast<TQTextEdit*>(widget)) else if (::tqqt_cast<TQLineEdit*>(widget) || ::tqqt_cast<TQTextEdit*>(widget))
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
else if (widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || widget->inherits("TQDockWindowResizeHandle")) else if (widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || widget->inherits("TQDockWindowResizeHandle"))
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
else if (::tqqt_cast<TQProgressBar*>(widget)) else if (::tqqt_cast<TQProgressBar*>(widget))
{ {
itsProgAnimWidgets.remove(widget); itsProgAnimWidgets.remove(widget);
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
} }
else if(opts.highlightScrollViews && ::tqqt_cast<TQScrollView*>(widget)) else if(opts.highlightScrollViews && ::tqqt_cast<TQScrollView*>(widget))
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
else if(0==qstrcmp(widget->name(), kdeToolbarWidget)) else if(0==qstrcmp(widget->name(), kdeToolbarWidget))
{ {
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
widget->setBackgroundMode(PaletteBackground); widget->setBackgroundMode(PaletteBackground);
} }
if (widget->parentWidget() && ::tqqt_cast<TQMenuBar *>(widget->parentWidget()) && !qstrcmp(widget->className(), TQFRAME_OBJECT_NAME_STRING)) if (widget->parentWidget() && ::tqqt_cast<TQMenuBar *>(widget->parentWidget()) && !qstrcmp(widget->className(), TQFRAME_OBJECT_NAME_STRING))
{ {
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
widget->setBackgroundMode(PaletteBackground); // We paint whole background. widget->setBackgroundMode(PaletteBackground); // We paint whole background.
} }
else if(widget->inherits("KTabCtl")) else if(widget->inherits("KTabCtl"))
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
#ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT #ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
else if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(widget)) else if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(widget))
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
#endif #endif
}
BASE_STYLE::unPolish(widget); BASE_STYLE::unPolish(ceData, elementFlags, ptr);
} }
static void sendXEvent(TQDialog *dlg, const char *msg) static void sendXEvent(TQDialog *dlg, const char *msg)
@ -1987,8 +2004,11 @@ bool TQtCurveStyle::appIsNotEmbedded(TQDialog *dlg)
return false; return false;
} }
bool TQtCurveStyle::eventFilter(TQObject *object, TQEvent *event) bool TQtCurveStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
{ {
if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
TQObject* object = reinterpret_cast<TQObject*>(source);
if(itsHoverWidget && TQT_BASE_OBJECT(object)==TQT_BASE_OBJECT(itsHoverWidget) && (TQEvent::Destroy==event->type() || TQEvent::Hide==event->type())) if(itsHoverWidget && TQT_BASE_OBJECT(object)==TQT_BASE_OBJECT(itsHoverWidget) && (TQEvent::Destroy==event->type() || TQEvent::Hide==event->type()))
resetHover(); resetHover();
@ -2063,13 +2083,13 @@ bool TQtCurveStyle::eventFilter(TQObject *object, TQEvent *event)
TQCheckBox *cb=static_cast<TQCheckBox *>(TQT_TQWIDGET(object)); TQCheckBox *cb=static_cast<TQCheckBox *>(TQT_TQWIDGET(object));
TQRect r(cb->geometry()); TQRect r(cb->geometry());
cb->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, source, this);
if(TQApplication::reverseLayout()) if(TQApplication::reverseLayout())
r.setWidth(r.width()+8); r.setWidth(r.width()+8);
else else
r.setX(0); r.setX(0);
cb->setGeometry(r); cb->setGeometry(r);
cb->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, source, this);
return false; return false;
} }
else if (TQEvent::Paint==event->type()) else if (TQEvent::Paint==event->type())
@ -2293,7 +2313,7 @@ bool TQtCurveStyle::eventFilter(TQObject *object, TQEvent *event)
break; break;
} }
#ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT #ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(object)) if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(object))
{ {
TQDialog *dlg=(TQDialog *)object; TQDialog *dlg=(TQDialog *)object;
@ -2366,7 +2386,7 @@ bool TQtCurveStyle::eventFilter(TQObject *object, TQEvent *event)
} }
return false; return false;
} }
#endif #endif
// Track show events for progress bars // Track show events for progress bars
if (opts.animatedProgress && ::tqqt_cast<TQProgressBar*>(object)) if (opts.animatedProgress && ::tqqt_cast<TQProgressBar*>(object))
@ -2389,10 +2409,10 @@ bool TQtCurveStyle::eventFilter(TQObject *object, TQEvent *event)
(((TQListBox *)object)->parentWidget() && (((TQListBox *)object)->parentWidget() &&
::tqqt_cast<TQComboBox *>(((TQListBox *)object)->parentWidget()))) ::tqqt_cast<TQComboBox *>(((TQListBox *)object)->parentWidget())))
((TQComboBox *)(((TQListBox *)object)->parentWidget()))->repaint(false); ((TQComboBox *)(((TQListBox *)object)->parentWidget()))->repaint(false);
// else if(::tqqt_cast<TQFrame *>(object) && // else if(::tqqt_cast<TQFrame *>(object) &&
// (TQFrame::Box==((TQFrame *)object)->frameShape() || TQFrame::Panel==((TQFrame *)object)->frameShape() || // (TQFrame::Box==((TQFrame *)object)->frameShape() || TQFrame::Panel==((TQFrame *)object)->frameShape() ||
// TQFrame::WinPanel==((TQFrame *)object)->frameShape())) // TQFrame::WinPanel==((TQFrame *)object)->frameShape()))
// ((TQFrame *)object)->setFrameShape(TQFrame::StyledPanel); // ((TQFrame *)object)->setFrameShape(TQFrame::StyledPanel);
break; break;
case TQEvent::Enter: case TQEvent::Enter:
if(object->isWidgetType()) if(object->isWidgetType())
@ -2442,8 +2462,9 @@ bool TQtCurveStyle::eventFilter(TQObject *object, TQEvent *event)
default: default:
break; break;
} }
}
return BASE_STYLE::eventFilter(object, event); return BASE_STYLE::objectEventHandler(ceData, elementFlags, source, event);
} }
void TQtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRect &rOrig, void TQtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRect &rOrig,

@ -134,11 +134,11 @@ class TQtCurveStyle : public BASE_STYLE
virtual ~TQtCurveStyle(); virtual ~TQtCurveStyle();
void polish(TQApplication *app); void applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish(TQPalette &pal); void polish(TQPalette &pal);
TQColorGroup setColorGroup(const TQColorGroup &old, const TQColorGroup &act, bool dis=false); TQColorGroup setColorGroup(const TQColorGroup &old, const TQColorGroup &act, bool dis=false);
void polish(TQWidget *widget); void polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void unPolish(TQWidget *widget); void unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void drawLightBevel(TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags, void drawLightBevel(TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags,
int round, const TQColor &fill, const TQColor *custom=NULL, int round, const TQColor &fill, const TQColor *custom=NULL,
bool doBorder=true, bool doCorners=true, EWidget w=WIDGET_OTHER) const bool doBorder=true, bool doCorners=true, EWidget w=WIDGET_OTHER) const
@ -186,7 +186,7 @@ class TQtCurveStyle : public BASE_STYLE
protected: protected:
bool appIsNotEmbedded(TQDialog *dlg); bool appIsNotEmbedded(TQDialog *dlg);
bool eventFilter(TQObject *object, TQEvent *event); virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
void drawMenuItem(TQPainter *p, const TQRect &r, int flags, const TQColorGroup &cg, void drawMenuItem(TQPainter *p, const TQRect &r, int flags, const TQColorGroup &cg,
bool mbi, int round, const TQColor &bgnd, const TQColor *cols) const; bool mbi, int round, const TQColor &bgnd, const TQColor *cols) const;
void drawProgress(TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags, int round, void drawProgress(TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags, int round,

Loading…
Cancel
Save