Update to new style API

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 9 years ago
parent 8f61d29f9c
commit c678579b70

File diff suppressed because it is too large Load Diff

@ -108,21 +108,25 @@ public:
Palette_Widget Palette_Widget
}; };
void polish(TQApplication* app ); void applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
void polish(TQWidget* widget ); void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
void polish( TQPalette &p ); void polish( TQPalette &p );
void unPolish(TQWidget* widget ); void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
void drawTDEStylePrimitive(TDEStylePrimitive kpe, void drawTDEStylePrimitive(TDEStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
void drawPrimitive(PrimitiveElement pe, void drawPrimitive(PrimitiveElement pe,
TQPainter *p, TQPainter *p,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -130,46 +134,71 @@ public:
void drawControl(ControlElement element, void drawControl(ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawControlMask( ControlElement, TQPainter *, const TQWidget *, const TQRect &, const TQStyleOption &) const; void drawControlMask( TQ_ControlElement,
TQPainter *,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &,
const TQStyleOption &,
const TQWidget *) const;
void drawComplexControl(ComplexControl control, void drawComplexControl(TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
SCFlags controls = SC_All, SCFlags controls = SC_All,
SCFlags active = SC_None, SCFlags active = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
int pixelMetric(PixelMetric m, int pixelMetric(PixelMetric m,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQWidget *widget = 0 ) const; const TQWidget *widget = 0 ) const;
TQRect subRect(SubRect r, TQRect subRect(SubRect r,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQWidget *widget ) const; const TQWidget *widget ) const;
TQRect querySubControlMetrics(ComplexControl control, TQRect querySubControlMetrics(ComplexControl control,
const TQWidget *widget, const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption &opt = TQStyleOption::Default ) const; const TQStyleOption &opt = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQSize sizeFromContents(TQStyle::ContentsType t, TQSize sizeFromContents(TQStyle::ContentsType t,
const TQWidget *w, const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQSize &s, const TQSize &s,
const TQStyleOption &o) const; const TQStyleOption &o,
const TQWidget *w = 0) const;
int styleHint(StyleHint, const TQWidget * = 0, int styleHint(TQ_StyleHint,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQStyleOption & = TQStyleOption::Default, const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn * = 0 ) const; TQStyleHintReturn * = 0,
const TQWidget * = 0 ) const;
TQPixmap stylePixmap(StylePixmap stylepixmap, const TQWidget* widget, const TQStyleOption& opt) const; TQPixmap stylePixmap(StylePixmap stylepixmap,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQStyleOption& opt,
const TQWidget* widget = 0) const;
void drawItem( TQPainter *p, const TQRect &r, void drawItem( TQPainter *p, const TQRect &r,
int flags, const TQColorGroup &g, bool enabled, int flags, const TQColorGroup &g, bool enabled,
@ -371,7 +400,10 @@ protected:
DSurface headerSurface; DSurface headerSurface;
DSurface checkItemSurface; DSurface checkItemSurface;
bool eventFilter(TQObject *, TQEvent *); virtual bool objectEventHandler( const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
void* source,
TQEvent *ev );
TQString configMode; TQString configMode;
void removeCachedSbPix(const TQColor &color) { void removeCachedSbPix(const TQColor &color) {

@ -16,8 +16,19 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 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()); // tqDebug("className: %s -- name: %s", obj->className(), obj->name());
@ -59,10 +70,10 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev)
if(!cb->listBox()) { if(!cb->listBox()) {
drawComplexControl( TQStyle::CC_ComboBox, &p, cb, cb->rect(), g, drawComplexControl( TQStyle::CC_ComboBox, &p, ceData, elementFlags, cb->rect(), g,
flags, (uint)TQStyle::SC_All, /*(cb->arrowDown ? */TQStyle::SC_ComboBoxArrow /*: TQStyle::SC_None )*/); 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); re = TQStyle::visualRect(re, cb);
p.setClipRect( re ); p.setClipRect( re );
@ -93,9 +104,9 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev)
} }
} }
else { else {
drawComplexControl( TQStyle::CC_ComboBox, &p, cb, cb->rect(), g, drawComplexControl( TQStyle::CC_ComboBox, &p, ceData, elementFlags, cb->rect(), g,
flags, (uint)TQStyle::SC_All, /*(d->arrowDown ? */TQStyle::SC_ComboBoxArrow/* : TQStyle::SC_None )*/); flags, (uint)TQStyle::SC_All, /*(d->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); re = TQStyle::visualRect(re, cb);
p.setClipRect( re ); p.setClipRect( re );
@ -801,8 +812,8 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev)
flags |= TQStyle::Style_HasFocus; flags |= TQStyle::Style_HasFocus;
if(spinWidgetDown && sw->hasMouse()) if(spinWidgetDown && sw->hasMouse())
flags |= TQStyle::Style_Down; flags |= TQStyle::Style_Down;
TQRect fr = TQStyle::visualRect(querySubControlMetrics( TQStyle::CC_SpinWidget, sw, TQStyle::SC_SpinWidgetFrame ), sw ); TQRect fr = TQStyle::visualRect(querySubControlMetrics( TQStyle::CC_SpinWidget, ceData, elementFlags, TQStyle::SC_SpinWidgetFrame, TQStyleOption::Default, sw ), sw );
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 );
p.end(); p.end();
p.begin(sw); p.begin(sw);
p.drawPixmap(0,0,buffer); p.drawPixmap(0,0,buffer);
@ -834,7 +845,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev)
if(spinWidgetDown) { if(spinWidgetDown) {
if(sw->paletteBackgroundPixmap()) if(sw->paletteBackgroundPixmap())
sw->erase(); 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; return false;
@ -844,7 +855,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev)
if(sw->paletteBackgroundPixmap()) if(sw->paletteBackgroundPixmap())
sw->erase(); 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; return false;
} }
case TQEvent::Enter: { case TQEvent::Enter: {
@ -1058,7 +1069,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev)
else if(btn == hoverWidget && btn->isEnabled()) else if(btn == hoverWidget && btn->isEnabled())
buttonContour->setState(Contour_MouseOver); 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(); buttonContour->reset();
return true; return true;
} }
@ -1146,7 +1157,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev)
flags |= TQStyle::Style_Off; flags |= TQStyle::Style_Off;
TQPainter p(rb); 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; return true;
} }
if (ev->type() == TQEvent::Show && !strcmp(obj->name(), "__tdehtml")) { if (ev->type() == TQEvent::Show && !strcmp(obj->name(), "__tdehtml")) {
@ -1165,7 +1176,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev)
TQPixmap pix(btn->size()); TQPixmap pix(btn->size());
pix.fill(tqApp->palette().active().background()); pix.fill(tqApp->palette().active().background());
TQPainter p(&pix); 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); btn->setErasePixmap(pix);
return true; return true;
} }
@ -1182,7 +1193,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev)
if ( btn->isEnabled() ) if ( btn->isEnabled() )
flags |= Style_Enabled; flags |= Style_Enabled;
TQPainter p(btn); 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 true;
} }
return false; return false;
@ -1224,7 +1235,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev)
flags |= TQStyle::Style_NoChange; flags |= TQStyle::Style_NoChange;
TQPainter p(cb); 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 true;
} }
return false; return false;

@ -2722,7 +2722,9 @@ void PreviewCheckBox::drawButton(TQPainter *p) {
TQPixmap pix(18,19); TQPixmap pix(18,19);
TQPainter painter(&pix); TQPainter painter(&pix);
pix.fill(backgroundColor()); pix.fill(backgroundColor());
style().drawControl(TQStyle::CE_CheckBox, &painter, this, irect, colorGroup(), flags); const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(this, TQStyleOption());
TQStyle::ControlElementFlags elementFlags = getControlElementFlagsForObject(this, TQStyleOption());
style().drawControl(TQStyle::CE_CheckBox, &painter, ceData, elementFlags, irect, colorGroup(), flags, TQStyleOption::Default, this);
bitBlt(this, 0, 0, &pix); bitBlt(this, 0, 0, &pix);
} }
@ -2756,7 +2758,9 @@ void PreviewRadioButton::drawButton(TQPainter *p) {
TQPixmap pix(17,17); TQPixmap pix(17,17);
TQPainter painter(&pix); TQPainter painter(&pix);
pix.fill(backgroundColor()); pix.fill(backgroundColor());
style().drawControl(TQStyle::CE_RadioButton, &painter, this, irect, colorGroup(), flags); const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(this, TQStyleOption());
TQStyle::ControlElementFlags elementFlags = getControlElementFlagsForObject(this, TQStyleOption());
style().drawControl(TQStyle::CE_RadioButton, &painter, ceData, elementFlags, irect, colorGroup(), flags, TQStyleOption::Default, this);
bitBlt(this, 0, 0, &pix); bitBlt(this, 0, 0, &pix);
} }
@ -2831,7 +2835,9 @@ void IndicatorPrevButton::paintEvent(TQPaintEvent* /*event*/)
TQPainter p(&buffer); TQPainter p(&buffer);
buffer.fill(paletteBackgroundColor()); buffer.fill(paletteBackgroundColor());
previewStyle->drawControl(TQStyle::CE_PushButton, &p, this, rect(), colorGroup(), flags); const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(this, TQStyleOption());
TQStyle::ControlElementFlags elementFlags = getControlElementFlagsForObject(this, TQStyleOption());
previewStyle->drawControl(TQStyle::CE_PushButton, &p, ceData, elementFlags, rect(), colorGroup(), flags, TQStyleOption::Default, this);
previewStyle->drawFocusIndicator(&p, style().subRect(TQStyle::SR_PushButtonFocusRect, this), AlignHCenter| AlignVCenter |ShowPrefix, previewStyle->drawFocusIndicator(&p, style().subRect(TQStyle::SR_PushButtonFocusRect, this), AlignHCenter| AlignVCenter |ShowPrefix,
colorGroup(), true, 0, indicatorPreviewText, -1, indicatorBtnColor->color(), (indicatorModeCombo->currentItem() == 1), true); colorGroup(), true, 0, indicatorPreviewText, -1, indicatorBtnColor->color(), (indicatorModeCombo->currentItem() == 1), true);
@ -2894,7 +2900,9 @@ void TextEffectPrevButton::paintEvent(TQPaintEvent* /*event*/)
TQPixmap buffer(width(), height()); TQPixmap buffer(width(), height());
TQPainter p(&buffer); TQPainter p(&buffer);
previewStyle->drawControl(TQStyle::CE_PushButton, &p, this, rect(), colorGroup(), flags); const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(this, TQStyleOption());
TQStyle::ControlElementFlags elementFlags = getControlElementFlagsForObject(this, TQStyleOption());
previewStyle->drawControl(TQStyle::CE_PushButton, &p, ceData, elementFlags, rect(), colorGroup(), flags, TQStyleOption::Default, this);
drawButtonLabel(&p); drawButtonLabel(&p);

Loading…
Cancel
Save