summaryrefslogtreecommitdiffstats
path: root/styles/dotnet
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-08-07 01:37:45 -0500
committerTimothy Pearson <[email protected]>2012-08-07 01:37:45 -0500
commitd89411f27bf0a4e80cd7e172d5a950ce63b0370d (patch)
treeea4619557bbadb9b88c855cd6585426994e86e6e /styles/dotnet
parent7e44aacf1792efdc4e725f1bbaf3de4cda75d9b1 (diff)
downloadtdeartwork-d89411f27bf0a4e80cd7e172d5a950ce63b0370d.tar.gz
tdeartwork-d89411f27bf0a4e80cd7e172d5a950ce63b0370d.zip
TQStyle API update
Diffstat (limited to 'styles/dotnet')
-rw-r--r--styles/dotnet/dotnet.cpp118
-rw-r--r--styles/dotnet/dotnet.h6
2 files changed, 68 insertions, 56 deletions
diff --git a/styles/dotnet/dotnet.cpp b/styles/dotnet/dotnet.cpp
index 52651849..5c85aefc 100644
--- a/styles/dotnet/dotnet.cpp
+++ b/styles/dotnet/dotnet.cpp
@@ -109,48 +109,56 @@ bool dotNETstyle::inheritsKHTML(const TQWidget* w) const
}
}
-void dotNETstyle::polish(TQWidget* widget)
+void dotNETstyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
- if (!qstrcmp(tqApp->argv()[0], "kicker") || widget->inherits("Kicker"))
- kickerMode = true;
-
- if (widget->isTopLevel())
- return;
-
-// we can't simply set a palette -- upon color-theme changes, we have
-// to update the palette again.
-// bool extraPalette = false;
-
- if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) && !inheritsKHTML(widget)) {
- widget->installEventFilter (this);
- updatePalette( (TQComboBox*) widget );
-// extraPalette = true;
- } else {
- winstyle->polish(widget);
- }
-
-// This code is disabled until Carsten explains to me why it's supposed to
-// be here. It breaks dynamically changing the color from KControl and does
-// other bad things (see bug #54569)
-/*
- if (!widget->ownPalette()) {
- if (widget->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) {
- updatePalette( (TQToolBar*) widget );
- extraPalette = true;
- } else if (widget->inherits(TQMENUBAR_OBJECT_NAME_STRING)) {
- updatePalette( (TQMenuBar*) widget );
- extraPalette = true;
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+
+ if (!qstrcmp(tqApp->argv()[0], "kicker") || widget->inherits("Kicker"))
+ kickerMode = true;
+
+ if (widget->isTopLevel())
+ return;
+
+ // we can't simply set a palette -- upon color-theme changes, we have
+ // to update the palette again.
+ // bool extraPalette = false;
+
+ if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) && !inheritsKHTML(widget)) {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ updatePalette( (TQComboBox*) widget );
+ // extraPalette = true;
+ } else {
+ winstyle->polish(ceData, elementFlags, ptr);
+ }
+
+ // This code is disabled until Carsten explains to me why it's supposed to
+ // be here. It breaks dynamically changing the color from KControl and does
+ // other bad things (see bug #54569)
+ /*
+ if (!widget->ownPalette()) {
+ if (widget->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) {
+ updatePalette( (TQToolBar*) widget );
+ extraPalette = true;
+ } else if (widget->inherits(TQMENUBAR_OBJECT_NAME_STRING)) {
+ updatePalette( (TQMenuBar*) widget );
+ extraPalette = true;
+ }
}
- }
*/
+ }
}
-void dotNETstyle::unPolish(TQWidget* widget)
+void dotNETstyle::unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
- winstyle->unPolish(widget);
+ winstyle->unPolish(ceData, elementFlags, ptr);
+
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
- if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) && !inheritsKHTML(widget)) {
- widget->removeEventFilter (this);
+ if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) && !inheritsKHTML(widget)) {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
}
}
@@ -2055,34 +2063,38 @@ void dotNETstyle::slotDestroyed()
m_widgets.remove( (TQWidget*) sender() );
}
-bool dotNETstyle::eventFilter(TQObject *obj, TQEvent *ev)
+bool dotNETstyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags, void* source, TQEvent *ev )
{
- if (obj->inherits(TQCOMBOBOX_OBJECT_NAME_STRING)) {
- if (ev->type() == TQEvent::Enter) {
- TQWidget *btn = (TQWidget *)obj;
- if (btn->isEnabled()) {
+ if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
+ TQObject* obj = reinterpret_cast<TQObject*>(source);
+
+ if (obj->inherits(TQCOMBOBOX_OBJECT_NAME_STRING)) {
+ if (ev->type() == TQEvent::Enter) {
+ TQWidget *btn = (TQWidget *)obj;
+ if (btn->isEnabled()) {
+ TQPalette pal = btn->palette();
+ pal.setColor(TQColorGroup::Dark,
+ pal.active().color(TQColorGroup::Highlight).dark());
+ pal.setColor(TQColorGroup::Midlight,
+ pal.active().color(TQColorGroup::Highlight));
+ btn->setPalette(pal);
+ }
+ } else if (ev->type() == TQEvent::Leave) {
+ TQWidget *btn = (TQWidget *)obj;
TQPalette pal = btn->palette();
pal.setColor(TQColorGroup::Dark,
- pal.active().color(TQColorGroup::Highlight).dark());
+ pal.active().color(TQColorGroup::Base));
pal.setColor(TQColorGroup::Midlight,
- pal.active().color(TQColorGroup::Highlight));
+ pal.active().color(TQColorGroup::Background));
btn->setPalette(pal);
}
- } else if (ev->type() == TQEvent::Leave) {
+ } else if (obj->inherits(TQBUTTON_OBJECT_NAME_STRING)) {
TQWidget *btn = (TQWidget *)obj;
TQPalette pal = btn->palette();
- pal.setColor(TQColorGroup::Dark,
- pal.active().color(TQColorGroup::Base));
- pal.setColor(TQColorGroup::Midlight,
- pal.active().color(TQColorGroup::Background));
+ pal.setColor(TQColorGroup::Button,
+ pal.active().color(TQColorGroup::Background));
btn->setPalette(pal);
}
- } else if (obj->inherits(TQBUTTON_OBJECT_NAME_STRING)) {
- TQWidget *btn = (TQWidget *)obj;
- TQPalette pal = btn->palette();
- pal.setColor(TQColorGroup::Button,
- pal.active().color(TQColorGroup::Background));
- btn->setPalette(pal);
}
return false;
diff --git a/styles/dotnet/dotnet.h b/styles/dotnet/dotnet.h
index 90cac23e..a0d91479 100644
--- a/styles/dotnet/dotnet.h
+++ b/styles/dotnet/dotnet.h
@@ -42,8 +42,8 @@ public:
virtual ~dotNETstyle();
bool inheritsKHTML( const TQWidget* widget ) const;
- void polish( TQWidget* widget );
- void unPolish( TQWidget* widget );
+ void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
+ void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void renderMenuBlendPixmap( KPixmap&, const TQColorGroup&, const TQPopupMenu * ) const;
@@ -134,7 +134,7 @@ protected:
void renderSlider(TQPainter *p,
const TQRect &r,
const TQColorGroup &g) const;
- bool eventFilter(TQObject *, TQEvent *);
+ bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
void updatePalette( TQComboBox * );
void updatePalette( TQToolBar * );