diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2016-04-08 03:07:37 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2016-04-08 03:07:37 +0200 |
commit | c678579b70f19d2cec2537f56d927e698a688aef (patch) | |
tree | 3678b04eba6975d301cccfb6df6f49d5fe5d9d12 /domino/eventfilter.cpp | |
parent | 8f61d29f9c7b9387d5bfe5d269273650d9089b96 (diff) | |
download | tde-style-domino-c678579b70f19d2cec2537f56d927e698a688aef.tar.gz tde-style-domino-c678579b70f19d2cec2537f56d927e698a688aef.zip |
Update to new style API
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'domino/eventfilter.cpp')
-rw-r--r-- | domino/eventfilter.cpp | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/domino/eventfilter.cpp b/domino/eventfilter.cpp index d3ec418..16f7c2e 100644 --- a/domino/eventfilter.cpp +++ b/domino/eventfilter.cpp @@ -16,8 +16,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) +bool DominoStyle::objectEventHandler( const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + void* source, + TQEvent *ev ) { + if (TDEStyle::objectEventHandler(ceData, elementFlags, source, ev)) { + return true; + } + + if (!ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) { + return false; + } + TQObject* obj = reinterpret_cast<TQObject*>(source); // tqDebug("className: %s -- name: %s", obj->className(), obj->name()); @@ -59,10 +70,10 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) if(!cb->listBox()) { - drawComplexControl( TQStyle::CC_ComboBox, &p, cb, cb->rect(), g, - flags, (uint)TQStyle::SC_All, /*(cb->arrowDown ? */TQStyle::SC_ComboBoxArrow /*: TQStyle::SC_None )*/); + drawComplexControl( TQStyle::CC_ComboBox, &p, ceData, elementFlags, cb->rect(), g, + flags, (uint)TQStyle::SC_All, /*(cb->arrowDown ? */TQStyle::SC_ComboBoxArrow /*: TQStyle::SC_None )*/, TQStyleOption::Default, cb); - TQRect re = querySubControlMetrics( TQStyle::CC_ComboBox, cb, TQStyle::SC_ComboBoxEditField ); + TQRect re = querySubControlMetrics( TQStyle::CC_ComboBox, ceData, elementFlags, TQStyle::SC_ComboBoxEditField, TQStyleOption::Default, cb ); re = TQStyle::visualRect(re, cb); p.setClipRect( re ); @@ -93,9 +104,9 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) } } else { - drawComplexControl( TQStyle::CC_ComboBox, &p, cb, cb->rect(), g, - flags, (uint)TQStyle::SC_All, /*(d->arrowDown ? */TQStyle::SC_ComboBoxArrow/* : TQStyle::SC_None )*/); - TQRect re = querySubControlMetrics( TQStyle::CC_ComboBox, cb, TQStyle::SC_ComboBoxEditField ); + drawComplexControl( TQStyle::CC_ComboBox, &p, ceData, elementFlags, cb->rect(), g, + flags, (uint)TQStyle::SC_All, /*(d->arrowDown ? */TQStyle::SC_ComboBoxArrow/* : TQStyle::SC_None )*/, TQStyleOption::Default, cb); + TQRect re = querySubControlMetrics( TQStyle::CC_ComboBox, ceData, elementFlags, TQStyle::SC_ComboBoxEditField, TQStyleOption::Default, cb ); re = TQStyle::visualRect(re, cb); p.setClipRect( re ); @@ -801,8 +812,8 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) flags |= TQStyle::Style_HasFocus; if(spinWidgetDown && sw->hasMouse()) flags |= TQStyle::Style_Down; - TQRect fr = TQStyle::visualRect(querySubControlMetrics( TQStyle::CC_SpinWidget, sw, TQStyle::SC_SpinWidgetFrame ), sw ); - drawComplexControl( TQStyle::CC_SpinWidget, &p, sw, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None ); + TQRect fr = TQStyle::visualRect(querySubControlMetrics( TQStyle::CC_SpinWidget, ceData, elementFlags, TQStyle::SC_SpinWidgetFrame, TQStyleOption::Default, sw ), sw ); + drawComplexControl( TQStyle::CC_SpinWidget, &p, ceData, elementFlags, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None, TQStyleOption::Default, sw ); p.end(); p.begin(sw); p.drawPixmap(0,0,buffer); @@ -834,7 +845,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) if(spinWidgetDown) { if(sw->paletteBackgroundPixmap()) sw->erase(); - drawComplexControl( TQStyle::CC_SpinWidget, &p, sw, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None); + drawComplexControl( TQStyle::CC_SpinWidget, &p, ceData, elementFlags, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None, TQStyleOption::Default, sw); } return false; @@ -844,7 +855,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) if(sw->paletteBackgroundPixmap()) sw->erase(); - drawComplexControl( TQStyle::CC_SpinWidget, &p, sw, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None); + drawComplexControl( TQStyle::CC_SpinWidget, &p, ceData, elementFlags, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None, TQStyleOption::Default, sw); return false; } case TQEvent::Enter: { @@ -1058,7 +1069,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) else if(btn == hoverWidget && btn->isEnabled()) buttonContour->setState(Contour_MouseOver); - drawComplexControl(TQStyle::CC_ToolButton, &p, btn, btn->rect(), btn->colorGroup(), flags, TQStyle::SC_ToolButton, active, TQStyleOption()); + drawComplexControl(TQStyle::CC_ToolButton, &p, ceData, elementFlags, btn->rect(), btn->colorGroup(), flags, TQStyle::SC_ToolButton, active, TQStyleOption(), btn); buttonContour->reset(); return true; } @@ -1146,7 +1157,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) flags |= TQStyle::Style_Off; TQPainter p(rb); - drawControl(CE_RadioButton, &p, rb, TQRect(0,0,17,17), rb->palette().active(), flags); + drawControl(CE_RadioButton, &p, ceData, elementFlags, TQRect(0,0,17,17), rb->palette().active(), flags, TQStyleOption::Default, rb); return true; } if (ev->type() == TQEvent::Show && !strcmp(obj->name(), "__tdehtml")) { @@ -1165,7 +1176,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) TQPixmap pix(btn->size()); pix.fill(tqApp->palette().active().background()); TQPainter p(&pix); - drawControl( CE_CheckBox, &p, btn, TQRect(0,0,18,19), tqApp->palette().active(), Style_Default|Style_Off, TQStyleOption::Default); + drawControl( CE_CheckBox, &p, ceData, elementFlags, TQRect(0,0,18,19), tqApp->palette().active(), Style_Default|Style_Off, TQStyleOption::Default, btn); btn->setErasePixmap(pix); return true; } @@ -1182,7 +1193,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) if ( btn->isEnabled() ) flags |= Style_Enabled; TQPainter p(btn); - drawPrimitive(PE_CheckMark, &p, TQRect(0,0,16,17), tqApp->palette().active(), flags); + drawPrimitive(PE_CheckMark, &p, ceData, elementFlags, TQRect(0,0,16,17), tqApp->palette().active(), flags); return true; } return false; @@ -1224,7 +1235,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) flags |= TQStyle::Style_NoChange; TQPainter p(cb); - drawControl(CE_CheckBox, &p, cb, TQRect(0,0,18,19), cb->palette().active(), flags); + drawControl(CE_CheckBox, &p, ceData, elementFlags, TQRect(0,0,18,19), cb->palette().active(), flags, TQStyleOption::Default, cb); return true; } return false; |