TQStyle API update

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

@ -109,8 +109,11 @@ bool dotNETstyle::inheritsKHTML(const TQWidget* w) const
}
}
void dotNETstyle::polish(TQWidget* widget)
void dotNETstyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
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;
@ -122,11 +125,11 @@ void dotNETstyle::polish(TQWidget* widget)
// bool extraPalette = false;
if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) && !inheritsKHTML(widget)) {
widget->installEventFilter (this);
installObjectEventHandler(ceData, elementFlags, ptr, this);
updatePalette( (TQComboBox*) widget );
// extraPalette = true;
} else {
winstyle->polish(widget);
winstyle->polish(ceData, elementFlags, ptr);
}
// This code is disabled until Carsten explains to me why it's supposed to
@ -144,13 +147,18 @@ void dotNETstyle::polish(TQWidget* widget)
}
*/
}
}
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);
removeObjectEventHandler(ceData, elementFlags, ptr, this);
}
}
}
@ -2055,8 +2063,11 @@ 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 (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;
@ -2084,6 +2095,7 @@ bool dotNETstyle::eventFilter(TQObject *obj, TQEvent *ev)
pal.active().color(TQColorGroup::Background));
btn->setPalette(pal);
}
}
return false;
}

@ -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 * );

@ -136,18 +136,24 @@ PhaseStyle::~PhaseStyle()
// --------
// Initialize application specific
void PhaseStyle::polish(TQApplication* app)
void PhaseStyle::applicationPolish(TQStyleControlElementData ceData, ControlElementFlags, void *ptr)
{
if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) {
TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
if (!qstrcmp(app->argv()[0], "kicker")) kicker_ = true;
}
}
//////////////////////////////////////////////////////////////////////////////
// polish()
// --------
// Initialize the appearance of a widget
void PhaseStyle::polish(TQWidget *widget)
void PhaseStyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{
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
@ -156,7 +162,7 @@ void PhaseStyle::polish(TQWidget *widget)
widget->inherits(TQTOOLBAREXTENSION) ||
(!qstrcmp(widget->name(), KTOOLBARWIDGET))) {
// needs special handling on paint events
widget->installEventFilter(this);
installObjectEventHandler(ceData, elementFlags, ptr, this);
} else if (highlights_ &&
(::tqqt_cast<TQPushButton*>(widget) ||
::tqqt_cast<TQComboBox*>(widget) ||
@ -166,14 +172,15 @@ void PhaseStyle::polish(TQWidget *widget)
::tqqt_cast<TQSlider*>(widget) ||
widget->inherits(TQSPLITTERHANDLE))) {
// mouseover highlighting
widget->installEventFilter(this);
installObjectEventHandler(ceData, elementFlags, ptr, this);
} else if (highlights_ && ::tqqt_cast<TQTabBar*>(widget)) {
// highlighting needing mouse tracking
widget->setMouseTracking(true);
widget->installEventFilter(this);
installObjectEventHandler(ceData, elementFlags, ptr, this);
}
}
KStyle::polish(widget);
KStyle::polish(ceData, elementFlags, ptr);
}
//////////////////////////////////////////////////////////////////////////////
@ -204,15 +211,18 @@ 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 (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))) {
widget->removeEventFilter(this);
removeObjectEventHandler(ceData, elementFlags, ptr, this);
} else if (highlights_ && // highlighting
(::tqqt_cast<TQPushButton*>(widget) ||
::tqqt_cast<TQComboBox*>(widget) ||
@ -221,13 +231,14 @@ void PhaseStyle::unPolish(TQWidget *widget)
::tqqt_cast<TQRadioButton*>(widget) ||
::tqqt_cast<TQSlider*>(widget) ||
widget->inherits(TQSPLITTERHANDLE))) {
widget->removeEventFilter(this);
removeObjectEventHandler(ceData, elementFlags, ptr, this);
} else if (highlights_ && ::tqqt_cast<TQTabBar*>(widget)) {
widget->setMouseTracking(false);
widget->removeEventFilter(this);
removeObjectEventHandler(ceData, elementFlags, ptr, this);
}
}
KStyle::unPolish(widget);
KStyle::unPolish(ceData, elementFlags, ptr);
}
//////////////////////////////////////////////////////////////////////////////
@ -2251,8 +2262,11 @@ 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 (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;
@ -2408,6 +2422,7 @@ bool PhaseStyle::eventFilter(TQObject *object, TQEvent *event)
}
}
}
}
return false;
}

@ -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_;

Loading…
Cancel
Save