summaryrefslogtreecommitdiffstats
path: root/styles
diff options
context:
space:
mode:
Diffstat (limited to 'styles')
-rw-r--r--styles/dotnet/dotnet.cpp118
-rw-r--r--styles/dotnet/dotnet.h6
-rw-r--r--styles/phase/phasestyle.cpp421
-rw-r--r--styles/phase/phasestyle.h8
4 files changed, 290 insertions, 263 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 * );
diff --git a/styles/phase/phasestyle.cpp b/styles/phase/phasestyle.cpp
index a36584ba..78f423cc 100644
--- a/styles/phase/phasestyle.cpp
+++ b/styles/phase/phasestyle.cpp
@@ -136,9 +136,12 @@ PhaseStyle::~PhaseStyle()
// --------
// Initialize application specific
-void PhaseStyle::polish(TQApplication* app)
+void PhaseStyle::applicationPolish(TQStyleControlElementData ceData, ControlElementFlags, void *ptr)
{
- if (!qstrcmp(app->argv()[0], "kicker")) kicker_ = true;
+ if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) {
+ TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
+ if (!qstrcmp(app->argv()[0], "kicker")) kicker_ = true;
+ }
}
//////////////////////////////////////////////////////////////////////////////
@@ -146,34 +149,38 @@ void PhaseStyle::polish(TQApplication* app)
// --------
// Initialize the appearance of a widget
-void PhaseStyle::polish(TQWidget *widget)
+void PhaseStyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
- if (::tqqt_cast<TQMenuBar*>(widget) ||
- ::tqqt_cast<TQPopupMenu*>(widget)) {
- // anti-flicker optimization
- widget->setBackgroundMode(NoBackground);
- } else if (::tqqt_cast<TQFrame*>(widget) ||
- widget->inherits(TQTOOLBAREXTENSION) ||
- (!qstrcmp(widget->name(), KTOOLBARWIDGET))) {
- // needs special handling on paint events
- widget->installEventFilter(this);
- } else if (highlights_ &&
- (::tqqt_cast<TQPushButton*>(widget) ||
- ::tqqt_cast<TQComboBox*>(widget) ||
- ::tqqt_cast<TQSpinWidget*>(widget) ||
- ::tqqt_cast<TQCheckBox*>(widget) ||
- ::tqqt_cast<TQRadioButton*>(widget) ||
- ::tqqt_cast<TQSlider*>(widget) ||
- widget->inherits(TQSPLITTERHANDLE))) {
- // mouseover highlighting
- widget->installEventFilter(this);
- } else if (highlights_ && ::tqqt_cast<TQTabBar*>(widget)) {
- // highlighting needing mouse tracking
- widget->setMouseTracking(true);
- widget->installEventFilter(this);
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+
+ if (::tqqt_cast<TQMenuBar*>(widget) ||
+ ::tqqt_cast<TQPopupMenu*>(widget)) {
+ // anti-flicker optimization
+ widget->setBackgroundMode(NoBackground);
+ } else if (::tqqt_cast<TQFrame*>(widget) ||
+ widget->inherits(TQTOOLBAREXTENSION) ||
+ (!qstrcmp(widget->name(), KTOOLBARWIDGET))) {
+ // needs special handling on paint events
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if (highlights_ &&
+ (::tqqt_cast<TQPushButton*>(widget) ||
+ ::tqqt_cast<TQComboBox*>(widget) ||
+ ::tqqt_cast<TQSpinWidget*>(widget) ||
+ ::tqqt_cast<TQCheckBox*>(widget) ||
+ ::tqqt_cast<TQRadioButton*>(widget) ||
+ ::tqqt_cast<TQSlider*>(widget) ||
+ widget->inherits(TQSPLITTERHANDLE))) {
+ // mouseover highlighting
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if (highlights_ && ::tqqt_cast<TQTabBar*>(widget)) {
+ // highlighting needing mouse tracking
+ widget->setMouseTracking(true);
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
}
- KStyle::polish(widget);
+ KStyle::polish(ceData, elementFlags, ptr);
}
//////////////////////////////////////////////////////////////////////////////
@@ -204,30 +211,34 @@ void PhaseStyle::polish(TQPalette &pal)
// ----------
// Undo the initialization of a widget's appearance
-void PhaseStyle::unPolish(TQWidget *widget)
+void PhaseStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
- if (::tqqt_cast<TQMenuBar*>(widget) ||
- ::tqqt_cast<TQPopupMenu*>(widget)) {
- widget->setBackgroundMode(PaletteBackground);
- } else if (::tqqt_cast<TQFrame*>(widget) ||
- widget->inherits(TQTOOLBAREXTENSION) ||
- (!qstrcmp(widget->name(), KTOOLBARWIDGET))) {
- widget->removeEventFilter(this);
- } else if (highlights_ && // highlighting
- (::tqqt_cast<TQPushButton*>(widget) ||
- ::tqqt_cast<TQComboBox*>(widget) ||
- ::tqqt_cast<TQSpinWidget*>(widget) ||
- ::tqqt_cast<TQCheckBox*>(widget) ||
- ::tqqt_cast<TQRadioButton*>(widget) ||
- ::tqqt_cast<TQSlider*>(widget) ||
- widget->inherits(TQSPLITTERHANDLE))) {
- widget->removeEventFilter(this);
- } else if (highlights_ && ::tqqt_cast<TQTabBar*>(widget)) {
- widget->setMouseTracking(false);
- widget->removeEventFilter(this);
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+
+ if (::tqqt_cast<TQMenuBar*>(widget) ||
+ ::tqqt_cast<TQPopupMenu*>(widget)) {
+ widget->setBackgroundMode(PaletteBackground);
+ } else if (::tqqt_cast<TQFrame*>(widget) ||
+ widget->inherits(TQTOOLBAREXTENSION) ||
+ (!qstrcmp(widget->name(), KTOOLBARWIDGET))) {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if (highlights_ && // highlighting
+ (::tqqt_cast<TQPushButton*>(widget) ||
+ ::tqqt_cast<TQComboBox*>(widget) ||
+ ::tqqt_cast<TQSpinWidget*>(widget) ||
+ ::tqqt_cast<TQCheckBox*>(widget) ||
+ ::tqqt_cast<TQRadioButton*>(widget) ||
+ ::tqqt_cast<TQSlider*>(widget) ||
+ widget->inherits(TQSPLITTERHANDLE))) {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if (highlights_ && ::tqqt_cast<TQTabBar*>(widget)) {
+ widget->setMouseTracking(false);
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
}
- KStyle::unPolish(widget);
+ KStyle::unPolish(ceData, elementFlags, ptr);
}
//////////////////////////////////////////////////////////////////////////////
@@ -2251,162 +2262,166 @@ bool PhaseStyle::flatToolbar(const TQToolBar *toolbar) const
// Grab events we are interested in. Most of this routine is to handle the
// exceptions to the normal styling rules.
-bool PhaseStyle::eventFilter(TQObject *object, TQEvent *event)
+bool PhaseStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags, void* source, TQEvent *event )
{
- if (KStyle::eventFilter(object, event)) return true;
- if (!object->isWidgetType()) return false;
-
- bool horiz;
- int x, y, w, h;
- TQFrame *frame;
- TQToolBar *toolbar;
- TQWidget *widget;
-
- // painting events
- if (event->type() == TQEvent::Paint) {
- // make sure we do the most specific stuff first
-
- // KDE Toolbar Widget
- // patch by Daniel Brownlees <dbrownlees@paradise.net.nz>
- if (object->parent() && !qstrcmp(object->name(), KTOOLBARWIDGET)) {
- if (0 == (widget = ::tqqt_cast<TQWidget*>(object))) return false;
- TQWidget *parent = ::tqqt_cast<TQWidget*>(object->parent());
- int px = widget->x(), py = widget->y();
- // find the toolbar
- while (parent && parent->parent()
- && !::tqqt_cast<TQToolBar*>(parent)) {
- px += parent->x();
- py += parent->y();
- parent = ::tqqt_cast<TQWidget*>(parent->parent());
- }
- if (!parent) return false;
- TQT_TQRECT_OBJECT(widget->rect()).rect(&x, &y, &w, &h);
- TQRect prect = parent->rect();
-
- toolbar = ::tqqt_cast<TQToolBar*>(parent);
- horiz = (toolbar) ? (toolbar->orientation() == Qt::Horizontal)
- : (prect.height() < prect.width());
- TQPainter painter(widget);
- if (flatToolbar(toolbar)) {
- painter.fillRect(widget->rect(),
- parent->colorGroup().background());
- } else {
- drawPhaseGradient(&painter, widget->rect(),
- parent->colorGroup().background(),
- !horiz, px, py,
- prect.width(), prect.height(), true);
- if (horiz && (h==prect.height()-2)) {
- painter.setPen(parent->colorGroup().mid());
- painter.drawLine(x, h-1, w-1, h-1);
- } else if (!horiz && (w==prect.width()-2)) {
- painter.setPen(parent->colorGroup().mid());
- painter.drawLine(w-1, y, w-1, h-1);
- }
- }
- }
-
- // TQToolBarExtensionWidget
- else if (object && object->isWidgetType() && object->parent() &&
- (toolbar = ::tqqt_cast<TQToolBar*>(object->parent()))) {
- if (0 == (widget = ::tqqt_cast<TQWidget*>(object))) return false;
- horiz = (toolbar->orientation() == Qt::Horizontal);
- TQPainter painter(widget);
- TQT_TQRECT_OBJECT(widget->rect()).rect(&x, &y, &w, &h);
- // draw the extension
- drawPhaseGradient(&painter, widget->rect(),
- toolbar->colorGroup().background(),
- !horiz, x, y, w-1, h-1, true);
- if (horiz) {
- painter.setPen(toolbar->colorGroup().dark());
- painter.drawLine(w-1, 0, w-1, h-1);
- painter.setPen(toolbar->colorGroup().mid());
- painter.drawLine(w-2, 0, w-2, h-2);
- painter.drawLine(x, h-1, w-2, h-1);
- painter.drawLine(x, y, x, h-2);
- painter.setPen(toolbar->colorGroup().midlight());
- painter.drawLine(x+1, y, x+1, h-2);
- } else {
- painter.setPen(toolbar->colorGroup().dark());
- painter.drawLine(0, h-1, w-1, h-1);
- painter.setPen(toolbar->colorGroup().mid());
- painter.drawLine(0, h-2, w-2, h-2);
- painter.drawLine(w-1, y, w-1, h-2);
- painter.drawLine(x, y, w-2, y);
- painter.setPen(toolbar->colorGroup().midlight());
- painter.drawLine(x, y+1, w-2, y+1);
- }
- }
-
- // TQFrame lines (do this guy last)
- else if (0 != (frame = ::tqqt_cast<TQFrame*>(object))) {
- TQFrame::Shape shape = frame->frameShape();
- switch (shape) {
- case TQFrame::HLine:
- case TQFrame::VLine: {
- // NOTE: assuming lines have no content
- TQPainter painter(frame);
- TQT_TQRECT_OBJECT(frame->rect()).rect(&x, &y, &w, &h);
- painter.setPen(frame->colorGroup().dark());
- if (shape == TQFrame::HLine) {
- painter.drawLine(0, h/2, w, h/2);
- } else if (shape == TQFrame::VLine) {
- painter.drawLine(w/2, 0, w/2, h);
- }
- return true;
- }
- default:
- break;
- }
- }
-
- } else if (highlights_) { // "mouseover" events
- if (::tqqt_cast<TQPushButton*>(object) ||
- ::tqqt_cast<TQComboBox*>(object) ||
- ::tqqt_cast<TQSpinWidget*>(object) ||
- ::tqqt_cast<TQCheckBox*>(object) ||
- ::tqqt_cast<TQRadioButton*>(object) ||
- ::tqqt_cast<TQSlider*>(object) ||
- object->inherits(TQSPLITTERHANDLE)) {
- if (event->type() == TQEvent::Enter) {
- if (0 != (widget = ::tqqt_cast<TQWidget*>(object)) &&
- widget->isEnabled()) {
- hover_ = widget;
- widget->repaint(false);
- }
- } else if (event->type() == TQEvent::Leave) {
- if (0 != (widget = ::tqqt_cast<TQWidget*>(object))) {
- hover_ = 0;
- widget->repaint(false);
- }
- }
- } else if (::tqqt_cast<TQTabBar*>(object)) { // special case for qtabbar
- if (event->type() == TQEvent::Enter) {
- if (0 != (widget = ::tqqt_cast<TQWidget*>(object)) &&
- widget->isEnabled()) {
- hover_ = widget;
- hovertab_ = 0;;
- widget->repaint(false);
- }
- } else if (event->type() == TQEvent::Leave) {
- if (0 != (widget = ::tqqt_cast<TQWidget*>(object))) {
- hover_ = 0;
- hovertab_ = 0;;
- widget->repaint(false);
- }
- } else if (event->type() == TQEvent::MouseMove) {
- TQTabBar *tabbar;
- if (0 != (tabbar = ::tqqt_cast<TQTabBar*>(object))) {
- TQMouseEvent *me;
- if (0 != (me = dynamic_cast<TQMouseEvent*>(event))) {
- TQTab *tab = tabbar->selectTab(me->pos());
- if (hovertab_ != tab) {
- hovertab_ = tab;
- tabbar->repaint(false);
- }
- }
- }
- }
- }
+ if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
+ TQObject* object = reinterpret_cast<TQObject*>(source);
+
+ if (KStyle::eventFilter(object, event)) return true;
+ if (!object->isWidgetType()) return false;
+
+ bool horiz;
+ int x, y, w, h;
+ TQFrame *frame;
+ TQToolBar *toolbar;
+ TQWidget *widget;
+
+ // painting events
+ if (event->type() == TQEvent::Paint) {
+ // make sure we do the most specific stuff first
+
+ // KDE Toolbar Widget
+ // patch by Daniel Brownlees <dbrownlees@paradise.net.nz>
+ if (object->parent() && !qstrcmp(object->name(), KTOOLBARWIDGET)) {
+ if (0 == (widget = ::tqqt_cast<TQWidget*>(object))) return false;
+ TQWidget *parent = ::tqqt_cast<TQWidget*>(object->parent());
+ int px = widget->x(), py = widget->y();
+ // find the toolbar
+ while (parent && parent->parent()
+ && !::tqqt_cast<TQToolBar*>(parent)) {
+ px += parent->x();
+ py += parent->y();
+ parent = ::tqqt_cast<TQWidget*>(parent->parent());
+ }
+ if (!parent) return false;
+ TQT_TQRECT_OBJECT(widget->rect()).rect(&x, &y, &w, &h);
+ TQRect prect = parent->rect();
+
+ toolbar = ::tqqt_cast<TQToolBar*>(parent);
+ horiz = (toolbar) ? (toolbar->orientation() == Qt::Horizontal)
+ : (prect.height() < prect.width());
+ TQPainter painter(widget);
+ if (flatToolbar(toolbar)) {
+ painter.fillRect(widget->rect(),
+ parent->colorGroup().background());
+ } else {
+ drawPhaseGradient(&painter, widget->rect(),
+ parent->colorGroup().background(),
+ !horiz, px, py,
+ prect.width(), prect.height(), true);
+ if (horiz && (h==prect.height()-2)) {
+ painter.setPen(parent->colorGroup().mid());
+ painter.drawLine(x, h-1, w-1, h-1);
+ } else if (!horiz && (w==prect.width()-2)) {
+ painter.setPen(parent->colorGroup().mid());
+ painter.drawLine(w-1, y, w-1, h-1);
+ }
+ }
+ }
+
+ // TQToolBarExtensionWidget
+ else if (object && object->isWidgetType() && object->parent() &&
+ (toolbar = ::tqqt_cast<TQToolBar*>(object->parent()))) {
+ if (0 == (widget = ::tqqt_cast<TQWidget*>(object))) return false;
+ horiz = (toolbar->orientation() == Qt::Horizontal);
+ TQPainter painter(widget);
+ TQT_TQRECT_OBJECT(widget->rect()).rect(&x, &y, &w, &h);
+ // draw the extension
+ drawPhaseGradient(&painter, widget->rect(),
+ toolbar->colorGroup().background(),
+ !horiz, x, y, w-1, h-1, true);
+ if (horiz) {
+ painter.setPen(toolbar->colorGroup().dark());
+ painter.drawLine(w-1, 0, w-1, h-1);
+ painter.setPen(toolbar->colorGroup().mid());
+ painter.drawLine(w-2, 0, w-2, h-2);
+ painter.drawLine(x, h-1, w-2, h-1);
+ painter.drawLine(x, y, x, h-2);
+ painter.setPen(toolbar->colorGroup().midlight());
+ painter.drawLine(x+1, y, x+1, h-2);
+ } else {
+ painter.setPen(toolbar->colorGroup().dark());
+ painter.drawLine(0, h-1, w-1, h-1);
+ painter.setPen(toolbar->colorGroup().mid());
+ painter.drawLine(0, h-2, w-2, h-2);
+ painter.drawLine(w-1, y, w-1, h-2);
+ painter.drawLine(x, y, w-2, y);
+ painter.setPen(toolbar->colorGroup().midlight());
+ painter.drawLine(x, y+1, w-2, y+1);
+ }
+ }
+
+ // TQFrame lines (do this guy last)
+ else if (0 != (frame = ::tqqt_cast<TQFrame*>(object))) {
+ TQFrame::Shape shape = frame->frameShape();
+ switch (shape) {
+ case TQFrame::HLine:
+ case TQFrame::VLine: {
+ // NOTE: assuming lines have no content
+ TQPainter painter(frame);
+ TQT_TQRECT_OBJECT(frame->rect()).rect(&x, &y, &w, &h);
+ painter.setPen(frame->colorGroup().dark());
+ if (shape == TQFrame::HLine) {
+ painter.drawLine(0, h/2, w, h/2);
+ } else if (shape == TQFrame::VLine) {
+ painter.drawLine(w/2, 0, w/2, h);
+ }
+ return true;
+ }
+ default:
+ break;
+ }
+ }
+
+ } else if (highlights_) { // "mouseover" events
+ if (::tqqt_cast<TQPushButton*>(object) ||
+ ::tqqt_cast<TQComboBox*>(object) ||
+ ::tqqt_cast<TQSpinWidget*>(object) ||
+ ::tqqt_cast<TQCheckBox*>(object) ||
+ ::tqqt_cast<TQRadioButton*>(object) ||
+ ::tqqt_cast<TQSlider*>(object) ||
+ object->inherits(TQSPLITTERHANDLE)) {
+ if (event->type() == TQEvent::Enter) {
+ if (0 != (widget = ::tqqt_cast<TQWidget*>(object)) &&
+ widget->isEnabled()) {
+ hover_ = widget;
+ widget->repaint(false);
+ }
+ } else if (event->type() == TQEvent::Leave) {
+ if (0 != (widget = ::tqqt_cast<TQWidget*>(object))) {
+ hover_ = 0;
+ widget->repaint(false);
+ }
+ }
+ } else if (::tqqt_cast<TQTabBar*>(object)) { // special case for qtabbar
+ if (event->type() == TQEvent::Enter) {
+ if (0 != (widget = ::tqqt_cast<TQWidget*>(object)) &&
+ widget->isEnabled()) {
+ hover_ = widget;
+ hovertab_ = 0;;
+ widget->repaint(false);
+ }
+ } else if (event->type() == TQEvent::Leave) {
+ if (0 != (widget = ::tqqt_cast<TQWidget*>(object))) {
+ hover_ = 0;
+ hovertab_ = 0;;
+ widget->repaint(false);
+ }
+ } else if (event->type() == TQEvent::MouseMove) {
+ TQTabBar *tabbar;
+ if (0 != (tabbar = ::tqqt_cast<TQTabBar*>(object))) {
+ TQMouseEvent *me;
+ if (0 != (me = dynamic_cast<TQMouseEvent*>(event))) {
+ TQTab *tab = tabbar->selectTab(me->pos());
+ if (hovertab_ != tab) {
+ hovertab_ = tab;
+ tabbar->repaint(false);
+ }
+ }
+ }
+ }
+ }
+ }
}
return false;
diff --git a/styles/phase/phasestyle.h b/styles/phase/phasestyle.h
index b2263822..be4f3016 100644
--- a/styles/phase/phasestyle.h
+++ b/styles/phase/phasestyle.h
@@ -62,10 +62,10 @@ public:
PhaseStyle();
virtual ~PhaseStyle();
- void polish(TQApplication* app);
- void polish(TQWidget *widget);
+ void applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
+ void polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish(TQPalette &pal);
- void unPolish(TQWidget *widget);
+ void unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void drawPrimitive(TQ_PrimitiveElement element,
TQPainter *painter,
@@ -184,7 +184,7 @@ private:
bool flatToolbar(const TQToolBar *toolbar) const;
- bool eventFilter(TQObject *object, TQEvent *event);
+ bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
private:
TQWidget *hover_;