summaryrefslogtreecommitdiffstats
path: root/kstyles/highcontrast
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-07 01:36:09 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-07 01:36:09 -0500
commit2053998fef5594813340b82cb1ea885908cbb1d6 (patch)
tree730c3660b2d14b1fe66a3e16d58d295a702c7d9a /kstyles/highcontrast
parent2ba2bd6da04b86d32ce1d3a3680a00810938cf9c (diff)
downloadtdelibs-2053998fef5594813340b82cb1ea885908cbb1d6.tar.gz
tdelibs-2053998fef5594813340b82cb1ea885908cbb1d6.zip
Update for new style API
Diffstat (limited to 'kstyles/highcontrast')
-rw-r--r--kstyles/highcontrast/highcontrast.cpp113
-rw-r--r--kstyles/highcontrast/highcontrast.h6
2 files changed, 68 insertions, 51 deletions
diff --git a/kstyles/highcontrast/highcontrast.cpp b/kstyles/highcontrast/highcontrast.cpp
index 8d4629677..1447a8e99 100644
--- a/kstyles/highcontrast/highcontrast.cpp
+++ b/kstyles/highcontrast/highcontrast.cpp
@@ -153,30 +153,43 @@ void HighContrastStyle::polish( TQPalette& pal )
}
-void HighContrastStyle::polish (TQWidget* widget)
+void HighContrastStyle::polish (TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
- if (widget->inherits (TQBUTTON_OBJECT_NAME_STRING)
- || widget->inherits (TQCOMBOBOX_OBJECT_NAME_STRING)
- || widget->inherits (TQSPINWIDGET_OBJECT_NAME_STRING)
- || widget->inherits (TQLINEEDIT_OBJECT_NAME_STRING)
- || widget->inherits (TQTEXTEDIT_OBJECT_NAME_STRING))
- {
- widget->installEventFilter (this);
-
- TQSpinWidget* spinwidget = dynamic_cast<TQSpinWidget*>(widget);
- if (spinwidget && spinwidget->editWidget())
- spinwidget->editWidget()->installEventFilter (this);
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+
+ if (widget->inherits (TQBUTTON_OBJECT_NAME_STRING)
+ || widget->inherits (TQCOMBOBOX_OBJECT_NAME_STRING)
+ || widget->inherits (TQSPINWIDGET_OBJECT_NAME_STRING)
+ || widget->inherits (TQLINEEDIT_OBJECT_NAME_STRING)
+ || widget->inherits (TQTEXTEDIT_OBJECT_NAME_STRING))
+ {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+
+ TQSpinWidget* spinwidget = dynamic_cast<TQSpinWidget*>(widget);
+ if (spinwidget && spinwidget->editWidget()) {
+ TQWidget* spinEditWidget = spinwidget->editWidget();
+ TQStyleControlElementData swCeData = populateControlElementDataFromWidget(spinEditWidget, TQStyleOption());
+ ControlElementFlags swElementFlags = getControlElementFlagsForObject(spinEditWidget, swCeData.widgetObjectTypes, TQStyleOption());
+ installObjectEventHandler(swCeData, swElementFlags, spinEditWidget, this);
+ }
+ }
}
- KStyle::polish (widget);
+ KStyle::polish (ceData, elementFlags, ptr);
}
-void HighContrastStyle::unPolish (TQWidget* widget)
+void HighContrastStyle::unPolish (TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
- if (widget->inherits (TQWIDGET_OBJECT_NAME_STRING) || widget->inherits (TQCOMBOBOX_OBJECT_NAME_STRING) || widget->inherits (TQSPINWIDGET_OBJECT_NAME_STRING) || widget->inherits (TQLINEEDIT_OBJECT_NAME_STRING) || widget->inherits (TQTEXTEDIT_OBJECT_NAME_STRING))
- widget->removeEventFilter (this);
- KStyle::unPolish (widget);
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+ if (widget->inherits (TQWIDGET_OBJECT_NAME_STRING) || widget->inherits (TQCOMBOBOX_OBJECT_NAME_STRING) || widget->inherits (TQSPINWIDGET_OBJECT_NAME_STRING) || widget->inherits (TQLINEEDIT_OBJECT_NAME_STRING) || widget->inherits (TQTEXTEDIT_OBJECT_NAME_STRING)) {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ }
+
+ KStyle::unPolish (ceData, elementFlags, ptr);
}
void HighContrastStyle::setColorsNormal (TQPainter* p, const TQColorGroup& cg, int flags, int highlight) const
@@ -1815,48 +1828,52 @@ TQRect HighContrastStyle::subRect (SubRect subrect, const TQStyleControlElementD
}
}
-bool HighContrastStyle::eventFilter (TQObject *object, TQEvent *event)
+bool HighContrastStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
{
- TQWidget* widget = dynamic_cast<TQWidget*>(object);
- if (widget)
- {
- // Handle hover effects.
- if (event->type() == TQEvent::Enter
- && (widget->inherits (TQBUTTON_OBJECT_NAME_STRING)
- || widget->inherits (TQCOMBOBOX_OBJECT_NAME_STRING)
- || widget->inherits (TQSPINWIDGET_OBJECT_NAME_STRING)))
+ if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
+ TQObject* object = reinterpret_cast<TQObject*>(source);
+
+ TQWidget* widget = dynamic_cast<TQWidget*>(object);
+ if (widget)
{
- hoverWidget = widget;
- widget->repaint (false);
- }
- else if (event->type() == TQEvent::Leave
+ // Handle hover effects.
+ if (event->type() == TQEvent::Enter
&& (widget->inherits (TQBUTTON_OBJECT_NAME_STRING)
|| widget->inherits (TQCOMBOBOX_OBJECT_NAME_STRING)
|| widget->inherits (TQSPINWIDGET_OBJECT_NAME_STRING)))
- {
- if (TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(hoverWidget))
- hoverWidget = 0L;
- widget->repaint (false);
- }
- // Make sure the focus rectangle is shown correctly.
- else if (event->type() == TQEvent::FocusIn || event->type() == TQEvent::FocusOut)
- {
- TQWidget* widgetparent = dynamic_cast<TQWidget*>(widget->parent());
- while (widgetparent
- && ! widgetparent->inherits (TQCOMBOBOX_OBJECT_NAME_STRING)
- && ! widgetparent->inherits (TQSPINWIDGET_OBJECT_NAME_STRING))
{
- widgetparent = dynamic_cast<TQWidget*>(widgetparent->parent());
+ hoverWidget = widget;
+ widget->repaint (false);
}
-
- if (widgetparent)
- widgetparent->repaint (false);
- else
+ else if (event->type() == TQEvent::Leave
+ && (widget->inherits (TQBUTTON_OBJECT_NAME_STRING)
+ || widget->inherits (TQCOMBOBOX_OBJECT_NAME_STRING)
+ || widget->inherits (TQSPINWIDGET_OBJECT_NAME_STRING)))
+ {
+ if (TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(hoverWidget))
+ hoverWidget = 0L;
widget->repaint (false);
+ }
+ // Make sure the focus rectangle is shown correctly.
+ else if (event->type() == TQEvent::FocusIn || event->type() == TQEvent::FocusOut)
+ {
+ TQWidget* widgetparent = dynamic_cast<TQWidget*>(widget->parent());
+ while (widgetparent
+ && ! widgetparent->inherits (TQCOMBOBOX_OBJECT_NAME_STRING)
+ && ! widgetparent->inherits (TQSPINWIDGET_OBJECT_NAME_STRING))
+ {
+ widgetparent = dynamic_cast<TQWidget*>(widgetparent->parent());
+ }
+
+ if (widgetparent)
+ widgetparent->repaint (false);
+ else
+ widget->repaint (false);
+ }
}
}
- return KStyle::eventFilter (object, event);
+ return KStyle::objectEventHandler (ceData, elementFlags, source, event);
}
// vim: set noet ts=4 sw=4:
diff --git a/kstyles/highcontrast/highcontrast.h b/kstyles/highcontrast/highcontrast.h
index 4d853e705..6ea667cc6 100644
--- a/kstyles/highcontrast/highcontrast.h
+++ b/kstyles/highcontrast/highcontrast.h
@@ -56,8 +56,8 @@ class HighContrastStyle : public KStyle
void polish( TQPalette& pal );
- void polish( TQWidget* widget );
- void unPolish( TQWidget* widget );
+ void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
+ void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p,
@@ -150,7 +150,7 @@ class HighContrastStyle : public KStyle
TQRect subRect (SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget * widget) const;
protected:
- bool eventFilter( TQObject *object, TQEvent *event );
+ virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
TQWidget *hoverWidget;