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
};
void polish(TQApplication* app );
void polish(TQWidget* widget );
void applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
void polish( TQPalette &p );
void unPolish(TQWidget* widget );
void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
void drawTDEStylePrimitive(TDEStylePrimitive kpe,
TQPainter* p,
const TQWidget* widget,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const;
const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
void drawPrimitive(PrimitiveElement pe,
TQPainter *p,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags = Style_Default,
@ -130,46 +134,71 @@ public:
void drawControl(ControlElement element,
TQPainter *p,
const TQWidget *widget,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
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,
const TQWidget *widget,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags = Style_Default,
SCFlags controls = SC_All,
SCFlags active = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const;
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
int pixelMetric(PixelMetric m,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQWidget *widget = 0 ) const;
TQRect subRect(SubRect r,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQWidget *widget ) const;
TQRect querySubControlMetrics(ComplexControl control,
const TQWidget *widget,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
SubControl subcontrol,
const TQStyleOption &opt = TQStyleOption::Default ) const;
const TQStyleOption &opt = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQSize sizeFromContents(TQStyle::ContentsType t,
const TQWidget *w,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
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,
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,
int flags, const TQColorGroup &g, bool enabled,
@ -371,7 +400,10 @@ protected:
DSurface headerSurface;
DSurface checkItemSurface;
bool eventFilter(TQObject *, TQEvent *);
virtual bool objectEventHandler( const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
void* source,
TQEvent *ev );
TQString configMode;
void removeCachedSbPix(const TQColor &color) {

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

@ -2722,7 +2722,9 @@ void PreviewCheckBox::drawButton(TQPainter *p) {
TQPixmap pix(18,19);
TQPainter painter(&pix);
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);
}
@ -2756,7 +2758,9 @@ void PreviewRadioButton::drawButton(TQPainter *p) {
TQPixmap pix(17,17);
TQPainter painter(&pix);
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);
}
@ -2831,7 +2835,9 @@ void IndicatorPrevButton::paintEvent(TQPaintEvent* /*event*/)
TQPainter p(&buffer);
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,
colorGroup(), true, 0, indicatorPreviewText, -1, indicatorBtnColor->color(), (indicatorModeCombo->currentItem() == 1), true);
@ -2894,7 +2900,9 @@ void TextEffectPrevButton::paintEvent(TQPaintEvent* /*event*/)
TQPixmap buffer(width(), height());
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);

Loading…
Cancel
Save