summaryrefslogtreecommitdiffstats
path: root/style/qtcurve.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-07 01:39:12 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-07 01:39:12 -0500
commit4fc58f393f02e076425d1651ce360e6d8818d182 (patch)
treee5ac88fa6f5193b466801f6985974540ff94cb6f /style/qtcurve.cpp
parent8a81e3e9ade5820c2764b7c912b5115c2fd64c1c (diff)
downloadtde-style-qtcurve-4fc58f393f02e076425d1651ce360e6d8818d182.tar.gz
tde-style-qtcurve-4fc58f393f02e076425d1651ce360e6d8818d182.zip
TQStyle API update
Diffstat (limited to 'style/qtcurve.cpp')
-rw-r--r--style/qtcurve.cpp2083
1 files changed, 1052 insertions, 1031 deletions
diff --git a/style/qtcurve.cpp b/style/qtcurve.cpp
index 83792ec..c56a99e 100644
--- a/style/qtcurve.cpp
+++ b/style/qtcurve.cpp
@@ -1154,95 +1154,99 @@ static TQString getFile(const TQString &f)
return d;
}
-void TQtCurveStyle::polish(TQApplication *app)
+void TQtCurveStyle::applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
- TQString appName(getFile(app->argv()[0]));
-
- if(NULL!=getenv("QTCURVE_DEBUG"))
- std::cout << "TQtCurve: Application name: \"" << appName.latin1() << "\"\n";
-
- if ("kicker"==appName || "appletproxy"==appName)
- {
- itsThemedApp=APP_KICKER;
-#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
- itsIsTransKicker=kickerIsTrans();
-#endif
- }
- else if ("kontact"==appName)
- itsThemedApp=APP_KONTACT;
- else if ("konqueror"==appName)
- itsThemedApp=APP_KONQUEROR;
- else if ("kate"==appName)
- itsThemedApp=APP_KATE;
- else if ("kpresenter"==appName)
- itsThemedApp=APP_KPRESENTER;
- else if ("soffice.bin"==appName)
- {
- itsThemedApp=APP_OPENOFFICE;
- opts.groupBox=FRAME_PLAIN;
- opts.gbLabel=0;
- }
- else if ("kdefilepicker"==appName)
- itsThemedApp=APP_SKIP_TASKBAR;
- else if ("kprinter"==appName)
- itsThemedApp=APP_KPRINTER;
- else if ("kdialog"==appName)
- itsThemedApp=APP_KDIALOG;
- else if ("kdialogd"==appName)
- itsThemedApp=APP_KDIALOGD;
- else if ("tora"==appName)
- itsThemedApp=APP_TORA;
- else if ("opera"==appName)
- itsThemedApp=APP_OPERA;
- else if ("systemsettings"==appName)
- itsThemedApp=APP_SYSTEMSETTINGS;
- else if ("korn"==appName)
- {
- itsThemedApp=APP_KORN;
-#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
- itsIsTransKicker=kickerIsTrans();
-#endif
+ if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) {
+ TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
+
+ TQString appName(getFile(app->argv()[0]));
+
+ if(NULL!=getenv("QTCURVE_DEBUG"))
+ std::cout << "TQtCurve: Application name: \"" << appName.latin1() << "\"\n";
+
+ if ("kicker"==appName || "appletproxy"==appName)
+ {
+ itsThemedApp=APP_KICKER;
+ #if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+ itsIsTransKicker=kickerIsTrans();
+ #endif
+ }
+ else if ("kontact"==appName)
+ itsThemedApp=APP_KONTACT;
+ else if ("konqueror"==appName)
+ itsThemedApp=APP_KONQUEROR;
+ else if ("kate"==appName)
+ itsThemedApp=APP_KATE;
+ else if ("kpresenter"==appName)
+ itsThemedApp=APP_KPRESENTER;
+ else if ("soffice.bin"==appName)
+ {
+ itsThemedApp=APP_OPENOFFICE;
+ opts.groupBox=FRAME_PLAIN;
+ opts.gbLabel=0;
+ }
+ else if ("kdefilepicker"==appName)
+ itsThemedApp=APP_SKIP_TASKBAR;
+ else if ("kprinter"==appName)
+ itsThemedApp=APP_KPRINTER;
+ else if ("kdialog"==appName)
+ itsThemedApp=APP_KDIALOG;
+ else if ("kdialogd"==appName)
+ itsThemedApp=APP_KDIALOGD;
+ else if ("tora"==appName)
+ itsThemedApp=APP_TORA;
+ else if ("opera"==appName)
+ itsThemedApp=APP_OPERA;
+ else if ("systemsettings"==appName)
+ itsThemedApp=APP_SYSTEMSETTINGS;
+ else if ("korn"==appName)
+ {
+ itsThemedApp=APP_KORN;
+ #if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+ itsIsTransKicker=kickerIsTrans();
+ #endif
+ }
+ else if ("mactor"==appName)
+ {
+ if(!itsMactorPal)
+ itsMactorPal=new TQPalette(TQApplication::palette());
+ itsThemedApp=APP_MACTOR;
+ }
+ else
+ itsThemedApp=APP_OTHER;
+
+ if(APP_OPENOFFICE==itsThemedApp)
+ {
+ //
+ // OO.o 2.x checks to see whether the used theme "inherits" from HighContrastStyle,
+ // if so it uses the highlightedText color to draw highlighted menubar and popup menu
+ // items. Otherwise it uses the standard color. Changing the metaobject's class name
+ // works around this...
+ if(opts.useHighlightForMenu)
+ {
+ TQMetaObject *meta=(TQMetaObject *)metaObject();
+
+ #ifdef USE_QT4
+ #warning Qt4 does not allow the metaobject classname to be set (skipping)
+ #else // USE_QT4
+ meta->classname="HighContrastStyle";
+ #endif // USE_QT4
+ }
+
+ if(opts.scrollbarType==SCROLLBAR_NEXT)
+ opts.scrollbarType=SCROLLBAR_KDE;
+ else if(opts.scrollbarType==SCROLLBAR_NONE)
+ opts.scrollbarType=SCROLLBAR_WINDOWS;
+ setSbType();
+ }
+
+ if(SHADE_NONE!=opts.menuStripe && opts.noMenuStripeApps.contains(appName))
+ opts.menuStripe=SHADE_NONE;
+ #ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
+ if(opts.fixParentlessDialogs && (opts.noDlgFixApps.contains(appName) || opts.noDlgFixApps.contains("kde")))
+ opts.fixParentlessDialogs=false;
+ #endif
}
- else if ("mactor"==appName)
- {
- if(!itsMactorPal)
- itsMactorPal=new TQPalette(TQApplication::palette());
- itsThemedApp=APP_MACTOR;
- }
- else
- itsThemedApp=APP_OTHER;
-
- if(APP_OPENOFFICE==itsThemedApp)
- {
- //
- // OO.o 2.x checks to see whether the used theme "inherits" from HighContrastStyle,
- // if so it uses the highlightedText color to draw highlighted menubar and popup menu
- // items. Otherwise it uses the standard color. Changing the metaobject's class name
- // works around this...
- if(opts.useHighlightForMenu)
- {
- TQMetaObject *meta=(TQMetaObject *)metaObject();
-
-#ifdef USE_QT4
-#warning Qt4 does not allow the metaobject classname to be set (skipping)
-#else // USE_QT4
- meta->classname="HighContrastStyle";
-#endif // USE_QT4
- }
-
- if(opts.scrollbarType==SCROLLBAR_NEXT)
- opts.scrollbarType=SCROLLBAR_KDE;
- else if(opts.scrollbarType==SCROLLBAR_NONE)
- opts.scrollbarType=SCROLLBAR_WINDOWS;
- setSbType();
- }
-
- if(SHADE_NONE!=opts.menuStripe && opts.noMenuStripeApps.contains(appName))
- opts.menuStripe=SHADE_NONE;
-#ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
- if(opts.fixParentlessDialogs && (opts.noDlgFixApps.contains(appName) || opts.noDlgFixApps.contains("kde")))
- opts.fixParentlessDialogs=false;
-#endif
}
void TQtCurveStyle::polish(TQPalette &pal)
@@ -1458,498 +1462,511 @@ TQColorGroup TQtCurveStyle::setColorGroup(const TQColorGroup &old, const TQColor
static const char * kdeToolbarWidget="kde toolbar widget";
-void TQtCurveStyle::polish(TQWidget *widget)
+void TQtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
- bool enableFilter(opts.highlightFactor || opts.coloredMouseOver);
-
- if(::isKhtmlFormWidget(widget))
- {
- itsKhtmlWidgets[widget]=true;
- connect(widget, TQT_SIGNAL(destroyed(TQObject *)), this, TQT_SLOT(khtmlWidgetDestroyed(TQObject *)));
- }
-
- if(enableFilter && isSpecialHover(widget))
- connect(widget, TQT_SIGNAL(destroyed(TQObject *)), this, TQT_SLOT(hoverWidgetDestroyed(TQObject *)));
-
- if(isWindowDragWidget(TQT_TQOBJECT(widget)))
- widget->installEventFilter(this);
-
- if(APPEARANCE_STRIPED==opts.bgndAppearance && (::tqqt_cast<TQDialog *>(widget) || ::tqqt_cast<TQMainWindow *>(widget)))
- setBgndProp(widget, APPEARANCE_STRIPED);
-
- if(widget->parentWidget() && ::tqqt_cast<TQScrollView *>(widget) && ::tqqt_cast<TQComboBox *>(widget->parentWidget()))
- {
- TQPalette pal(widget->palette());
-#if 0
- TQPalette orig(pal);
-#endif
- TQColorGroup act(pal.active());
-
-#if 0
- if(opts.gtkComboMenus)
- act.setColor(TQColorGroup::Base, USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]);
- act.setColor(TQColorGroup::Background, opts.gtkComboMenus
- ? USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]
- : TQApplication::palette().active().base());
-#endif
- act.setColor(TQColorGroup::Foreground, itsBackgroundCols[STD_BORDER]);
-
- pal.setActive(act);
- widget->setPalette(pal);
-#if 0
- //((TQScrollView *)widget)->setMargin(1);
-
- const TQObjectList *children(widget->children());
-
- if(children)
- {
- TQObjectList::Iterator it(children->begin()),
- end(children->end());
-
- for(; it!=end; ++it)
- if(::tqqt_cast<TQWidget *>(*it))
- ((TQWidget *)(*it))->setPalette(orig);
- }
-#endif
- }
-
- if (APP_MACTOR==itsThemedApp && itsMactorPal && !widget->inherits("TQTipLabel"))
- widget->setPalette(*itsMactorPal);
-
- // Get rid of Kontact's frame...
- if(APP_KONTACT==itsThemedApp && ::tqqt_cast<TQHBox *>(widget) && widget->parentWidget() &&
- 0==qstrcmp(widget->parentWidget()->className(), "Kontact::MainWindow"))
- ((TQHBox *)widget)->setLineWidth(0);
-
- if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::tqqt_cast<const TQPopupMenu *>(widget))
- widget->installEventFilter(this);
-
- #if 0
- if(opts.menubarHiding && ::tqqt_cast<TQMainWindow *>(widget) && static_cast<TQMainWindow *>(widget)->menuBar())
- widget->installEventFilter(this);
- #endif
-
- if ((opts.square&SQUARE_SCROLLVIEW) && widget &&
- (::tqqt_cast<const TQScrollView *>(widget) ||
- (widget->parentWidget() && ::tqqt_cast<const TQFrame *>(widget) &&
- widget->parentWidget()->inherits("KateView"))) &&
- ((TQFrame *)widget)->lineWidth()>1)
- ((TQFrame *)widget)->setLineWidth(opts.gtkScrollViews ? 1 : 2);
- else if(!opts.popupBorder && widget &&
- (::tqqt_cast<const TQPopupMenu *>(widget) ||
- (widget->parentWidget() && ::tqqt_cast<const TQListBox *>(widget) &&
- ::tqqt_cast<const TQComboBox *>(widget->parentWidget()))))
- ((TQFrame *)widget)->setLineWidth(0);
- else if ((USE_LIGHTER_POPUP_MENU || !IS_FLAT_BGND(opts.menuBgndAppearance)) && !opts.borderMenuitems &&
- widget && ::tqqt_cast<const TQPopupMenu *>(widget))
- ((TQFrame *)widget)->setLineWidth(1);
-
- if (::tqqt_cast<TQRadioButton *>(widget) || ::tqqt_cast<TQCheckBox *>(widget))
- {
- bool framelessGroupBoxCheckBox=(NO_FRAME(opts.groupBox) && isCheckBoxOfGroupBox(TQT_TQOBJECT(widget)));
-
- if(framelessGroupBoxCheckBox || enableFilter)
- {
-#if 0x039999 >= 0x030200
- if(!isFormWidget(widget))
- widget->setMouseTracking(true);
-#endif
- if(framelessGroupBoxCheckBox)
- {
- TQFont fnt(widget->font());
-
- fnt.setBold(true);
- widget->setFont(fnt);
- }
- widget->installEventFilter(this);
- }
- }
- else if (::tqqt_cast<TQHeader *>(widget) || ::tqqt_cast<TQTabBar *>(widget) || ::tqqt_cast<TQSpinWidget *>(widget)/* ||
- ::tqqt_cast<TQDateTimeEditBase*>(widget)*/)
- {
- if(enableFilter)
- {
- widget->setMouseTracking(true);
- widget->installEventFilter(this);
- }
- }
- else if (::tqqt_cast<TQToolButton *>(widget))
- {
- if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
- widget->setBackgroundMode(PaletteBackground);
- if(enableFilter)
- {
- widget->installEventFilter(this);
-#if defined TDE_VERSION && TDE_VERSION >= 0x30400 && TDE_VERSION < 0x30500
- widget->setMouseTracking(true);
-#endif
- }
- }
- else if (::tqqt_cast<TQButton *>(widget) || widget->inherits("TQToolBarExtensionWidget"))
- {
- /*if(onToolBar(widget))
- widget->setBackgroundMode(NoBackground);
- else*/ if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
- widget->setBackgroundMode(PaletteBackground);
- if(enableFilter)
- widget->installEventFilter(this);
- }
- else if (::tqqt_cast<TQComboBox *>(widget))
- {
- if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
- widget->setBackgroundMode(PaletteBackground);
- widget->installEventFilter(this);
-
- if(DO_EFFECT && onToolBar(widget))
- widget->setName(kdeToolbarWidget);
-
- if(enableFilter)
- widget->setMouseTracking(true);
-
- if(((TQComboBox *)widget)->listBox())
- ((TQComboBox *)widget)->listBox()->installEventFilter(this);
- }
- else if(::tqqt_cast<TQMenuBar *>(widget))
- {
- if(NoBackground!=widget->backgroundMode())
- widget->setBackgroundMode(PaletteBackground);
- if(SHADE_NONE!=opts.shadeMenubars)
- widget->installEventFilter(this);
- if(BLEND_TITLEBAR || opts.windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR)
- emitMenuSize(widget, widget->rect().height());
- if(SHADE_WINDOW_BORDER==opts.shadeMenubars)
- {
- TQPalette pal(widget->palette());
- TQColorGroup act(pal.active());
- TQColorGroup inact(pal.inactive());
-
- getMdiColors(act, true);
- act.setColor(TQColorGroup::Foreground, itsActiveMdiTextColor);
- inact.setColor(TQColorGroup::Foreground, opts.shadeMenubarOnlyWhenActive ? itsMdiTextColor : itsActiveMdiTextColor);
- pal.setInactive(inact);
- pal.setActive(act);
- widget->setPalette(pal);
- }
- else if(opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars ||
- (SHADE_CUSTOM==opts.shadeMenubars && TOO_DARK(itsMenubarCols[ORIGINAL_SHADE])))
- {
- TQPalette pal(widget->palette());
- TQColorGroup act(pal.active());
-
- act.setColor(TQColorGroup::Foreground, opts.customMenuTextColor
- ? opts.customMenuNormTextColor
- : TQApplication::palette().active().highlightedText());
-
- if(!opts.shadeMenubarOnlyWhenActive)
- {
- TQColorGroup inact(pal.inactive());
- inact.setColor(TQColorGroup::Foreground, act.color(TQColorGroup::Foreground));
- pal.setInactive(inact);
- }
-
- pal.setActive(act);
- widget->setPalette(pal);
- }
- }
- else if(::tqqt_cast<TQToolBar *>(widget))
- {
- if(NoBackground!=widget->backgroundMode())
- widget->setBackgroundMode(PaletteBackground);
- }
- else if(::tqqt_cast<TQPopupMenu *>(widget))
- widget->setBackgroundMode(NoBackground); // PaletteBackground);
- else if (widget->inherits("KToolBarSeparator") ||
- (widget->inherits("KListViewSearchLineWidget") &&
- widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent())))
- {
- widget->setName(kdeToolbarWidget);
- widget->setBackgroundMode(NoBackground);
- widget->installEventFilter(this);
- }
- else if (::tqqt_cast<TQScrollBar *>(widget))
- {
- if(enableFilter)
- {
- widget->setMouseTracking(true);
- widget->installEventFilter(this);
- }
- //widget->setBackgroundMode(NoBackground);
- }
- else if (::tqqt_cast<TQSlider *>(widget))
- {
- if(enableFilter)
- widget->installEventFilter(this);
- if(widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent()))
- {
- widget->setName(kdeToolbarWidget);
- widget->setBackgroundMode(NoBackground); // We paint whole background.
-
- if(!enableFilter)
- widget->installEventFilter(this);
- }
-
- // This bit stolen form polyester...
- connect(widget, TQT_SIGNAL(sliderMoved(int)), this, TQT_SLOT(sliderThumbMoved(int)));
- connect(widget, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(sliderThumbMoved(int)));
- }
- else if (::tqqt_cast<TQLineEdit*>(widget) || ::tqqt_cast<TQTextEdit*>(widget))
- {
- widget->installEventFilter(this);
- if(onToolBar(widget))
- widget->setName(kdeToolbarWidget);
- if(widget && widget->parentWidget() &&
- widget->inherits("KLineEdit") && widget->parentWidget()->inherits("KIO::DefaultProgress") &&
- ::tqqt_cast<TQFrame *>(widget))
- ((TQFrame *)widget)->setLineWidth(0);
- }
- else if (widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || widget->inherits("TQDockWindowResizeHandle"))
- {
- if(enableFilter)
- widget->installEventFilter(this);
- }
- else if (0==qstrcmp(widget->name(), kdeToolbarWidget))
- {
- if(!widget->parent() ||
- 0!=qstrcmp(TQT_TQWIDGET(widget->parent())->className(),
- "KListViewSearchLineWidget") ||
- onToolBar(widget))
- {
- widget->installEventFilter(this);
- widget->setBackgroundMode(NoBackground); // We paint whole background.
- }
- }
-
- if (widget->parentWidget() && ::tqqt_cast<TQMenuBar *>(widget->parentWidget()) && !qstrcmp(widget->className(), TQFRAME_OBJECT_NAME_STRING))
- {
- widget->installEventFilter(this);
- widget->setBackgroundMode(NoBackground); // We paint whole background.
- }
- else if (TQt::X11ParentRelative!=widget->backgroundMode() &&
- (::tqqt_cast<TQLabel *>(widget) || ::tqqt_cast<TQHBox *>(widget) ||
- ::tqqt_cast<TQVBox *>(widget)) &&
- widget->parent() &&
- ( 0==qstrcmp(TQT_TQWIDGET(widget->parent())->className(),
- "MainWindow") || onToolBar(widget)))
- {
- widget->setName(kdeToolbarWidget);
- widget->installEventFilter(this);
- widget->setBackgroundMode(NoBackground); // We paint the whole background.
- }
- else if(::tqqt_cast<TQProgressBar *>(widget))
- {
- if(widget->palette().inactive().highlightedText()!=widget->palette().active().highlightedText())
- {
- TQPalette pal(widget->palette());
- pal.setInactive(widget->palette().active());
- widget->setPalette(pal);
- }
-
- if(opts.animatedProgress)
- {
- widget->installEventFilter(this);
- itsProgAnimWidgets[widget] = 0;
- connect(widget, TQT_SIGNAL(destroyed(TQObject *)), this, TQT_SLOT(progressBarDestroyed(TQObject *)));
- if (!itsAnimationTimer->isActive())
- itsAnimationTimer->start(PROGRESS_ANIMATION, false);
- }
- }
- else if(opts.highlightScrollViews && ::tqqt_cast<TQScrollView*>(widget))
- widget->installEventFilter(this);
- else if(!qstrcmp(widget->className(), "KonqFrameStatusBar"))
- {
- // This disables the white background of the KonquerorFrameStatusBar.
- // When the green led is shown the background is set to
- // applications cg.midlight() so we override it to standard background.
- // Thanks Comix! (because this was ugly from day one!)
- // NOTE: Check if we can set it earlier (before painting), cause
- // on slow machines we can see the repainting of the bar (from white to background...)
- TQPalette pal(TQApplication::palette());
-
- pal.setColor(TQColorGroup::Midlight, pal.active().background());
- TQApplication::setPalette(pal);
- }
- else if(widget->inherits("KTabCtl"))
- widget->installEventFilter(this);
- else if(NO_FRAME(opts.groupBox) && ::tqqt_cast<TQGroupBox *>(widget))
- {
- ((TQGroupBox *)widget)->setFlat(false);
- ((TQGroupBox *)widget)->setFrameShape(TQFrame::NoFrame);
- }
-#ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
- else if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(widget))
- {
- TQDialog *dlg=(TQDialog *)widget;
-
- // The parent->isShown is needed for KWord. It's insert picure file dialog is a child of
- // the insert picture dialog - but the file dialog is shown *before* the picture dialog!
- if( (SKIP_TASKBAR && !dlg->parentWidget()) ||
- ( (!dlg->parentWidget() || !dlg->parentWidget()->isShown())// &&
- /*(dlg->isModal() || ::tqqt_cast<TQProgressDialog *>(widget))*/) )
- widget->installEventFilter(this);
- }
-
- if(opts.fixParentlessDialogs && (APP_KPRINTER==itsThemedApp || APP_KDIALOG==itsThemedApp ||
- APP_KDIALOGD==itsThemedApp))
- {
- TQString cap(widget->caption());
- int index=-1;
-
- // Remove horrible "Open - KDialog" titles...
- if( cap.length() &&
- ( (APP_KPRINTER==itsThemedApp && (-1!=(index=cap.find(" - KPrinter"))) &&
- (index+11)==(int)cap.length()) ||
- (APP_KDIALOG==itsThemedApp && (-1!=(index=cap.find(" - KDialog"))) &&
- (index+10)==(int)cap.length()) ||
- (APP_KDIALOGD==itsThemedApp && (-1!=(index=cap.find(" - KDialog Daemon"))) &&
- (index+17)==(int)cap.length())) )
- widget->TQWidget::setCaption(cap.left(index));
- }
-#endif
-
- if(APP_SYSTEMSETTINGS==itsThemedApp)
- {
- if(widget && widget->parentWidget() && widget->parentWidget()->parentWidget() &&
- ::tqqt_cast<TQFrame *>(widget) && TQFrame::NoFrame!=((TQFrame *)widget)->frameShape() &&
- ::tqqt_cast<TQFrame *>(widget->parentWidget()) &&
- ::tqqt_cast<TQTabWidget *>(widget->parentWidget()->parentWidget()))
- ((TQFrame *)widget)->setFrameShape(TQFrame::NoFrame);
-
- if(widget->parentWidget() && widget->parentWidget()->parentWidget() &&
- ::tqqt_cast<TQScrollView *>(widget->parentWidget()->parentWidget()) &&
- widget->inherits("KCMultiWidget") && widget->parentWidget()->inherits("TQViewportWidget"))
- ((TQScrollView *)(widget->parentWidget()->parentWidget()))->setLineWidth(0);
- }
-
- if(opts.tabBgnd && widget && widget->parentWidget() && ::tqqt_cast<TQWidgetStack *>(widget) &&
- ::tqqt_cast<TQTabWidget *>(widget->parentWidget()) &&
- 0==qstrcmp(widget->name(), "tab pages"))
- {
- TQPalette pal(widget->palette());
-
- pal.setColor(TQColorGroup::Background, shade(pal.active().background(), TO_FACTOR(opts.tabBgnd)));
- widget->setBackgroundMode(PaletteBackground);
- widget->setPalette(pal);
- }
-
- if(APPEARANCE_STRIPED==opts.bgndAppearance)
- widget->setBackgroundOrigin(TQWidget::WindowOrigin);
- BASE_STYLE::polish(widget);
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+
+ bool enableFilter(opts.highlightFactor || opts.coloredMouseOver);
+
+ if(::isKhtmlFormWidget(widget))
+ {
+ itsKhtmlWidgets[widget]=true;
+ connect(widget, TQT_SIGNAL(destroyed(TQObject *)), this, TQT_SLOT(khtmlWidgetDestroyed(TQObject *)));
+ }
+
+ if(enableFilter && isSpecialHover(widget))
+ connect(widget, TQT_SIGNAL(destroyed(TQObject *)), this, TQT_SLOT(hoverWidgetDestroyed(TQObject *)));
+
+ if(isWindowDragWidget(TQT_TQOBJECT(widget)))
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+
+ if(APPEARANCE_STRIPED==opts.bgndAppearance && (::tqqt_cast<TQDialog *>(widget) || ::tqqt_cast<TQMainWindow *>(widget)))
+ setBgndProp(widget, APPEARANCE_STRIPED);
+
+ if(widget->parentWidget() && ::tqqt_cast<TQScrollView *>(widget) && ::tqqt_cast<TQComboBox *>(widget->parentWidget()))
+ {
+ TQPalette pal(widget->palette());
+ #if 0
+ TQPalette orig(pal);
+ #endif
+ TQColorGroup act(pal.active());
+
+ #if 0
+ if(opts.gtkComboMenus)
+ act.setColor(TQColorGroup::Base, USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]);
+ act.setColor(TQColorGroup::Background, opts.gtkComboMenus
+ ? USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]
+ : TQApplication::palette().active().base());
+ #endif
+ act.setColor(TQColorGroup::Foreground, itsBackgroundCols[STD_BORDER]);
+
+ pal.setActive(act);
+ widget->setPalette(pal);
+ #if 0
+ //((TQScrollView *)widget)->setMargin(1);
+
+ const TQObjectList *children(widget->children());
+
+ if(children)
+ {
+ TQObjectList::Iterator it(children->begin()),
+ end(children->end());
+
+ for(; it!=end; ++it)
+ if(::tqqt_cast<TQWidget *>(*it))
+ ((TQWidget *)(*it))->setPalette(orig);
+ }
+ #endif
+ }
+
+ if (APP_MACTOR==itsThemedApp && itsMactorPal && !widget->inherits("TQTipLabel"))
+ widget->setPalette(*itsMactorPal);
+
+ // Get rid of Kontact's frame...
+ if(APP_KONTACT==itsThemedApp && ::tqqt_cast<TQHBox *>(widget) && widget->parentWidget() &&
+ 0==qstrcmp(widget->parentWidget()->className(), "Kontact::MainWindow"))
+ ((TQHBox *)widget)->setLineWidth(0);
+
+ if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::tqqt_cast<const TQPopupMenu *>(widget))
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+
+ #if 0
+ if(opts.menubarHiding && ::tqqt_cast<TQMainWindow *>(widget) && static_cast<TQMainWindow *>(widget)->menuBar())
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ #endif
+
+ if ((opts.square&SQUARE_SCROLLVIEW) && widget &&
+ (::tqqt_cast<const TQScrollView *>(widget) ||
+ (widget->parentWidget() && ::tqqt_cast<const TQFrame *>(widget) &&
+ widget->parentWidget()->inherits("KateView"))) &&
+ ((TQFrame *)widget)->lineWidth()>1)
+ ((TQFrame *)widget)->setLineWidth(opts.gtkScrollViews ? 1 : 2);
+ else if(!opts.popupBorder && widget &&
+ (::tqqt_cast<const TQPopupMenu *>(widget) ||
+ (widget->parentWidget() && ::tqqt_cast<const TQListBox *>(widget) &&
+ ::tqqt_cast<const TQComboBox *>(widget->parentWidget()))))
+ ((TQFrame *)widget)->setLineWidth(0);
+ else if ((USE_LIGHTER_POPUP_MENU || !IS_FLAT_BGND(opts.menuBgndAppearance)) && !opts.borderMenuitems &&
+ widget && ::tqqt_cast<const TQPopupMenu *>(widget))
+ ((TQFrame *)widget)->setLineWidth(1);
+
+ if (::tqqt_cast<TQRadioButton *>(widget) || ::tqqt_cast<TQCheckBox *>(widget))
+ {
+ bool framelessGroupBoxCheckBox=(NO_FRAME(opts.groupBox) && isCheckBoxOfGroupBox(TQT_TQOBJECT(widget)));
+
+ if(framelessGroupBoxCheckBox || enableFilter)
+ {
+ #if 0x039999 >= 0x030200
+ if(!isFormWidget(widget))
+ widget->setMouseTracking(true);
+ #endif
+ if(framelessGroupBoxCheckBox)
+ {
+ TQFont fnt(widget->font());
+
+ fnt.setBold(true);
+ widget->setFont(fnt);
+ }
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ }
+ else if (::tqqt_cast<TQHeader *>(widget) || ::tqqt_cast<TQTabBar *>(widget) || ::tqqt_cast<TQSpinWidget *>(widget)/* ||
+ ::tqqt_cast<TQDateTimeEditBase*>(widget)*/)
+ {
+ if(enableFilter)
+ {
+ widget->setMouseTracking(true);
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ }
+ else if (::tqqt_cast<TQToolButton *>(widget))
+ {
+ if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
+ widget->setBackgroundMode(PaletteBackground);
+ if(enableFilter)
+ {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ #if defined TDE_VERSION && TDE_VERSION >= 0x30400 && TDE_VERSION < 0x30500
+ widget->setMouseTracking(true);
+ #endif
+ }
+ }
+ else if (::tqqt_cast<TQButton *>(widget) || widget->inherits("TQToolBarExtensionWidget"))
+ {
+ /*if(onToolBar(widget))
+ widget->setBackgroundMode(NoBackground);
+ else*/ if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
+ widget->setBackgroundMode(PaletteBackground);
+ if(enableFilter)
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if (::tqqt_cast<TQComboBox *>(widget))
+ {
+ if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
+ widget->setBackgroundMode(PaletteBackground);
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+
+ if(DO_EFFECT && onToolBar(widget))
+ widget->setName(kdeToolbarWidget);
+
+ if(enableFilter)
+ widget->setMouseTracking(true);
+
+ if(((TQComboBox *)widget)->listBox())
+ ((TQComboBox *)widget)->listBox()->installEventFilter(this);
+ // FIXME
+ // installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if(::tqqt_cast<TQMenuBar *>(widget))
+ {
+ if(NoBackground!=widget->backgroundMode())
+ widget->setBackgroundMode(PaletteBackground);
+ if(SHADE_NONE!=opts.shadeMenubars)
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ if(BLEND_TITLEBAR || opts.windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR)
+ emitMenuSize(widget, widget->rect().height());
+ if(SHADE_WINDOW_BORDER==opts.shadeMenubars)
+ {
+ TQPalette pal(widget->palette());
+ TQColorGroup act(pal.active());
+ TQColorGroup inact(pal.inactive());
+
+ getMdiColors(act, true);
+ act.setColor(TQColorGroup::Foreground, itsActiveMdiTextColor);
+ inact.setColor(TQColorGroup::Foreground, opts.shadeMenubarOnlyWhenActive ? itsMdiTextColor : itsActiveMdiTextColor);
+ pal.setInactive(inact);
+ pal.setActive(act);
+ widget->setPalette(pal);
+ }
+ else if(opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars ||
+ (SHADE_CUSTOM==opts.shadeMenubars && TOO_DARK(itsMenubarCols[ORIGINAL_SHADE])))
+ {
+ TQPalette pal(widget->palette());
+ TQColorGroup act(pal.active());
+
+ act.setColor(TQColorGroup::Foreground, opts.customMenuTextColor
+ ? opts.customMenuNormTextColor
+ : TQApplication::palette().active().highlightedText());
+
+ if(!opts.shadeMenubarOnlyWhenActive)
+ {
+ TQColorGroup inact(pal.inactive());
+ inact.setColor(TQColorGroup::Foreground, act.color(TQColorGroup::Foreground));
+ pal.setInactive(inact);
+ }
+
+ pal.setActive(act);
+ widget->setPalette(pal);
+ }
+ }
+ else if(::tqqt_cast<TQToolBar *>(widget))
+ {
+ if(NoBackground!=widget->backgroundMode())
+ widget->setBackgroundMode(PaletteBackground);
+ }
+ else if(::tqqt_cast<TQPopupMenu *>(widget))
+ widget->setBackgroundMode(NoBackground); // PaletteBackground);
+ else if (widget->inherits("KToolBarSeparator") ||
+ (widget->inherits("KListViewSearchLineWidget") &&
+ widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent())))
+ {
+ widget->setName(kdeToolbarWidget);
+ widget->setBackgroundMode(NoBackground);
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if (::tqqt_cast<TQScrollBar *>(widget))
+ {
+ if(enableFilter)
+ {
+ widget->setMouseTracking(true);
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ //widget->setBackgroundMode(NoBackground);
+ }
+ else if (::tqqt_cast<TQSlider *>(widget))
+ {
+ if(enableFilter)
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ if(widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent()))
+ {
+ widget->setName(kdeToolbarWidget);
+ widget->setBackgroundMode(NoBackground); // We paint whole background.
+
+ if(!enableFilter)
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+
+ // This bit stolen form polyester...
+ connect(widget, TQT_SIGNAL(sliderMoved(int)), this, TQT_SLOT(sliderThumbMoved(int)));
+ connect(widget, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(sliderThumbMoved(int)));
+ }
+ else if (::tqqt_cast<TQLineEdit*>(widget) || ::tqqt_cast<TQTextEdit*>(widget))
+ {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ if(onToolBar(widget))
+ widget->setName(kdeToolbarWidget);
+ if(widget && widget->parentWidget() &&
+ widget->inherits("KLineEdit") && widget->parentWidget()->inherits("KIO::DefaultProgress") &&
+ ::tqqt_cast<TQFrame *>(widget))
+ ((TQFrame *)widget)->setLineWidth(0);
+ }
+ else if (widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || widget->inherits("TQDockWindowResizeHandle"))
+ {
+ if(enableFilter)
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if (0==qstrcmp(widget->name(), kdeToolbarWidget))
+ {
+ if(!widget->parent() ||
+ 0!=qstrcmp(TQT_TQWIDGET(widget->parent())->className(),
+ "KListViewSearchLineWidget") ||
+ onToolBar(widget))
+ {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ widget->setBackgroundMode(NoBackground); // We paint whole background.
+ }
+ }
+
+ if (widget->parentWidget() && ::tqqt_cast<TQMenuBar *>(widget->parentWidget()) && !qstrcmp(widget->className(), TQFRAME_OBJECT_NAME_STRING))
+ {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ widget->setBackgroundMode(NoBackground); // We paint whole background.
+ }
+ else if (TQt::X11ParentRelative!=widget->backgroundMode() &&
+ (::tqqt_cast<TQLabel *>(widget) || ::tqqt_cast<TQHBox *>(widget) ||
+ ::tqqt_cast<TQVBox *>(widget)) &&
+ widget->parent() &&
+ ( 0==qstrcmp(TQT_TQWIDGET(widget->parent())->className(),
+ "MainWindow") || onToolBar(widget)))
+ {
+ widget->setName(kdeToolbarWidget);
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ widget->setBackgroundMode(NoBackground); // We paint the whole background.
+ }
+ else if(::tqqt_cast<TQProgressBar *>(widget))
+ {
+ if(widget->palette().inactive().highlightedText()!=widget->palette().active().highlightedText())
+ {
+ TQPalette pal(widget->palette());
+ pal.setInactive(widget->palette().active());
+ widget->setPalette(pal);
+ }
+
+ if(opts.animatedProgress)
+ {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ itsProgAnimWidgets[widget] = 0;
+ connect(widget, TQT_SIGNAL(destroyed(TQObject *)), this, TQT_SLOT(progressBarDestroyed(TQObject *)));
+ if (!itsAnimationTimer->isActive())
+ itsAnimationTimer->start(PROGRESS_ANIMATION, false);
+ }
+ }
+ else if(opts.highlightScrollViews && ::tqqt_cast<TQScrollView*>(widget))
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ else if(!qstrcmp(widget->className(), "KonqFrameStatusBar"))
+ {
+ // This disables the white background of the KonquerorFrameStatusBar.
+ // When the green led is shown the background is set to
+ // applications cg.midlight() so we override it to standard background.
+ // Thanks Comix! (because this was ugly from day one!)
+ // NOTE: Check if we can set it earlier (before painting), cause
+ // on slow machines we can see the repainting of the bar (from white to background...)
+ TQPalette pal(TQApplication::palette());
+
+ pal.setColor(TQColorGroup::Midlight, pal.active().background());
+ TQApplication::setPalette(pal);
+ }
+ else if(widget->inherits("KTabCtl"))
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ else if(NO_FRAME(opts.groupBox) && ::tqqt_cast<TQGroupBox *>(widget))
+ {
+ ((TQGroupBox *)widget)->setFlat(false);
+ ((TQGroupBox *)widget)->setFrameShape(TQFrame::NoFrame);
+ }
+ #ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
+ else if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(widget))
+ {
+ TQDialog *dlg=(TQDialog *)widget;
+
+ // The parent->isShown is needed for KWord. It's insert picure file dialog is a child of
+ // the insert picture dialog - but the file dialog is shown *before* the picture dialog!
+ if( (SKIP_TASKBAR && !dlg->parentWidget()) ||
+ ( (!dlg->parentWidget() || !dlg->parentWidget()->isShown())// &&
+ /*(dlg->isModal() || ::tqqt_cast<TQProgressDialog *>(widget))*/) )
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+
+ if(opts.fixParentlessDialogs && (APP_KPRINTER==itsThemedApp || APP_KDIALOG==itsThemedApp ||
+ APP_KDIALOGD==itsThemedApp))
+ {
+ TQString cap(widget->caption());
+ int index=-1;
+
+ // Remove horrible "Open - KDialog" titles...
+ if( cap.length() &&
+ ( (APP_KPRINTER==itsThemedApp && (-1!=(index=cap.find(" - KPrinter"))) &&
+ (index+11)==(int)cap.length()) ||
+ (APP_KDIALOG==itsThemedApp && (-1!=(index=cap.find(" - KDialog"))) &&
+ (index+10)==(int)cap.length()) ||
+ (APP_KDIALOGD==itsThemedApp && (-1!=(index=cap.find(" - KDialog Daemon"))) &&
+ (index+17)==(int)cap.length())) )
+ widget->TQWidget::setCaption(cap.left(index));
+ }
+ #endif
+
+ if(APP_SYSTEMSETTINGS==itsThemedApp)
+ {
+ if(widget && widget->parentWidget() && widget->parentWidget()->parentWidget() &&
+ ::tqqt_cast<TQFrame *>(widget) && TQFrame::NoFrame!=((TQFrame *)widget)->frameShape() &&
+ ::tqqt_cast<TQFrame *>(widget->parentWidget()) &&
+ ::tqqt_cast<TQTabWidget *>(widget->parentWidget()->parentWidget()))
+ ((TQFrame *)widget)->setFrameShape(TQFrame::NoFrame);
+
+ if(widget->parentWidget() && widget->parentWidget()->parentWidget() &&
+ ::tqqt_cast<TQScrollView *>(widget->parentWidget()->parentWidget()) &&
+ widget->inherits("KCMultiWidget") && widget->parentWidget()->inherits("TQViewportWidget"))
+ ((TQScrollView *)(widget->parentWidget()->parentWidget()))->setLineWidth(0);
+ }
+
+ if(opts.tabBgnd && widget && widget->parentWidget() && ::tqqt_cast<TQWidgetStack *>(widget) &&
+ ::tqqt_cast<TQTabWidget *>(widget->parentWidget()) &&
+ 0==qstrcmp(widget->name(), "tab pages"))
+ {
+ TQPalette pal(widget->palette());
+
+ pal.setColor(TQColorGroup::Background, shade(pal.active().background(), TO_FACTOR(opts.tabBgnd)));
+ widget->setBackgroundMode(PaletteBackground);
+ widget->setPalette(pal);
+ }
+
+ if(APPEARANCE_STRIPED==opts.bgndAppearance)
+ widget->setBackgroundOrigin(TQWidget::WindowOrigin);
+ }
+
+ BASE_STYLE::polish(ceData, elementFlags, ptr);
}
-void TQtCurveStyle::unPolish(TQWidget *widget)
+void TQtCurveStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
- if(isFormWidget(widget))
- itsKhtmlWidgets.remove(widget);
-
- if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::tqqt_cast<const TQPopupMenu *>(widget))
- widget->removeEventFilter(this);
-
- #if 0
- if(opts.menubarHiding && ::tqqt_cast<TQMainWindow *>(widget) && static_cast<TQMainWindow *>(widget)->menuBar())
- widget->removeEventFilter(this);
- #endif
-
- if(isWindowDragWidget(TQT_TQOBJECT(widget)))
- widget->removeEventFilter(this);
-
- if (::tqqt_cast<TQRadioButton *>(widget) || ::tqqt_cast<TQCheckBox *>(widget))
- {
-#if 0x039999 >= 0x030200
- widget->setMouseTracking(false);
-#endif
- widget->removeEventFilter(this);
- }
- else if (::tqqt_cast<TQHeader *>(widget) || ::tqqt_cast<TQTabBar *>(widget) || ::tqqt_cast<TQSpinWidget *>(widget) /*||
- ::tqqt_cast<TQDateTimeEditBase*>(widget)*/)
- {
- widget->setMouseTracking(false);
- widget->removeEventFilter(this);
- }
- else if (::tqqt_cast<TQButton *>(widget) || widget->inherits("TQToolBarExtensionWidget"))
- {
- if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
- widget->setBackgroundMode(PaletteButton);
- widget->removeEventFilter(this);
- }
- else if (::tqqt_cast<TQToolButton *>(widget))
- {
- if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
- widget->setBackgroundMode(PaletteButton);
- widget->removeEventFilter(this);
-#if defined TDE_VERSION && TDE_VERSION >= 0x30400 && TDE_VERSION < 0x30500
- widget->setMouseTracking(false);
-#endif
- }
- else if (::tqqt_cast<TQComboBox *>(widget))
- {
- if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
- widget->setBackgroundMode(PaletteButton);
- widget->removeEventFilter(this);
- widget->setMouseTracking(false);
- if(((TQComboBox *)widget)->listBox())
- ((TQComboBox *)widget)->listBox()->removeEventFilter(this);
- }
- else if (::tqqt_cast<TQToolBar *>(widget) || ::tqqt_cast<TQPopupMenu *>(widget))
- {
- if(NoBackground!=widget->backgroundMode())
- widget->setBackgroundMode(PaletteBackground);
- }
- else if (::tqqt_cast<TQMenuBar *>(widget))
- {
- if(NoBackground!=widget->backgroundMode())
- widget->setBackgroundMode(PaletteBackground);
- if(SHADE_NONE!=opts.shadeMenubars)
- widget->removeEventFilter(this);
- 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])))
- widget->setPalette(TQApplication::palette());
- }
- 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(PaletteButton);
- }
- else if (::tqqt_cast<TQSlider *>(widget))
- {
- widget->removeEventFilter(this);
- if(widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent()))
- widget->setBackgroundMode(PaletteBackground);
- }
- else if (::tqqt_cast<TQLineEdit*>(widget) || ::tqqt_cast<TQTextEdit*>(widget))
- widget->removeEventFilter(this);
- else if (widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || widget->inherits("TQDockWindowResizeHandle"))
- widget->removeEventFilter(this);
- else if (::tqqt_cast<TQProgressBar*>(widget))
- {
- itsProgAnimWidgets.remove(widget);
- widget->removeEventFilter(this);
- }
- else if(opts.highlightScrollViews && ::tqqt_cast<TQScrollView*>(widget))
- widget->removeEventFilter(this);
- else if(0==qstrcmp(widget->name(), kdeToolbarWidget))
- {
- widget->removeEventFilter(this);
- widget->setBackgroundMode(PaletteBackground);
- }
- if (widget->parentWidget() && ::tqqt_cast<TQMenuBar *>(widget->parentWidget()) && !qstrcmp(widget->className(), TQFRAME_OBJECT_NAME_STRING))
- {
- widget->removeEventFilter(this);
- widget->setBackgroundMode(PaletteBackground); // We paint whole background.
- }
- else if(widget->inherits("KTabCtl"))
- widget->removeEventFilter(this);
-#ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
- else if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(widget))
- widget->removeEventFilter(this);
-#endif
-
- BASE_STYLE::unPolish(widget);
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+
+ if(isFormWidget(widget))
+ itsKhtmlWidgets.remove(widget);
+
+ if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::tqqt_cast<const TQPopupMenu *>(widget))
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+
+ #if 0
+ if(opts.menubarHiding && ::tqqt_cast<TQMainWindow *>(widget) && static_cast<TQMainWindow *>(widget)->menuBar())
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ #endif
+
+ if(isWindowDragWidget(TQT_TQOBJECT(widget)))
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+
+ if (::tqqt_cast<TQRadioButton *>(widget) || ::tqqt_cast<TQCheckBox *>(widget))
+ {
+ #if 0x039999 >= 0x030200
+ widget->setMouseTracking(false);
+ #endif
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if (::tqqt_cast<TQHeader *>(widget) || ::tqqt_cast<TQTabBar *>(widget) || ::tqqt_cast<TQSpinWidget *>(widget) /*||
+ ::tqqt_cast<TQDateTimeEditBase*>(widget)*/)
+ {
+ widget->setMouseTracking(false);
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if (::tqqt_cast<TQButton *>(widget) || widget->inherits("TQToolBarExtensionWidget"))
+ {
+ if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
+ widget->setBackgroundMode(PaletteButton);
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if (::tqqt_cast<TQToolButton *>(widget))
+ {
+ if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
+ widget->setBackgroundMode(PaletteButton);
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ #if defined TDE_VERSION && TDE_VERSION >= 0x30400 && TDE_VERSION < 0x30500
+ widget->setMouseTracking(false);
+ #endif
+ }
+ else if (::tqqt_cast<TQComboBox *>(widget))
+ {
+ if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
+ widget->setBackgroundMode(PaletteButton);
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ widget->setMouseTracking(false);
+ if(((TQComboBox *)widget)->listBox())
+ ((TQComboBox *)widget)->listBox()->removeEventFilter(this);
+ // FIXME
+ // removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if (::tqqt_cast<TQToolBar *>(widget) || ::tqqt_cast<TQPopupMenu *>(widget))
+ {
+ if(NoBackground!=widget->backgroundMode())
+ widget->setBackgroundMode(PaletteBackground);
+ }
+ else if (::tqqt_cast<TQMenuBar *>(widget))
+ {
+ if(NoBackground!=widget->backgroundMode())
+ widget->setBackgroundMode(PaletteBackground);
+ if(SHADE_NONE!=opts.shadeMenubars)
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ 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])))
+ widget->setPalette(TQApplication::palette());
+ }
+ 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(PaletteButton);
+ }
+ else if (::tqqt_cast<TQSlider *>(widget))
+ {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ if(widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent()))
+ widget->setBackgroundMode(PaletteBackground);
+ }
+ else if (::tqqt_cast<TQLineEdit*>(widget) || ::tqqt_cast<TQTextEdit*>(widget))
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ else if (widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || widget->inherits("TQDockWindowResizeHandle"))
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ else if (::tqqt_cast<TQProgressBar*>(widget))
+ {
+ itsProgAnimWidgets.remove(widget);
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if(opts.highlightScrollViews && ::tqqt_cast<TQScrollView*>(widget))
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ else if(0==qstrcmp(widget->name(), kdeToolbarWidget))
+ {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ widget->setBackgroundMode(PaletteBackground);
+ }
+ if (widget->parentWidget() && ::tqqt_cast<TQMenuBar *>(widget->parentWidget()) && !qstrcmp(widget->className(), TQFRAME_OBJECT_NAME_STRING))
+ {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ widget->setBackgroundMode(PaletteBackground); // We paint whole background.
+ }
+ else if(widget->inherits("KTabCtl"))
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ #ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
+ else if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(widget))
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ #endif
+ }
+
+ BASE_STYLE::unPolish(ceData, elementFlags, ptr);
}
static void sendXEvent(TQDialog *dlg, const char *msg)
@@ -1987,463 +2004,467 @@ bool TQtCurveStyle::appIsNotEmbedded(TQDialog *dlg)
return false;
}
-bool TQtCurveStyle::eventFilter(TQObject *object, TQEvent *event)
+bool TQtCurveStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
{
- if(itsHoverWidget && TQT_BASE_OBJECT(object)==TQT_BASE_OBJECT(itsHoverWidget) && (TQEvent::Destroy==event->type() || TQEvent::Hide==event->type()))
- resetHover();
-
- #if 0
- // Works for qtconfig, but k3b hangs?
- if(opts.menubarHiding && TQEvent::KeyRelease==event->type() && ::tqqt_cast<TQMainWindow *>(object))
- {
- TQMainWindow *window=static_cast<TQMainWindow *>(object);
-
- if(window->isVisible() && window->menuBar())
- {
- TQKeyEvent *k=static_cast<TQKeyEvent *>(event);
-
- if(k->state()&TQt::ControlButton && k->state()&TQt::AltButton && TQt::Key_M==k->key())
- window->menuBar()->setHidden(window->menuBar()->isVisible());
- }
- }
- #endif
-
- 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()));
-
- if(IS_FLAT(opts.toolbarAppearance))
- TQPainter(widget).fillRect(widget->rect(), parent->colorGroup().background());
- else
- {
- int y_offset(widget->y());
-
- while(parent && parent->parent() && 0==qstrcmp(parent->name(), kdeToolbarWidget))
- {
- y_offset += parent->y();
- parent = TQT_TQWIDGET(parent->parent());
- }
-
- TQRect r(widget->rect()),
- pr(parent->rect());
- bool horiz=pr.width() > pr.height();
- TQPainter p(widget);
- TQToolBar *tb(::tqqt_cast<TQToolBar*>(parent));
-
- // If parent is a TQToolbar use its orientation, else just base on width>height.
- if (tb)
- horiz = Qt::Horizontal==tb->orientation();
-
- TQRect bgndRect(r.x(), r.y()-y_offset, r.width(), pr.height());
-
- if(!IS_FLAT(opts.toolbarAppearance)) {
- if(horiz) {
- bgndRect.addCoords(0, -1, 0, 1);
- }
- else {
- bgndRect.addCoords(-1, 0, 1, 0);
- }
- }
-
- drawMenuOrToolBarBackground(&p, bgndRect, parent->colorGroup(), false, horiz);
- }
-
- if(!::tqqt_cast<TQLineEdit*>(object) && !::tqqt_cast<TQTextEdit*>(object) &&
- !(DO_EFFECT && ::tqqt_cast<TQComboBox*>(object)))
- return false; // Now draw the contents
- }
- }
- else if (NO_FRAME(opts.groupBox) && TQEvent::Move==event->type() && isCheckBoxOfGroupBox(object))
- {
- TQCheckBox *cb=static_cast<TQCheckBox *>(TQT_TQWIDGET(object));
- TQRect r(cb->geometry());
-
- cb->removeEventFilter(this);
- if(TQApplication::reverseLayout())
- r.setWidth(r.width()+8);
- else
- r.setX(0);
- cb->setGeometry(r);
- cb->installEventFilter(this);
- return false;
- }
- else if (TQEvent::Paint==event->type())
- {
- if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::tqqt_cast<TQPopupMenu *>(object))
- {
- TQWidget *widget=(TQWidget*)object;
- TQPainter painter(widget);
- TQColor col(USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : widget->palette().active().background());
-
- if(APPEARANCE_STRIPED==opts.menuBgndAppearance)
- painter.drawTiledPixmap(widget->rect(), *createStripePixmap(col, false));
- else
- drawBevelGradientReal(col, &painter, widget->rect(), GT_HORIZ==opts.menuBgndGrad, false,
- opts.menuBgndAppearance, WIDGET_OTHER);
- return false;
- }
- else if (object->inherits("KToolBarSeparator"))
- {
- TQFrame *frame(::tqqt_cast<TQFrame *>(object));
-
- if(frame && TQFrame::NoFrame!=frame->frameShape())
- {
- TQPainter painter(frame);
- if (TQFrame::VLine==frame->frameShape())
- drawPrimitive(PE_DockWindowSeparator, &painter, TQStyleControlElementData(), CEF_None, frame->rect(),
- frame->colorGroup(), Style_Horizontal);
- else if (TQFrame::HLine==frame->frameShape())
- drawPrimitive(PE_DockWindowSeparator, &painter, TQStyleControlElementData(), CEF_None, frame->rect(),
- frame->colorGroup());
- else
- return false;
- return true; // been drawn!
- }
- }
- else if(object->inherits("KTabCtl") && ::tqqt_cast<TQWidget*>(object))
- {
- TQWidget *widget((TQWidget*)object);
- TQObject *child(object->child("_tabbar"));
- TQTabBar *tb(child ? ::tqqt_cast<TQTabBar *>(child) : 0L);
- TQPainter painter(widget);
- TQRect r(widget->rect());
- int tbHeight(tb ? tb->height()-1 : 28);
-
- if(tb && (TQTabBar::RoundedBelow == tb->shape() ||
- TQTabBar::TriangularBelow == tb->shape()))
- r.addCoords(0, 0, 0, -tbHeight);
- else
- r.addCoords(0, tbHeight, 0, 0);
- drawPrimitive(PE_PanelTabWidget, &painter, TQStyleControlElementData(), CEF_None, r, widget->colorGroup(),
- Style_Horizontal|Style_Enabled);
- return true;
- }
- }
-
- // Fix mdi buttons in menubars...
- if(::tqqt_cast<TQWidget*>(object) && ((TQWidget *)object)->parentWidget() &&
- ::tqqt_cast<TQMenuBar*>(((TQWidget *)object)->parentWidget()))
- {
- bool drawMenubar=false;
-
- switch(event->type())
- {
- case TQEvent::Paint:
- drawMenubar=true;
- break;
- case TQEvent::WindowActivate:
- itsActive=true;
- drawMenubar=opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars;
- break;
- case TQEvent::WindowDeactivate:
- itsActive=false;
- drawMenubar=opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars;
- default:
- break;
- }
-
- if(drawMenubar)
- {
-
- TQWidget *widget(TQT_TQWIDGET(object)),
- *parent(TQT_TQWIDGET(object->parent()));
- TQRect r(widget->rect());
- TQPainter p(widget);
- int y_offset(widget->y()+parent->y());
-
- r.setY(r.y()-y_offset);
- r.setHeight(parent->rect().height());
-
- drawMenuOrToolBarBackground(&p, r, parent->colorGroup());
- return true;
- }
- }
-
- // Taken from plastik...
- // focus highlight
- if (::tqqt_cast<TQLineEdit*>(object) || ::tqqt_cast<TQTextEdit*>(object)/* || ::tqqt_cast<TQDateTimeEditBase*>(object)*/)
- {
- if(TQEvent::FocusIn==event->type() || TQEvent::FocusOut==event->type() || TQEvent::Enter==event->type() || TQEvent::Leave==event->type())
- {
- TQWidget *widget(TQT_TQWIDGET(object));
-
- if (::tqqt_cast<TQSpinWidget*>(widget->parentWidget()))
- {
- widget->parentWidget()->repaint(false);
- return false;
- }
-
- widget->repaint(false);
- }
- return false;
- }
-
- if(::tqqt_cast<TQMenuBar *>(object))
- {
- bool useWindowCols=SHADE_WINDOW_BORDER==opts.shadeMenubars;
-
- if( (useWindowCols || opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars ||
- SHADE_CUSTOM==opts.shadeMenubars) && TQEvent::Paint==event->type())
- {
- const TQColor &col(((TQWidget *)object)->palette().active().color(TQColorGroup::Foreground));
-
- // If we're relouring the menubar text, check to see if menubar palette has changed, if so set back to
- // our values. This fixes opera - which seems to change the widgets palette after it is polished.
- if((opts.customMenuTextColor && col!=opts.customMenuNormTextColor) ||
- ( (SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars ||
- (SHADE_CUSTOM==opts.shadeMenubars && TOO_DARK(itsMenubarCols[ORIGINAL_SHADE]))) &&
- col!=TQApplication::palette().active().highlightedText()))
- {
- TQPalette pal(((TQWidget *)object)->palette());
- TQColorGroup act(pal.active());
-
- act.setColor(TQColorGroup::Foreground, useWindowCols
- ? itsActiveMdiTextColor
- : opts.customMenuTextColor
- ? opts.customMenuNormTextColor
- : TQApplication::palette().active().highlightedText());
-
- if(!opts.shadeMenubarOnlyWhenActive || useWindowCols)
- {
- TQColorGroup inact(pal.inactive());
- inact.setColor(TQColorGroup::Foreground, useWindowCols ? itsMdiTextColor : act.color(TQColorGroup::Foreground));
- pal.setInactive(inact);
- }
-
- pal.setActive(act);
- ((TQWidget *)object)->setPalette(pal);
- }
- }
-
- if(opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars)
- switch(event->type())
- {
- case TQEvent::WindowActivate:
- itsActive=true;
- ((TQWidget *)object)->repaint(false);
- return false;
- case TQEvent::WindowDeactivate:
- itsActive=false;
- ((TQWidget *)object)->repaint(false);
- return false;
- default:
- break;
- }
- if(BLEND_TITLEBAR || opts.windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR)
- switch(event->type())
- {
- case TQEvent::Resize:
- {
- TQResizeEvent *re = TQT_TQRESIZEEVENT(event);
-
- if (re->size().height() != re->oldSize().height())
- emitMenuSize((TQMenuBar *)object, re->size().height());
- break;
- }
- default:
- break;
- }
- }
-
- if(dynamic_cast<TQMouseEvent*>(event))
- switch(event->type())
- {
- case TQEvent::MouseMove: // Only occurs for widgets with mouse tracking enabled
- if(itsDragWidget)
- {
- itsDragWidget->setMouseTracking(itsDragWidgetHadMouseTracking);
- bool move=isWindowDragWidget(object);
-
- if(move)
- triggerWMMove(itsDragWidget, ((TQMouseEvent *)event)->globalPos());
- itsDragWidget = 0L;
- return move;
- }
- case TQEvent::MouseButtonPress:
- {
- TQMouseEvent *mev = (TQMouseEvent *)event;
-
- if(isWindowDragWidget(object, mev->pos()))
- {
-
- if(/*TQt::NoModifier==mev->modifiers() && */ Qt::LeftButton==mev->button())
- {
- TQWidget *wid = TQT_TQWIDGET(object);
- itsDragWidget=wid;
- itsDragWidgetHadMouseTracking=itsDragWidget->hasMouseTracking();
- itsDragWidget->setMouseTracking(true);
- return false;
- }
- }
- break;
- }
- case TQEvent::MouseButtonRelease:
- if(itsDragWidget)
- {
- itsDragWidget->setMouseTracking(itsDragWidgetHadMouseTracking);
- itsDragWidget = 0L;
- return false;
- }
- default:
- break;
- }
-
-#ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
- if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(object))
- {
- TQDialog *dlg=(TQDialog *)object;
-
- switch(event->type())
- {
- case TQEvent::ShowMinimized:
- if(SKIP_TASKBAR && appIsNotEmbedded(dlg))
- {
- // Ugly hack :-( Cant seem to get KWin to remove the minimize button. So when
- // the dialog gets minimized, restore.
- dlg->setWindowState(dlg->windowState() & ~WindowMinimized | WindowActive);
- return true;
- }
- break;
- case TQEvent::WindowActivate:
- if(SKIP_TASKBAR && appIsNotEmbedded(dlg))
- {
- // OO.o's filepicker is a spawned process - but is not set transient :-(
- // --plus no reliable way of finding which widget to make it transient for...
- sendXEvent(dlg, "_NET_WM_STATE_SKIP_PAGER");
- sendXEvent(dlg, "_NET_WM_STATE_SKIP_TASKBAR");
- sendXEvent(dlg, "_NET_WM_STATE_ABOVE");
- sendXEvent(dlg, "_NET_WM_STATE_STAYS_ON_TOP");
- //setActions(dlg);
- }
- break;
- case TQEvent::Show:
- // The parent->isShown is needed for KWord. It's insert picure file dialog is a
- // child of the insert picture dialog - but the file dialog is shown *before* the
- // picture dialog!
- if((!dlg->parentWidget() || !dlg->parentWidget()->isShown())) // &&
- //(dlg->isModal() || ::tqqt_cast<TQProgressDialog *>(object)))
- {
- TQWidget *activeWindow=tqApp->activeWindow();
-
- if(activeWindow)
- {
- XWindowAttributes attr;
- int rx, ry;
- Window win;
-
- if(!XGetTransientForHint(tqt_xdisplay(), dlg->winId(), &win) ||
- win!=activeWindow->winId())
- {
- XSetTransientForHint(tqt_xdisplay(), dlg->winId(),
- activeWindow->winId());
-
- if(XGetWindowAttributes(tqt_xdisplay(), activeWindow->winId(), &attr))
- {
- XTranslateCoordinates(tqt_xdisplay(), activeWindow->winId(),
- attr.root, -attr.border_width, -16,
- &rx, &ry, &win);
-
- rx=(rx+(attr.width/2))-(dlg->width()/2);
- if(rx<0)
- rx=0;
- ry=(ry+(attr.height/2))-(dlg->height()/2);
- if(ry<0)
- ry=0;
- dlg->move(rx, ry);
- if(!dlg->isModal())
- dlg->setModal(true);
- }
- }
- }
- }
- default:
- break;
- }
- return false;
- }
-#endif
-
- // Track show events for progress bars
- if (opts.animatedProgress && ::tqqt_cast<TQProgressBar*>(object))
- {
- if(TQEvent::Show==event->type() && !itsAnimationTimer->isActive())
- itsAnimationTimer->start(PROGRESS_ANIMATION, false);
- return false;
- }
-
- switch(event->type())
- {
- case TQEvent::FocusIn:
- case TQEvent::FocusOut:
- if(opts.highlightScrollViews && object->isWidgetType() && ::tqqt_cast<TQScrollView*>(object))
- ((TQWidget *)object)->repaint(false);
- break;
- case TQEvent::Hide:
- case TQEvent::Show:
- if(::tqqt_cast<TQListBox *>(object) &&
- (((TQListBox *)object)->parentWidget() &&
- ::tqqt_cast<TQComboBox *>(((TQListBox *)object)->parentWidget())))
- ((TQComboBox *)(((TQListBox *)object)->parentWidget()))->repaint(false);
-// else if(::tqqt_cast<TQFrame *>(object) &&
-// (TQFrame::Box==((TQFrame *)object)->frameShape() || TQFrame::Panel==((TQFrame *)object)->frameShape() ||
-// TQFrame::WinPanel==((TQFrame *)object)->frameShape()))
-// ((TQFrame *)object)->setFrameShape(TQFrame::StyledPanel);
- break;
- case TQEvent::Enter:
- if(object->isWidgetType())
- {
- itsHoverWidget=(TQWidget *)object;
-
- if(itsHoverWidget && itsHoverWidget->isEnabled())
- {
- if(::tqqt_cast<TQTabBar*>(object) && TQT_TQWIDGET(object)->isEnabled())
- {
- itsHoverTab=0L;
- itsHoverWidget->repaint(false);
- }
- else if(!itsHoverWidget->hasMouseTracking() ||
- (itsFormMode=isFormWidget(itsHoverWidget)))
- {
- itsHoverWidget->repaint(false);
- itsFormMode=false;
- }
- }
- else
- itsHoverWidget=0L;
-
- if(itsHoverWidget && !itsIsSpecialHover && isSpecialHover(itsHoverWidget))
- itsIsSpecialHover=true;
- }
- break;
- case TQEvent::Leave:
- if(itsHoverWidget && TQT_BASE_OBJECT(object)==TQT_BASE_OBJECT(itsHoverWidget))
- {
- resetHover();
- ((TQWidget *)object)->repaint(false);
- }
- break;
- case TQEvent::MouseMove: // Only occurs for widgets with mouse tracking enabled
- {
- TQMouseEvent *me = TQT_TQMOUSEEVENT(event);
-
- if(me && itsHoverWidget && object->isWidgetType())
- {
- if(!me->pos().isNull() && itsIsSpecialHover && redrawHoverWidget(me->pos()))
- itsHoverWidget->repaint(false);
- itsOldPos=me->pos();
- }
- break;
- }
- default:
- break;
- }
-
- return BASE_STYLE::eventFilter(object, 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()))
+ resetHover();
+
+ #if 0
+ // Works for qtconfig, but k3b hangs?
+ if(opts.menubarHiding && TQEvent::KeyRelease==event->type() && ::tqqt_cast<TQMainWindow *>(object))
+ {
+ TQMainWindow *window=static_cast<TQMainWindow *>(object);
+
+ if(window->isVisible() && window->menuBar())
+ {
+ TQKeyEvent *k=static_cast<TQKeyEvent *>(event);
+
+ if(k->state()&TQt::ControlButton && k->state()&TQt::AltButton && TQt::Key_M==k->key())
+ window->menuBar()->setHidden(window->menuBar()->isVisible());
+ }
+ }
+ #endif
+
+ 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()));
+
+ if(IS_FLAT(opts.toolbarAppearance))
+ TQPainter(widget).fillRect(widget->rect(), parent->colorGroup().background());
+ else
+ {
+ int y_offset(widget->y());
+
+ while(parent && parent->parent() && 0==qstrcmp(parent->name(), kdeToolbarWidget))
+ {
+ y_offset += parent->y();
+ parent = TQT_TQWIDGET(parent->parent());
+ }
+
+ TQRect r(widget->rect()),
+ pr(parent->rect());
+ bool horiz=pr.width() > pr.height();
+ TQPainter p(widget);
+ TQToolBar *tb(::tqqt_cast<TQToolBar*>(parent));
+
+ // If parent is a TQToolbar use its orientation, else just base on width>height.
+ if (tb)
+ horiz = Qt::Horizontal==tb->orientation();
+
+ TQRect bgndRect(r.x(), r.y()-y_offset, r.width(), pr.height());
+
+ if(!IS_FLAT(opts.toolbarAppearance)) {
+ if(horiz) {
+ bgndRect.addCoords(0, -1, 0, 1);
+ }
+ else {
+ bgndRect.addCoords(-1, 0, 1, 0);
+ }
+ }
+
+ drawMenuOrToolBarBackground(&p, bgndRect, parent->colorGroup(), false, horiz);
+ }
+
+ if(!::tqqt_cast<TQLineEdit*>(object) && !::tqqt_cast<TQTextEdit*>(object) &&
+ !(DO_EFFECT && ::tqqt_cast<TQComboBox*>(object)))
+ return false; // Now draw the contents
+ }
+ }
+ else if (NO_FRAME(opts.groupBox) && TQEvent::Move==event->type() && isCheckBoxOfGroupBox(object))
+ {
+ TQCheckBox *cb=static_cast<TQCheckBox *>(TQT_TQWIDGET(object));
+ TQRect r(cb->geometry());
+
+ removeObjectEventHandler(ceData, elementFlags, source, this);
+ if(TQApplication::reverseLayout())
+ r.setWidth(r.width()+8);
+ else
+ r.setX(0);
+ cb->setGeometry(r);
+ installObjectEventHandler(ceData, elementFlags, source, this);
+ return false;
+ }
+ else if (TQEvent::Paint==event->type())
+ {
+ if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::tqqt_cast<TQPopupMenu *>(object))
+ {
+ TQWidget *widget=(TQWidget*)object;
+ TQPainter painter(widget);
+ TQColor col(USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : widget->palette().active().background());
+
+ if(APPEARANCE_STRIPED==opts.menuBgndAppearance)
+ painter.drawTiledPixmap(widget->rect(), *createStripePixmap(col, false));
+ else
+ drawBevelGradientReal(col, &painter, widget->rect(), GT_HORIZ==opts.menuBgndGrad, false,
+ opts.menuBgndAppearance, WIDGET_OTHER);
+ return false;
+ }
+ else if (object->inherits("KToolBarSeparator"))
+ {
+ TQFrame *frame(::tqqt_cast<TQFrame *>(object));
+
+ if(frame && TQFrame::NoFrame!=frame->frameShape())
+ {
+ TQPainter painter(frame);
+ if (TQFrame::VLine==frame->frameShape())
+ drawPrimitive(PE_DockWindowSeparator, &painter, TQStyleControlElementData(), CEF_None, frame->rect(),
+ frame->colorGroup(), Style_Horizontal);
+ else if (TQFrame::HLine==frame->frameShape())
+ drawPrimitive(PE_DockWindowSeparator, &painter, TQStyleControlElementData(), CEF_None, frame->rect(),
+ frame->colorGroup());
+ else
+ return false;
+ return true; // been drawn!
+ }
+ }
+ else if(object->inherits("KTabCtl") && ::tqqt_cast<TQWidget*>(object))
+ {
+ TQWidget *widget((TQWidget*)object);
+ TQObject *child(object->child("_tabbar"));
+ TQTabBar *tb(child ? ::tqqt_cast<TQTabBar *>(child) : 0L);
+ TQPainter painter(widget);
+ TQRect r(widget->rect());
+ int tbHeight(tb ? tb->height()-1 : 28);
+
+ if(tb && (TQTabBar::RoundedBelow == tb->shape() ||
+ TQTabBar::TriangularBelow == tb->shape()))
+ r.addCoords(0, 0, 0, -tbHeight);
+ else
+ r.addCoords(0, tbHeight, 0, 0);
+ drawPrimitive(PE_PanelTabWidget, &painter, TQStyleControlElementData(), CEF_None, r, widget->colorGroup(),
+ Style_Horizontal|Style_Enabled);
+ return true;
+ }
+ }
+
+ // Fix mdi buttons in menubars...
+ if(::tqqt_cast<TQWidget*>(object) && ((TQWidget *)object)->parentWidget() &&
+ ::tqqt_cast<TQMenuBar*>(((TQWidget *)object)->parentWidget()))
+ {
+ bool drawMenubar=false;
+
+ switch(event->type())
+ {
+ case TQEvent::Paint:
+ drawMenubar=true;
+ break;
+ case TQEvent::WindowActivate:
+ itsActive=true;
+ drawMenubar=opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars;
+ break;
+ case TQEvent::WindowDeactivate:
+ itsActive=false;
+ drawMenubar=opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars;
+ default:
+ break;
+ }
+
+ if(drawMenubar)
+ {
+
+ TQWidget *widget(TQT_TQWIDGET(object)),
+ *parent(TQT_TQWIDGET(object->parent()));
+ TQRect r(widget->rect());
+ TQPainter p(widget);
+ int y_offset(widget->y()+parent->y());
+
+ r.setY(r.y()-y_offset);
+ r.setHeight(parent->rect().height());
+
+ drawMenuOrToolBarBackground(&p, r, parent->colorGroup());
+ return true;
+ }
+ }
+
+ // Taken from plastik...
+ // focus highlight
+ if (::tqqt_cast<TQLineEdit*>(object) || ::tqqt_cast<TQTextEdit*>(object)/* || ::tqqt_cast<TQDateTimeEditBase*>(object)*/)
+ {
+ if(TQEvent::FocusIn==event->type() || TQEvent::FocusOut==event->type() || TQEvent::Enter==event->type() || TQEvent::Leave==event->type())
+ {
+ TQWidget *widget(TQT_TQWIDGET(object));
+
+ if (::tqqt_cast<TQSpinWidget*>(widget->parentWidget()))
+ {
+ widget->parentWidget()->repaint(false);
+ return false;
+ }
+
+ widget->repaint(false);
+ }
+ return false;
+ }
+
+ if(::tqqt_cast<TQMenuBar *>(object))
+ {
+ bool useWindowCols=SHADE_WINDOW_BORDER==opts.shadeMenubars;
+
+ if( (useWindowCols || opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars ||
+ SHADE_CUSTOM==opts.shadeMenubars) && TQEvent::Paint==event->type())
+ {
+ const TQColor &col(((TQWidget *)object)->palette().active().color(TQColorGroup::Foreground));
+
+ // If we're relouring the menubar text, check to see if menubar palette has changed, if so set back to
+ // our values. This fixes opera - which seems to change the widgets palette after it is polished.
+ if((opts.customMenuTextColor && col!=opts.customMenuNormTextColor) ||
+ ( (SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars ||
+ (SHADE_CUSTOM==opts.shadeMenubars && TOO_DARK(itsMenubarCols[ORIGINAL_SHADE]))) &&
+ col!=TQApplication::palette().active().highlightedText()))
+ {
+ TQPalette pal(((TQWidget *)object)->palette());
+ TQColorGroup act(pal.active());
+
+ act.setColor(TQColorGroup::Foreground, useWindowCols
+ ? itsActiveMdiTextColor
+ : opts.customMenuTextColor
+ ? opts.customMenuNormTextColor
+ : TQApplication::palette().active().highlightedText());
+
+ if(!opts.shadeMenubarOnlyWhenActive || useWindowCols)
+ {
+ TQColorGroup inact(pal.inactive());
+ inact.setColor(TQColorGroup::Foreground, useWindowCols ? itsMdiTextColor : act.color(TQColorGroup::Foreground));
+ pal.setInactive(inact);
+ }
+
+ pal.setActive(act);
+ ((TQWidget *)object)->setPalette(pal);
+ }
+ }
+
+ if(opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars)
+ switch(event->type())
+ {
+ case TQEvent::WindowActivate:
+ itsActive=true;
+ ((TQWidget *)object)->repaint(false);
+ return false;
+ case TQEvent::WindowDeactivate:
+ itsActive=false;
+ ((TQWidget *)object)->repaint(false);
+ return false;
+ default:
+ break;
+ }
+ if(BLEND_TITLEBAR || opts.windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR)
+ switch(event->type())
+ {
+ case TQEvent::Resize:
+ {
+ TQResizeEvent *re = TQT_TQRESIZEEVENT(event);
+
+ if (re->size().height() != re->oldSize().height())
+ emitMenuSize((TQMenuBar *)object, re->size().height());
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ if(dynamic_cast<TQMouseEvent*>(event))
+ switch(event->type())
+ {
+ case TQEvent::MouseMove: // Only occurs for widgets with mouse tracking enabled
+ if(itsDragWidget)
+ {
+ itsDragWidget->setMouseTracking(itsDragWidgetHadMouseTracking);
+ bool move=isWindowDragWidget(object);
+
+ if(move)
+ triggerWMMove(itsDragWidget, ((TQMouseEvent *)event)->globalPos());
+ itsDragWidget = 0L;
+ return move;
+ }
+ case TQEvent::MouseButtonPress:
+ {
+ TQMouseEvent *mev = (TQMouseEvent *)event;
+
+ if(isWindowDragWidget(object, mev->pos()))
+ {
+
+ if(/*TQt::NoModifier==mev->modifiers() && */ Qt::LeftButton==mev->button())
+ {
+ TQWidget *wid = TQT_TQWIDGET(object);
+ itsDragWidget=wid;
+ itsDragWidgetHadMouseTracking=itsDragWidget->hasMouseTracking();
+ itsDragWidget->setMouseTracking(true);
+ return false;
+ }
+ }
+ break;
+ }
+ case TQEvent::MouseButtonRelease:
+ if(itsDragWidget)
+ {
+ itsDragWidget->setMouseTracking(itsDragWidgetHadMouseTracking);
+ itsDragWidget = 0L;
+ return false;
+ }
+ default:
+ break;
+ }
+
+ #ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
+ if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(object))
+ {
+ TQDialog *dlg=(TQDialog *)object;
+
+ switch(event->type())
+ {
+ case TQEvent::ShowMinimized:
+ if(SKIP_TASKBAR && appIsNotEmbedded(dlg))
+ {
+ // Ugly hack :-( Cant seem to get KWin to remove the minimize button. So when
+ // the dialog gets minimized, restore.
+ dlg->setWindowState(dlg->windowState() & ~WindowMinimized | WindowActive);
+ return true;
+ }
+ break;
+ case TQEvent::WindowActivate:
+ if(SKIP_TASKBAR && appIsNotEmbedded(dlg))
+ {
+ // OO.o's filepicker is a spawned process - but is not set transient :-(
+ // --plus no reliable way of finding which widget to make it transient for...
+ sendXEvent(dlg, "_NET_WM_STATE_SKIP_PAGER");
+ sendXEvent(dlg, "_NET_WM_STATE_SKIP_TASKBAR");
+ sendXEvent(dlg, "_NET_WM_STATE_ABOVE");
+ sendXEvent(dlg, "_NET_WM_STATE_STAYS_ON_TOP");
+ //setActions(dlg);
+ }
+ break;
+ case TQEvent::Show:
+ // The parent->isShown is needed for KWord. It's insert picure file dialog is a
+ // child of the insert picture dialog - but the file dialog is shown *before* the
+ // picture dialog!
+ if((!dlg->parentWidget() || !dlg->parentWidget()->isShown())) // &&
+ //(dlg->isModal() || ::tqqt_cast<TQProgressDialog *>(object)))
+ {
+ TQWidget *activeWindow=tqApp->activeWindow();
+
+ if(activeWindow)
+ {
+ XWindowAttributes attr;
+ int rx, ry;
+ Window win;
+
+ if(!XGetTransientForHint(tqt_xdisplay(), dlg->winId(), &win) ||
+ win!=activeWindow->winId())
+ {
+ XSetTransientForHint(tqt_xdisplay(), dlg->winId(),
+ activeWindow->winId());
+
+ if(XGetWindowAttributes(tqt_xdisplay(), activeWindow->winId(), &attr))
+ {
+ XTranslateCoordinates(tqt_xdisplay(), activeWindow->winId(),
+ attr.root, -attr.border_width, -16,
+ &rx, &ry, &win);
+
+ rx=(rx+(attr.width/2))-(dlg->width()/2);
+ if(rx<0)
+ rx=0;
+ ry=(ry+(attr.height/2))-(dlg->height()/2);
+ if(ry<0)
+ ry=0;
+ dlg->move(rx, ry);
+ if(!dlg->isModal())
+ dlg->setModal(true);
+ }
+ }
+ }
+ }
+ default:
+ break;
+ }
+ return false;
+ }
+ #endif
+
+ // Track show events for progress bars
+ if (opts.animatedProgress && ::tqqt_cast<TQProgressBar*>(object))
+ {
+ if(TQEvent::Show==event->type() && !itsAnimationTimer->isActive())
+ itsAnimationTimer->start(PROGRESS_ANIMATION, false);
+ return false;
+ }
+
+ switch(event->type())
+ {
+ case TQEvent::FocusIn:
+ case TQEvent::FocusOut:
+ if(opts.highlightScrollViews && object->isWidgetType() && ::tqqt_cast<TQScrollView*>(object))
+ ((TQWidget *)object)->repaint(false);
+ break;
+ case TQEvent::Hide:
+ case TQEvent::Show:
+ if(::tqqt_cast<TQListBox *>(object) &&
+ (((TQListBox *)object)->parentWidget() &&
+ ::tqqt_cast<TQComboBox *>(((TQListBox *)object)->parentWidget())))
+ ((TQComboBox *)(((TQListBox *)object)->parentWidget()))->repaint(false);
+ // else if(::tqqt_cast<TQFrame *>(object) &&
+ // (TQFrame::Box==((TQFrame *)object)->frameShape() || TQFrame::Panel==((TQFrame *)object)->frameShape() ||
+ // TQFrame::WinPanel==((TQFrame *)object)->frameShape()))
+ // ((TQFrame *)object)->setFrameShape(TQFrame::StyledPanel);
+ break;
+ case TQEvent::Enter:
+ if(object->isWidgetType())
+ {
+ itsHoverWidget=(TQWidget *)object;
+
+ if(itsHoverWidget && itsHoverWidget->isEnabled())
+ {
+ if(::tqqt_cast<TQTabBar*>(object) && TQT_TQWIDGET(object)->isEnabled())
+ {
+ itsHoverTab=0L;
+ itsHoverWidget->repaint(false);
+ }
+ else if(!itsHoverWidget->hasMouseTracking() ||
+ (itsFormMode=isFormWidget(itsHoverWidget)))
+ {
+ itsHoverWidget->repaint(false);
+ itsFormMode=false;
+ }
+ }
+ else
+ itsHoverWidget=0L;
+
+ if(itsHoverWidget && !itsIsSpecialHover && isSpecialHover(itsHoverWidget))
+ itsIsSpecialHover=true;
+ }
+ break;
+ case TQEvent::Leave:
+ if(itsHoverWidget && TQT_BASE_OBJECT(object)==TQT_BASE_OBJECT(itsHoverWidget))
+ {
+ resetHover();
+ ((TQWidget *)object)->repaint(false);
+ }
+ break;
+ case TQEvent::MouseMove: // Only occurs for widgets with mouse tracking enabled
+ {
+ TQMouseEvent *me = TQT_TQMOUSEEVENT(event);
+
+ if(me && itsHoverWidget && object->isWidgetType())
+ {
+ if(!me->pos().isNull() && itsIsSpecialHover && redrawHoverWidget(me->pos()))
+ itsHoverWidget->repaint(false);
+ itsOldPos=me->pos();
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ return BASE_STYLE::objectEventHandler(ceData, elementFlags, source, event);
}
void TQtCurveStyle::drawLightBevel(const TQColor &bgnd, TQPainter *p, const TQRect &rOrig,