TQStyle API update

pull/1/head
Timothy Pearson 12 years ago
parent 7e44aacf17
commit d89411f27b

@ -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")) if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
kickerMode = true; TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
if (widget->isTopLevel()) if (!qstrcmp(tqApp->argv()[0], "kicker") || widget->inherits("Kicker"))
return; kickerMode = true;
// we can't simply set a palette -- upon color-theme changes, we have if (widget->isTopLevel())
// to update the palette again. return;
// bool extraPalette = false;
// we can't simply set a palette -- upon color-theme changes, we have
if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) && !inheritsKHTML(widget)) { // to update the palette again.
widget->installEventFilter (this); // bool extraPalette = false;
updatePalette( (TQComboBox*) widget );
// extraPalette = true; if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) && !inheritsKHTML(widget)) {
} else { installObjectEventHandler(ceData, elementFlags, ptr, this);
winstyle->polish(widget); updatePalette( (TQComboBox*) widget );
} // extraPalette = true;
} else {
// This code is disabled until Carsten explains to me why it's supposed to winstyle->polish(ceData, elementFlags, ptr);
// be here. It breaks dynamically changing the color from KControl and does }
// other bad things (see bug #54569)
/* // This code is disabled until Carsten explains to me why it's supposed to
if (!widget->ownPalette()) { // be here. It breaks dynamically changing the color from KControl and does
if (widget->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) { // other bad things (see bug #54569)
updatePalette( (TQToolBar*) widget ); /*
extraPalette = true; if (!widget->ownPalette()) {
} else if (widget->inherits(TQMENUBAR_OBJECT_NAME_STRING)) { if (widget->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) {
updatePalette( (TQMenuBar*) widget ); updatePalette( (TQToolBar*) widget );
extraPalette = true; 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)) { if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) && !inheritsKHTML(widget)) {
widget->removeEventFilter (this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
}
} }
} }
@ -2055,34 +2063,38 @@ void dotNETstyle::slotDestroyed()
m_widgets.remove( (TQWidget*) sender() ); 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 (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
if (ev->type() == TQEvent::Enter) { TQObject* obj = reinterpret_cast<TQObject*>(source);
TQWidget *btn = (TQWidget *)obj;
if (btn->isEnabled()) { 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(); TQPalette pal = btn->palette();
pal.setColor(TQColorGroup::Dark, pal.setColor(TQColorGroup::Dark,
pal.active().color(TQColorGroup::Highlight).dark()); pal.active().color(TQColorGroup::Base));
pal.setColor(TQColorGroup::Midlight, pal.setColor(TQColorGroup::Midlight,
pal.active().color(TQColorGroup::Highlight)); pal.active().color(TQColorGroup::Background));
btn->setPalette(pal); btn->setPalette(pal);
} }
} else if (ev->type() == TQEvent::Leave) { } else if (obj->inherits(TQBUTTON_OBJECT_NAME_STRING)) {
TQWidget *btn = (TQWidget *)obj; TQWidget *btn = (TQWidget *)obj;
TQPalette pal = btn->palette(); TQPalette pal = btn->palette();
pal.setColor(TQColorGroup::Dark, pal.setColor(TQColorGroup::Button,
pal.active().color(TQColorGroup::Base)); pal.active().color(TQColorGroup::Background));
pal.setColor(TQColorGroup::Midlight,
pal.active().color(TQColorGroup::Background));
btn->setPalette(pal); 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; return false;

@ -42,8 +42,8 @@ public:
virtual ~dotNETstyle(); virtual ~dotNETstyle();
bool inheritsKHTML( const TQWidget* widget ) const; bool inheritsKHTML( const TQWidget* widget ) const;
void polish( TQWidget* widget ); void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void unPolish( TQWidget* widget ); void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void renderMenuBlendPixmap( KPixmap&, const TQColorGroup&, const TQPopupMenu * ) const; void renderMenuBlendPixmap( KPixmap&, const TQColorGroup&, const TQPopupMenu * ) const;
@ -134,7 +134,7 @@ protected:
void renderSlider(TQPainter *p, void renderSlider(TQPainter *p,
const TQRect &r, const TQRect &r,
const TQColorGroup &g) const; const TQColorGroup &g) const;
bool eventFilter(TQObject *, TQEvent *); bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
void updatePalette( TQComboBox * ); void updatePalette( TQComboBox * );
void updatePalette( TQToolBar * ); void updatePalette( TQToolBar * );

@ -136,9 +136,12 @@ PhaseStyle::~PhaseStyle()
// -------- // --------
// Initialize application specific // 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 // 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) || if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
::tqqt_cast<TQPopupMenu*>(widget)) { TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
// anti-flicker optimization
widget->setBackgroundMode(NoBackground); if (::tqqt_cast<TQMenuBar*>(widget) ||
} else if (::tqqt_cast<TQFrame*>(widget) || ::tqqt_cast<TQPopupMenu*>(widget)) {
widget->inherits(TQTOOLBAREXTENSION) || // anti-flicker optimization
(!qstrcmp(widget->name(), KTOOLBARWIDGET))) { widget->setBackgroundMode(NoBackground);
// needs special handling on paint events } else if (::tqqt_cast<TQFrame*>(widget) ||
widget->installEventFilter(this); widget->inherits(TQTOOLBAREXTENSION) ||
} else if (highlights_ && (!qstrcmp(widget->name(), KTOOLBARWIDGET))) {
(::tqqt_cast<TQPushButton*>(widget) || // needs special handling on paint events
::tqqt_cast<TQComboBox*>(widget) || installObjectEventHandler(ceData, elementFlags, ptr, this);
::tqqt_cast<TQSpinWidget*>(widget) || } else if (highlights_ &&
::tqqt_cast<TQCheckBox*>(widget) || (::tqqt_cast<TQPushButton*>(widget) ||
::tqqt_cast<TQRadioButton*>(widget) || ::tqqt_cast<TQComboBox*>(widget) ||
::tqqt_cast<TQSlider*>(widget) || ::tqqt_cast<TQSpinWidget*>(widget) ||
widget->inherits(TQSPLITTERHANDLE))) { ::tqqt_cast<TQCheckBox*>(widget) ||
// mouseover highlighting ::tqqt_cast<TQRadioButton*>(widget) ||
widget->installEventFilter(this); ::tqqt_cast<TQSlider*>(widget) ||
} else if (highlights_ && ::tqqt_cast<TQTabBar*>(widget)) { widget->inherits(TQSPLITTERHANDLE))) {
// highlighting needing mouse tracking // mouseover highlighting
widget->setMouseTracking(true); installObjectEventHandler(ceData, elementFlags, ptr, this);
widget->installEventFilter(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 // 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) || if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
::tqqt_cast<TQPopupMenu*>(widget)) { TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
widget->setBackgroundMode(PaletteBackground);
} else if (::tqqt_cast<TQFrame*>(widget) || if (::tqqt_cast<TQMenuBar*>(widget) ||
widget->inherits(TQTOOLBAREXTENSION) || ::tqqt_cast<TQPopupMenu*>(widget)) {
(!qstrcmp(widget->name(), KTOOLBARWIDGET))) { widget->setBackgroundMode(PaletteBackground);
widget->removeEventFilter(this); } else if (::tqqt_cast<TQFrame*>(widget) ||
} else if (highlights_ && // highlighting widget->inherits(TQTOOLBAREXTENSION) ||
(::tqqt_cast<TQPushButton*>(widget) || (!qstrcmp(widget->name(), KTOOLBARWIDGET))) {
::tqqt_cast<TQComboBox*>(widget) || removeObjectEventHandler(ceData, elementFlags, ptr, this);
::tqqt_cast<TQSpinWidget*>(widget) || } else if (highlights_ && // highlighting
::tqqt_cast<TQCheckBox*>(widget) || (::tqqt_cast<TQPushButton*>(widget) ||
::tqqt_cast<TQRadioButton*>(widget) || ::tqqt_cast<TQComboBox*>(widget) ||
::tqqt_cast<TQSlider*>(widget) || ::tqqt_cast<TQSpinWidget*>(widget) ||
widget->inherits(TQSPLITTERHANDLE))) { ::tqqt_cast<TQCheckBox*>(widget) ||
widget->removeEventFilter(this); ::tqqt_cast<TQRadioButton*>(widget) ||
} else if (highlights_ && ::tqqt_cast<TQTabBar*>(widget)) { ::tqqt_cast<TQSlider*>(widget) ||
widget->setMouseTracking(false); widget->inherits(TQSPLITTERHANDLE))) {
widget->removeEventFilter(this); 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 // Grab events we are interested in. Most of this routine is to handle the
// exceptions to the normal styling rules. // 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 (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
if (!object->isWidgetType()) return false; TQObject* object = reinterpret_cast<TQObject*>(source);
bool horiz; if (KStyle::eventFilter(object, event)) return true;
int x, y, w, h; if (!object->isWidgetType()) return false;
TQFrame *frame;
TQToolBar *toolbar; bool horiz;
TQWidget *widget; int x, y, w, h;
TQFrame *frame;
// painting events TQToolBar *toolbar;
if (event->type() == TQEvent::Paint) { TQWidget *widget;
// make sure we do the most specific stuff first
// painting events
// KDE Toolbar Widget if (event->type() == TQEvent::Paint) {
// patch by Daniel Brownlees <dbrownlees@paradise.net.nz> // make sure we do the most specific stuff first
if (object->parent() && !qstrcmp(object->name(), KTOOLBARWIDGET)) {
if (0 == (widget = ::tqqt_cast<TQWidget*>(object))) return false; // KDE Toolbar Widget
TQWidget *parent = ::tqqt_cast<TQWidget*>(object->parent()); // patch by Daniel Brownlees <dbrownlees@paradise.net.nz>
int px = widget->x(), py = widget->y(); if (object->parent() && !qstrcmp(object->name(), KTOOLBARWIDGET)) {
// find the toolbar if (0 == (widget = ::tqqt_cast<TQWidget*>(object))) return false;
while (parent && parent->parent() TQWidget *parent = ::tqqt_cast<TQWidget*>(object->parent());
&& !::tqqt_cast<TQToolBar*>(parent)) { int px = widget->x(), py = widget->y();
px += parent->x(); // find the toolbar
py += parent->y(); while (parent && parent->parent()
parent = ::tqqt_cast<TQWidget*>(parent->parent()); && !::tqqt_cast<TQToolBar*>(parent)) {
} px += parent->x();
if (!parent) return false; py += parent->y();
TQT_TQRECT_OBJECT(widget->rect()).rect(&x, &y, &w, &h); parent = ::tqqt_cast<TQWidget*>(parent->parent());
TQRect prect = parent->rect(); }
if (!parent) return false;
toolbar = ::tqqt_cast<TQToolBar*>(parent); TQT_TQRECT_OBJECT(widget->rect()).rect(&x, &y, &w, &h);
horiz = (toolbar) ? (toolbar->orientation() == Qt::Horizontal) TQRect prect = parent->rect();
: (prect.height() < prect.width());
TQPainter painter(widget); toolbar = ::tqqt_cast<TQToolBar*>(parent);
if (flatToolbar(toolbar)) { horiz = (toolbar) ? (toolbar->orientation() == Qt::Horizontal)
painter.fillRect(widget->rect(), : (prect.height() < prect.width());
parent->colorGroup().background()); TQPainter painter(widget);
} else { if (flatToolbar(toolbar)) {
drawPhaseGradient(&painter, widget->rect(), painter.fillRect(widget->rect(),
parent->colorGroup().background(), parent->colorGroup().background());
!horiz, px, py, } else {
prect.width(), prect.height(), true); drawPhaseGradient(&painter, widget->rect(),
if (horiz && (h==prect.height()-2)) { parent->colorGroup().background(),
painter.setPen(parent->colorGroup().mid()); !horiz, px, py,
painter.drawLine(x, h-1, w-1, h-1); prect.width(), prect.height(), true);
} else if (!horiz && (w==prect.width()-2)) { if (horiz && (h==prect.height()-2)) {
painter.setPen(parent->colorGroup().mid()); painter.setPen(parent->colorGroup().mid());
painter.drawLine(w-1, y, w-1, h-1); 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; // TQToolBarExtensionWidget
horiz = (toolbar->orientation() == Qt::Horizontal); else if (object && object->isWidgetType() && object->parent() &&
TQPainter painter(widget); (toolbar = ::tqqt_cast<TQToolBar*>(object->parent()))) {
TQT_TQRECT_OBJECT(widget->rect()).rect(&x, &y, &w, &h); if (0 == (widget = ::tqqt_cast<TQWidget*>(object))) return false;
// draw the extension horiz = (toolbar->orientation() == Qt::Horizontal);
drawPhaseGradient(&painter, widget->rect(), TQPainter painter(widget);
toolbar->colorGroup().background(), TQT_TQRECT_OBJECT(widget->rect()).rect(&x, &y, &w, &h);
!horiz, x, y, w-1, h-1, true); // draw the extension
if (horiz) { drawPhaseGradient(&painter, widget->rect(),
painter.setPen(toolbar->colorGroup().dark()); toolbar->colorGroup().background(),
painter.drawLine(w-1, 0, w-1, h-1); !horiz, x, y, w-1, h-1, true);
painter.setPen(toolbar->colorGroup().mid()); if (horiz) {
painter.drawLine(w-2, 0, w-2, h-2); painter.setPen(toolbar->colorGroup().dark());
painter.drawLine(x, h-1, w-2, h-1); painter.drawLine(w-1, 0, w-1, h-1);
painter.drawLine(x, y, x, h-2); painter.setPen(toolbar->colorGroup().mid());
painter.setPen(toolbar->colorGroup().midlight()); painter.drawLine(w-2, 0, w-2, h-2);
painter.drawLine(x+1, y, x+1, h-2); painter.drawLine(x, h-1, w-2, h-1);
} else { painter.drawLine(x, y, x, h-2);
painter.setPen(toolbar->colorGroup().dark()); painter.setPen(toolbar->colorGroup().midlight());
painter.drawLine(0, h-1, w-1, h-1); painter.drawLine(x+1, y, x+1, h-2);
painter.setPen(toolbar->colorGroup().mid()); } else {
painter.drawLine(0, h-2, w-2, h-2); painter.setPen(toolbar->colorGroup().dark());
painter.drawLine(w-1, y, w-1, h-2); painter.drawLine(0, h-1, w-1, h-1);
painter.drawLine(x, y, w-2, y); painter.setPen(toolbar->colorGroup().mid());
painter.setPen(toolbar->colorGroup().midlight()); painter.drawLine(0, h-2, w-2, h-2);
painter.drawLine(x, y+1, w-2, y+1); 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) { // TQFrame lines (do this guy last)
case TQFrame::HLine: else if (0 != (frame = ::tqqt_cast<TQFrame*>(object))) {
case TQFrame::VLine: { TQFrame::Shape shape = frame->frameShape();
// NOTE: assuming lines have no content switch (shape) {
TQPainter painter(frame); case TQFrame::HLine:
TQT_TQRECT_OBJECT(frame->rect()).rect(&x, &y, &w, &h); case TQFrame::VLine: {
painter.setPen(frame->colorGroup().dark()); // NOTE: assuming lines have no content
if (shape == TQFrame::HLine) { TQPainter painter(frame);
painter.drawLine(0, h/2, w, h/2); TQT_TQRECT_OBJECT(frame->rect()).rect(&x, &y, &w, &h);
} else if (shape == TQFrame::VLine) { painter.setPen(frame->colorGroup().dark());
painter.drawLine(w/2, 0, w/2, h); if (shape == TQFrame::HLine) {
} painter.drawLine(0, h/2, w, h/2);
return true; } else if (shape == TQFrame::VLine) {
} painter.drawLine(w/2, 0, w/2, h);
default: }
break; return true;
} }
} default:
break;
} else if (highlights_) { // "mouseover" events }
if (::tqqt_cast<TQPushButton*>(object) || }
::tqqt_cast<TQComboBox*>(object) ||
::tqqt_cast<TQSpinWidget*>(object) || } else if (highlights_) { // "mouseover" events
::tqqt_cast<TQCheckBox*>(object) || if (::tqqt_cast<TQPushButton*>(object) ||
::tqqt_cast<TQRadioButton*>(object) || ::tqqt_cast<TQComboBox*>(object) ||
::tqqt_cast<TQSlider*>(object) || ::tqqt_cast<TQSpinWidget*>(object) ||
object->inherits(TQSPLITTERHANDLE)) { ::tqqt_cast<TQCheckBox*>(object) ||
if (event->type() == TQEvent::Enter) { ::tqqt_cast<TQRadioButton*>(object) ||
if (0 != (widget = ::tqqt_cast<TQWidget*>(object)) && ::tqqt_cast<TQSlider*>(object) ||
widget->isEnabled()) { object->inherits(TQSPLITTERHANDLE)) {
hover_ = widget; if (event->type() == TQEvent::Enter) {
widget->repaint(false); if (0 != (widget = ::tqqt_cast<TQWidget*>(object)) &&
} widget->isEnabled()) {
} else if (event->type() == TQEvent::Leave) { hover_ = widget;
if (0 != (widget = ::tqqt_cast<TQWidget*>(object))) { widget->repaint(false);
hover_ = 0; }
widget->repaint(false); } else if (event->type() == TQEvent::Leave) {
} if (0 != (widget = ::tqqt_cast<TQWidget*>(object))) {
} hover_ = 0;
} else if (::tqqt_cast<TQTabBar*>(object)) { // special case for qtabbar widget->repaint(false);
if (event->type() == TQEvent::Enter) { }
if (0 != (widget = ::tqqt_cast<TQWidget*>(object)) && }
widget->isEnabled()) { } else if (::tqqt_cast<TQTabBar*>(object)) { // special case for qtabbar
hover_ = widget; if (event->type() == TQEvent::Enter) {
hovertab_ = 0;; if (0 != (widget = ::tqqt_cast<TQWidget*>(object)) &&
widget->repaint(false); widget->isEnabled()) {
} hover_ = widget;
} else if (event->type() == TQEvent::Leave) { hovertab_ = 0;;
if (0 != (widget = ::tqqt_cast<TQWidget*>(object))) { widget->repaint(false);
hover_ = 0; }
hovertab_ = 0;; } else if (event->type() == TQEvent::Leave) {
widget->repaint(false); if (0 != (widget = ::tqqt_cast<TQWidget*>(object))) {
} hover_ = 0;
} else if (event->type() == TQEvent::MouseMove) { hovertab_ = 0;;
TQTabBar *tabbar; widget->repaint(false);
if (0 != (tabbar = ::tqqt_cast<TQTabBar*>(object))) { }
TQMouseEvent *me; } else if (event->type() == TQEvent::MouseMove) {
if (0 != (me = dynamic_cast<TQMouseEvent*>(event))) { TQTabBar *tabbar;
TQTab *tab = tabbar->selectTab(me->pos()); if (0 != (tabbar = ::tqqt_cast<TQTabBar*>(object))) {
if (hovertab_ != tab) { TQMouseEvent *me;
hovertab_ = tab; if (0 != (me = dynamic_cast<TQMouseEvent*>(event))) {
tabbar->repaint(false); TQTab *tab = tabbar->selectTab(me->pos());
} if (hovertab_ != tab) {
} hovertab_ = tab;
} tabbar->repaint(false);
} }
} }
}
}
}
}
} }
return false; return false;

@ -62,10 +62,10 @@ public:
PhaseStyle(); PhaseStyle();
virtual ~PhaseStyle(); virtual ~PhaseStyle();
void polish(TQApplication* app); void applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish(TQWidget *widget); void polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish(TQPalette &pal); void polish(TQPalette &pal);
void unPolish(TQWidget *widget); void unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void drawPrimitive(TQ_PrimitiveElement element, void drawPrimitive(TQ_PrimitiveElement element,
TQPainter *painter, TQPainter *painter,
@ -184,7 +184,7 @@ private:
bool flatToolbar(const TQToolBar *toolbar) const; bool flatToolbar(const TQToolBar *toolbar) const;
bool eventFilter(TQObject *object, TQEvent *event); bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
private: private:
TQWidget *hover_; TQWidget *hover_;

Loading…
Cancel
Save