Update to new style API

pull/16/head
Timothy Pearson 12 years ago
parent e9f29cfb2a
commit 2ba2bd6da0

@ -174,11 +174,13 @@ void AsteroidStyle::renderMenuBlendPixmap(KPixmap &pix,
void AsteroidStyle::drawKStylePrimitive(KStylePrimitive ksp, void AsteroidStyle::drawKStylePrimitive(KStylePrimitive ksp,
TQPainter *p, TQPainter *p,
const TQWidget *w, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags sf, SFlags sf,
const TQStyleOption &o) const const TQStyleOption &o,
const TQWidget *w) const
{ {
switch (ksp) { switch (ksp) {
@ -284,15 +286,17 @@ void AsteroidStyle::drawKStylePrimitive(KStylePrimitive ksp,
} }
default: { default: {
KStyle::drawKStylePrimitive(ksp, p, w, r, cg, sf, o); KStyle::drawKStylePrimitive(ksp, p, ceData, elementFlags, r, cg, sf, o, w);
} }
} }
} }
int AsteroidStyle::styleHint( TQ_StyleHint stylehint, int AsteroidStyle::styleHint( TQ_StyleHint stylehint,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption &option, const TQStyleOption &option,
TQStyleHintReturn* returnData ) const TQStyleHintReturn* returnData,
const TQWidget *widget ) const
{ {
switch (stylehint) { switch (stylehint) {
case SH_EtchDisabledText: case SH_EtchDisabledText:
@ -309,12 +313,14 @@ int AsteroidStyle::styleHint( TQ_StyleHint stylehint,
return 1; return 1;
default: default:
return KStyle::styleHint(stylehint, widget, option, returnData); return KStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
} }
} }
void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, void AsteroidStyle::drawPrimitive(TQ_PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags sf, SFlags sf,
@ -724,13 +730,13 @@ void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
p->setPen(cg.foreground()); p->setPen(cg.foreground());
if (sf & Style_Enabled) { if (sf & Style_Enabled) {
tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, r, cg, sf); drawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags, r, cg, sf);
} else { } else {
TQPen oldPen = p->pen(); TQPen oldPen = p->pen();
p->setPen(cg.light()); p->setPen(cg.light());
tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, TQRect(x+1, y+1, w, h), cg, sf); drawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags, TQRect(x+1, y+1, w, h), cg, sf);
p->setPen(cg.dark()); p->setPen(cg.dark());
tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, r, cg, sf); drawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags, r, cg, sf);
p->setPen(oldPen); p->setPen(oldPen);
} }
break; break;
@ -758,13 +764,13 @@ void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
p->setPen(cg.foreground()); p->setPen(cg.foreground());
if (sf & Style_Enabled) { if (sf & Style_Enabled) {
tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, r, cg, sf); drawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags, r, cg, sf);
} else { } else {
TQPen oldPen = p->pen(); TQPen oldPen = p->pen();
p->setPen(cg.light()); p->setPen(cg.light());
tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, TQRect(x+1, y+1, w, h), cg, sf); drawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags, TQRect(x+1, y+1, w, h), cg, sf);
p->setPen(cg.dark()); p->setPen(cg.dark());
tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, r, cg, sf); drawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags, r, cg, sf);
p->setPen(oldPen); p->setPen(oldPen);
} }
break; break;
@ -907,8 +913,8 @@ void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
} }
if (sf & Style_Down) { if (sf & Style_Down) {
p->translate(pixelMetric(PM_ButtonShiftHorizontal), p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags),
pixelMetric(PM_ButtonShiftVertical)); pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags));
} }
a.translate((x + w/2), (y + (h-1)/2)); a.translate((x + w/2), (y + (h-1)/2));
@ -916,26 +922,28 @@ void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
p->drawPoint(a[6]); p->drawPoint(a[6]);
if (sf & Style_Down) { if (sf & Style_Down) {
p->translate(-pixelMetric(PM_ButtonShiftHorizontal), p->translate(-pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags),
-pixelMetric(PM_ButtonShiftVertical)); -pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags));
} }
break; break;
} }
default: { default: {
KStyle::tqdrawPrimitive(pe, p, r, cg, sf, o); KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, sf, o);
} }
} }
} }
void AsteroidStyle::drawControl(TQ_ControlElement ce, void AsteroidStyle::drawControl(TQ_ControlElement ce,
TQPainter *p, TQPainter *p,
const TQWidget *w, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags sf, SFlags sf,
const TQStyleOption &o) const const TQStyleOption &o,
const TQWidget *w) const
{ {
int x, y, x2, y2, sw, sh; int x, y, x2, y2, sw, sh;
r.coords(&x, &y, &x2, &y2); r.coords(&x, &y, &x2, &y2);
@ -1016,7 +1024,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
p->drawLine( x2, r2.top() + 2, x2, r2.bottom() - p->drawLine( x2, r2.top() + 2, x2, r2.bottom() -
(selected ? (lastTab ? 0:1) :2)); (selected ? (lastTab ? 0:1) :2));
} else if ( tb->shape() == TQTabBar::RoundedBelow ) { } else if ( tb->shape() == TQTabBar::RoundedBelow ) {
bool rightAligned = styleHint( SH_TabBar_Alignment, tb ) == TQt::AlignRight; bool rightAligned = styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, tb ) == TQt::AlignRight;
bool firstTab = tb->indexOf( t->identifier() ) == 0; bool firstTab = tb->indexOf( t->identifier() ) == 0;
if ( selected ) { if ( selected ) {
p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1), p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1),
@ -1060,7 +1068,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2), p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2),
r2.left(), r2.bottom() - 2 ); r2.left(), r2.bottom() - 2 );
} else { } else {
TQCommonStyle::drawControl(ce, p, w, r, cg, sf, o); TQCommonStyle::drawControl(ce, p, ceData, elementFlags, r, cg, sf, o, w);
} }
break; break;
} }
@ -1074,15 +1082,15 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
TQTab * t = o.tab(); TQTab * t = o.tab();
const bool enabled = sf & Style_Enabled; const bool enabled = sf & Style_Enabled;
bool etchtext = styleHint( SH_EtchDisabledText ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
TQRect tr = r; TQRect tr = r;
if ( t->identifier() == tb->currentTab() ) if ( t->identifier() == tb->currentTab() )
tr.setBottom( tr.bottom() - tr.setBottom( tr.bottom() -
pixelMetric( TQStyle::PM_DefaultFrameWidth, tb ) ); pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, tb ) );
int alignment = TQt::AlignCenter | TQt::ShowPrefix; int alignment = TQt::AlignCenter | TQt::ShowPrefix;
if (!styleHint(SH_UnderlineAccelerator, w, TQStyleOption::Default, 0)) if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, w))
alignment |= TQt::NoAccel; alignment |= TQt::NoAccel;
tr.setWidth(tr.width()+4); // Compensate for text appearing too far to the left tr.setWidth(tr.width()+4); // Compensate for text appearing too far to the left
// TQRect tr_offset = TQRect(tr.x()+ETCH_X_OFFSET, tr.y()+ETCH_Y_OFFSET, tr.width(), tr.height()); // TQRect tr_offset = TQRect(tr.x()+ETCH_X_OFFSET, tr.y()+ETCH_Y_OFFSET, tr.width(), tr.height());
@ -1115,7 +1123,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
} }
if ( (sf & Style_HasFocus) && !t->text().isEmpty() ) if ( (sf & Style_HasFocus) && !t->text().isEmpty() )
tqdrawPrimitive( TQStyle::PE_FocusRect, p, r, cg ); drawPrimitive( TQStyle::PE_FocusRect, p, ceData, elementFlags, r, cg );
break; break;
} }
#endif // TQT_NO_TABBAR #endif // TQT_NO_TABBAR
@ -1126,10 +1134,10 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
const TQCheckBox *checkbox = (const TQCheckBox *) w; const TQCheckBox *checkbox = (const TQCheckBox *) w;
const bool enabled = sf & Style_Enabled; const bool enabled = sf & Style_Enabled;
bool etchtext = styleHint( SH_EtchDisabledText ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
int alignment = TQApplication::reverseLayout() ? TQt::AlignRight : TQt::AlignLeft; int alignment = TQApplication::reverseLayout() ? TQt::AlignRight : TQt::AlignLeft;
if (!styleHint(SH_UnderlineAccelerator, w, TQStyleOption::Default, 0)) if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, w))
alignment |= TQt::NoAccel; alignment |= TQt::NoAccel;
//TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height()); //TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height());
@ -1162,8 +1170,8 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
} }
if (sf & Style_HasFocus) { if (sf & Style_HasFocus) {
TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, w), w); TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, w), ceData, elementFlags);
tqdrawPrimitive(TQStyle::PE_FocusRect, p, fr, cg, sf); drawPrimitive(TQStyle::PE_FocusRect, p, ceData, elementFlags, fr, cg, sf);
} }
#endif #endif
break; break;
@ -1175,10 +1183,10 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
const TQRadioButton *radiobutton = (const TQRadioButton *) w; const TQRadioButton *radiobutton = (const TQRadioButton *) w;
const bool enabled = sf & Style_Enabled; const bool enabled = sf & Style_Enabled;
bool etchtext = styleHint( SH_EtchDisabledText ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
int alignment = TQApplication::reverseLayout() ? TQt::AlignRight : TQt::AlignLeft; int alignment = TQApplication::reverseLayout() ? TQt::AlignRight : TQt::AlignLeft;
if (!styleHint(SH_UnderlineAccelerator, w, TQStyleOption::Default, 0)) if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, w))
alignment |= TQt::NoAccel; alignment |= TQt::NoAccel;
// TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height()); // TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height());
@ -1209,8 +1217,8 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
drawItem(p, r, alignment | TQt::AlignVCenter | TQt::ShowPrefix, cg, enabled, radiobutton->pixmap(), radiobutton->text()); drawItem(p, r, alignment | TQt::AlignVCenter | TQt::ShowPrefix, cg, enabled, radiobutton->pixmap(), radiobutton->text());
if (sf & Style_HasFocus) { if (sf & Style_HasFocus) {
TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, w), w); TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, w), ceData, elementFlags);
tqdrawPrimitive(TQStyle::PE_FocusRect, p, fr, cg, sf); drawPrimitive(TQStyle::PE_FocusRect, p, ceData, elementFlags, fr, cg, sf);
} }
#endif #endif
break; break;
@ -1228,7 +1236,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
// ### Take into account totalSteps() for busy indicator // ### Take into account totalSteps() for busy indicator
const TQProgressBar* pb = (const TQProgressBar*)w; const TQProgressBar* pb = (const TQProgressBar*)w;
TQRect cr = subRect(SR_ProgressBarContents, w); TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, w);
double progress = pb->progress(); double progress = pb->progress();
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
int steps = pb->totalSteps(); int steps = pb->totalSteps();
@ -1283,15 +1291,15 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
} }
case CE_CheckBox: { case CE_CheckBox: {
tqdrawPrimitive(PE_Indicator, p, r, cg, sf); drawPrimitive(PE_Indicator, p, ceData, elementFlags, r, cg, sf);
if (sf & Style_On) { if (sf & Style_On) {
tqdrawPrimitive(PE_CheckMark, p, r, cg, sf); drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, sf);
} }
break; break;
} }
case CE_RadioButton: { case CE_RadioButton: {
tqdrawPrimitive(PE_ExclusiveIndicator, p, r, cg, sf); drawPrimitive(PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, sf);
if (sf & Style_On) { if (sf & Style_On) {
TQCOORD center[] = { 4, 5, 4, 6, 5, 7, 6, 7, 7, 6, 7, 5, 6, 4, 5, 4 }; TQCOORD center[] = { 4, 5, 4, 6, 5, 7, 6, 7, 7, 6, 7, 5, 6, 4, 5, 4 };
TQPointArray c(8, center); TQPointArray c(8, center);
@ -1328,10 +1336,10 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
} }
else { else {
if (pb->isDefault()) { if (pb->isDefault()) {
tqdrawPrimitive(PE_ButtonDefault, p, r, cg, sf); drawPrimitive(PE_ButtonDefault, p, ceData, elementFlags, r, cg, sf);
tqdrawPrimitive(PE_ButtonBevel, p, TQRect(x+1, y+1, sw-2, sh-2), cg, sf); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, TQRect(x+1, y+1, sw-2, sh-2), cg, sf);
} else { } else {
tqdrawPrimitive(PE_ButtonBevel, p, r, cg, sf); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, sf);
} }
} }
@ -1343,7 +1351,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
bool focused = sf & Style_HasFocus; bool focused = sf & Style_HasFocus;
bool down = sf & Style_Down; bool down = sf & Style_Down;
bool enabled = sf & Style_Enabled; bool enabled = sf & Style_Enabled;
bool etchtext = styleHint( SH_EtchDisabledText ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
const int text_flags = AlignVCenter | AlignHCenter | ShowPrefix | DontClip | SingleLine; const int text_flags = AlignVCenter | AlignHCenter | ShowPrefix | DontClip | SingleLine;
if (active && focused) { if (active && focused) {
@ -1390,13 +1398,13 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
case CE_PushButtonLabel: { case CE_PushButtonLabel: {
const TQPushButton *pb = dynamic_cast<const TQPushButton *>(w); const TQPushButton *pb = dynamic_cast<const TQPushButton *>(w);
const bool enabled = sf & Style_Enabled; const bool enabled = sf & Style_Enabled;
bool etchtext = styleHint( SH_EtchDisabledText ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
const int text_flags = AlignVCenter | AlignHCenter | ShowPrefix | DontClip | SingleLine; const int text_flags = AlignVCenter | AlignHCenter | ShowPrefix | DontClip | SingleLine;
int dx = 0; int dx = 0;
if (sf & Style_Down) { if (sf & Style_Down) {
p->translate(pixelMetric(PM_ButtonShiftHorizontal), p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags),
pixelMetric(PM_ButtonShiftVertical)); pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags));
} }
if (pb->iconSet() && !pb->iconSet()->isNull()) { if (pb->iconSet() && !pb->iconSet()->isNull()) {
@ -1458,7 +1466,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
const TQHeader *hw = dynamic_cast<const TQHeader *>(w); const TQHeader *hw = dynamic_cast<const TQHeader *>(w);
int hs = o.headerSection(); int hs = o.headerSection();
const bool enabled = sf & Style_Enabled; const bool enabled = sf & Style_Enabled;
bool etchtext = styleHint( SH_EtchDisabledText ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
const int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine; const int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine;
TQIconSet *is = hw->iconSet(hs); TQIconSet *is = hw->iconSet(hs);
@ -1513,7 +1521,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
bool disabled = !mi->isEnabled(); bool disabled = !mi->isEnabled();
bool checkable = pum->isCheckable(); bool checkable = pum->isCheckable();
bool enabled = mi->isEnabled(); bool enabled = mi->isEnabled();
bool etchtext = styleHint( SH_EtchDisabledText ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
int xpos = x; int xpos = x;
int xm = itemFrame + checkcol + itemHMargin; int xm = itemFrame + checkcol + itemHMargin;
@ -1575,7 +1583,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
rr = visualRect(rr, r); rr = visualRect(rr, r);
} }
tqdrawPrimitive(PE_CheckMark, p, rr, cg, cflags); drawPrimitive(PE_CheckMark, p, ceData, elementFlags, rr, cg, cflags);
} }
} }
@ -1668,7 +1676,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
} }
if (mi->popup()) { if (mi->popup()) {
int dim = pixelMetric(PM_MenuButtonIndicator); int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags);
xpos = x + sw - arrowHMargin - 2 * itemFrame - dim; xpos = x + sw - arrowHMargin - 2 * itemFrame - dim;
@ -1681,23 +1689,25 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
TQRect rr = TQRect(xpos, y + sh/2 - dim/2, dim, dim); TQRect rr = TQRect(xpos, y + sh/2 - dim/2, dim, dim);
if (backwards) if (backwards)
rr = visualRect(rr, r); rr = visualRect(rr, r);
tqdrawPrimitive((backwards ? PE_ArrowLeft : PE_ArrowRight), p, rr, cg, Style_Enabled); drawPrimitive((backwards ? PE_ArrowLeft : PE_ArrowRight), p, ceData, elementFlags, rr, cg, Style_Enabled);
} }
break; break;
} }
default: { default: {
KStyle::drawControl(ce, p, w, r, cg, sf, o); KStyle::drawControl(ce, p, ceData, elementFlags, r, cg, sf, o, w);
} }
} }
} }
void AsteroidStyle::drawControlMask(TQ_ControlElement ce, void AsteroidStyle::drawControlMask(TQ_ControlElement ce,
TQPainter *p, TQPainter *p,
const TQWidget *w, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &o) const const TQStyleOption &o,
const TQWidget *w) const
{ {
switch (ce) { switch (ce) {
/* /*
@ -1733,20 +1743,22 @@ void AsteroidStyle::drawControlMask(TQ_ControlElement ce,
CE_HeaderLabel CE_HeaderLabel
*/ */
default: { default: {
KStyle::drawControlMask(ce, p, w, r, o); KStyle::drawControlMask(ce, p, ceData, elementFlags, r, o, w);
} }
} }
} }
void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc, void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
TQPainter *p, TQPainter *p,
const TQWidget *w, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags sf, SFlags sf,
SCFlags sc, SCFlags sc,
SCFlags sa, SCFlags sa,
const TQStyleOption &o) const const TQStyleOption &o,
const TQWidget *w) const
{ {
switch (cc) { switch (cc) {
/* TQ_ComplexControls available are: /* TQ_ComplexControls available are:
@ -1762,7 +1774,7 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
case CC_ListView: case CC_ListView:
{ {
if ( sc & SC_ListView ) { if ( sc & SC_ListView ) {
TQCommonStyle::drawComplexControl( cc, p, w, r, cg, sf, sc, sa, o ); TQCommonStyle::drawComplexControl( cc, p, ceData, elementFlags, r, cg, sf, sc, sa, o, w );
} }
if ( sc & ( SC_ListViewBranch | SC_ListViewExpand ) ) { if ( sc & ( SC_ListViewBranch | SC_ListViewExpand ) ) {
if (o.isDefault()) if (o.isDefault())
@ -1953,7 +1965,7 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
p->drawLine(x2-1, y2-1, x+1, y2-1); p->drawLine(x2-1, y2-1, x+1, y2-1);
// Fill in the area behind the text. // Fill in the area behind the text.
p->fillRect(querySubControlMetrics(cc, w, SC_ComboBoxEditField), cg.base()); p->fillRect(querySubControlMetrics(cc, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, w), cg.base());
p->setBrush(cg.background()); p->setBrush(cg.background());
// Draw the box on the right. // Draw the box on the right.
@ -2008,8 +2020,8 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
if ( toolbutton->backgroundMode() != TQt::PaletteButton ) if ( toolbutton->backgroundMode() != TQt::PaletteButton )
c.setBrush( TQColorGroup::Button, toolbutton->paletteBackgroundColor() ); c.setBrush( TQColorGroup::Button, toolbutton->paletteBackgroundColor() );
TQRect button, menuarea; TQRect button, menuarea;
button = visualRect( querySubControlMetrics(cc, w, SC_ToolButton, o), w ); button = visualRect( querySubControlMetrics(cc, ceData, elementFlags, SC_ToolButton, o, w), ceData, elementFlags );
menuarea = visualRect( querySubControlMetrics(cc, w, SC_ToolButtonMenu, o), w ); menuarea = visualRect( querySubControlMetrics(cc, ceData, elementFlags, SC_ToolButtonMenu, o, w), ceData, elementFlags );
SFlags bflags = sf; SFlags bflags = sf;
SFlags mflags = sf; SFlags mflags = sf;
@ -2021,7 +2033,7 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
if (sc & SC_ToolButton) { if (sc & SC_ToolButton) {
if (bflags & (Style_Down | Style_On | Style_Raised)) { if (bflags & (Style_Down | Style_On | Style_Raised)) {
tqdrawPrimitive(TQStyle::PE_ButtonTool, p, button, c, bflags, o); drawPrimitive(TQStyle::PE_ButtonTool, p, ceData, elementFlags, button, c, bflags, o);
} else if ( toolbutton->parentWidget() && toolbutton->parentWidget()->backgroundPixmap() && ! toolbutton->parentWidget()->backgroundPixmap()->isNull() ) { } else if ( toolbutton->parentWidget() && toolbutton->parentWidget()->backgroundPixmap() && ! toolbutton->parentWidget()->backgroundPixmap()->isNull() ) {
TQPixmap pixmap = TQPixmap pixmap =
*(toolbutton->parentWidget()->backgroundPixmap()); *(toolbutton->parentWidget()->backgroundPixmap());
@ -2032,14 +2044,14 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
if (sc & SC_ToolButtonMenu) { if (sc & SC_ToolButtonMenu) {
if (mflags & (Style_Down | Style_On | Style_Raised)) if (mflags & (Style_Down | Style_On | Style_Raised))
tqdrawPrimitive(TQStyle::PE_ButtonDropDown, p, menuarea, c, mflags, o); drawPrimitive(TQStyle::PE_ButtonDropDown, p, ceData, elementFlags, menuarea, c, mflags, o);
tqdrawPrimitive(TQStyle::PE_ArrowDown, p, menuarea, c, mflags, o); drawPrimitive(TQStyle::PE_ArrowDown, p, ceData, elementFlags, menuarea, c, mflags, o);
} }
if (toolbutton->hasFocus() && !toolbutton->focusProxy()) { if (toolbutton->hasFocus() && !toolbutton->focusProxy()) {
TQRect fr = toolbutton->rect(); TQRect fr = toolbutton->rect();
fr.addCoords(3, 3, -3, -3); fr.addCoords(3, 3, -3, -3);
tqdrawPrimitive(TQStyle::PE_FocusRect, p, fr, c); drawPrimitive(TQStyle::PE_FocusRect, p, ceData, elementFlags, fr, c);
} }
break; break;
@ -2048,8 +2060,8 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
case CC_Slider: { case CC_Slider: {
const TQSlider* slider = (const TQSlider*)w; const TQSlider* slider = (const TQSlider*)w;
TQRect groove = querySubControlMetrics(CC_Slider, w, SC_SliderGroove, o); TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, o, w);
TQRect handle = querySubControlMetrics(CC_Slider, w, SC_SliderHandle, o); TQRect handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, o, w);
// Double-buffer slider for no flicker // Double-buffer slider for no flicker
TQPixmap pix(w->size()); TQPixmap pix(w->size());
@ -2066,11 +2078,11 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
// Draw slider groove // Draw slider groove
if ((sc & SC_SliderGroove) && groove.isValid()) { if ((sc & SC_SliderGroove) && groove.isValid()) {
drawKStylePrimitive( KPE_SliderGroove, &p2, w, groove, cg, sf, o ); drawKStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, sf, o, w );
// Draw the focus rect around the groove // Draw the focus rect around the groove
if (slider->hasFocus()) if (slider->hasFocus())
tqdrawPrimitive(PE_FocusRect, &p2, groove, cg); drawPrimitive(PE_FocusRect, &p2, ceData, elementFlags, groove, cg);
} }
@ -2084,7 +2096,7 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
if ((sc & SC_SliderHandle) && handle.isValid()) { if ((sc & SC_SliderHandle) && handle.isValid()) {
if (sa == SC_SliderHandle) if (sa == SC_SliderHandle)
sf |= Style_Active; sf |= Style_Active;
drawKStylePrimitive( KPE_SliderHandle, &p2, w, handle, cg, sf, o ); drawKStylePrimitive( KPE_SliderHandle, &p2, ceData, elementFlags, handle, cg, sf, o, w );
} }
p2.end(); p2.end();
@ -2114,10 +2126,10 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
// Draw the arrow buttons // Draw the arrow buttons
p->drawLine(x2-aw-1, y+2, x2-aw-1, y2-1); p->drawLine(x2-aw-1, y+2, x2-aw-1, y2-1);
tqdrawPrimitive(PE_ButtonBevel, p, arrowup, cg, sf, o); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, arrowup, cg, sf, o);
tqdrawPrimitive(PE_ButtonBevel, p, arrowdn, cg, sf, o); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, arrowdn, cg, sf, o);
tqdrawPrimitive(PE_SpinWidgetUp, p, arrowup, cg, sf, o); drawPrimitive(PE_SpinWidgetUp, p, ceData, elementFlags, arrowup, cg, sf, o);
tqdrawPrimitive(PE_SpinWidgetDown, p, arrowdn, cg, sf, o); drawPrimitive(PE_SpinWidgetDown, p, ceData, elementFlags, arrowdn, cg, sf, o);
break; break;
@ -2126,16 +2138,18 @@ void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
default: { default: {
KStyle::drawComplexControl(cc, p, w, r, cg, sf, sc, sa, o); KStyle::drawComplexControl(cc, p, ceData, elementFlags, r, cg, sf, sc, sa, o, w);
} }
} }
} }
void AsteroidStyle::drawComplexControlMask(TQ_ComplexControl cc, void AsteroidStyle::drawComplexControlMask(TQ_ComplexControl cc,
TQPainter *p, TQPainter *p,
const TQWidget *w, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &o) const const TQStyleOption &o,
const TQWidget *w) const
{ {
switch (cc) { switch (cc) {
/* TQ_ComplexControls available are: /* TQ_ComplexControls available are:
@ -2149,12 +2163,12 @@ void AsteroidStyle::drawComplexControlMask(TQ_ComplexControl cc,
CC_ListView CC_ListView
*/ */
default: { default: {
KStyle::drawComplexControlMask(cc, p, w, r, o); KStyle::drawComplexControlMask(cc, p, ceData, elementFlags, r, o, w);
} }
} }
} }
int AsteroidStyle::pixelMetric(PixelMetric pm, const TQWidget *w) const int AsteroidStyle::pixelMetric(PixelMetric pm, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *w) const
{ {
switch (pm) { switch (pm) {
/* PixelMetrics available are: /* PixelMetrics available are:
@ -2248,7 +2262,7 @@ int AsteroidStyle::pixelMetric(PixelMetric pm, const TQWidget *w) const
if (w && w->inherits(TQPOPUPMENU_OBJECT_NAME_STRING)) { if (w && w->inherits(TQPOPUPMENU_OBJECT_NAME_STRING)) {
return 3; return 3;
} else { } else {
return KStyle::pixelMetric(pm, w); return KStyle::pixelMetric(pm, ceData, elementFlags, w);
} }
} }
@ -2274,12 +2288,12 @@ int AsteroidStyle::pixelMetric(PixelMetric pm, const TQWidget *w) const
return TQMAX( 4, TQApplication::globalStrut().width() ); return TQMAX( 4, TQApplication::globalStrut().width() );
default: { default: {
return KStyle::pixelMetric(pm, w); return KStyle::pixelMetric(pm, ceData, elementFlags, w);
} }
} }
} }
TQRect AsteroidStyle::subRect(SubRect sr, const TQWidget *w) const TQRect AsteroidStyle::subRect(SubRect sr, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *w) const
{ {
switch (sr) { switch (sr) {
/* SubRects to calculate are: /* SubRects to calculate are:
@ -2318,15 +2332,17 @@ TQRect AsteroidStyle::subRect(SubRect sr, const TQWidget *w) const
SR_DialogButtonCustom SR_DialogButtonCustom
*/ */
default: { default: {
return KStyle::subRect(sr, w); return KStyle::subRect(sr, ceData, elementFlags, w);
} }
} }
} }
TQRect AsteroidStyle::querySubControlMetrics(TQ_ComplexControl cc, TQRect AsteroidStyle::querySubControlMetrics(TQ_ComplexControl cc,
const TQWidget *w, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc, SubControl sc,
const TQStyleOption &o) const const TQStyleOption &o,
const TQWidget *w) const
{ {
switch (cc) { switch (cc) {
/* Available SubControls are: /* Available SubControls are:
@ -2382,7 +2398,7 @@ TQRect AsteroidStyle::querySubControlMetrics(TQ_ComplexControl cc,
return TQRect(r.x()+2, r.y()+2, r.width()-20, r.height()-4); return TQRect(r.x()+2, r.y()+2, r.width()-20, r.height()-4);
} }
default: { default: {
return KStyle::querySubControlMetrics(cc, w, sc, o); return KStyle::querySubControlMetrics(cc, ceData, elementFlags, sc, o, w);
} }
} }
@ -2390,15 +2406,17 @@ TQRect AsteroidStyle::querySubControlMetrics(TQ_ComplexControl cc,
} }
default: { default: {
return KStyle::querySubControlMetrics(cc, w, sc, o); return KStyle::querySubControlMetrics(cc, ceData, elementFlags, sc, o, w);
} }
} }
} }
TQSize AsteroidStyle::tqsizeFromContents(ContentsType ct, TQSize AsteroidStyle::sizeFromContents(ContentsType ct,
const TQWidget *w, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &s, const TQSize &s,
const TQStyleOption &o) const const TQStyleOption &o,
const TQWidget *w) const
{ {
switch (ct) { switch (ct) {
/* ContentsType values can be: /* ContentsType values can be:
@ -2422,7 +2440,7 @@ TQSize AsteroidStyle::tqsizeFromContents(ContentsType ct,
case CT_PushButton: { case CT_PushButton: {
const TQPushButton *pb = dynamic_cast<const TQPushButton *>(w); const TQPushButton *pb = dynamic_cast<const TQPushButton *>(w);
const TQSize ret = KStyle::tqsizeFromContents(ct, w, s, o); const TQSize ret = KStyle::sizeFromContents(ct, ceData, elementFlags, s, o, w);
int rw = ret.width(), rh = ret.height(); int rw = ret.width(), rh = ret.height();
int mw; int mw;
int mh; int mh;
@ -2454,7 +2472,7 @@ TQSize AsteroidStyle::tqsizeFromContents(ContentsType ct,
} }
case CT_ComboBox: { case CT_ComboBox: {
int padding = (pixelMetric(PM_DefaultFrameWidth, w) * 2) + 1; int padding = (pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, w) * 2) + 1;
return TQSize(s.width() + 21, s.height() + padding); return TQSize(s.width() + 21, s.height() + padding);
} }
@ -2522,7 +2540,7 @@ TQSize AsteroidStyle::tqsizeFromContents(ContentsType ct,
} }
default: { default: {
return KStyle::tqsizeFromContents(ct, w, s, o); return KStyle::sizeFromContents(ct, ceData, elementFlags, s, o, w);
} }
} }
} }

@ -36,18 +36,23 @@ public:
void drawKStylePrimitive(KStylePrimitive, void drawKStylePrimitive(KStylePrimitive,
TQPainter *, TQPainter *,
const TQWidget *, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &, const TQRect &,
const TQColorGroup &, const TQColorGroup &,
SFlags = Style_Default, SFlags = Style_Default,
const TQStyleOption & = TQStyleOption::Default) const; const TQStyleOption & = TQStyleOption::Default,
const TQWidget * = 0) const;
int styleHint(TQ_StyleHint, const TQWidget * = 0, int styleHint(TQ_StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQStyleOption & = TQStyleOption::Default, const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn * = 0 ) const; TQStyleHintReturn * = 0,
const TQWidget * = 0 ) const;
void tqdrawPrimitive(TQ_PrimitiveElement, void drawPrimitive(TQ_PrimitiveElement,
TQPainter *, TQPainter *,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &, const TQRect &,
const TQColorGroup &, const TQColorGroup &,
SFlags = Style_Default, SFlags = Style_Default,
@ -55,49 +60,61 @@ public:
void drawControl(TQ_ControlElement, void drawControl(TQ_ControlElement,
TQPainter *, TQPainter *,
const TQWidget *, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &, const TQRect &,
const TQColorGroup &, const TQColorGroup &,
SFlags = Style_Default, SFlags = Style_Default,
const TQStyleOption & = TQStyleOption::Default) const; const TQStyleOption & = TQStyleOption::Default,
const TQWidget * = 0) const;
void drawControlMask(TQ_ControlElement, void drawControlMask(TQ_ControlElement,
TQPainter *, TQPainter *,
const TQWidget *, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &, const TQRect &,
const TQStyleOption &) const; const TQStyleOption &,
const TQWidget * = 0) const;
void drawComplexControl(TQ_ComplexControl, void drawComplexControl(TQ_ComplexControl,
TQPainter *, TQPainter *,
const TQWidget *, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &, const TQRect &,
const TQColorGroup &, const TQColorGroup &,
SFlags = Style_Default, SFlags = 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 * = 0) const;
void drawComplexControlMask(TQ_ComplexControl, void drawComplexControlMask(TQ_ComplexControl,
TQPainter *, TQPainter *,
const TQWidget *, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption & = TQStyleOption::Default) const; const TQStyleOption & = TQStyleOption::Default,
const TQWidget * = 0) const;
int pixelMetric(PixelMetric, const TQWidget * = 0) const; int pixelMetric(PixelMetric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * = 0) const;
int kPixelMetric( KStylePixelMetric kpm, const TQWidget* /* widget */) const; int kPixelMetric( KStylePixelMetric kpm, const TQWidget* /* widget */) const;
TQRect subRect(SubRect, const TQWidget *) const; TQRect subRect(SubRect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *) const;
TQRect querySubControlMetrics(TQ_ComplexControl, TQRect querySubControlMetrics(TQ_ComplexControl,
const TQWidget *, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl, SubControl,
const TQStyleOption & = TQStyleOption::Default) const; const TQStyleOption & = TQStyleOption::Default,
const TQWidget * = 0) const;
TQSize tqsizeFromContents(ContentsType, TQSize sizeFromContents(ContentsType,
const TQWidget *, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &, const TQSize &,
const TQStyleOption &) const; const TQStyleOption &,
const TQWidget * = 0) const;
protected: protected:
bool eventFilter(TQObject *, TQEvent *); bool eventFilter(TQObject *, TQEvent *);

@ -246,8 +246,10 @@ void HighColorStyle::renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup &cg
// This function draws primitive elements as well as their masks. // This function draws primitive elements as well as their masks.
void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, void HighColorStyle::drawPrimitive( TQ_PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -458,7 +460,7 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
// Small hack to ensure scrollbar gradients are drawn the right way. // Small hack to ensure scrollbar gradients are drawn the right way.
flags ^= Style_Horizontal; flags ^= Style_Horizontal;
tqdrawPrimitive(PE_ButtonBevel, p, r, cg, flags | Style_Enabled | Style_Raised); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags | Style_Enabled | Style_Raised);
// Draw a scrollbar riffle (note direction after above changes) // Draw a scrollbar riffle (note direction after above changes)
if ( type != B3 ) { if ( type != B3 ) {
@ -597,21 +599,21 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
case PE_ScrollBarAddLine: { case PE_ScrollBarAddLine: {
tqdrawPrimitive( PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) | drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) |
((flags & Style_Down) ? Style_Down : Style_Raised) ); ((flags & Style_Down) ? Style_Down : Style_Raised) );
tqdrawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown),
p, r, cg, flags ); p, ceData, elementFlags, r, cg, flags );
break; break;
} }
case PE_ScrollBarSubLine: { case PE_ScrollBarSubLine: {
tqdrawPrimitive( PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) | drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) |
((flags & Style_Down) ? Style_Down : Style_Raised) ); ((flags & Style_Down) ? Style_Down : Style_Raised) );
tqdrawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp),
p, r, cg, flags ); p, ceData, elementFlags, r, cg, flags );
break; break;
} }
@ -764,7 +766,7 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
case PE_WindowFrame: case PE_WindowFrame:
case PE_PanelLineEdit: { case PE_PanelLineEdit: {
bool sunken = flags & Style_Sunken; bool sunken = flags & Style_Sunken;
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
: opt.lineWidth(); : opt.lineWidth();
if (lw == 2) if (lw == 2)
{ {
@ -787,7 +789,7 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
p->drawLine(x+1, y+1, x+1, y2-1); p->drawLine(x+1, y+1, x+1, y2-1);
p->setPen(oldPen); p->setPen(oldPen);
} else } else
KStyle::tqdrawPrimitive(pe, p, r, cg, flags, opt); KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
break; break;
} }
@ -799,7 +801,7 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
case PE_PanelDockWindow: { // Toolbar case PE_PanelDockWindow: { // Toolbar
int x2 = r.x()+r.width()-1; int x2 = r.x()+r.width()-1;
int y2 = r.y()+r.height()-1; int y2 = r.y()+r.height()-1;
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
: opt.lineWidth(); : opt.lineWidth();
if (lw) if (lw)
@ -893,8 +895,8 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
p->save(); p->save();
if ( flags & Style_Down ) if ( flags & Style_Down )
p->translate( pixelMetric( PM_ButtonShiftHorizontal ), p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ),
pixelMetric( PM_ButtonShiftVertical ) ); pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) );
if ( flags & Style_Enabled ) { if ( flags & Style_Enabled ) {
a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 ); a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
@ -911,7 +913,7 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
p->restore(); p->restore();
} else } else
KStyle::tqdrawPrimitive( pe, p, r, cg, flags, opt ); KStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
} }
} }
} }
@ -919,11 +921,13 @@ void HighColorStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
void HighColorStyle::drawKStylePrimitive( KStylePrimitive kpe, void HighColorStyle::drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption &opt ) const const TQStyleOption &opt,
const TQWidget* widget ) const
{ {
switch ( kpe ) switch ( kpe )
{ {
@ -1091,18 +1095,20 @@ void HighColorStyle::drawKStylePrimitive( KStylePrimitive kpe,
} }
default: default:
KStyle::drawKStylePrimitive( kpe, p, widget, r, cg, flags, opt); KStyle::drawKStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
void HighColorStyle::drawControl( TQ_ControlElement element, void HighColorStyle::drawControl( TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch (element) switch (element)
{ {
@ -1119,17 +1125,17 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
if ( btnDefault || button->autoDefault() ) { if ( btnDefault || button->autoDefault() ) {
// Compensate for default indicator // Compensate for default indicator
static int di = pixelMetric( PM_ButtonDefaultIndicator ); static int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
br.addCoords( di, di, -di, -di ); br.addCoords( di, di, -di, -di );
} }
if ( btnDefault ) if ( btnDefault )
tqdrawPrimitive( PE_ButtonDefault, p, r, cg, flags ); drawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags );
tqdrawPrimitive( PE_ButtonCommand, p, br, cg, flags ); drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags );
} else } else
tqdrawPrimitive( PE_ButtonCommand, p, r, cg, flags ); drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags );
break; break;
} }
@ -1145,15 +1151,15 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
// Shift button contents if pushed. // Shift button contents if pushed.
if ( active ) { if ( active ) {
x += pixelMetric(PM_ButtonShiftHorizontal, widget); x += pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget);
y += pixelMetric(PM_ButtonShiftVertical, widget); y += pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget);
flags |= Style_Sunken; flags |= Style_Sunken;
} }
// Does the button have a popup menu? // Does the button have a popup menu?
if ( button->isMenuButton() ) { if ( button->isMenuButton() ) {
int dx = pixelMetric( PM_MenuButtonIndicator, widget ); int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget );
tqdrawPrimitive( PE_ArrowDown, p, TQRect(x + w - dx - 2, y + 2, dx, h - 4), drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect(x + w - dx - 2, y + 2, dx, h - 4),
cg, flags, opt ); cg, flags, opt );
w -= dx; w -= dx;
} }
@ -1210,8 +1216,8 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
// Draw a focus rect if the button has focus // Draw a focus rect if the button has focus
if ( flags & Style_HasFocus ) if ( flags & Style_HasFocus )
tqdrawPrimitive( PE_FocusRect, p, drawPrimitive( PE_FocusRect, p, ceData, elementFlags,
TQStyle::visualRect(subRect(SR_PushButtonFocusRect, widget), widget), TQStyle::visualRect(subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget), ceData, elementFlags),
cg, flags ); cg, flags );
break; break;
} }
@ -1297,7 +1303,7 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
bool enabled = mi->isEnabled(); bool enabled = mi->isEnabled();
bool checkable = popupmenu->isCheckable(); bool checkable = popupmenu->isCheckable();
bool active = flags & Style_Active; bool active = flags & Style_Active;
bool etchtext = styleHint( SH_EtchDisabledText ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
int x, y, w, h; int x, y, w, h;
r.rect( &x, &y, &w, &h ); r.rect( &x, &y, &w, &h );
@ -1362,7 +1368,7 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
SFlags cflags = Style_Default; SFlags cflags = Style_Default;
cflags |= active ? Style_Enabled : Style_On; cflags |= active ? Style_Enabled : Style_On;
tqdrawPrimitive( PE_CheckMark, p, TQRect( cx + itemFrame, y + itemFrame, drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame,
checkcol - itemFrame*2, h - itemFrame*2), cg, cflags ); checkcol - itemFrame*2, h - itemFrame*2), cg, cflags );
} }
@ -1463,7 +1469,7 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
// Does the menu item have a submenu? // Does the menu item have a submenu?
if ( mi->popup() ) { if ( mi->popup() ) {
TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
int dim = pixelMetric(PM_MenuButtonIndicator); int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags);
TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim, TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim,
y + h / 2 - dim / 2, dim, dim), r ); y + h / 2 - dim / 2, dim, dim), r );
@ -1475,25 +1481,27 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
TQColorGroup g2( discol, cg.highlight(), white, white, TQColorGroup g2( discol, cg.highlight(), white, white,
enabled ? white : discol, discol, white ); enabled ? white : discol, discol, white );
tqdrawPrimitive( arrow, p, vr, g2, Style_Enabled ); drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled );
} else } else
tqdrawPrimitive( arrow, p, vr, cg, drawPrimitive( arrow, p, ceData, elementFlags, vr, cg,
enabled ? Style_Enabled : Style_Default ); enabled ? Style_Enabled : Style_Default );
} }
break; break;
} }
default: default:
KStyle::drawControl(element, p, widget, r, cg, flags, opt); KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
void HighColorStyle::drawControlMask( TQ_ControlElement element, void HighColorStyle::drawControlMask( TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch (element) switch (element)
{ {
@ -1510,20 +1518,22 @@ void HighColorStyle::drawControlMask( TQ_ControlElement element,
} }
default: default:
KStyle::drawControlMask(element, p, widget, r, opt); KStyle::drawControlMask(element, p, ceData, elementFlags, r, opt, widget);
} }
} }
void HighColorStyle::drawComplexControl( TQ_ComplexControl control, void HighColorStyle::drawComplexControl( TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
SCFlags controls, SCFlags controls,
SCFlags active, SCFlags active,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch(control) switch(control)
{ {
@ -1567,8 +1577,8 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control,
// Get the button bounding box // Get the button bounding box
TQRect ar = TQStyle::visualRect( TQRect ar = TQStyle::visualRect(
querySubControlMetrics(CC_ComboBox, widget, SC_ComboBoxArrow), querySubControlMetrics(CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget),
widget ); ceData, elementFlags );
// Are we enabled? // Are we enabled?
if ( widget->isEnabled() ) if ( widget->isEnabled() )
@ -1578,7 +1588,7 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control,
if ( active & Style_Sunken ) if ( active & Style_Sunken )
flags |= Style_Sunken; flags |= Style_Sunken;
tqdrawPrimitive(PE_ArrowDown, p, ar, cg, flags); drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags);
} }
// Draw an edit field if required // Draw an edit field if required
@ -1586,8 +1596,8 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control,
{ {
const TQComboBox * cb = (const TQComboBox *) widget; const TQComboBox * cb = (const TQComboBox *) widget;
TQRect re = TQStyle::visualRect( TQRect re = TQStyle::visualRect(
querySubControlMetrics( CC_ComboBox, widget, querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
SC_ComboBoxEditField), widget ); SC_ComboBoxEditField, TQStyleOption::Default, widget), ceData, elementFlags );
// Draw the indent // Draw the indent
if (cb->editable()) { if (cb->editable()) {
@ -1610,9 +1620,9 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control,
cg.brush( TQColorGroup::Highlight ) ); cg.brush( TQColorGroup::Highlight ) );
TQRect re = TQStyle::visualRect( TQRect re = TQStyle::visualRect(
subRect(SR_ComboBoxFocusRect, cb), widget); subRect(SR_ComboBoxFocusRect, ceData, elementFlags, cb), ceData, elementFlags);
tqdrawPrimitive( PE_FocusRect, p, re, cg, drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg,
Style_FocusAtBorder, TQStyleOption(cg.highlight())); Style_FocusAtBorder, TQStyleOption(cg.highlight()));
} }
} }
@ -1625,8 +1635,8 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control,
const TQToolButton *toolbutton = (const TQToolButton *) widget; const TQToolButton *toolbutton = (const TQToolButton *) widget;
TQRect button, menuarea; TQRect button, menuarea;
button = querySubControlMetrics(control, widget, SC_ToolButton, opt); button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget);
menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget);
SFlags bflags = flags, SFlags bflags = flags,
mflags = flags; mflags = flags;
@ -1640,7 +1650,7 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control,
{ {
// If we're pressed, on, or raised... // If we're pressed, on, or raised...
if (bflags & (Style_Down | Style_On | Style_Raised)) if (bflags & (Style_Down | Style_On | Style_Raised))
tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
// Check whether to draw a background pixmap // Check whether to draw a background pixmap
else if ( toolbutton->parentWidget() && else if ( toolbutton->parentWidget() &&
@ -1682,14 +1692,14 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control,
if (controls & SC_ToolButtonMenu) if (controls & SC_ToolButtonMenu)
{ {
if (mflags & (Style_Down | Style_On | Style_Raised)) if (mflags & (Style_Down | Style_On | Style_Raised))
tqdrawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, opt); drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
tqdrawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, opt); drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
} }
if (toolbutton->hasFocus() && !toolbutton->focusProxy()) { if (toolbutton->hasFocus() && !toolbutton->focusProxy()) {
TQRect fr = toolbutton->rect(); TQRect fr = toolbutton->rect();
fr.addCoords(3, 3, -3, -3); fr.addCoords(3, 3, -3, -3);
tqdrawPrimitive(PE_FocusRect, p, fr, cg); drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg);
} }
break; break;
@ -1697,8 +1707,8 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control,
default: default:
KStyle::drawComplexControl(control, p, widget, KStyle::drawComplexControl(control, p, ceData, elementFlags,
r, cg, flags, controls, active, opt); r, cg, flags, controls, active, opt, widget);
break; break;
} }
} }
@ -1706,9 +1716,11 @@ void HighColorStyle::drawComplexControl( TQ_ComplexControl control,
void HighColorStyle::drawComplexControlMask( TQ_ComplexControl control, void HighColorStyle::drawComplexControlMask( TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch (control) switch (control)
{ {
@ -1726,7 +1738,7 @@ void HighColorStyle::drawComplexControlMask( TQ_ComplexControl control,
} }
default: default:
KStyle::drawComplexControlMask(control, p, widget, r, opt); KStyle::drawComplexControlMask(control, p, ceData, elementFlags, r, opt, widget);
} }
} }
@ -1758,7 +1770,7 @@ void HighColorStyle::drawItem( TQPainter *p,
} }
TQRect HighColorStyle::subRect(SubRect r, const TQWidget *widget) const TQRect HighColorStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
// We want the focus rect for buttons to be adjusted from // We want the focus rect for buttons to be adjusted from
// the Qt3 defaults to be similar to Qt 2's defaults. // the Qt3 defaults to be similar to Qt 2's defaults.
@ -1769,11 +1781,11 @@ TQRect HighColorStyle::subRect(SubRect r, const TQWidget *widget) const
int dbw1 = 0, dbw2 = 0; int dbw1 = 0, dbw2 = 0;
if (button->isDefault() || button->autoDefault()) { if (button->isDefault() || button->autoDefault()) {
dbw1 = pixelMetric(PM_ButtonDefaultIndicator, widget); dbw1 = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget);
dbw2 = dbw1 * 2; dbw2 = dbw1 * 2;
} }
int dfw1 = pixelMetric(PM_DefaultFrameWidth, widget) * 2, int dfw1 = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2,
dfw2 = dfw1 * 2; dfw2 = dfw1 * 2;
return TQRect(wrect.x() + dfw1 + dbw1 + 1, return TQRect(wrect.x() + dfw1 + dbw1 + 1,
@ -1781,11 +1793,11 @@ TQRect HighColorStyle::subRect(SubRect r, const TQWidget *widget) const
wrect.width() - dfw2 - dbw2 - 1, wrect.width() - dfw2 - dbw2 - 1,
wrect.height() - dfw2 - dbw2 - 1); wrect.height() - dfw2 - dbw2 - 1);
} else } else
return KStyle::subRect(r, widget); return KStyle::subRect(r, ceData, elementFlags, widget);
} }
int HighColorStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const int HighColorStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
switch(m) switch(m)
{ {
@ -1818,15 +1830,17 @@ int HighColorStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const
} }
default: default:
return KStyle::pixelMetric(m, widget); return KStyle::pixelMetric(m, ceData, elementFlags, widget);
} }
} }
TQSize HighColorStyle::tqsizeFromContents( ContentsType contents, TQSize HighColorStyle::sizeFromContents( ContentsType contents,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentSize, const TQSize &contentSize,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget* widget ) const
{ {
switch (contents) switch (contents)
{ {
@ -1836,8 +1850,8 @@ TQSize HighColorStyle::tqsizeFromContents( ContentsType contents,
const TQPushButton* button = (const TQPushButton*) widget; const TQPushButton* button = (const TQPushButton*) widget;
int w = contentSize.width(); int w = contentSize.width();
int h = contentSize.height(); int h = contentSize.height();
int bm = pixelMetric( PM_ButtonMargin, widget ); int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget );
int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2; int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2;
w += bm + fw + 6; // ### Add 6 to make way for bold font. w += bm + fw + 6; // ### Add 6 to make way for bold font.
h += bm + fw; h += bm + fw;
@ -1849,7 +1863,7 @@ TQSize HighColorStyle::tqsizeFromContents( ContentsType contents,
if ( type != HighColor ) { if ( type != HighColor ) {
// Compensate for default indicator // Compensate for default indicator
int di = pixelMetric( PM_ButtonDefaultIndicator ); int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
w += di * 2; w += di * 2;
h += di * 2; h += di * 2;
} }
@ -1921,15 +1935,17 @@ TQSize HighColorStyle::tqsizeFromContents( ContentsType contents,
default: default:
return KStyle::tqsizeFromContents( contents, widget, contentSize, opt ); return KStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget );
} }
} }
// Fix Qt's wacky image alignment // Fix Qt's wacky image alignment
TQPixmap HighColorStyle::stylePixmap(StylePixmap stylepixmap, TQPixmap HighColorStyle::stylePixmap(StylePixmap stylepixmap,
const TQWidget* widget, TQStyleControlElementData ceData,
const TQStyleOption& opt) const ControlElementFlags elementFlags,
const TQStyleOption& opt,
const TQWidget* widget) const
{ {
switch (stylepixmap) { switch (stylepixmap) {
case SP_TitleBarMinButton: case SP_TitleBarMinButton:
@ -1940,7 +1956,7 @@ TQPixmap HighColorStyle::stylePixmap(StylePixmap stylepixmap,
break; break;
} }
return KStyle::stylePixmap(stylepixmap, widget, opt); return KStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget);
} }

@ -73,14 +73,18 @@ class HighColorStyle : public KStyle
void drawKStylePrimitive( KStylePrimitive kpe, void drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, 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 tqdrawPrimitive( TQ_PrimitiveElement pe, void drawPrimitive( TQ_PrimitiveElement pe,
TQPainter* p, TQPainter* p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -88,33 +92,41 @@ class HighColorStyle : public KStyle
void drawControl( TQ_ControlElement element, void drawControl( TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, 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( TQ_ControlElement element, void drawControlMask( TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControl( TQ_ComplexControl control, void drawComplexControl( TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, 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;
void drawComplexControlMask( TQ_ComplexControl control, void drawComplexControlMask( TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawItem( TQPainter *p, void drawItem( TQPainter *p,
const TQRect &r, const TQRect &r,
@ -126,21 +138,25 @@ class HighColorStyle : public KStyle
int len = -1, int len = -1,
const TQColor *penColor = 0 ) const; const TQColor *penColor = 0 ) const;
int pixelMetric( PixelMetric m, int pixelMetric( PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQWidget *widget = 0 ) const; const TQWidget *widget = 0 ) const;
TQSize tqsizeFromContents( ContentsType contents, TQSize sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentSize, const TQSize &contentSize,
const TQStyleOption& opt ) const; const TQStyleOption& opt,
const TQWidget *widget ) const;
TQRect subRect( SubRect r, TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags,
const TQWidget *widget ) const; const TQWidget *widget ) const;
// Fix Qt3's wacky image positions // Fix Qt3's wacky image positions
TQPixmap stylePixmap( StylePixmap stylepixmap, TQPixmap stylePixmap( StylePixmap stylepixmap,
const TQWidget *widget = 0, TQStyleControlElementData ceData,
const TQStyleOption& = TQStyleOption::Default ) const; ControlElementFlags elementFlags,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
protected: protected:
bool eventFilter( TQObject *object, TQEvent *event ); bool eventFilter( TQObject *object, TQEvent *event );

@ -327,6 +327,8 @@ void HighContrastStyle::drawArrow (TQPainter* p, TQRect r, TQ_PrimitiveElement a
// This function draws primitive elements // This function draws primitive elements
void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe, void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -574,7 +576,7 @@ void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe,
setColorsText (p, cg, flags, 0); setColorsText (p, cg, flags, 0);
drawRoundRect (p, r); drawRoundRect (p, r);
if (flags & (Style_HasFocus | Style_Active)) if (flags & (Style_HasFocus | Style_Active))
tqdrawPrimitive (PE_FocusRect, p, r, cg, flags, TQStyleOption (p->backgroundColor())); tqdrawPrimitive (PE_FocusRect, p, ceData, elementFlags, r, cg, flags, TQStyleOption (p->backgroundColor()));
break; break;
} }
case PE_PanelTabWidget: case PE_PanelTabWidget:
@ -634,7 +636,7 @@ void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe,
} }
default: { default: {
KStyle::tqdrawPrimitive( pe, p, r, cg, flags, opt ); KStyle::tqdrawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
} }
} }
} }
@ -642,11 +644,13 @@ void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe,
void HighContrastStyle::drawKStylePrimitive (KStylePrimitive kpe, void HighContrastStyle::drawKStylePrimitive (KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption &opt ) const const TQStyleOption &opt,
const TQWidget* widget ) const
{ {
if ( widget == hoverWidget ) if ( widget == hoverWidget )
flags |= Style_MouseOver; flags |= Style_MouseOver;
@ -728,18 +732,20 @@ void HighContrastStyle::drawKStylePrimitive (KStylePrimitive kpe,
// TODO Draw (thick) dotted line. Check kstyle.cpp // TODO Draw (thick) dotted line. Check kstyle.cpp
// Fall down for now // Fall down for now
default: default:
KStyle::drawKStylePrimitive( kpe, p, widget, r, cg, flags, opt); KStyle::drawKStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
void HighContrastStyle::drawControl (TQ_ControlElement element, void HighContrastStyle::drawControl (TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
if ( widget == hoverWidget ) if ( widget == hoverWidget )
flags |= Style_MouseOver; flags |= Style_MouseOver;
@ -793,14 +799,14 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
if (( btnDefault || button->autoDefault() ) && (button->isEnabled())) { if (( btnDefault || button->autoDefault() ) && (button->isEnabled())) {
// Compensate for default indicator // Compensate for default indicator
static int di = pixelMetric( PM_ButtonDefaultIndicator ); static int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
addOffset (&br, di); addOffset (&br, di);
} }
if ( btnDefault && (button->isEnabled())) if ( btnDefault && (button->isEnabled()))
tqdrawPrimitive( PE_ButtonDefault, p, r, cg, flags ); tqdrawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags );
tqdrawPrimitive( PE_ButtonCommand, p, br, cg, flags ); tqdrawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags );
break; break;
} }
@ -864,7 +870,7 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
// Does the button have a popup menu? // Does the button have a popup menu?
if (popup) { if (popup) {
int dx = pixelMetric (PM_MenuButtonIndicator, widget); int dx = pixelMetric (PM_MenuButtonIndicator, ceData, elementFlags, widget);
drawArrow (p, TQRect(x + w - dx - 2, y + 2, dx, h - 4), PE_ArrowDown); drawArrow (p, TQRect(x + w - dx - 2, y + 2, dx, h - 4), PE_ArrowDown);
w -= dx; w -= dx;
} }
@ -886,7 +892,7 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
// Draw a focus rect if the button has focus // Draw a focus rect if the button has focus
if (flags & Style_HasFocus) if (flags & Style_HasFocus)
tqdrawPrimitive (PE_FocusRect, p, r, cg, flags, TQStyleOption (p->backgroundColor())); tqdrawPrimitive (PE_FocusRect, p, ceData, elementFlags, r, cg, flags, TQStyleOption (p->backgroundColor()));
// Draw the label itself // Draw the label itself
TQColor color = p->pen().color(); TQColor color = p->pen().color();
@ -931,14 +937,14 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
// CHECKBOX // CHECKBOX
// ------------------------------------------------------------------- // -------------------------------------------------------------------
case CE_CheckBox: { case CE_CheckBox: {
tqdrawPrimitive (PE_Indicator, p, r, cg, flags); tqdrawPrimitive (PE_Indicator, p, ceData, elementFlags, r, cg, flags);
break; break;
} }
// RADIOBUTTON // RADIOBUTTON
// ------------------------------------------------------------------- // -------------------------------------------------------------------
case CE_RadioButton: { case CE_RadioButton: {
tqdrawPrimitive (PE_ExclusiveIndicator, p, r, cg, flags); tqdrawPrimitive (PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, flags);
break; break;
} }
@ -1122,7 +1128,7 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
// Does the menu item have a submenu? // Does the menu item have a submenu?
if ( mi->popup() ) { if ( mi->popup() ) {
TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
int dim = pixelMetric(PM_MenuButtonIndicator); int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags);
TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim, TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim,
y + h / 2 - dim / 2, dim, dim), r ); y + h / 2 - dim / 2, dim, dim), r );
@ -1133,15 +1139,17 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
} }
default: default:
KStyle::drawControl(element, p, widget, r, cg, flags, opt); KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
void HighContrastStyle::drawControlMask (TQ_ControlElement element, void HighContrastStyle::drawControlMask (TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *w, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &opt) const const TQStyleOption &opt,
const TQWidget *w) const
{ {
switch (element) { switch (element) {
case CE_PushButton: case CE_PushButton:
@ -1161,7 +1169,7 @@ void HighContrastStyle::drawControlMask (TQ_ControlElement element,
} }
default: { default: {
KStyle::drawControlMask (element, p, w, r, opt); KStyle::drawControlMask (element, p, ceData, elementFlags, r, opt, w);
} }
} }
} }
@ -1182,13 +1190,15 @@ static TQListViewItem* nextVisibleSibling(TQListViewItem* item)
void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
SCFlags controls, SCFlags controls,
SCFlags active, SCFlags active,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
if ( widget == hoverWidget ) if ( widget == hoverWidget )
flags |= Style_MouseOver; flags |= Style_MouseOver;
@ -1201,7 +1211,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
setColorsText (p, cg, flags); setColorsText (p, cg, flags);
drawRoundRect (p, r); drawRoundRect (p, r);
TQRect r2 = TQStyle::visualRect (querySubControlMetrics (CC_ComboBox, widget, SC_ComboBoxArrow), widget); TQRect r2 = TQStyle::visualRect (querySubControlMetrics (CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget), ceData, elementFlags);
if (flags & Style_HasFocus) { if (flags & Style_HasFocus) {
TQRect r3 (r); TQRect r3 (r);
if (r2.left() > 0) if (r2.left() > 0)
@ -1209,7 +1219,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
else else
r3.setLeft (r2.right()-basicLineWidth+1); r3.setLeft (r2.right()-basicLineWidth+1);
tqdrawPrimitive (PE_FocusRect, p, r3, cg, flags, TQStyleOption (p->backgroundColor())); tqdrawPrimitive (PE_FocusRect, p, ceData, elementFlags, r3, cg, flags, TQStyleOption (p->backgroundColor()));
} }
setColorsButton (p, cg, flags); setColorsButton (p, cg, flags);
@ -1230,18 +1240,18 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
setColorsText (p, cg, flags); setColorsText (p, cg, flags);
drawRoundRect (p, r); drawRoundRect (p, r);
if (flags & Style_HasFocus) if (flags & Style_HasFocus)
tqdrawPrimitive(PE_FocusRect, p, r, cg, flags, TQStyleOption (p->backgroundColor())); tqdrawPrimitive(PE_FocusRect, p, ceData, elementFlags, r, cg, flags, TQStyleOption (p->backgroundColor()));
} }
setColorsButton (p, cg, flags); setColorsButton (p, cg, flags);
// Draw arrows if required // Draw arrows if required
if (controls & SC_SpinWidgetDown) { if (controls & SC_SpinWidgetDown) {
TQRect r2 = TQStyle::visualRect (querySubControlMetrics ((TQ_ComplexControl)CC_SpinWidget, widget, SC_SpinWidgetDown), widget); TQRect r2 = TQStyle::visualRect (querySubControlMetrics ((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetDown, TQStyleOption::Default, widget), ceData, elementFlags);
drawRoundRect (p, r2); drawRoundRect (p, r2);
drawArrow (p, r2, PE_SpinWidgetDown, 2*basicLineWidth); drawArrow (p, r2, PE_SpinWidgetDown, 2*basicLineWidth);
} }
if (controls & SC_SpinWidgetUp) { if (controls & SC_SpinWidgetUp) {
TQRect r2 = TQStyle::visualRect (querySubControlMetrics ((TQ_ComplexControl)CC_SpinWidget, widget, SC_SpinWidgetUp), widget); TQRect r2 = TQStyle::visualRect (querySubControlMetrics ((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetUp, TQStyleOption::Default, widget), ceData, elementFlags);
drawRoundRect (p, r2); drawRoundRect (p, r2);
drawArrow (p, r2, PE_SpinWidgetUp, 2*basicLineWidth); drawArrow (p, r2, PE_SpinWidgetUp, 2*basicLineWidth);
} }
@ -1259,8 +1269,8 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
p->fillRect (r, p->backgroundColor ()); p->fillRect (r, p->backgroundColor ());
TQRect button, menuarea; TQRect button, menuarea;
button = querySubControlMetrics(control, widget, SC_ToolButton, opt); button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget);
menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget);
SFlags bflags = flags, SFlags bflags = flags,
mflags = flags; mflags = flags;
@ -1274,7 +1284,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
{ {
// If we're pressed, on, or raised... // If we're pressed, on, or raised...
if (bflags & (Style_Down | Style_On | Style_Raised)) if (bflags & (Style_Down | Style_On | Style_Raised))
tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); tqdrawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
// Check whether to draw a background pixmap // Check whether to draw a background pixmap
else if ( toolbutton->parentWidget() && else if ( toolbutton->parentWidget() &&
@ -1290,14 +1300,14 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
if (controls & SC_ToolButtonMenu) if (controls & SC_ToolButtonMenu)
{ {
if (mflags & (Style_Down | Style_On | Style_Raised)) if (mflags & (Style_Down | Style_On | Style_Raised))
tqdrawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, opt); tqdrawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
drawArrow (p, menuarea, PE_ArrowDown); drawArrow (p, menuarea, PE_ArrowDown);
} }
if (toolbutton->hasFocus() && !toolbutton->focusProxy()) { if (toolbutton->hasFocus() && !toolbutton->focusProxy()) {
TQRect fr = toolbutton->rect(); TQRect fr = toolbutton->rect();
addOffset (&fr, 3); addOffset (&fr, 3);
tqdrawPrimitive(PE_FocusRect, p, fr, cg, flags, TQStyleOption (p->backgroundColor())); tqdrawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags, TQStyleOption (p->backgroundColor()));
} }
break; break;
@ -1316,7 +1326,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
// Paint the icon and text. // Paint the icon and text.
if ( controls & SC_ListView ) if ( controls & SC_ListView )
TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags, controls, active, opt ); TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget );
// If we're have a branch or are expanded... // If we're have a branch or are expanded...
if ( controls & (SC_ListViewBranch | SC_ListViewExpand) ) if ( controls & (SC_ListViewBranch | SC_ListViewExpand) )
@ -1384,7 +1394,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
boxflags = child->isOpen() ? TQStyle::Style_Off : TQStyle::Style_On; boxflags = child->isOpen() ? TQStyle::Style_Off : TQStyle::Style_On;
// KStyle extension: Draw the box and expand/collapse indicator // KStyle extension: Draw the box and expand/collapse indicator
drawKStylePrimitive( KPE_ListViewExpander, p, NULL, boxrect, cg, boxflags, opt ); drawKStylePrimitive( KPE_ListViewExpander, p, ceData, elementFlags, boxrect, cg, boxflags, opt, NULL );
// dotlinery // dotlinery
p->setPen( cg.mid() ); p->setPen( cg.mid() );
@ -1438,7 +1448,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
branchflags = TQStyle::Style_Horizontal; branchflags = TQStyle::Style_Horizontal;
// KStyle extension: Draw the horizontal branch // KStyle extension: Draw the horizontal branch
drawKStylePrimitive( KPE_ListViewBranch, p, NULL, branchrect, cg, branchflags, opt ); drawKStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL );
} else { } else {
// Vertical branch // Vertical branch
@ -1454,7 +1464,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
branchflags = TQStyle::Style_Default; branchflags = TQStyle::Style_Default;
// KStyle extension: Draw the vertical branch // KStyle extension: Draw the vertical branch
drawKStylePrimitive( KPE_ListViewBranch, p, NULL, branchrect, cg, branchflags, opt ); drawKStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL );
} }
} }
} }
@ -1462,17 +1472,19 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
} }
default: default:
KStyle::drawComplexControl(control, p, widget, KStyle::drawComplexControl(control, p, ceData, elementFlags,
r, cg, flags, controls, active, opt); r, cg, flags, controls, active, opt, widget);
break; break;
} }
} }
void HighContrastStyle::drawComplexControlMask(TQ_ComplexControl c, void HighContrastStyle::drawComplexControlMask(TQ_ComplexControl c,
TQPainter *p, TQPainter *p,
const TQWidget *w, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &o) const const TQStyleOption &o,
const TQWidget *w) const
{ {
switch (c) { switch (c) {
case CC_SpinWidget: case CC_SpinWidget:
@ -1482,7 +1494,7 @@ void HighContrastStyle::drawComplexControlMask(TQ_ComplexControl c,
break; break;
} }
default: { default: {
KStyle::drawComplexControlMask (c, p, w, r, o); KStyle::drawComplexControlMask (c, p, ceData, elementFlags, r, o, w);
} }
} }
} }
@ -1512,14 +1524,16 @@ void HighContrastStyle::drawItem( TQPainter *p,
} }
TQRect HighContrastStyle::querySubControlMetrics( TQ_ComplexControl control, TQRect HighContrastStyle::querySubControlMetrics( TQ_ComplexControl control,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget* widget ) const
{ {
switch (control) switch (control)
{ {
case CC_ComboBox : { case CC_ComboBox : {
int arrow = pixelMetric (PM_ScrollBarExtent, widget); int arrow = pixelMetric (PM_ScrollBarExtent, ceData, elementFlags, widget);
switch (subcontrol) switch (subcontrol)
{ {
case SC_ComboBoxFrame: case SC_ComboBoxFrame:
@ -1535,7 +1549,7 @@ TQRect HighContrastStyle::querySubControlMetrics( TQ_ComplexControl control,
break; break;
} }
case CC_SpinWidget : { case CC_SpinWidget : {
int arrow = pixelMetric (PM_ScrollBarExtent, 0); int arrow = pixelMetric (PM_ScrollBarExtent, ceData, elementFlags, 0);
switch (subcontrol) switch (subcontrol)
{ {
case SC_SpinWidgetFrame: case SC_SpinWidgetFrame:
@ -1559,11 +1573,11 @@ TQRect HighContrastStyle::querySubControlMetrics( TQ_ComplexControl control,
default: break; default: break;
} }
return KStyle::querySubControlMetrics (control, widget, subcontrol, opt); return KStyle::querySubControlMetrics (control, ceData, elementFlags, subcontrol, opt, widget);
} }
int HighContrastStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const int HighContrastStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
//### TODO: Use the tab metrics changes from Ker. //### TODO: Use the tab metrics changes from Ker.
switch(m) switch(m)
@ -1647,7 +1661,7 @@ int HighContrastStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const
} }
default: default:
return KStyle::pixelMetric(m, widget); return KStyle::pixelMetric(m, ceData, elementFlags, widget);
} }
} }
@ -1663,10 +1677,12 @@ int HighContrastStyle::kPixelMetric( KStylePixelMetric kpm, const TQWidget *widg
} }
} }
TQSize HighContrastStyle::tqsizeFromContents( ContentsType contents, TQSize HighContrastStyle::sizeFromContents( ContentsType contents,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentSize, const TQSize &contentSize,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget* widget ) const
{ {
switch (contents) switch (contents)
{ {
@ -1676,8 +1692,8 @@ TQSize HighContrastStyle::tqsizeFromContents( ContentsType contents,
const TQPushButton* button = (const TQPushButton*) widget; const TQPushButton* button = (const TQPushButton*) widget;
int w = contentSize.width(); int w = contentSize.width();
int h = contentSize.height(); int h = contentSize.height();
int bm = pixelMetric( PM_ButtonMargin, widget ); int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget );
int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2; int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2;
w += bm + fw + 6; // ### Add 6 to make way for bold font. w += bm + fw + 6; // ### Add 6 to make way for bold font.
h += bm + fw; h += bm + fw;
@ -1688,7 +1704,7 @@ TQSize HighContrastStyle::tqsizeFromContents( ContentsType contents,
w = 80; w = 80;
// Compensate for default indicator // Compensate for default indicator
int di = pixelMetric( PM_ButtonDefaultIndicator ); int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
w += di * 2; w += di * 2;
h += di * 2; h += di * 2;
} }
@ -1713,7 +1729,7 @@ TQSize HighContrastStyle::tqsizeFromContents( ContentsType contents,
case CT_ComboBox: { case CT_ComboBox: {
const TQComboBox *cb = static_cast< const TQComboBox* > (widget); const TQComboBox *cb = static_cast< const TQComboBox* > (widget);
int borderSize = (cb->editable() ? 4 : 2) * basicLineWidth; int borderSize = (cb->editable() ? 4 : 2) * basicLineWidth;
int arrowSize = pixelMetric (PM_ScrollBarExtent, cb); int arrowSize = pixelMetric (PM_ScrollBarExtent, ceData, elementFlags, cb);
return TQSize(borderSize + basicLineWidth + arrowSize, borderSize) + contentSize; return TQSize(borderSize + basicLineWidth + arrowSize, borderSize) + contentSize;
} }
@ -1783,11 +1799,11 @@ TQSize HighContrastStyle::tqsizeFromContents( ContentsType contents,
default: default:
return KStyle::tqsizeFromContents( contents, widget, contentSize, opt ); return KStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget );
} }
} }
TQRect HighContrastStyle::subRect (SubRect subrect, const TQWidget * widget) const TQRect HighContrastStyle::subRect (SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget * widget) const
{ {
switch (subrect) { switch (subrect) {
case SR_ProgressBarGroove: case SR_ProgressBarGroove:
@ -1795,7 +1811,7 @@ TQRect HighContrastStyle::subRect (SubRect subrect, const TQWidget * widget) con
case SR_ProgressBarLabel: case SR_ProgressBarLabel:
return widget->rect(); return widget->rect();
default: default:
return KStyle::subRect (subrect, widget); return KStyle::subRect (subrect, ceData, elementFlags, widget);
} }
} }

@ -61,14 +61,18 @@ class HighContrastStyle : public KStyle
void drawKStylePrimitive( KStylePrimitive kpe, void drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, 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 tqdrawPrimitive( TQ_PrimitiveElement pe, void tqdrawPrimitive( TQ_PrimitiveElement pe,
TQPainter* p, TQPainter* p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -76,38 +80,48 @@ class HighContrastStyle : public KStyle
void drawControl( TQ_ControlElement element, void drawControl( TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, 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( TQ_ControlElement element, void drawControlMask( TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControl( TQ_ComplexControl control, void drawComplexControl( TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, 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;
void drawComplexControlMask( TQ_ComplexControl control, void drawComplexControlMask( TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQRect querySubControlMetrics( TQ_ComplexControl control, TQRect querySubControlMetrics( TQ_ComplexControl control,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption& opt = TQStyleOption::Default ) const; const TQStyleOption& opt = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
void drawItem( TQPainter *p, void drawItem( TQPainter *p,
@ -120,18 +134,20 @@ class HighContrastStyle : public KStyle
int len = -1, int len = -1,
const TQColor *penColor = 0 ) const; const TQColor *penColor = 0 ) const;
int pixelMetric( PixelMetric m, int pixelMetric( PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQWidget *widget = 0 ) const; const TQWidget *widget = 0 ) const;
int kPixelMetric( KStylePixelMetric m, int kPixelMetric( KStylePixelMetric m,
const TQWidget *widget = 0 ) const; const TQWidget *widget = 0 ) const;
TQSize tqsizeFromContents( ContentsType contents, TQSize sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentSize, const TQSize &contentSize,
const TQStyleOption& opt ) const; const TQStyleOption& opt,
const TQWidget *widget = 0 ) const;
TQRect subRect (SubRect subrect, const TQWidget * widget) const; TQRect subRect (SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget * widget) const;
protected: protected:
bool eventFilter( TQObject *object, TQEvent *event ); bool eventFilter( TQObject *object, TQEvent *event );

@ -147,8 +147,8 @@ namespace
p->save(); p->save();
/*if ( down ) /*if ( down )
p->translate( pixelMetric( PM_ButtonShiftHorizontal ), p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ),
pixelMetric( PM_ButtonShiftVertical ) ); pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) );
*/ */
if ( enabled ) { if ( enabled ) {
@ -189,7 +189,7 @@ void KeramikStyle::renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup &cg,
} }
// XXX // XXX
TQRect KeramikStyle::subRect(SubRect r, const TQWidget *widget) const TQRect KeramikStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
// We want the focus rect for buttons to be adjusted from // We want the focus rect for buttons to be adjusted from
// the Qt3 defaults to be similar to Qt 2's defaults. // the Qt3 defaults to be similar to Qt 2's defaults.
@ -215,7 +215,7 @@ TQRect KeramikStyle::subRect(SubRect r, const TQWidget *widget) const
case SR_ComboBoxFocusRect: case SR_ComboBoxFocusRect:
{ {
return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ); return querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget );
} }
case SR_CheckBoxFocusRect: case SR_CheckBoxFocusRect:
@ -240,14 +240,16 @@ TQRect KeramikStyle::subRect(SubRect r, const TQWidget *widget) const
} }
default: default:
return KStyle::subRect( r, widget ); return KStyle::subRect( r, ceData, elementFlags, widget );
} }
} }
TQPixmap KeramikStyle::stylePixmap(StylePixmap stylepixmap, TQPixmap KeramikStyle::stylePixmap(StylePixmap stylepixmap,
const TQWidget* widget, TQStyleControlElementData ceData,
const TQStyleOption& opt) const ControlElementFlags elementFlags,
const TQStyleOption& opt,
const TQWidget* widget) const
{ {
switch (stylepixmap) { switch (stylepixmap) {
case SP_TitleBarMinButton: case SP_TitleBarMinButton:
@ -270,7 +272,7 @@ TQPixmap KeramikStyle::stylePixmap(StylePixmap stylepixmap,
break; break;
} }
return KStyle::stylePixmap(stylepixmap, widget, opt); return KStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget);
} }
@ -533,8 +535,10 @@ static void renderToolbarWidgetBackground(TQPainter* painter, const TQWidget* wi
} }
// This function draws primitive elements as well as their masks. // This function draws primitive elements as well as their masks.
void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, void KeramikStyle::drawPrimitive( TQ_PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -750,8 +754,8 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
case PE_HeaderArrow: case PE_HeaderArrow:
if ( flags & Style_Up ) if ( flags & Style_Up )
tqdrawPrimitive( PE_ArrowUp, p, r, cg, Style_Enabled ); drawPrimitive( PE_ArrowUp, p, ceData, elementFlags, r, cg, Style_Enabled );
else tqdrawPrimitive( PE_ArrowDown, p, r, cg, Style_Enabled ); else drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, r, cg, Style_Enabled );
break; break;
@ -972,13 +976,13 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
return; return;
} }
} }
KStyle::tqdrawPrimitive(pe, p, r, cg, flags, opt); KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
break; break;
} }
case PE_WindowFrame: case PE_WindowFrame:
{ {
bool sunken = flags & Style_Sunken; bool sunken = flags & Style_Sunken;
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
: opt.lineWidth(); : opt.lineWidth();
if (lw == 2) if (lw == 2)
{ {
@ -1001,7 +1005,7 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
p->drawLine(x+1, y+1, x+1, y2-1); p->drawLine(x+1, y+1, x+1, y2-1);
p->setPen(oldPen); p->setPen(oldPen);
} else } else
KStyle::tqdrawPrimitive(pe, p, r, cg, flags, opt); KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
break; break;
} }
@ -1016,7 +1020,7 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
int x2 = r.x()+r.width()-1; int x2 = r.x()+r.width()-1;
int y2 = r.y()+r.height()-1; int y2 = r.y()+r.height()-1;
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
: opt.lineWidth(); : opt.lineWidth();
if (lw) if (lw)
{ {
@ -1036,7 +1040,7 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
int y = r.y(); int y = r.y();
int x2 = r.x() + r.width() - 1; int x2 = r.x() + r.width() - 1;
int y2 = r.y() + r.height() - 1; int y2 = r.y() + r.height() - 1;
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
: opt.lineWidth(); : opt.lineWidth();
if (lw) if (lw)
@ -1142,8 +1146,8 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
p->save(); p->save();
if ( flags & Style_Down ) if ( flags & Style_Down )
p->translate( pixelMetric( PM_ButtonShiftHorizontal ), p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ),
pixelMetric( PM_ButtonShiftVertical ) ); pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) );
if ( flags & Style_Enabled ) if ( flags & Style_Enabled )
{ {
@ -1164,18 +1168,20 @@ void KeramikStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
} }
else else
KStyle::tqdrawPrimitive( pe, p, r, cg, flags, opt ); KStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
} }
} }
} }
void KeramikStyle::drawKStylePrimitive( KStylePrimitive kpe, void KeramikStyle::drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption &opt ) const const TQStyleOption &opt,
const TQWidget* widget ) const
{ {
bool disabled = ( flags & Style_Enabled ) == 0; bool disabled = ( flags & Style_Enabled ) == 0;
int x, y, w, h; int x, y, w, h;
@ -1299,7 +1305,7 @@ void KeramikStyle::drawKStylePrimitive( KStylePrimitive kpe,
default: default:
KStyle::drawKStylePrimitive( kpe, p, widget, r, cg, flags, opt); KStyle::drawKStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
@ -1327,11 +1333,13 @@ bool KeramikStyle::isFormWidget(const TQWidget* widget) const
void KeramikStyle::drawControl( TQ_ControlElement element, void KeramikStyle::drawControl( TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
bool disabled = ( flags & Style_Enabled ) == 0; bool disabled = ( flags & Style_Enabled ) == 0;
int x, y, w, h; int x, y, w, h;
@ -1356,14 +1364,14 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
if ( btn->isDefault( ) && !flatMode ) if ( btn->isDefault( ) && !flatMode )
{ {
tqdrawPrimitive( PE_ButtonDefault, p, r, cg, flags ); drawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags );
} }
else else
{ {
if (widget->parent() && widget->parent()->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) if (widget->parent() && widget->parent()->inherits(TQTOOLBAR_OBJECT_NAME_STRING))
toolbarBlendWidget = widget; toolbarBlendWidget = widget;
tqdrawPrimitive( PE_ButtonCommand, p, r, cg, flags ); drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags );
toolbarBlendWidget = 0; toolbarBlendWidget = 0;
} }
@ -1383,15 +1391,15 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
// Shift button contents if pushed. // Shift button contents if pushed.
if ( active ) if ( active )
{ {
x += pixelMetric(PM_ButtonShiftHorizontal, widget); x += pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget);
y += pixelMetric(PM_ButtonShiftVertical, widget); y += pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget);
flags |= Style_Sunken; flags |= Style_Sunken;
} }
// Does the button have a popup menu? // Does the button have a popup menu?
if ( button->isMenuButton() ) if ( button->isMenuButton() )
{ {
int dx = pixelMetric( PM_MenuButtonIndicator, widget ); int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget );
if ( button->iconSet() && !button->iconSet()->isNull() && if ( button->iconSet() && !button->iconSet()->isNull() &&
(dx + button->iconSet()->pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w ) (dx + button->iconSet()->pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w )
{ {
@ -1399,7 +1407,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
} }
else else
{ {
tqdrawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ), drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ),
cg, flags, opt ); cg, flags, opt );
w -= dx; w -= dx;
} }
@ -1448,7 +1456,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
} }
if (cornArrow) //Draw over the icon if (cornArrow) //Draw over the icon
tqdrawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ), drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ),
cg, flags, opt ); cg, flags, opt );
} }
@ -1458,8 +1466,8 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
&button->colorGroup().buttonText() ); &button->colorGroup().buttonText() );
if ( flags & Style_HasFocus ) if ( flags & Style_HasFocus )
tqdrawPrimitive( PE_FocusRect, p, drawPrimitive( PE_FocusRect, p, ceData, elementFlags,
visualRect( subRect( SR_PushButtonFocusRect, widget ), widget ), visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ),
cg, flags ); cg, flags );
break; break;
} }
@ -1488,7 +1496,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
// nr.setWidth(r.width()-2); //Account for shadow // nr.setWidth(r.width()-2); //Account for shadow
} }
KStyle::drawControl(element, p, widget, nr, cg, flags, opt); KStyle::drawControl(element, p, ceData, elementFlags, nr, cg, flags, opt, widget);
break; break;
} }
@ -1553,8 +1561,8 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
tb->orientation() == Qt::Horizontal); tb->orientation() == Qt::Horizontal);
} }
else else
KStyle::drawControl( (TQ_ControlElement)CE_DockWindowEmptyArea, p, KStyle::drawControl( (TQ_ControlElement)CE_DockWindowEmptyArea, p, ceData, elementFlags,
widget, r, cg, flags, opt ); r, cg, flags, opt, widget );
break; break;
} }
case CE_MenuBarEmptyArea: case CE_MenuBarEmptyArea:
@ -1609,7 +1617,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
bool enabled = mi->isEnabled(); bool enabled = mi->isEnabled();
bool checkable = popupmenu->isCheckable(); bool checkable = popupmenu->isCheckable();
bool active = flags & Style_Active; bool active = flags & Style_Active;
bool etchtext = styleHint( SH_EtchDisabledText ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
if ( checkable ) if ( checkable )
checkcol = QMAX( checkcol, 20 ); checkcol = QMAX( checkcol, 20 );
@ -1682,7 +1690,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
SFlags cflags = Style_Default; SFlags cflags = Style_Default;
cflags |= active ? Style_Enabled : Style_On; cflags |= active ? Style_Enabled : Style_On;
tqdrawPrimitive( PE_CheckMark, p, cr, cg, cflags ); drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags );
} }
// Time to draw the menu item label... // Time to draw the menu item label...
@ -1789,7 +1797,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
// Does the menu item have a submenu? // Does the menu item have a submenu?
if ( mi->popup() ) { if ( mi->popup() ) {
TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
int dim = pixelMetric(PM_MenuButtonIndicator) - itemFrame; int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags) - itemFrame;
TQRect vr = visualRect( TQRect( x + w - arrowHMargin - itemFrame - dim, TQRect vr = visualRect( TQRect( x + w - arrowHMargin - itemFrame - dim,
y + h / 2 - dim / 2, dim, dim), r ); y + h / 2 - dim / 2, dim, dim), r );
@ -1801,16 +1809,16 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
TQColorGroup g2( discol, cg.highlight(), white, white, TQColorGroup g2( discol, cg.highlight(), white, white,
enabled ? white : discol, discol, white ); enabled ? white : discol, discol, white );
tqdrawPrimitive( arrow, p, vr, g2, Style_Enabled ); drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled );
} else } else
tqdrawPrimitive( arrow, p, vr, cg, drawPrimitive( arrow, p, ceData, elementFlags, vr, cg,
enabled ? Style_Enabled : Style_Default ); enabled ? Style_Enabled : Style_Default );
} }
break; break;
} }
case CE_ProgressBarContents: { case CE_ProgressBarContents: {
const TQProgressBar* pb = (const TQProgressBar*)widget; const TQProgressBar* pb = (const TQProgressBar*)widget;
TQRect cr = subRect(SR_ProgressBarContents, widget); TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget);
double progress = pb->progress(); double progress = pb->progress();
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
int steps = pb->totalSteps(); int steps = pb->totalSteps();
@ -1916,19 +1924,21 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
default: default:
KStyle::drawControl(element, p, widget, r, cg, flags, opt); KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
void KeramikStyle::drawControlMask( TQ_ControlElement element, void KeramikStyle::drawControlMask( TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
p->fillRect(r, color1); p->fillRect(r, color1);
maskMode = true; maskMode = true;
drawControl( element, p, widget, r, TQApplication::palette().active(), TQStyle::Style_Default, opt); drawControl( element, p, ceData, elementFlags, r, TQApplication::palette().active(), TQStyle::Style_Default, opt, widget);
maskMode = false; maskMode = false;
} }
@ -1946,13 +1956,15 @@ bool KeramikStyle::isSizeConstrainedCombo(const TQComboBox* combo) const
void KeramikStyle::drawComplexControl( TQ_ComplexControl control, void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
SCFlags controls, SCFlags controls,
SCFlags active, SCFlags active,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
bool disabled = ( flags & Style_Enabled ) == 0; bool disabled = ( flags & Style_Enabled ) == 0;
switch(control) switch(control)
@ -2016,7 +2028,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
if ( widget == hoverWidget ) if ( widget == hoverWidget )
flags |= Style_MouseOver; flags |= Style_MouseOver;
tqdrawPrimitive( PE_ButtonCommand, p2, br, cg, flags ); drawPrimitive( PE_ButtonCommand, p2, ceData, elementFlags, br, cg, flags );
toolbarBlendWidget = 0; toolbarBlendWidget = 0;
} }
@ -2030,18 +2042,18 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
if ( active ) if ( active )
flags |= Style_On; flags |= Style_On;
TQRect ar = querySubControlMetrics( CC_ComboBox, widget, TQRect ar = querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
SC_ComboBoxArrow ); SC_ComboBoxArrow, TQStyleOption::Default, widget );
if (!compact) if (!compact)
{ {
ar.setWidth(ar.width()-13); ar.setWidth(ar.width()-13);
TQRect rr = visualRect( TQRect( ar.x(), ar.y() + 4, TQRect rr = visualRect( TQRect( ar.x(), ar.y() + 4,
loader.size(keramik_ripple ).width(), ar.height() - 8 ), loader.size(keramik_ripple ).width(), ar.height() - 8 ),
widget ); ceData, elementFlags );
ar = visualRect( TQRect( ar.x() + loader.size( keramik_ripple ).width() + 4, ar.y(), ar = visualRect( TQRect( ar.x() + loader.size( keramik_ripple ).width() + 4, ar.y(),
11, ar.height() ), 11, ar.height() ),
widget ); ceData, elementFlags );
TQPointArray a; TQPointArray a;
@ -2056,7 +2068,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
else //Size-constrained combo -- loose the ripple. else //Size-constrained combo -- loose the ripple.
{ {
ar.setWidth(ar.width() - 7); ar.setWidth(ar.width() - 7);
ar = visualRect( TQRect( ar.x(), ar.y(), 11, ar.height() ), widget); ar = visualRect( TQRect( ar.x(), ar.y(), 11, ar.height() ), ceData, elementFlags);
TQPointArray a; TQPointArray a;
a.setPoints(TQCOORDARRLEN(keramik_combo_arrow), keramik_combo_arrow); a.setPoints(TQCOORDARRLEN(keramik_combo_arrow), keramik_combo_arrow);
@ -2071,20 +2083,20 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
{ {
if ( cb->editable() ) if ( cb->editable() )
{ {
TQRect er = visualRect( querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ), widget ); TQRect er = visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget ), ceData, elementFlags );
er.addCoords( -2, -2, 2, 2 ); er.addCoords( -2, -2, 2, 2 );
p2->fillRect( er, cg.base() ); p2->fillRect( er, cg.base() );
tqdrawPrimitive( PE_PanelLineEdit, p2, er, cg ); drawPrimitive( PE_PanelLineEdit, p2, ceData, elementFlags, er, cg );
Keramik::RectTilePainter( keramik_frame_shadow, false, false, 2, 2 ).draw( p2, er, cg.button(), Keramik::RectTilePainter( keramik_frame_shadow, false, false, 2, 2 ).draw( p2, er, cg.button(),
Qt::black, false, pmodeFullBlend() ); Qt::black, false, pmodeFullBlend() );
} }
else if ( cb->hasFocus() ) else if ( cb->hasFocus() )
{ {
TQRect re = TQStyle::visualRect(subRect(SR_ComboBoxFocusRect, cb), widget); TQRect re = TQStyle::visualRect(subRect(SR_ComboBoxFocusRect, ceData, elementFlags, cb), ceData, elementFlags);
if ( compact ) if ( compact )
re.addCoords( 3, 3, 0, -3 ); re.addCoords( 3, 3, 0, -3 );
p2->fillRect( re, cg.brush( TQColorGroup::Highlight ) ); p2->fillRect( re, cg.brush( TQColorGroup::Highlight ) );
tqdrawPrimitive( PE_FocusRect, p2, re, cg, drawPrimitive( PE_FocusRect, p2, ceData, elementFlags, re, cg,
Style_FocusAtBorder, TQStyleOption( cg.highlight() ) ); Style_FocusAtBorder, TQStyleOption( cg.highlight() ) );
} }
// TQComboBox draws the text on its own and uses the painter's current colors // TQComboBox draws the text on its own and uses the painter's current colors
@ -2115,7 +2127,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
case CC_SpinWidget: case CC_SpinWidget:
{ {
const TQSpinWidget* sw = static_cast< const TQSpinWidget* >( widget ); const TQSpinWidget* sw = static_cast< const TQSpinWidget* >( widget );
TQRect br = visualRect( querySubControlMetrics( (TQ_ComplexControl)CC_SpinWidget, widget, SC_SpinWidgetButtonField ), widget ); TQRect br = visualRect( querySubControlMetrics( (TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetButtonField, TQStyleOption::Default, widget ), ceData, elementFlags );
if ( controls & SC_SpinWidgetButtonField ) if ( controls & SC_SpinWidgetButtonField )
{ {
Keramik::SpinBoxPainter().draw( p, br, cg.button(), cg.background(), !sw->isEnabled() ); Keramik::SpinBoxPainter().draw( p, br, cg.button(), cg.background(), !sw->isEnabled() );
@ -2130,7 +2142,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
} }
if ( controls & SC_SpinWidgetFrame ) if ( controls & SC_SpinWidgetFrame )
tqdrawPrimitive( PE_PanelLineEdit, p, r, cg ); drawPrimitive( PE_PanelLineEdit, p, ceData, elementFlags, r, cg );
break; break;
} }
@ -2146,14 +2158,14 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
TQRect slider, subpage, addpage, subline, addline; TQRect slider, subpage, addpage, subline, addline;
if ( sb->minValue() == sb->maxValue() ) flags &= ~Style_Enabled; if ( sb->minValue() == sb->maxValue() ) flags &= ~Style_Enabled;
slider = querySubControlMetrics( control, widget, SC_ScrollBarSlider, opt ); slider = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget );
subpage = querySubControlMetrics( control, widget, SC_ScrollBarSubPage, opt ); subpage = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget );
addpage = querySubControlMetrics( control, widget, SC_ScrollBarAddPage, opt ); addpage = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget );
subline = querySubControlMetrics( control, widget, SC_ScrollBarSubLine, opt ); subline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget );
addline = querySubControlMetrics( control, widget, SC_ScrollBarAddLine, opt ); addline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget );
if ( controls & SC_ScrollBarSubLine ) if ( controls & SC_ScrollBarSubLine )
tqdrawPrimitive( PE_ScrollBarSubLine, p, subline, cg, drawPrimitive( PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg,
flags | ( ( active & SC_ScrollBarSubLine ) ? Style_Down : 0 ) ); flags | ( ( active & SC_ScrollBarSubLine ) ? Style_Down : 0 ) );
TQRegion clip; TQRegion clip;
@ -2174,21 +2186,21 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
p->setClipRect( slider.x(), slider.y(), addpage.right() - slider.x() + 1, slider.height() ); p->setClipRect( slider.x(), slider.y(), addpage.right() - slider.x() + 1, slider.height() );
else else
p->setClipRect( slider.x(), slider.y(), slider.width(), addpage.bottom() - slider.y() + 1 ); p->setClipRect( slider.x(), slider.y(), slider.width(), addpage.bottom() - slider.y() + 1 );
tqdrawPrimitive( PE_ScrollBarSlider, p, slider, cg, drawPrimitive( PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg,
flags | ( ( active == SC_ScrollBarSlider ) ? Style_Down : 0 ) ); flags | ( ( active == SC_ScrollBarSlider ) ? Style_Down : 0 ) );
} }
p->setClipping( false ); p->setClipping( false );
if ( controls & ( SC_ScrollBarSubLine | SC_ScrollBarAddLine ) ) if ( controls & ( SC_ScrollBarSubLine | SC_ScrollBarAddLine ) )
{ {
tqdrawPrimitive( PE_ScrollBarAddLine, p, addline, cg, flags ); drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, flags );
if ( active & SC_ScrollBarSubLine ) if ( active & SC_ScrollBarSubLine )
{ {
if ( horizontal ) if ( horizontal )
p->setClipRect( TQRect( addline.x(), addline.y(), addline.width() / 2, addline.height() ) ); p->setClipRect( TQRect( addline.x(), addline.y(), addline.width() / 2, addline.height() ) );
else else
p->setClipRect( TQRect( addline.x(), addline.y(), addline.width(), addline.height() / 2 ) ); p->setClipRect( TQRect( addline.x(), addline.y(), addline.width(), addline.height() / 2 ) );
tqdrawPrimitive( PE_ScrollBarAddLine, p, addline, cg, flags | Style_Down ); drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, flags | Style_Down );
} }
else if ( active & SC_ScrollBarAddLine ) else if ( active & SC_ScrollBarAddLine )
{ {
@ -2196,7 +2208,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
p->setClipRect( TQRect( addline.x() + addline.width() / 2, addline.y(), addline.width() / 2, addline.height() ) ); p->setClipRect( TQRect( addline.x() + addline.width() / 2, addline.y(), addline.width() / 2, addline.height() ) );
else else
p->setClipRect( TQRect( addline.x(), addline.y() + addline.height() / 2, addline.width(), addline.height() / 2 ) ); p->setClipRect( TQRect( addline.x(), addline.y() + addline.height() / 2, addline.width(), addline.height() / 2 ) );
tqdrawPrimitive( PE_ScrollBarAddLine, p, addline, cg, flags | Style_Down ); drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, flags | Style_Down );
} }
} }
@ -2224,8 +2236,8 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
} }
TQRect button, menuarea; TQRect button, menuarea;
button = querySubControlMetrics(control, widget, SC_ToolButton, opt); button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget);
menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget);
SFlags bflags = flags, SFlags bflags = flags,
mflags = flags; mflags = flags;
@ -2251,7 +2263,7 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
if (!onToolbar && !onControlButtons) if (!onToolbar && !onControlButtons)
bflags |= Style_Horizontal; bflags |= Style_Horizontal;
tqdrawPrimitive( PE_ButtonTool, p, button, cg, drawPrimitive( PE_ButtonTool, p, ceData, elementFlags, button, cg,
bflags, opt); bflags, opt);
} }
@ -2295,14 +2307,14 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
if (controls & SC_ToolButtonMenu) if (controls & SC_ToolButtonMenu)
{ {
if (mflags & (Style_Down | Style_On | Style_Raised)) if (mflags & (Style_Down | Style_On | Style_Raised))
tqdrawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, opt); drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
tqdrawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, opt); drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
} }
if (toolbutton->hasFocus() && !toolbutton->focusProxy()) { if (toolbutton->hasFocus() && !toolbutton->focusProxy()) {
TQRect fr = toolbutton->rect(); TQRect fr = toolbutton->rect();
fr.addCoords(3, 3, -3, -3); fr.addCoords(3, 3, -3, -3);
tqdrawPrimitive(PE_FocusRect, p, fr, cg); drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg);
} }
titleBarMode = None; titleBarMode = None;
@ -2313,8 +2325,8 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
case CC_TitleBar: case CC_TitleBar:
titleBarMode = Regular; //Handle buttons on titlebar different from toolbuttons titleBarMode = Regular; //Handle buttons on titlebar different from toolbuttons
default: default:
KStyle::drawComplexControl( control, p, widget, KStyle::drawComplexControl( control, p, ceData, elementFlags,
r, cg, flags, controls, active, opt ); r, cg, flags, controls, active, opt, widget );
titleBarMode = None; titleBarMode = None;
} }
@ -2322,16 +2334,18 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
void KeramikStyle::drawComplexControlMask( TQ_ComplexControl control, void KeramikStyle::drawComplexControlMask( TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
if (control == CC_ComboBox) if (control == CC_ComboBox)
{ {
maskMode = true; maskMode = true;
drawComplexControl(CC_ComboBox, p, widget, r, drawComplexControl(CC_ComboBox, p, ceData, elementFlags, r,
TQApplication::palette().active(), Style_Default, TQApplication::palette().active(), Style_Default,
SC_ComboBoxFrame,SC_None, opt); SC_ComboBoxFrame,SC_None, opt, widget);
maskMode = false; maskMode = false;
} }
@ -2340,7 +2354,7 @@ void KeramikStyle::drawComplexControlMask( TQ_ComplexControl control,
} }
int KeramikStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const int KeramikStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
switch(m) switch(m)
{ {
@ -2410,15 +2424,17 @@ int KeramikStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const
return titleBarH; return titleBarH;
default: default:
return KStyle::pixelMetric(m, widget); return KStyle::pixelMetric(m, ceData, elementFlags, widget);
} }
} }
TQSize KeramikStyle::tqsizeFromContents( ContentsType contents, TQSize KeramikStyle::sizeFromContents( ContentsType contents,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentSize, const TQSize &contentSize,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget* widget ) const
{ {
switch (contents) switch (contents)
{ {
@ -2428,8 +2444,8 @@ TQSize KeramikStyle::tqsizeFromContents( ContentsType contents,
{ {
const TQPushButton* btn = static_cast< const TQPushButton* >( widget ); const TQPushButton* btn = static_cast< const TQPushButton* >( widget );
int w = contentSize.width() + 2 * pixelMetric( PM_ButtonMargin, widget ); int w = contentSize.width() + 2 * pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget );
int h = contentSize.height() + 2 * pixelMetric( PM_ButtonMargin, widget ); int h = contentSize.height() + 2 * pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget );
if ( btn->text().isEmpty() && contentSize.width() < 32 ) return TQSize( w, h ); if ( btn->text().isEmpty() && contentSize.width() < 32 ) return TQSize( w, h );
@ -2451,7 +2467,7 @@ TQSize KeramikStyle::tqsizeFromContents( ContentsType contents,
} }
else else
{ {
return KStyle::tqsizeFromContents( contents, widget, contentSize, opt ); return KStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget );
} }
} }
@ -2520,20 +2536,22 @@ TQSize KeramikStyle::tqsizeFromContents( ContentsType contents,
} }
default: default:
return KStyle::tqsizeFromContents( contents, widget, contentSize, opt ); return KStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget );
} }
} }
TQStyle::SubControl KeramikStyle::querySubControl( TQ_ComplexControl control, TQStyle::SubControl KeramikStyle::querySubControl( TQ_ComplexControl control,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQPoint& point, const TQPoint& point,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget* widget ) const
{ {
SubControl result = KStyle::querySubControl( control, widget, point, opt ); SubControl result = KStyle::querySubControl( control, ceData, elementFlags, point, opt, widget );
if ( control == CC_ScrollBar && result == SC_ScrollBarAddLine ) if ( control == CC_ScrollBar && result == SC_ScrollBarAddLine )
{ {
TQRect addline = querySubControlMetrics( control, widget, result, opt ); TQRect addline = querySubControlMetrics( control, ceData, elementFlags, result, opt, widget );
if ( static_cast< const TQScrollBar* >( widget )->orientation() == Qt::Horizontal ) if ( static_cast< const TQScrollBar* >( widget )->orientation() == Qt::Horizontal )
{ {
if ( point.x() < addline.center().x() ) result = SC_ScrollBarSubLine; if ( point.x() < addline.center().x() ) result = SC_ScrollBarSubLine;
@ -2544,9 +2562,11 @@ TQStyle::SubControl KeramikStyle::querySubControl( TQ_ComplexControl control,
} }
TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control, TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget* widget ) const
{ {
switch ( control ) switch ( control )
{ {
@ -2623,7 +2643,7 @@ TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control,
{ {
int range = sb->maxValue() - sb->minValue(); int range = sb->maxValue() - sb->minValue();
sliderlen = ( sb->pageStep() * maxlen ) / ( range + sb->pageStep() ); sliderlen = ( sb->pageStep() * maxlen ) / ( range + sb->pageStep() );
slidermin = pixelMetric( PM_ScrollBarSliderMin, sb ); slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, sb );
if ( sliderlen < slidermin ) sliderlen = slidermin; if ( sliderlen < slidermin ) sliderlen = slidermin;
if ( sliderlen > maxlen ) sliderlen = maxlen; if ( sliderlen > maxlen ) sliderlen = maxlen;
} }
@ -2666,9 +2686,9 @@ TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control,
bool horizontal = sl->orientation() == Qt::Horizontal; bool horizontal = sl->orientation() == Qt::Horizontal;
TQSlider::TickSetting ticks = sl->tickmarks(); TQSlider::TickSetting ticks = sl->tickmarks();
int pos = sl->sliderStart(); int pos = sl->sliderStart();
int size = pixelMetric( PM_SliderControlThickness, widget ); int size = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
int handleSize = pixelMetric( PM_SliderThickness, widget ); int handleSize = pixelMetric( PM_SliderThickness, ceData, elementFlags, widget );
int len = pixelMetric( PM_SliderLength, widget ); int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget );
//Shrink the metrics if the widget is too small //Shrink the metrics if the widget is too small
//to fit our normal values for them. //to fit our normal values for them.
@ -2721,7 +2741,7 @@ TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control,
} }
default: break; default: break;
} }
return KStyle::querySubControlMetrics( control, widget, subcontrol, opt ); return KStyle::querySubControlMetrics( control, ceData, elementFlags, subcontrol, opt, widget );
} }

@ -48,7 +48,7 @@ public:
virtual ~KeramikStyle(); virtual ~KeramikStyle();
void renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup &cg, const TQPopupMenu* ) const; void renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup &cg, const TQPopupMenu* ) const;
TQPixmap stylePixmap(StylePixmap stylepixmap, const TQWidget* widget, const TQStyleOption& opt) const; TQPixmap stylePixmap(StylePixmap stylepixmap, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption& opt, const TQWidget* widget = 0) const;
void polish( TQWidget* widget ); void polish( TQWidget* widget );
void unPolish( TQWidget* widget ); void unPolish( TQWidget* widget );
@ -57,14 +57,18 @@ public:
void drawKStylePrimitive( KStylePrimitive kpe, void drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, 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 tqdrawPrimitive( TQ_PrimitiveElement pe, void drawPrimitive( TQ_PrimitiveElement pe,
TQPainter* p, TQPainter* p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect& r, const TQRect& r,
const TQColorGroup& cg, const TQColorGroup& cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -72,50 +76,64 @@ public:
void drawControl( TQ_ControlElement element, void drawControl( TQ_ControlElement element,
TQPainter* p, TQPainter* p,
const TQWidget* widget, 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& opt = TQStyleOption::Default ) const; const TQStyleOption& opt = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
void drawControlMask( TQ_ControlElement element, void drawControlMask( TQ_ControlElement element,
TQPainter* p, TQPainter* p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect& r, const TQRect& r,
const TQStyleOption& opt = TQStyleOption::Default ) const; const TQStyleOption& opt = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
void drawComplexControl( TQ_ComplexControl control, void drawComplexControl( TQ_ComplexControl control,
TQPainter* p, TQPainter* p,
const TQWidget* widget, 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;
void drawComplexControlMask( TQ_ComplexControl control, void drawComplexControlMask( TQ_ComplexControl control,
TQPainter* p, TQPainter* p,
const TQWidget* widget, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect& r, const TQRect& r,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
int pixelMetric( PixelMetric m, const TQWidget* widget = 0 ) const; int pixelMetric( PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget* widget = 0 ) const;
TQSize tqsizeFromContents( ContentsType contents, TQSize sizeFromContents( ContentsType contents,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize& contentSize, const TQSize& contentSize,
const TQStyleOption& opt ) const; const TQStyleOption& opt,
const TQWidget* widget = 0 ) const;
SubControl querySubControl( TQ_ComplexControl control, SubControl querySubControl( TQ_ComplexControl control,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQPoint& point, const TQPoint& point,
const TQStyleOption& opt = TQStyleOption::Default ) const; const TQStyleOption& opt = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
TQRect querySubControlMetrics( TQ_ComplexControl control, TQRect querySubControlMetrics( TQ_ComplexControl control,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption& opt = TQStyleOption::Default ) const; const TQStyleOption& opt = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
private slots: private slots:
//Animation slots. //Animation slots.
@ -194,7 +212,7 @@ private:
// For progress bar animation // For progress bar animation
TQTimer *animationTimer; TQTimer *animationTimer;
TQRect subRect(SubRect r, const TQWidget *widget) const; TQRect subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const;
// Disable copy constructor and = operator // Disable copy constructor and = operator
KeramikStyle( const KeramikStyle& ); KeramikStyle( const KeramikStyle& );

@ -508,88 +508,100 @@ protected:
/** /**
These are included for fuuture extension purposes.. These are included for fuuture extension purposes..
*/ */
virtual int pixelMetric ( PixelMetric metric, const TQWidget * widget = 0 ) const virtual int pixelMetric ( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * widget = 0 ) const
{ {
return KStyle::pixelMetric( metric, widget ); return KStyle::pixelMetric( metric, ceData, elementFlags, widget );
} }
virtual void drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRect & r, const TQColorGroup & cg, virtual void drawPrimitive ( PrimitiveElement pe, TQPainter * p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect & r, const TQColorGroup & cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
const TQStyleOption& option = TQStyleOption::Default ) const const TQStyleOption& option = TQStyleOption::Default ) const
{ {
KStyle::tqdrawPrimitive ( pe, p, r, cg, KStyle::tqdrawPrimitive ( pe, p, ceData, elementFlags, r, cg,
flags, option ); flags, option );
} }
virtual void drawControl( TQ_ControlElement element, virtual void drawControl( TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
const TQStyleOption& opt = TQStyleOption::Default ) const const TQStyleOption& opt = TQStyleOption::Default,
const TQWidget *widget = 0 ) const
{ {
KStyle::drawControl( element, p, widget, KStyle::drawControl( element, p, ceData, elementFlags,
r, cg, how, opt ); r, cg, how, opt, widget );
} }
virtual void drawControlMask( TQ_ControlElement element, virtual void drawControlMask( TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& opt = TQStyleOption::Default ) const const TQStyleOption& opt = TQStyleOption::Default,
const TQWidget *widget = 0 ) const
{ {
KStyle::drawControlMask( element, p, widget, r, opt ); KStyle::drawControlMask( element, p, ceData, elementFlags, r, opt, widget );
} }
virtual void drawComplexControl( TQ_ComplexControl control, virtual void drawComplexControl( TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget* widget, 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& opt = TQStyleOption::Default ) const const TQStyleOption& opt = TQStyleOption::Default,
const TQWidget* widget = 0 ) const
{ {
KStyle::drawComplexControl( control, p, widget, r, cg, flags, controls, active, opt ); KStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget );
} }
virtual void drawKStylePrimitive( KStylePrimitive kpe, virtual void drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, 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& opt = TQStyleOption::Default ) const const TQStyleOption& opt = TQStyleOption::Default,
const TQWidget* widget = 0 ) const
{ {
KStyle::drawKStylePrimitive( kpe, KStyle::drawKStylePrimitive( kpe,
p, widget, r, p, ceData, elementFlags, r,
cg, flags, opt ); cg, flags, opt, widget );
} }
virtual int styleHint( StyleHint sh, virtual int styleHint( StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQWidget *widget = 0,
const TQStyleOption& opt = TQStyleOption::Default, const TQStyleOption& opt = TQStyleOption::Default,
TQStyleHintReturn* returnData = 0 ) const TQStyleHintReturn* returnData = 0,
const TQWidget *widget = 0 ) const
{ {
return KStyle::styleHint( sh, return KStyle::styleHint( sh,
widget, ceData,
elementFlags,
opt, opt,
returnData ); returnData,
widget );
} }
virtual TQSize tqsizeFromContents( ContentsType contents, virtual TQSize sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption& opt = TQStyleOption::Default ) const const TQStyleOption& opt = TQStyleOption::Default,
const TQWidget *widget = 0 ) const
{ {
return KStyle::tqsizeFromContents( contents, return KStyle::sizeFromContents( contents,
widget, contentsSize, opt ); ceData, elementFlags, contentsSize, opt, widget );
} }
private: private:

@ -161,7 +161,7 @@ public:
KDE_Q_EXPORT_PLUGIN( KThemeStylePlugin ) KDE_Q_EXPORT_PLUGIN( KThemeStylePlugin )
void kDrawWindowsArrow ( TQPainter *p, const TQStyle* style, TQStyle::PrimitiveElement pe, bool down, void kDrawWindowsArrow ( TQPainter *p, const TQStyleControlElementData ceData, const TQStyle::ControlElementFlags elementFlags, const TQStyle* style, TQStyle::PrimitiveElement pe, bool down,
int x, int y, int w, int h, int x, int y, int w, int h,
const TQColorGroup &cg, bool enabled ) const TQColorGroup &cg, bool enabled )
{ {
@ -186,8 +186,8 @@ void kDrawWindowsArrow ( TQPainter *p, const TQStyle* style, TQStyle::PrimitiveE
p->save(); p->save();
if ( down ) if ( down )
{ {
p->translate( style->pixelMetric( TQStyle::PM_ButtonShiftHorizontal ), p->translate( style->pixelMetric( TQStyle::PM_ButtonShiftHorizontal, ceData, elementFlags ),
style->pixelMetric( TQStyle::PM_ButtonShiftVertical ) ); style->pixelMetric( TQStyle::PM_ButtonShiftVertical, ceData, elementFlags ) );
} }
if ( enabled ) if ( enabled )
@ -212,10 +212,12 @@ void kDrawWindowsArrow ( TQPainter *p, const TQStyle* style, TQStyle::PrimitiveE
TQSize KThemeStyle::tqsizeFromContents( ContentsType contents, TQSize KThemeStyle::sizeFromContents( ContentsType contents,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentSize, const TQSize &contentSize,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget* widget ) const
{ {
switch ( contents ) switch ( contents )
{ {
@ -226,8 +228,8 @@ TQSize KThemeStyle::tqsizeFromContents( ContentsType contents,
const TQPushButton * button = ( const TQPushButton* ) widget; const TQPushButton * button = ( const TQPushButton* ) widget;
int w = contentSize.width(); int w = contentSize.width();
int h = contentSize.height(); int h = contentSize.height();
int bm = pixelMetric( PM_ButtonMargin, widget ); int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget );
int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2; int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2;
w += bm + fw + 6; // ### Add 6 to make way for bold font. w += bm + fw + 6; // ### Add 6 to make way for bold font.
h += bm + fw; h += bm + fw;
@ -304,12 +306,12 @@ TQSize KThemeStyle::tqsizeFromContents( ContentsType contents,
} }
default: default:
return KThemeBase::tqsizeFromContents( contents, widget, contentSize, opt ); return KThemeBase::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget );
} }
} }
TQRect KThemeStyle::subRect(SubRect sr, const TQWidget* widget) const TQRect KThemeStyle::subRect(SubRect sr, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget* widget) const
{ {
if (sr == SR_CheckBoxFocusRect) if (sr == SR_CheckBoxFocusRect)
{ {
@ -320,18 +322,18 @@ TQRect KThemeStyle::subRect(SubRect sr, const TQWidget* widget) const
{ {
TQRect bounding = cb->rect(); TQRect bounding = cb->rect();
int cw = pixelMetric(PM_IndicatorWidth, widget); int cw = pixelMetric(PM_IndicatorWidth, ceData, elementFlags, widget);
int ch = pixelMetric(PM_IndicatorHeight, widget); int ch = pixelMetric(PM_IndicatorHeight, ceData, elementFlags, widget);
TQRect checkbox(bounding.x() + 2, bounding.y() + 2 + (bounding.height() - ch)/2, cw - 4, ch - 4); TQRect checkbox(bounding.x() + 2, bounding.y() + 2 + (bounding.height() - ch)/2, cw - 4, ch - 4);
return checkbox; return checkbox;
} }
} }
return KStyle::subRect(sr, widget); return KStyle::subRect(sr, ceData, elementFlags, widget);
} }
int KThemeStyle::pixelMetric ( PixelMetric metric, const TQWidget * widget ) const int KThemeStyle::pixelMetric ( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * widget ) const
{ {
switch ( metric ) switch ( metric )
{ {
@ -361,26 +363,26 @@ int KThemeStyle::pixelMetric ( PixelMetric metric, const TQWidget * widget ) con
if ( isPixmap( ExIndicatorOn ) ) if ( isPixmap( ExIndicatorOn ) )
return ( uncached( ExIndicatorOn ) ->size().width() ); return ( uncached( ExIndicatorOn ) ->size().width() );
else else
return KThemeBase::pixelMetric ( metric, widget ); return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget );
case PM_ExclusiveIndicatorHeight: case PM_ExclusiveIndicatorHeight:
if ( isPixmap( ExIndicatorOn ) ) if ( isPixmap( ExIndicatorOn ) )
return ( uncached( ExIndicatorOn ) ->size().height() ); return ( uncached( ExIndicatorOn ) ->size().height() );
else else
return KThemeBase::pixelMetric ( metric, widget ); return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget );
case PM_IndicatorWidth: case PM_IndicatorWidth:
if ( isPixmap( IndicatorOn ) ) if ( isPixmap( IndicatorOn ) )
return ( uncached( IndicatorOn ) ->size().width() ); return ( uncached( IndicatorOn ) ->size().width() );
else else
return KThemeBase::pixelMetric ( metric, widget ); return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget );
case PM_IndicatorHeight: case PM_IndicatorHeight:
if ( isPixmap( IndicatorOn ) ) if ( isPixmap( IndicatorOn ) )
return ( uncached( IndicatorOn ) ->size().height() ); return ( uncached( IndicatorOn ) ->size().height() );
else else
return KThemeBase::pixelMetric ( metric, widget ); return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget );
case PM_SliderLength: case PM_SliderLength:
return ( sliderButtonLength() ); return ( sliderButtonLength() );
@ -389,7 +391,7 @@ int KThemeStyle::pixelMetric ( PixelMetric metric, const TQWidget * widget ) con
return ( splitWidth() ); return ( splitWidth() );
default: default:
return KThemeBase::pixelMetric ( metric, widget ); return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget );
} }
} }
@ -700,7 +702,7 @@ void KThemeStyle::drawBaseButton( TQPainter *p, int x, int y, int w, int h,
p->setPen( oldPen ); p->setPen( oldPen );
} }
void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRect & r, const TQColorGroup & g_base, void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect & r, const TQColorGroup & g_base,
SFlags flags, const TQStyleOption & opt ) const SFlags flags, const TQStyleOption & opt ) const
{ {
bool handled = false; bool handled = false;
@ -761,7 +763,7 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRe
// Standard arrow types // Standard arrow types
if ( arrowType() == MotifArrow ) if ( arrowType() == MotifArrow )
{ {
mtfstyle->tqdrawPrimitive( pe, p, r, g, flags, opt ); mtfstyle->drawPrimitive( pe, p, ceData, elementFlags, r, g, flags, opt );
handled = true; handled = true;
} }
@ -791,8 +793,8 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRe
p->save(); p->save();
if ( flags & Style_Down ) if ( flags & Style_Down )
p->translate( pixelMetric( PM_ButtonShiftHorizontal ), p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ),
pixelMetric( PM_ButtonShiftVertical ) ); pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) );
if ( flags & Style_Enabled ) if ( flags & Style_Enabled )
{ {
@ -1006,7 +1008,7 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRe
*colorGroup( g, down ? ScrollButtonDown : ScrollButton ), *colorGroup( g, down ? ScrollButtonDown : ScrollButton ),
down, false, down ? ScrollButtonDown : ScrollButton ); down, false, down ? ScrollButtonDown : ScrollButton );
tqdrawPrimitive( ( horizontal ) ? PE_ArrowRight : PE_ArrowDown, p , drawPrimitive( ( horizontal ) ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags ,
TQRect( r.x() + 3, r.y() + 3, r.width() - 6, r.height() - 6 ), TQRect( r.x() + 3, r.y() + 3, r.width() - 6, r.height() - 6 ),
*colorGroup( g, down ? ScrollButtonDown : ScrollButton ), *colorGroup( g, down ? ScrollButtonDown : ScrollButton ),
flags ); flags );
@ -1021,7 +1023,7 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRe
*colorGroup( g, down ? ScrollButtonDown : ScrollButton ), *colorGroup( g, down ? ScrollButtonDown : ScrollButton ),
down, false, down ? ScrollButtonDown : ScrollButton ); down, false, down ? ScrollButtonDown : ScrollButton );
tqdrawPrimitive( ( horizontal ) ? PE_ArrowLeft : PE_ArrowUp, p , drawPrimitive( ( horizontal ) ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags ,
TQRect( r.x() + 3, r.y() + 3, r.width() - 6, r.height() - 6 ), TQRect( r.x() + 3, r.y() + 3, r.width() - 6, r.height() - 6 ),
*colorGroup( g, down ? ScrollButtonDown : ScrollButton ), *colorGroup( g, down ? ScrollButtonDown : ScrollButton ),
flags ); flags );
@ -1069,7 +1071,7 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRe
} }
if ( !handled ) if ( !handled )
KThemeBase::drawPrimitive ( pe, p, r, g, KThemeBase::drawPrimitive ( pe, p, ceData, elementFlags, r, g,
flags, opt ); flags, opt );
} }
@ -1099,11 +1101,13 @@ TQPixmap* KThemeStyle::makeMenuBarCache(int w, int h) const
void KThemeStyle::drawControl( ControlElement element, void KThemeStyle::drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how , SFlags how ,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
bool handled = false; bool handled = false;
int x, y, w, h; int x, y, w, h;
@ -1116,7 +1120,7 @@ void KThemeStyle::drawControl( ControlElement element,
{ {
const TQPushButton * btn = ( const TQPushButton* ) widget; const TQPushButton * btn = ( const TQPushButton* ) widget;
bool sunken = btn->isOn() || btn->isDown(); bool sunken = btn->isOn() || btn->isDown();
int diw = pixelMetric( PM_ButtonDefaultIndicator, btn ); int diw = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, btn );
drawBaseButton( p, diw, diw, w - 2 * diw, h - 2 * diw, drawBaseButton( p, diw, diw, w - 2 * diw, h - 2 * diw,
*colorGroup( btn->colorGroup(), sunken ? PushButtonDown : *colorGroup( btn->colorGroup(), sunken ? PushButtonDown :
PushButton ), sunken, roundButton(), PushButton ), sunken, roundButton(),
@ -1135,16 +1139,16 @@ void KThemeStyle::drawControl( ControlElement element,
// Shift button contents if pushed. // Shift button contents if pushed.
if ( active ) if ( active )
{ {
x += pixelMetric( PM_ButtonShiftHorizontal, widget ); x += pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags, widget );
y += pixelMetric( PM_ButtonShiftVertical, widget ); y += pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags, widget );
how |= Style_Sunken; how |= Style_Sunken;
} }
// Does the button have a popup menu? // Does the button have a popup menu?
if ( button->isMenuButton() ) if ( button->isMenuButton() )
{ {
int dx = pixelMetric( PM_MenuButtonIndicator, widget ); int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget );
tqdrawPrimitive( PE_ArrowDown, p, TQRect( x + w - dx - 2, y + 2, dx, h - 4 ), drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect( x + w - dx - 2, y + 2, dx, h - 4 ),
cg, how, opt ); cg, how, opt );
w -= dx; w -= dx;
} }
@ -1219,8 +1223,8 @@ void KThemeStyle::drawControl( ControlElement element,
// Draw a focus rect if the button has focus // Draw a focus rect if the button has focus
if ( how & Style_HasFocus ) if ( how & Style_HasFocus )
tqdrawPrimitive( PE_FocusRect, p, drawPrimitive( PE_FocusRect, p, ceData, elementFlags,
TQStyle::visualRect( subRect( SR_PushButtonFocusRect, widget ), widget ), TQStyle::visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ),
cg, how ); cg, how );
handled = true; handled = true;
break; break;
@ -1229,7 +1233,7 @@ void KThemeStyle::drawControl( ControlElement element,
case CE_MenuBarEmptyArea: case CE_MenuBarEmptyArea:
{ {
//Expand to cover entire region //Expand to cover entire region
tqdrawPrimitive(PE_PanelMenuBar, p, drawPrimitive(PE_PanelMenuBar, p, ceData, elementFlags,
TQRect(0,0,r.width()+r.x()*2, r.height()+r.y()*2), TQRect(0,0,r.width()+r.x()*2, r.height()+r.y()*2),
cg, Style_Default); cg, Style_Default);
handled = true; handled = true;
@ -1440,7 +1444,7 @@ void KThemeStyle::drawControl( ControlElement element,
bool enabled = (mi? mi->isEnabled():true); bool enabled = (mi? mi->isEnabled():true);
bool checkable = popupmenu->isCheckable(); bool checkable = popupmenu->isCheckable();
bool active = how & Style_Active; bool active = how & Style_Active;
bool etchtext = styleHint( SH_EtchDisabledText, 0 ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags, TQStyleOption::Default, 0, 0 );
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
const TQColorGroup& cg_ours = *colorGroup( cg, active ? MenuItemDown : MenuItem ); const TQColorGroup& cg_ours = *colorGroup( cg, active ? MenuItemDown : MenuItem );
@ -1531,7 +1535,7 @@ void KThemeStyle::drawControl( ControlElement element,
SFlags cflags = Style_Default; SFlags cflags = Style_Default;
cflags |= active ? Style_Enabled : Style_On; cflags |= active ? Style_Enabled : Style_On;
tqdrawPrimitive( PE_CheckMark, p, TQRect( cx + itemFrame, y + itemFrame, drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame,
checkcol - itemFrame * 2, h - itemFrame * 2 ), cg_ours, cflags ); checkcol - itemFrame * 2, h - itemFrame * 2 ), cg_ours, cflags );
} }
@ -1656,10 +1660,10 @@ void KThemeStyle::drawControl( ControlElement element,
TQColorGroup g2( discol, cg_ours.highlight(), white, white, TQColorGroup g2( discol, cg_ours.highlight(), white, white,
enabled ? white : discol, discol, white ); enabled ? white : discol, discol, white );
tqdrawPrimitive( arrow, p, vr, g2, Style_Enabled | Style_Down ); drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled | Style_Down );
} }
else else
tqdrawPrimitive( arrow, p, vr, cg_ours, drawPrimitive( arrow, p, ceData, elementFlags, vr, cg_ours,
enabled ? Style_Enabled : Style_Default ); enabled ? Style_Enabled : Style_Default );
} }
handled = true; handled = true;
@ -1681,7 +1685,7 @@ void KThemeStyle::drawControl( ControlElement element,
case CE_ProgressBarContents: case CE_ProgressBarContents:
{ {
const TQProgressBar* pb = (const TQProgressBar*)widget; const TQProgressBar* pb = (const TQProgressBar*)widget;
TQRect cr = subRect(SR_ProgressBarContents, widget); TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget);
double progress = pb->progress(); double progress = pb->progress();
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
int steps = pb->totalSteps(); int steps = pb->totalSteps();
@ -1737,15 +1741,17 @@ void KThemeStyle::drawControl( ControlElement element,
if ( !handled ) if ( !handled )
KThemeBase::drawControl( element, KThemeBase::drawControl( element,
p, widget, r, cg, how, opt ); p, ceData, elementFlags, r, cg, how, opt, widget );
} }
void KThemeStyle::drawControlMask( ControlElement element, void KThemeStyle::drawControlMask( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
bool handled = false; bool handled = false;
int x, y, w, h; int x, y, w, h;
@ -1766,18 +1772,20 @@ void KThemeStyle::drawControlMask( ControlElement element,
if ( !handled ) if ( !handled )
KThemeBase::drawControlMask( element, KThemeBase::drawControlMask( element,
p, widget, r, opt ); p, ceData, elementFlags, r, opt, widget );
} }
void KThemeStyle::drawKStylePrimitive( KStylePrimitive kpe, void KThemeStyle::drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget* widget ) const
{ {
bool handled = false; bool handled = false;
int x, y, w, h; int x, y, w, h;
@ -1942,8 +1950,8 @@ void KThemeStyle::drawKStylePrimitive( KStylePrimitive kpe,
if ( !handled ) if ( !handled )
{ {
KThemeBase::drawKStylePrimitive( kpe, p, widget, KThemeBase::drawKStylePrimitive( kpe, p, ceData, elementFlags,
r, cg, flags, opt ); r, cg, flags, opt, widget );
} }
} }
@ -1951,10 +1959,10 @@ void KThemeStyle::drawKStylePrimitive( KStylePrimitive kpe,
void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, const TQWidget * widget, void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQRect & r, const TQColorGroup & g, SFlags how , const TQRect & r, const TQColorGroup & g, SFlags how ,
SCFlags controls, SCFlags active, SCFlags controls, SCFlags active,
const TQStyleOption & opt ) const const TQStyleOption & opt, const TQWidget * widget ) const
{ {
bool handled = false; bool handled = false;
int x, y, w, h; int x, y, w, h;
@ -1970,8 +1978,8 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p,
{ {
const TQToolButton * toolbutton = ( const TQToolButton * ) widget; const TQToolButton * toolbutton = ( const TQToolButton * ) widget;
TQRect button, menu; TQRect button, menu;
button = querySubControlMetrics( control, widget, SC_ToolButton, opt ); button = querySubControlMetrics( control, ceData, elementFlags, SC_ToolButton, opt, widget );
menu = querySubControlMetrics( control, widget, SC_ToolButtonMenu, opt ); menu = querySubControlMetrics( control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget );
if ( controls & SC_ToolButton ) if ( controls & SC_ToolButton )
@ -1986,12 +1994,12 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p,
if ( controls & SC_ToolButtonMenu ) if ( controls & SC_ToolButtonMenu )
{ {
tqdrawPrimitive( PE_ArrowDown, p, menu, g, how ); drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, menu, g, how );
/* if ( enabled ) /* if ( enabled )
kDrawWindowsArrow(p, this, PE_ArrowDown, false, menu.x(), menu.y(), menu.width(), menu.height(), kDrawWindowsArrow(p, ceData, elementFlags, this, PE_ArrowDown, false, menu.x(), menu.y(), menu.width(), menu.height(),
g, true ); g, true );
else else
kDrawWindowsArrow(p, this, PE_ArrowDown, false, menu.x(), menu.y(), menu.width(), menu.height(), kDrawWindowsArrow(p, ceData, elementFlags, this, PE_ArrowDown, false, menu.x(), menu.y(), menu.width(), menu.height(),
g, false );*/ g, false );*/
} }
@ -1999,7 +2007,7 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p,
{ {
TQRect fr = toolbutton->rect(); TQRect fr = toolbutton->rect();
fr.addCoords( 3, 3, -3, -3 ); fr.addCoords( 3, 3, -3, -3 );
tqdrawPrimitive( PE_FocusRect, p, fr, g ); drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, g );
} }
handled = true; handled = true;
@ -2024,8 +2032,8 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p,
{ {
bool sunken = ( active == SC_ComboBoxArrow ); bool sunken = ( active == SC_ComboBoxArrow );
TQRect ar = TQStyle::visualRect( TQRect ar = TQStyle::visualRect(
querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxArrow ), querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget ),
widget ); ceData, elementFlags );
ar.rect( &x, &y, &w, &h ); ar.rect( &x, &y, &w, &h );
WidgetType widget = sunken ? ComboBoxDown : ComboBox; WidgetType widget = sunken ? ComboBoxDown : ComboBox;
@ -2042,7 +2050,7 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p,
else else
{ {
mtfstyle->tqdrawPrimitive( PE_ArrowDown, p, TQRect( x, y, w, h ), *colorGroup( g, widget ), sunken ? ( how | Style_Sunken ) : how, opt ); mtfstyle->drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect( x, y, w, h ), *colorGroup( g, widget ), sunken ? ( how | Style_Sunken ) : how, opt );
qDrawShadeRect( p, x, y, w, h, *colorGroup( g, widget ) ); //w-14, y+7+(h-15), 10, 3, qDrawShadeRect( p, x, y, w, h, *colorGroup( g, widget ) ); //w-14, y+7+(h-15), 10, 3,
} }
controls ^= SC_ComboBoxArrow; controls ^= SC_ComboBoxArrow;
@ -2059,11 +2067,11 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p,
//Here, we don't do add page, subpage, etc., //Here, we don't do add page, subpage, etc.,
TQRect addline, subline, subline2, groove, slider; TQRect addline, subline, subline2, groove, slider;
subline = querySubControlMetrics( control, widget, SC_ScrollBarSubLine, opt ); subline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget );
addline = querySubControlMetrics( control, widget, SC_ScrollBarAddLine, opt ); addline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget );
groove = querySubControlMetrics( control, widget, SC_ScrollBarGroove, opt ); groove = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarGroove, opt, widget );
slider = querySubControlMetrics( control, widget, SC_ScrollBarSlider, opt ); slider = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget );
subline2 = addline; subline2 = addline;
TQPixmap buf( sb->width(), sb->height() ); TQPixmap buf( sb->width(), sb->height() );
@ -2072,7 +2080,7 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p,
if ( groove.isValid() ) if ( groove.isValid() )
{ {
p2.fillRect( groove, TQColor( 255, 0, 0 ) ); p2.fillRect( groove, TQColor( 255, 0, 0 ) );
tqdrawPrimitive( PE_ScrollBarSubPage, &p2, groove, g, drawPrimitive( PE_ScrollBarSubPage, &p2, ceData, elementFlags, groove, g,
sflags | ( ( active == SC_ScrollBarSubPage ) ? sflags | ( ( active == SC_ScrollBarSubPage ) ?
Style_Down : Style_Default ) ); Style_Down : Style_Default ) );
} }
@ -2081,19 +2089,19 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p,
// Draw the up/left button set // Draw the up/left button set
if ( subline.isValid() ) if ( subline.isValid() )
{ {
tqdrawPrimitive( PE_ScrollBarSubLine, &p2, subline, g, drawPrimitive( PE_ScrollBarSubLine, &p2, ceData, elementFlags, subline, g,
sflags | ( active == SC_ScrollBarSubLine ? sflags | ( active == SC_ScrollBarSubLine ?
Style_Down : Style_Default ) ); Style_Down : Style_Default ) );
} }
if ( addline.isValid() ) if ( addline.isValid() )
tqdrawPrimitive( PE_ScrollBarAddLine, &p2, addline, g, drawPrimitive( PE_ScrollBarAddLine, &p2, ceData, elementFlags, addline, g,
sflags | ( ( active == SC_ScrollBarAddLine ) ? sflags | ( ( active == SC_ScrollBarAddLine ) ?
Style_Down : Style_Default ) ); Style_Down : Style_Default ) );
if ( slider.isValid() ) if ( slider.isValid() )
{ //(controls & SC_ScrollBarSlider) && { //(controls & SC_ScrollBarSlider) &&
tqdrawPrimitive( PE_ScrollBarSlider, &p2, slider, g, drawPrimitive( PE_ScrollBarSlider, &p2, ceData, elementFlags, slider, g,
sflags | ( ( active == SC_ScrollBarSlider ) ? sflags | ( ( active == SC_ScrollBarSlider ) ?
Style_Down : Style_Default ) ); Style_Down : Style_Default ) );
// Draw focus rect // Draw focus rect
@ -2101,7 +2109,7 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p,
{ {
TQRect fr( slider.x() + 2, slider.y() + 2, TQRect fr( slider.x() + 2, slider.y() + 2,
slider.width() - 5, slider.height() - 5 ); slider.width() - 5, slider.height() - 5 );
tqdrawPrimitive( PE_FocusRect, &p2, fr, g, Style_Default ); drawPrimitive( PE_FocusRect, &p2, ceData, elementFlags, fr, g, Style_Default );
} }
p2.end(); p2.end();
bitBlt( p->device(), x, y, &buf ); bitBlt( p->device(), x, y, &buf );
@ -2116,10 +2124,10 @@ void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p,
if ( !handled ) if ( !handled )
{ {
KThemeBase::drawComplexControl ( control, p, widget, KThemeBase::drawComplexControl ( control, p, ceData, elementFlags,
r, g, how , r, g, how ,
controls, active, controls, active,
opt ); opt, widget );
} }
} }
@ -2185,7 +2193,7 @@ void KThemeStyle::drawBaseMask( TQPainter *p, int x, int y, int w, int h,
p->fillRect( x, y, w, h, fillBrush ); p->fillRect( x, y, w, h, fillBrush );
} }
int KThemeStyle::styleHint( StyleHint sh, const TQWidget *w, const TQStyleOption &opt, TQStyleHintReturn *shr ) const int KThemeStyle::styleHint( StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *shr, const TQWidget *w ) const
{ {
switch ( sh ) switch ( sh )
{ {
@ -2207,7 +2215,7 @@ int KThemeStyle::styleHint( StyleHint sh, const TQWidget *w, const TQStyleOption
return NoBackground; return NoBackground;
default: default:
return KThemeBase::styleHint( sh, w, opt, shr ); return KThemeBase::styleHint( sh, ceData, elementFlags, opt, shr, w );
}; };
} }

@ -79,57 +79,69 @@ public:
KThemeStyle( const TQString& configDir, const TQString &configFile = TQString::null ); KThemeStyle( const TQString& configDir, const TQString &configFile = TQString::null );
~KThemeStyle(); ~KThemeStyle();
virtual int pixelMetric ( PixelMetric metric, const TQWidget * widget = 0 ) const; virtual int pixelMetric ( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * widget = 0 ) const;
virtual void drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQRect & r, const TQColorGroup & cg, virtual void drawPrimitive ( PrimitiveElement pe, TQPainter * p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect & r, const TQColorGroup & cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default ) const;
virtual void drawControl( ControlElement element, virtual void drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
virtual void drawControlMask( ControlElement element, virtual void drawControlMask( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
virtual void drawComplexControl( TQ_ComplexControl control, virtual void drawComplexControl( TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget* widget, 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;
virtual void drawKStylePrimitive( KStylePrimitive kpe, virtual void drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, 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;
virtual int styleHint( StyleHint sh, virtual int styleHint( StyleHint sh,
const TQWidget *widget = 0, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption& = TQStyleOption::Default, const TQStyleOption& = TQStyleOption::Default,
TQStyleHintReturn* returnData = 0 ) const; TQStyleHintReturn* returnData = 0,
const TQWidget *widget = 0 ) const;
virtual TQSize tqsizeFromContents( ContentsType contents, virtual TQSize sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
virtual TQRect subRect(SubRect, const TQWidget *) const; virtual TQRect subRect(SubRect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *) const;
virtual void polish( TQWidget* ); virtual void polish( TQWidget* );
virtual void unPolish( TQWidget* ); virtual void unPolish( TQWidget* );

@ -129,8 +129,10 @@ static void drawLightBevel(TQPainter *p, const TQRect &r, const TQColorGroup &cg
if (fill) p->fillRect(br, *fill); if (fill) p->fillRect(br, *fill);
} }
void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe, void LightStyleV2::drawPrimitive( TQ_PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -367,7 +369,7 @@ void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe,
p->drawLine(r.left() + 6, r.top() + 2, r.right() - 6, r.top() + 2); p->drawLine(r.left() + 6, r.top() + 2, r.right() - 6, r.top() + 2);
} }
} else } else
TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
break; break;
} }
@ -406,39 +408,39 @@ void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe,
case PE_WindowFrame: case PE_WindowFrame:
{ {
int lw = data.isDefault() ? int lw = data.isDefault() ?
pixelMetric(PM_DefaultFrameWidth) : data.lineWidth(); pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) : data.lineWidth();
if ( ! ( flags & Style_Sunken ) ) if ( ! ( flags & Style_Sunken ) )
flags |= Style_Raised; flags |= Style_Raised;
if (lw == 2) if (lw == 2)
drawLightBevel(p, r, cg, flags); drawLightBevel(p, r, cg, flags);
else else
TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
break; break;
} }
case PE_PanelDockWindow: case PE_PanelDockWindow:
{ {
int lw = data.isDefault() ? int lw = data.isDefault() ?
pixelMetric(PM_DockWindowFrameWidth) : data.lineWidth(); pixelMetric(PM_DockWindowFrameWidth, ceData, elementFlags) : data.lineWidth();
if (lw == 2) if (lw == 2)
drawLightBevel(p, r, cg, flags | Style_Raised, drawLightBevel(p, r, cg, flags | Style_Raised,
&cg.brush(TQColorGroup::Button)); &cg.brush(TQColorGroup::Button));
else else
TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
break; break;
} }
case PE_PanelMenuBar: case PE_PanelMenuBar:
{ {
int lw = data.isDefault() ? int lw = data.isDefault() ?
pixelMetric(PM_MenuBarFrameWidth) : data.lineWidth(); pixelMetric(PM_MenuBarFrameWidth, ceData, elementFlags) : data.lineWidth();
if (lw == 2) if (lw == 2)
drawLightBevel(p, r, cg, flags, &cg.brush(TQColorGroup::Button)); drawLightBevel(p, r, cg, flags, &cg.brush(TQColorGroup::Button));
else else
TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
break; break;
} }
@ -463,7 +465,7 @@ void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe,
p->fillRect(fr, cg.brush((flags & Style_Down) ? p->fillRect(fr, cg.brush((flags & Style_Down) ?
TQColorGroup::Midlight : TQColorGroup::Midlight :
TQColorGroup::Background)); TQColorGroup::Background));
tqdrawPrimitive(pe, p, ar, cg, flags); drawPrimitive(pe, p, ceData, elementFlags, ar, cg, flags);
break; break;
} }
@ -488,7 +490,7 @@ void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe,
p->fillRect(fr, cg.brush((flags & Style_Down) ? p->fillRect(fr, cg.brush((flags & Style_Down) ?
TQColorGroup::Midlight : TQColorGroup::Midlight :
TQColorGroup::Background)); TQColorGroup::Background));
tqdrawPrimitive(pe, p, ar, cg, flags); drawPrimitive(pe, p, ceData, elementFlags, ar, cg, flags);
break; break;
} }
@ -611,18 +613,20 @@ void LightStyleV2::tqdrawPrimitive( TQ_PrimitiveElement pe,
} }
p->restore(); p->restore();
} else } else
TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
break; break;
} }
} }
void LightStyleV2::drawControl( TQ_ControlElement control, void LightStyleV2::drawControl( TQ_ControlElement control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget *widget ) const
{ {
switch (control) { switch (control) {
case CE_TabBarTab: case CE_TabBarTab:
@ -854,7 +858,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
p->setPen(cg.text()); p->setPen(cg.text());
p->drawPixmap(pmr.topLeft(), pixmap); p->drawPixmap(pmr.topLeft(), pixmap);
} else if (popupmenu->isCheckable() && mi->isChecked()) } else if (popupmenu->isCheckable() && mi->isChecked())
tqdrawPrimitive(PE_CheckMark, p, cr, cg, drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg,
(flags & Style_Enabled) | Style_On); (flags & Style_Enabled) | Style_On);
TQColor textcolor; TQColor textcolor;
@ -930,7 +934,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
} }
if (mi->popup()) if (mi->popup())
tqdrawPrimitive( (reverse ? PE_ArrowLeft : PE_ArrowRight), p, sr, cg, flags); drawPrimitive( (reverse ? PE_ArrowLeft : PE_ArrowRight), p, ceData, elementFlags, sr, cg, flags);
break; break;
} }
@ -969,16 +973,18 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
break; break;
default: default:
TQCommonStyle::drawControl(control, p, widget, r, cg, flags, data); TQCommonStyle::drawControl(control, p, ceData, elementFlags, r, cg, flags, data, widget);
break; break;
} }
} }
void LightStyleV2::drawControlMask( TQ_ControlElement control, void LightStyleV2::drawControlMask( TQ_ControlElement control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget *widget ) const
{ {
switch (control) { switch (control) {
case CE_PushButton: case CE_PushButton:
@ -986,12 +992,12 @@ void LightStyleV2::drawControlMask( TQ_ControlElement control,
break; break;
default: default:
TQCommonStyle::drawControlMask(control, p, widget, r, data); TQCommonStyle::drawControlMask(control, p, ceData, elementFlags, r, data, widget);
break; break;
} }
} }
TQRect LightStyleV2::subRect(SubRect subrect, const TQWidget *widget) const TQRect LightStyleV2::subRect(SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
TQRect rect, wrect(widget->rect()); TQRect rect, wrect(widget->rect());
@ -1001,7 +1007,7 @@ TQRect LightStyleV2::subRect(SubRect subrect, const TQWidget *widget) const
const TQPushButton *button = (const TQPushButton *) widget; const TQPushButton *button = (const TQPushButton *) widget;
int dbw1 = 0, dbw2 = 0; int dbw1 = 0, dbw2 = 0;
if (button->isDefault() || button->autoDefault()) { if (button->isDefault() || button->autoDefault()) {
dbw1 = pixelMetric(PM_ButtonDefaultIndicator, widget); dbw1 = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget);
dbw2 = dbw1 * 2; dbw2 = dbw1 * 2;
} }
@ -1013,7 +1019,7 @@ TQRect LightStyleV2::subRect(SubRect subrect, const TQWidget *widget) const
} }
default: default:
rect = TQCommonStyle::subRect(subrect, widget); rect = TQCommonStyle::subRect(subrect, ceData, elementFlags, widget);
} }
return rect; return rect;
@ -1021,13 +1027,15 @@ TQRect LightStyleV2::subRect(SubRect subrect, const TQWidget *widget) const
void LightStyleV2::drawComplexControl( TQ_ComplexControl control, void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
TQPainter* p, TQPainter* p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect& r, const TQRect& r,
const TQColorGroup& cg, const TQColorGroup& cg,
SFlags flags, SFlags flags,
SCFlags controls, SCFlags controls,
SCFlags active, SCFlags active,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget* widget ) const
{ {
switch (control) { switch (control) {
case CC_ComboBox: case CC_ComboBox:
@ -1035,17 +1043,17 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
const TQComboBox *combobox = (const TQComboBox *) widget; const TQComboBox *combobox = (const TQComboBox *) widget;
TQRect frame, arrow, field; TQRect frame, arrow, field;
frame = frame =
TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
SC_ComboBoxFrame, data), SC_ComboBoxFrame, data, widget),
widget); ceData, elementFlags);
arrow = arrow =
TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
SC_ComboBoxArrow, data), SC_ComboBoxArrow, data, widget),
widget); ceData, elementFlags);
field = field =
TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
SC_ComboBoxEditField, data), SC_ComboBoxEditField, data, widget),
widget); ceData, elementFlags);
if ((controls & SC_ComboBoxFrame) && frame.isValid()) if ((controls & SC_ComboBoxFrame) && frame.isValid())
drawLightBevel(p, frame, cg, flags | Style_Raised, drawLightBevel(p, frame, cg, flags | Style_Raised,
@ -1055,7 +1063,7 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
if (active == SC_ComboBoxArrow) if (active == SC_ComboBoxArrow)
p->fillRect(arrow, cg.brush(TQColorGroup::Mid)); p->fillRect(arrow, cg.brush(TQColorGroup::Mid));
arrow.addCoords(4, 2, -2, -2); arrow.addCoords(4, 2, -2, -2);
tqdrawPrimitive(PE_ArrowDown, p, arrow, cg, flags); drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, arrow, cg, flags);
} }
if ((controls & SC_ComboBoxEditField) && field.isValid()) { if ((controls & SC_ComboBoxEditField) && field.isValid()) {
@ -1071,9 +1079,9 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
if (! combobox->editable()) { if (! combobox->editable()) {
p->fillRect( field, cg.brush( TQColorGroup::Highlight ) ); p->fillRect( field, cg.brush( TQColorGroup::Highlight ) );
TQRect fr = TQRect fr =
TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, widget ), TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ),
widget ); ceData, elementFlags );
tqdrawPrimitive( PE_FocusRect, p, fr, cg, drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg,
flags | Style_FocusAtBorder, flags | Style_FocusAtBorder,
TQStyleOption(cg.highlight())); TQStyleOption(cg.highlight()));
} }
@ -1091,8 +1099,8 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
const TQSpinWidget *spinwidget = (const TQSpinWidget *) widget; const TQSpinWidget *spinwidget = (const TQSpinWidget *) widget;
TQRect frame, up, down; TQRect frame, up, down;
frame = querySubControlMetrics((TQ_ComplexControl)CC_SpinWidget, widget, frame = querySubControlMetrics((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags,
SC_SpinWidgetFrame, data); SC_SpinWidgetFrame, data, widget);
up = spinwidget->upRect(); up = spinwidget->upRect();
down = spinwidget->downRect(); down = spinwidget->downRect();
@ -1128,7 +1136,7 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
up.right() - 1, up.bottom()); up.right() - 1, up.bottom());
up.addCoords(1, 0, 0, 0); up.addCoords(1, 0, 0, 0);
tqdrawPrimitive(pe, p, up, cg, flags | drawPrimitive(pe, p, ceData, elementFlags, up, cg, flags |
((active == SC_SpinWidgetUp) ? ((active == SC_SpinWidgetUp) ?
Style_On | Style_Sunken : Style_Raised)); Style_On | Style_Sunken : Style_Raised));
} }
@ -1161,7 +1169,7 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
down.right() - 1, down.bottom()); down.right() - 1, down.bottom());
down.addCoords(1, 0, 0, 0); down.addCoords(1, 0, 0, 0);
tqdrawPrimitive(pe, p, down, cg, flags | drawPrimitive(pe, p, ceData, elementFlags, down, cg, flags |
((active == SC_SpinWidgetDown) ? ((active == SC_SpinWidgetDown) ?
Style_On | Style_Sunken : Style_Raised)); Style_On | Style_Sunken : Style_Raised));
} }
@ -1175,13 +1183,13 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
TQRect addline, subline, subline2, addpage, subpage, slider, first, last; TQRect addline, subline, subline2, addpage, subpage, slider, first, last;
bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue()); bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue());
subline = querySubControlMetrics(control, widget, SC_ScrollBarSubLine, data); subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, data, widget);
addline = querySubControlMetrics(control, widget, SC_ScrollBarAddLine, data); addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, data, widget);
subpage = querySubControlMetrics(control, widget, SC_ScrollBarSubPage, data); subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, data, widget);
addpage = querySubControlMetrics(control, widget, SC_ScrollBarAddPage, data); addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, data, widget);
slider = querySubControlMetrics(control, widget, SC_ScrollBarSlider, data); slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, data, widget);
first = querySubControlMetrics(control, widget, SC_ScrollBarFirst, data); first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, data, widget);
last = querySubControlMetrics(control, widget, SC_ScrollBarLast, data); last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, data, widget);
subline2 = addline; subline2 = addline;
if (scrollbar->orientation() == Qt::Horizontal) if (scrollbar->orientation() == Qt::Horizontal)
@ -1190,52 +1198,52 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
subline2.moveBy(0, -addline.height()); subline2.moveBy(0, -addline.height());
if ((controls & SC_ScrollBarSubLine) && subline.isValid()) { if ((controls & SC_ScrollBarSubLine) && subline.isValid()) {
tqdrawPrimitive(PE_ScrollBarSubLine, p, subline, cg, drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg,
Style_Enabled | ((active == SC_ScrollBarSubLine) ? Style_Enabled | ((active == SC_ScrollBarSubLine) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if (subline2.isValid()) if (subline2.isValid())
tqdrawPrimitive(PE_ScrollBarSubLine, p, subline2, cg, drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, cg,
Style_Enabled | ((active == SC_ScrollBarSubLine) ? Style_Enabled | ((active == SC_ScrollBarSubLine) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
} }
if ((controls & SC_ScrollBarAddLine) && addline.isValid()) if ((controls & SC_ScrollBarAddLine) && addline.isValid())
tqdrawPrimitive(PE_ScrollBarAddLine, p, addline, cg, drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg,
Style_Enabled | ((active == SC_ScrollBarAddLine) ? Style_Enabled | ((active == SC_ScrollBarAddLine) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) if ((controls & SC_ScrollBarSubPage) && subpage.isValid())
tqdrawPrimitive(PE_ScrollBarSubPage, p, subpage, cg, drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg,
Style_Enabled | ((active == SC_ScrollBarSubPage) ? Style_Enabled | ((active == SC_ScrollBarSubPage) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) if ((controls & SC_ScrollBarAddPage) && addpage.isValid())
tqdrawPrimitive(PE_ScrollBarAddPage, p, addpage, cg, drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg,
((maxedOut) ? Style_Default : Style_Enabled) | ((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarAddPage) ? ((active == SC_ScrollBarAddPage) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if ((controls & SC_ScrollBarFirst) && first.isValid()) if ((controls & SC_ScrollBarFirst) && first.isValid())
tqdrawPrimitive(PE_ScrollBarFirst, p, first, cg, drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg,
Style_Enabled | ((active == SC_ScrollBarFirst) ? Style_Enabled | ((active == SC_ScrollBarFirst) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if ((controls & SC_ScrollBarLast) && last.isValid()) if ((controls & SC_ScrollBarLast) && last.isValid())
tqdrawPrimitive(PE_ScrollBarLast, p, last, cg, drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg,
Style_Enabled | ((active == SC_ScrollBarLast) ? Style_Enabled | ((active == SC_ScrollBarLast) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if ((controls & SC_ScrollBarSlider) && slider.isValid()) { if ((controls & SC_ScrollBarSlider) && slider.isValid()) {
tqdrawPrimitive(PE_ScrollBarSlider, p, slider, cg, drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg,
Style_Enabled | ((active == SC_ScrollBarSlider) ? Style_Enabled | ((active == SC_ScrollBarSlider) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
@ -1245,7 +1253,7 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
if (scrollbar->hasFocus()) { if (scrollbar->hasFocus()) {
TQRect fr(slider.x() + 2, slider.y() + 2, TQRect fr(slider.x() + 2, slider.y() + 2,
slider.width() - 5, slider.height() - 5); slider.width() - 5, slider.height() - 5);
tqdrawPrimitive(PE_FocusRect, p, fr, cg, Style_Default); drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default);
} }
} }
@ -1255,14 +1263,14 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
case CC_Slider: case CC_Slider:
{ {
const TQSlider *slider = (const TQSlider *) widget; const TQSlider *slider = (const TQSlider *) widget;
TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove,
data), data, widget),
handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle,
data); data, widget);
if ((controls & SC_SliderGroove) && groove.isValid()) { if ((controls & SC_SliderGroove) && groove.isValid()) {
if (flags & Style_HasFocus) if (flags & Style_HasFocus)
tqdrawPrimitive( PE_FocusRect, p, groove, cg ); drawPrimitive( PE_FocusRect, p, ceData, elementFlags, groove, cg );
if (slider->orientation() == Qt::Horizontal) { if (slider->orientation() == Qt::Horizontal) {
int dh = (groove.height() - 5) / 2; int dh = (groove.height() - 5) / 2;
@ -1285,28 +1293,30 @@ void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
} }
if (controls & SC_SliderTickmarks) if (controls & SC_SliderTickmarks)
TQCommonStyle::drawComplexControl(control, p, widget, r, cg, flags, TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
SC_SliderTickmarks, active, data ); SC_SliderTickmarks, active, data, widget );
break; break;
} }
case CC_ListView: case CC_ListView:
// use the base style for CC_ListView // use the base style for CC_ListView
singleton->basestyle->drawComplexControl(control, p, widget, r, cg, flags, singleton->basestyle->drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
controls, active, data); controls, active, data, widget);
break; break;
default: default:
TQCommonStyle::drawComplexControl(control, p, widget, r, cg, flags, TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
controls, active, data); controls, active, data, widget);
break; break;
} }
} }
TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control, TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc, SubControl sc,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget *widget ) const
{ {
TQRect ret; TQRect ret;
@ -1315,7 +1325,7 @@ TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control,
{ {
const TQScrollBar *scrollbar = (const TQScrollBar *) widget; const TQScrollBar *scrollbar = (const TQScrollBar *) widget;
int sliderstart = scrollbar->sliderStart(); int sliderstart = scrollbar->sliderStart();
int sbextent = pixelMetric(PM_ScrollBarExtent, widget); int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget);
int maxlen = ((scrollbar->orientation() == Qt::Horizontal) ? int maxlen = ((scrollbar->orientation() == Qt::Horizontal) ?
scrollbar->width() : scrollbar->height()) - (sbextent * 3); scrollbar->width() : scrollbar->height()) - (sbextent * 3);
int sliderlen; int sliderlen;
@ -1326,7 +1336,7 @@ TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control,
sliderlen = (scrollbar->pageStep() * maxlen) / sliderlen = (scrollbar->pageStep() * maxlen) /
(range + scrollbar->pageStep()); (range + scrollbar->pageStep());
int slidermin = pixelMetric( PM_ScrollBarSliderMin, widget ); int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget );
if ( sliderlen < slidermin || range > INT_MAX / 2 ) if ( sliderlen < slidermin || range > INT_MAX / 2 )
sliderlen = slidermin; sliderlen = slidermin;
if ( sliderlen > maxlen ) if ( sliderlen > maxlen )
@ -1390,7 +1400,7 @@ TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control,
} }
default: default:
ret = TQCommonStyle::querySubControlMetrics(control, widget, sc, data); ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget);
break; break;
} }
@ -1398,11 +1408,13 @@ TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control,
} }
TQStyle::SubControl LightStyleV2::querySubControl( TQ_ComplexControl control, TQStyle::SubControl LightStyleV2::querySubControl( TQ_ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQPoint &pos, const TQPoint &pos,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget *widget ) const
{ {
TQStyle::SubControl ret = TQCommonStyle::querySubControl(control, widget, pos, data); TQStyle::SubControl ret = TQCommonStyle::querySubControl(control, ceData, elementFlags, pos, data, widget);
// this is an ugly hack, but i really don't care, it's the quickest way to // this is an ugly hack, but i really don't care, it's the quickest way to
// enabled the third button // enabled the third button
@ -1413,7 +1425,7 @@ TQStyle::SubControl LightStyleV2::querySubControl( TQ_ComplexControl control,
return ret; return ret;
} }
int LightStyleV2::pixelMetric( PixelMetric metric, int LightStyleV2::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQWidget *widget ) const const TQWidget *widget ) const
{ {
int ret; int ret;
@ -1468,7 +1480,7 @@ int LightStyleV2::pixelMetric( PixelMetric metric,
case PM_SliderLength: case PM_SliderLength:
case PM_SliderControlThickness: case PM_SliderControlThickness:
ret = singleton->basestyle->pixelMetric( metric, widget ); ret = singleton->basestyle->pixelMetric( metric, ceData, elementFlags, widget );
break; break;
case PM_MaximumDragDistance: case PM_MaximumDragDistance:
@ -1476,17 +1488,19 @@ int LightStyleV2::pixelMetric( PixelMetric metric,
break; break;
default: default:
ret = TQCommonStyle::pixelMetric(metric, widget); ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget);
break; break;
} }
return ret; return ret;
} }
TQSize LightStyleV2::tqsizeFromContents( ContentsType contents, TQSize LightStyleV2::sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget *widget ) const
{ {
TQSize ret; TQSize ret;
@ -1494,7 +1508,7 @@ TQSize LightStyleV2::tqsizeFromContents( ContentsType contents,
case CT_PushButton: case CT_PushButton:
{ {
const TQPushButton *button = (const TQPushButton *) widget; const TQPushButton *button = (const TQPushButton *) widget;
ret = TQCommonStyle::tqsizeFromContents( contents, widget, contentsSize, data ); ret = TQCommonStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, data, widget );
int w = ret.width(), h = ret.height(); int w = ret.width(), h = ret.height();
// only expand the button if we are displaying text... // only expand the button if we are displaying text...
@ -1583,7 +1597,7 @@ TQSize LightStyleV2::tqsizeFromContents( ContentsType contents,
} }
default: default:
ret = TQCommonStyle::tqsizeFromContents(contents, widget, contentsSize, data); ret = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, data, widget);
break; break;
} }
@ -1591,9 +1605,11 @@ TQSize LightStyleV2::tqsizeFromContents( ContentsType contents,
} }
int LightStyleV2::styleHint( TQ_StyleHint stylehint, int LightStyleV2::styleHint( TQ_StyleHint stylehint,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption &option, const TQStyleOption &option,
TQStyleHintReturn* returnData ) const TQStyleHintReturn* returnData,
const TQWidget *widget ) const
{ {
int ret; int ret;
@ -1615,7 +1631,7 @@ int LightStyleV2::styleHint( TQ_StyleHint stylehint,
break; break;
default: default:
ret = TQCommonStyle::styleHint(stylehint, widget, option, returnData); ret = TQCommonStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
break; break;
} }
@ -1623,9 +1639,11 @@ int LightStyleV2::styleHint( TQ_StyleHint stylehint,
} }
TQPixmap LightStyleV2::stylePixmap( StylePixmap stylepixmap, TQPixmap LightStyleV2::stylePixmap( StylePixmap stylepixmap,
const TQWidget *widget, TQStyleControlElementData ceData,
const TQStyleOption &data ) const ControlElementFlags elementFlags,
const TQStyleOption &data,
const TQWidget *widget ) const
{ {
return singleton->basestyle->stylePixmap( stylepixmap, widget, data ); return singleton->basestyle->stylePixmap( stylepixmap, ceData, elementFlags, data, widget );
} }
#include "lightstyle-v2.moc" #include "lightstyle-v2.moc"

@ -44,41 +44,43 @@ public:
void polishPopupMenu( TQPopupMenu * ); void polishPopupMenu( TQPopupMenu * );
void tqdrawPrimitive(TQ_PrimitiveElement, TQPainter *, const TQRect &, const TQColorGroup &, void drawPrimitive(TQ_PrimitiveElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &,
SFlags = Style_Default, SFlags = Style_Default,
const TQStyleOption & = TQStyleOption::Default ) const; const TQStyleOption & = TQStyleOption::Default ) const;
void drawControl(TQ_ControlElement, TQPainter *, const TQWidget *, const TQRect &, void drawControl(TQ_ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &,
const TQColorGroup &, SFlags = Style_Default, const TQColorGroup &, SFlags = Style_Default,
const TQStyleOption & = TQStyleOption::Default ) const; const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
void drawControlMask(TQ_ControlElement, TQPainter *, const TQWidget *, const TQRect &, void drawControlMask(TQ_ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &,
const TQStyleOption & = TQStyleOption::Default) const; const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0) const;
TQRect subRect(SubRect, const TQWidget *) const; TQRect subRect(SubRect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *) const;
void drawComplexControl(TQ_ComplexControl, TQPainter *, const TQWidget *, const TQRect &, void drawComplexControl(TQ_ComplexControl, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &,
const TQColorGroup &, SFlags = Style_Default, const TQColorGroup &, SFlags = Style_Default,
SCFlags = SC_All, SCFlags = SC_None, SCFlags = SC_All, SCFlags = SC_None,
const TQStyleOption & = TQStyleOption::Default ) const; const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
TQRect querySubControlMetrics(TQ_ComplexControl, const TQWidget *, SubControl, TQRect querySubControlMetrics(TQ_ComplexControl, TQStyleControlElementData ceData, ControlElementFlags elementFlags, SubControl,
const TQStyleOption & = TQStyleOption::Default ) const; const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
SubControl querySubControl(TQ_ComplexControl, const TQWidget *, const TQPoint &, SubControl querySubControl(TQ_ComplexControl, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQPoint &,
const TQStyleOption &data = TQStyleOption::Default ) const; const TQStyleOption &data = TQStyleOption::Default, const TQWidget * = 0 ) const;
int pixelMetric(PixelMetric, const TQWidget * = 0 ) const; int pixelMetric(PixelMetric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * = 0 ) const;
TQSize tqsizeFromContents(ContentsType, const TQWidget *, const TQSize &, TQSize sizeFromContents(ContentsType, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQSize &,
const TQStyleOption & = TQStyleOption::Default ) const; const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
int styleHint(TQ_StyleHint, const TQWidget * = 0, int styleHint(TQ_StyleHint, 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, TQPixmap stylePixmap( StylePixmap stylepixmap,
const TQWidget* widget = 0, TQStyleControlElementData ceData,
const TQStyleOption& = TQStyleOption::Default ) const; ControlElementFlags elementFlags,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
}; };

@ -212,8 +212,10 @@ static void drawLightBevel( TQPainter *p,
p->fillRect( br, *fill ); p->fillRect( br, *fill );
} }
void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe, void LightStyleV3::drawPrimitive( TQ_PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -278,7 +280,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe,
br.addCoords( 1, 1, -1, -1 ); br.addCoords( 1, 1, -1, -1 );
} }
drawLightBevel( p, br, cg, flags, drawLightBevel( p, br, cg, flags,
pixelMetric( PM_DefaultFrameWidth ) + ( etch ? 1 : 0 ), pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) + ( etch ? 1 : 0 ),
etch, true, fill ); etch, true, fill );
break; break;
} }
@ -294,7 +296,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe,
fill = &cg.brush(TQColorGroup::Button); fill = &cg.brush(TQColorGroup::Button);
} else } else
fill = &cg.brush(TQColorGroup::Background); fill = &cg.brush(TQColorGroup::Background);
drawLightBevel( p, r, cg, flags, pixelMetric( PM_DefaultFrameWidth ), drawLightBevel( p, r, cg, flags, pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ),
false, true, fill ); false, true, fill );
break; break;
@ -532,7 +534,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe,
case PE_PanelPopup: case PE_PanelPopup:
drawLightBevel( p, r, cg, flags, drawLightBevel( p, r, cg, flags,
( data.isDefault() ? pixelMetric(PM_DefaultFrameWidth) : ( data.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) :
data.lineWidth() ), false, true ); data.lineWidth() ), false, true );
break; break;
@ -545,7 +547,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe,
int cover = 0; int cover = 0;
int reallw = ( data.isDefault() ? int reallw = ( data.isDefault() ?
pixelMetric( PM_DefaultFrameWidth ) : data.lineWidth() ); pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) : data.lineWidth() );
cover = reallw - 1; cover = reallw - 1;
if ( ! ( flags & Style_Sunken ) ) if ( ! ( flags & Style_Sunken ) )
@ -573,14 +575,14 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe,
case PE_PanelDockWindow: case PE_PanelDockWindow:
drawLightBevel( p, r, cg, flags, ( data.isDefault() ? drawLightBevel( p, r, cg, flags, ( data.isDefault() ?
pixelMetric(PM_DefaultFrameWidth) : pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) :
data.lineWidth() ), false, false, data.lineWidth() ), false, false,
&cg.brush( TQColorGroup::Button ) ); &cg.brush( TQColorGroup::Button ) );
break; break;
case PE_PanelMenuBar: case PE_PanelMenuBar:
drawLightBevel( p, r, cg, flags, ( data.isDefault() ? drawLightBevel( p, r, cg, flags, ( data.isDefault() ?
pixelMetric(PM_MenuBarFrameWidth) : pixelMetric(PM_MenuBarFrameWidth, ceData, elementFlags) :
data.lineWidth() ), false, false, data.lineWidth() ), false, false,
&cg.brush( TQColorGroup::Button ) ); &cg.brush( TQColorGroup::Button ) );
break; break;
@ -615,7 +617,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe,
if ( ! br.isValid() ) if ( ! br.isValid() )
break; break;
tqdrawPrimitive( pe, p, br, cg, flags ); drawPrimitive( pe, p, ceData, elementFlags, br, cg, flags );
break; break;
} }
@ -649,7 +651,7 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe,
if ( ! br.isValid() ) if ( ! br.isValid() )
break; break;
tqdrawPrimitive( pe, p, br, cg, flags ); drawPrimitive( pe, p, ceData, elementFlags, br, cg, flags );
break; break;
} }
@ -799,18 +801,20 @@ void LightStyleV3::tqdrawPrimitive( TQ_PrimitiveElement pe,
} }
p->restore(); p->restore();
} else } else
TQCommonStyle::tqdrawPrimitive(pe, p, r, cg, flags, data); TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
break; break;
} }
} }
void LightStyleV3::drawControl( TQ_ControlElement control, void LightStyleV3::drawControl( TQ_ControlElement control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget *widget ) const
{ {
switch (control) { switch (control) {
case CE_TabBarTab: case CE_TabBarTab:
@ -893,7 +897,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
p->fillRect( br, cg.background() ); p->fillRect( br, cg.background() );
} else } else
TQCommonStyle::drawControl( control, p, widget, r, cg, flags, data ); TQCommonStyle::drawControl( control, p, ceData, elementFlags, r, cg, flags, data, widget );
break; break;
} }
@ -974,7 +978,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
p->setPen(cg.text()); p->setPen(cg.text());
p->drawPixmap(pmr.topLeft(), pixmap); p->drawPixmap(pmr.topLeft(), pixmap);
} else if (popupmenu->isCheckable() && mi->isChecked()) } else if (popupmenu->isCheckable() && mi->isChecked())
tqdrawPrimitive(PE_CheckMark, p, cr, cg, drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg,
(flags & Style_Enabled) | Style_On); (flags & Style_Enabled) | Style_On);
TQColor textcolor; TQColor textcolor;
@ -1050,8 +1054,8 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
} }
if (mi->popup()) if (mi->popup())
tqdrawPrimitive( (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight), drawPrimitive( (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight),
p, sr, cg, flags); p, ceData, elementFlags, sr, cg, flags);
break; break;
} }
@ -1079,21 +1083,23 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
} }
case CE_ProgressBarGroove: case CE_ProgressBarGroove:
drawLightBevel( p, r, cg, Style_Sunken, pixelMetric( PM_DefaultFrameWidth ), drawLightBevel( p, r, cg, Style_Sunken, pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ),
true, true, &cg.brush( TQColorGroup::Background ) ); true, true, &cg.brush( TQColorGroup::Background ) );
break; break;
default: default:
TQCommonStyle::drawControl(control, p, widget, r, cg, flags, data); TQCommonStyle::drawControl(control, p, ceData, elementFlags, r, cg, flags, data, widget);
break; break;
} }
} }
void LightStyleV3::drawControlMask( TQ_ControlElement control, void LightStyleV3::drawControlMask( TQ_ControlElement control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget *widget ) const
{ {
switch (control) { switch (control) {
case CE_PushButton: case CE_PushButton:
@ -1101,27 +1107,27 @@ void LightStyleV3::drawControlMask( TQ_ControlElement control,
break; break;
default: default:
TQCommonStyle::drawControlMask(control, p, widget, r, data); TQCommonStyle::drawControlMask(control, p, ceData, elementFlags, r, data, widget);
break; break;
} }
} }
TQRect LightStyleV3::subRect(SubRect subrect, const TQWidget *widget) const TQRect LightStyleV3::subRect(SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
TQRect rect; TQRect rect;
switch (subrect) { switch (subrect) {
case SR_PushButtonFocusRect: case SR_PushButtonFocusRect:
{ {
rect = TQCommonStyle::subRect( SR_PushButtonContents, widget ); rect = TQCommonStyle::subRect( SR_PushButtonContents, ceData, elementFlags, widget );
int bm = pixelMetric( PM_ButtonMargin, widget ), hbm = bm / 2; int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ), hbm = bm / 2;
rect.addCoords( hbm, hbm, -hbm, -hbm ); rect.addCoords( hbm, hbm, -hbm, -hbm );
break; break;
} }
case SR_ComboBoxFocusRect: case SR_ComboBoxFocusRect:
{ {
rect = TQCommonStyle::subRect( SR_ComboBoxFocusRect, widget ); rect = TQCommonStyle::subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget );
rect.addCoords( -1, -1, 1, 1 ); rect.addCoords( -1, -1, 1, 1 );
break; break;
} }
@ -1144,7 +1150,7 @@ TQRect LightStyleV3::subRect(SubRect subrect, const TQWidget *widget) const
default: default:
rect = TQCommonStyle::subRect(subrect, widget); rect = TQCommonStyle::subRect(subrect, ceData, elementFlags, widget);
break; break;
} }
@ -1153,13 +1159,15 @@ TQRect LightStyleV3::subRect(SubRect subrect, const TQWidget *widget) const
void LightStyleV3::drawComplexControl( TQ_ComplexControl control, void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
TQPainter* p, TQPainter* p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect& r, const TQRect& r,
const TQColorGroup& cg, const TQColorGroup& cg,
SFlags flags, SFlags flags,
SCFlags controls, SCFlags controls,
SCFlags active, SCFlags active,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget* widget ) const
{ {
switch (control) { switch (control) {
case CC_ComboBox: case CC_ComboBox:
@ -1167,37 +1175,37 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
const TQComboBox *combobox = (const TQComboBox *) widget; const TQComboBox *combobox = (const TQComboBox *) widget;
TQRect frame, arrow, field; TQRect frame, arrow, field;
frame = frame =
TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
SC_ComboBoxFrame, data), SC_ComboBoxFrame, data, widget),
widget); ceData, elementFlags);
arrow = arrow =
TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
SC_ComboBoxArrow, data), SC_ComboBoxArrow, data, widget),
widget); ceData, elementFlags);
field = field =
TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
SC_ComboBoxEditField, data), SC_ComboBoxEditField, data, widget),
widget); ceData, elementFlags);
if ((controls & SC_ComboBoxFrame) && frame.isValid()) if ((controls & SC_ComboBoxFrame) && frame.isValid())
tqdrawPrimitive( PE_Panel, p, frame, cg, flags | Style_Sunken ); drawPrimitive( PE_Panel, p, ceData, elementFlags, frame, cg, flags | Style_Sunken );
if ((controls & SC_ComboBoxArrow) && arrow.isValid()) { if ((controls & SC_ComboBoxArrow) && arrow.isValid()) {
drawLightEtch( p, arrow, cg.button(), ( active == SC_ComboBoxArrow ) ); drawLightEtch( p, arrow, cg.button(), ( active == SC_ComboBoxArrow ) );
arrow.addCoords( 1, 1, -1, -1 ); arrow.addCoords( 1, 1, -1, -1 );
p->fillRect( arrow, cg.brush( TQColorGroup::Button ) ); p->fillRect( arrow, cg.brush( TQColorGroup::Button ) );
arrow.addCoords(3, 1, -1, -1); arrow.addCoords(3, 1, -1, -1);
tqdrawPrimitive(PE_ArrowDown, p, arrow, cg, flags); drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, arrow, cg, flags);
} }
if ((controls & SC_ComboBoxEditField) && field.isValid()) { if ((controls & SC_ComboBoxEditField) && field.isValid()) {
if (flags & Style_HasFocus) { if (flags & Style_HasFocus) {
if (! combobox->editable()) { if (! combobox->editable()) {
TQRect fr = TQRect fr =
TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, widget ), TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ),
widget ); ceData, elementFlags );
p->fillRect( fr, cg.brush( TQColorGroup::Highlight ) ); p->fillRect( fr, cg.brush( TQColorGroup::Highlight ) );
tqdrawPrimitive( PE_FocusRect, p, fr, cg, drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg,
flags | Style_FocusAtBorder, flags | Style_FocusAtBorder,
TQStyleOption(cg.highlight())); TQStyleOption(cg.highlight()));
} }
@ -1219,13 +1227,13 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
const TQSpinWidget *spinwidget = (const TQSpinWidget *) widget; const TQSpinWidget *spinwidget = (const TQSpinWidget *) widget;
TQRect frame, up, down; TQRect frame, up, down;
frame = querySubControlMetrics((TQ_ComplexControl)CC_SpinWidget, widget, frame = querySubControlMetrics((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags,
SC_SpinWidgetFrame, data); SC_SpinWidgetFrame, data, widget);
up = spinwidget->upRect(); up = spinwidget->upRect();
down = spinwidget->downRect(); down = spinwidget->downRect();
if ((controls & SC_SpinWidgetFrame) && frame.isValid()) if ((controls & SC_SpinWidgetFrame) && frame.isValid())
tqdrawPrimitive( PE_Panel, p, frame, cg, flags | Style_Sunken ); drawPrimitive( PE_Panel, p, ceData, elementFlags, frame, cg, flags | Style_Sunken );
if ((controls & SC_SpinWidgetUp) && up.isValid()) { if ((controls & SC_SpinWidgetUp) && up.isValid()) {
TQ_PrimitiveElement pe = PE_SpinWidgetUp; TQ_PrimitiveElement pe = PE_SpinWidgetUp;
@ -1240,7 +1248,7 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
drawLightEtch( p, up, cg.button(), ( active == SC_SpinWidgetUp ) ); drawLightEtch( p, up, cg.button(), ( active == SC_SpinWidgetUp ) );
up.addCoords( 1, 0, 0, 0 ); up.addCoords( 1, 0, 0, 0 );
tqdrawPrimitive(pe, p, up, cg, flags | drawPrimitive(pe, p, ceData, elementFlags, up, cg, flags |
((active == SC_SpinWidgetUp) ? ((active == SC_SpinWidgetUp) ?
Style_On | Style_Sunken : Style_Raised)); Style_On | Style_Sunken : Style_Raised));
} }
@ -1258,7 +1266,7 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
drawLightEtch( p, down, cg.button(), ( active == SC_SpinWidgetDown ) ); drawLightEtch( p, down, cg.button(), ( active == SC_SpinWidgetDown ) );
down.addCoords( 1, 0, 0, 0 ); down.addCoords( 1, 0, 0, 0 );
tqdrawPrimitive(pe, p, down, cg, flags | drawPrimitive(pe, p, ceData, elementFlags, down, cg, flags |
((active == SC_SpinWidgetDown) ? ((active == SC_SpinWidgetDown) ?
Style_On | Style_Sunken : Style_Raised)); Style_On | Style_Sunken : Style_Raised));
} }
@ -1272,13 +1280,13 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
TQRect addline, subline, subline2, addpage, subpage, slider, first, last; TQRect addline, subline, subline2, addpage, subpage, slider, first, last;
bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue()); bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue());
subline = querySubControlMetrics(control, widget, SC_ScrollBarSubLine, data); subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, data, widget);
addline = querySubControlMetrics(control, widget, SC_ScrollBarAddLine, data); addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, data, widget);
subpage = querySubControlMetrics(control, widget, SC_ScrollBarSubPage, data); subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, data, widget);
addpage = querySubControlMetrics(control, widget, SC_ScrollBarAddPage, data); addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, data, widget);
slider = querySubControlMetrics(control, widget, SC_ScrollBarSlider, data); slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, data, widget);
first = querySubControlMetrics(control, widget, SC_ScrollBarFirst, data); first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, data, widget);
last = querySubControlMetrics(control, widget, SC_ScrollBarLast, data); last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, data, widget);
subline2 = addline; subline2 = addline;
if (scrollbar->orientation() == Qt::Horizontal) if (scrollbar->orientation() == Qt::Horizontal)
@ -1287,52 +1295,52 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
subline2.moveBy(0, -addline.height()); subline2.moveBy(0, -addline.height());
if ((controls & SC_ScrollBarSubLine) && subline.isValid()) { if ((controls & SC_ScrollBarSubLine) && subline.isValid()) {
tqdrawPrimitive(PE_ScrollBarSubLine, p, subline, cg, drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg,
Style_Enabled | ((active == SC_ScrollBarSubLine) ? Style_Enabled | ((active == SC_ScrollBarSubLine) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if (subline2.isValid()) if (subline2.isValid())
tqdrawPrimitive(PE_ScrollBarSubLine, p, subline2, cg, drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, cg,
Style_Enabled | ((active == SC_ScrollBarSubLine) ? Style_Enabled | ((active == SC_ScrollBarSubLine) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
} }
if ((controls & SC_ScrollBarAddLine) && addline.isValid()) if ((controls & SC_ScrollBarAddLine) && addline.isValid())
tqdrawPrimitive(PE_ScrollBarAddLine, p, addline, cg, drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg,
Style_Enabled | ((active == SC_ScrollBarAddLine) ? Style_Enabled | ((active == SC_ScrollBarAddLine) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) if ((controls & SC_ScrollBarSubPage) && subpage.isValid())
tqdrawPrimitive(PE_ScrollBarSubPage, p, subpage, cg, drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg,
Style_Enabled | ((active == SC_ScrollBarSubPage) ? Style_Enabled | ((active == SC_ScrollBarSubPage) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) if ((controls & SC_ScrollBarAddPage) && addpage.isValid())
tqdrawPrimitive(PE_ScrollBarAddPage, p, addpage, cg, drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg,
((maxedOut) ? Style_Default : Style_Enabled) | ((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarAddPage) ? ((active == SC_ScrollBarAddPage) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if ((controls & SC_ScrollBarFirst) && first.isValid()) if ((controls & SC_ScrollBarFirst) && first.isValid())
tqdrawPrimitive(PE_ScrollBarFirst, p, first, cg, drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg,
Style_Enabled | ((active == SC_ScrollBarFirst) ? Style_Enabled | ((active == SC_ScrollBarFirst) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if ((controls & SC_ScrollBarLast) && last.isValid()) if ((controls & SC_ScrollBarLast) && last.isValid())
tqdrawPrimitive(PE_ScrollBarLast, p, last, cg, drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg,
Style_Enabled | ((active == SC_ScrollBarLast) ? Style_Enabled | ((active == SC_ScrollBarLast) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
Style_Horizontal : 0)); Style_Horizontal : 0));
if ((controls & SC_ScrollBarSlider) && slider.isValid()) { if ((controls & SC_ScrollBarSlider) && slider.isValid()) {
tqdrawPrimitive(PE_ScrollBarSlider, p, slider, cg, drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg,
Style_Enabled | ((active == SC_ScrollBarSlider) ? Style_Enabled | ((active == SC_ScrollBarSlider) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == Qt::Horizontal) ? ((scrollbar->orientation() == Qt::Horizontal) ?
@ -1342,7 +1350,7 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
if (scrollbar->hasFocus()) { if (scrollbar->hasFocus()) {
TQRect fr(slider.x() + 2, slider.y() + 2, TQRect fr(slider.x() + 2, slider.y() + 2,
slider.width() - 5, slider.height() - 5); slider.width() - 5, slider.height() - 5);
tqdrawPrimitive(PE_FocusRect, p, fr, cg, Style_Default); drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default);
} }
} }
@ -1352,10 +1360,10 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
case CC_Slider: case CC_Slider:
{ {
const TQSlider *slider = (const TQSlider *) widget; const TQSlider *slider = (const TQSlider *) widget;
TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove,
data), data, widget),
handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle,
data); data, widget);
if ((controls & SC_SliderGroove) && groove.isValid()) { if ((controls & SC_SliderGroove) && groove.isValid()) {
TQColor grooveColor = cg.midlight(); TQColor grooveColor = cg.midlight();
@ -1374,7 +1382,7 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
if (flags & Style_HasFocus) { if (flags & Style_HasFocus) {
groove.addCoords( -2, -2, 2, 2 ); groove.addCoords( -2, -2, 2, 2 );
tqdrawPrimitive( PE_FocusRect, p, groove, cg, flags ); drawPrimitive( PE_FocusRect, p, ceData, elementFlags, groove, cg, flags );
} }
} }
@ -1409,36 +1417,38 @@ void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
} }
if (controls & SC_SliderTickmarks) if (controls & SC_SliderTickmarks)
TQCommonStyle::drawComplexControl(control, p, widget, r, cg, flags, TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
SC_SliderTickmarks, active, data ); SC_SliderTickmarks, active, data, widget );
break; break;
} }
case CC_ListView: case CC_ListView:
// use the base style for CC_ListView // use the base style for CC_ListView
basestyle->drawComplexControl(control, p, widget, r, cg, flags, basestyle->drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
controls, active, data); controls, active, data, widget);
break; break;
default: default:
TQCommonStyle::drawComplexControl(control, p, widget, r, cg, flags, TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
controls, active, data); controls, active, data, widget);
break; break;
} }
} }
TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control, TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc, SubControl sc,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget *widget ) const
{ {
TQRect ret; TQRect ret;
switch (control) { switch (control) {
case CC_ComboBox: case CC_ComboBox:
{ {
int fw = pixelMetric( PM_DefaultFrameWidth, widget ); int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
int sb = pixelMetric( PM_ScrollBarExtent ); // width of the arrow int sb = pixelMetric( PM_ScrollBarExtent, ceData, elementFlags ); // width of the arrow
switch ( sc ) { switch ( sc ) {
case SC_ComboBoxFrame: case SC_ComboBoxFrame:
@ -1463,7 +1473,7 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control,
{ {
const TQScrollBar *scrollbar = (const TQScrollBar *) widget; const TQScrollBar *scrollbar = (const TQScrollBar *) widget;
int sliderstart = scrollbar->sliderStart(); int sliderstart = scrollbar->sliderStart();
int sbextent = pixelMetric(PM_ScrollBarExtent, widget); int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget);
int maxlen = ((scrollbar->orientation() == Qt::Horizontal) ? int maxlen = ((scrollbar->orientation() == Qt::Horizontal) ?
scrollbar->width() : scrollbar->height()) - (sbextent * 3); scrollbar->width() : scrollbar->height()) - (sbextent * 3);
int sliderlen; int sliderlen;
@ -1474,7 +1484,7 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control,
sliderlen = (scrollbar->pageStep() * maxlen) / sliderlen = (scrollbar->pageStep() * maxlen) /
(range + scrollbar->pageStep()); (range + scrollbar->pageStep());
int slidermin = pixelMetric( PM_ScrollBarSliderMin, widget ); int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget );
if ( sliderlen < slidermin || range > INT_MAX / 2 ) if ( sliderlen < slidermin || range > INT_MAX / 2 )
sliderlen = slidermin; sliderlen = slidermin;
if ( sliderlen > maxlen ) if ( sliderlen > maxlen )
@ -1538,8 +1548,8 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control,
case CC_Slider: case CC_Slider:
{ {
const TQSlider *slider = (const TQSlider *) widget; const TQSlider *slider = (const TQSlider *) widget;
int tickOffset = pixelMetric( PM_SliderTickmarkOffset, widget ); int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget );
int thickness = pixelMetric( PM_SliderControlThickness, widget ); int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
switch ( sc ) { switch ( sc ) {
case SC_SliderGroove: case SC_SliderGroove:
@ -1552,7 +1562,7 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control,
case SC_SliderHandle: case SC_SliderHandle:
{ {
int pos = slider->sliderStart(); int pos = slider->sliderStart();
int len = pixelMetric( PM_SliderLength, widget ); int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget );
if ( slider->orientation() == Qt::Horizontal ) if ( slider->orientation() == Qt::Horizontal )
ret.setRect( pos + 2, tickOffset + 2, len - 4, thickness - 4 ); ret.setRect( pos + 2, tickOffset + 2, len - 4, thickness - 4 );
@ -1562,7 +1572,7 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control,
} }
default: default:
ret = TQCommonStyle::querySubControlMetrics(control, widget, sc, data); ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget);
break; break;
} }
@ -1570,7 +1580,7 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control,
} }
default: default:
ret = TQCommonStyle::querySubControlMetrics(control, widget, sc, data); ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget);
break; break;
} }
@ -1578,12 +1588,14 @@ TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control,
} }
TQStyle::SubControl LightStyleV3::querySubControl( TQ_ComplexControl control, TQStyle::SubControl LightStyleV3::querySubControl( TQ_ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQPoint &pos, const TQPoint &pos,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget *widget ) const
{ {
TQStyle::SubControl ret = TQStyle::SubControl ret =
TQCommonStyle::querySubControl(control, widget, pos, data); TQCommonStyle::querySubControl(control, ceData, elementFlags, pos, data, widget);
// this is an ugly hack, but i really don't care, it's the quickest way to // this is an ugly hack, but i really don't care, it's the quickest way to
// enabled the third button // enabled the third button
@ -1594,7 +1606,7 @@ TQStyle::SubControl LightStyleV3::querySubControl( TQ_ComplexControl control,
return ret; return ret;
} }
int LightStyleV3::pixelMetric( PixelMetric metric, int LightStyleV3::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQWidget *widget ) const const TQWidget *widget ) const
{ {
int ret; int ret;
@ -1691,25 +1703,27 @@ int LightStyleV3::pixelMetric( PixelMetric metric,
break; break;
default: default:
ret = TQCommonStyle::pixelMetric(metric, widget); ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget);
break; break;
} }
return ret; return ret;
} }
TQSize LightStyleV3::tqsizeFromContents( ContentsType contents, TQSize LightStyleV3::sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption &data ) const const TQStyleOption &data,
const TQWidget *widget ) const
{ {
TQSize ret; TQSize ret;
switch (contents) { switch (contents) {
case CT_ComboBox: case CT_ComboBox:
{ {
int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2; int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2;
int sb = pixelMetric( PM_ScrollBarExtent ); // width of the arrow int sb = pixelMetric( PM_ScrollBarExtent, ceData, elementFlags ); // width of the arrow
int w = contentsSize.width(); int w = contentsSize.width();
int h = contentsSize.height(); int h = contentsSize.height();
@ -1727,9 +1741,9 @@ TQSize LightStyleV3::tqsizeFromContents( ContentsType contents,
case CT_PushButton: case CT_PushButton:
{ {
const TQPushButton *button = (const TQPushButton *) widget; const TQPushButton *button = (const TQPushButton *) widget;
ret = TQCommonStyle::tqsizeFromContents( contents, widget, contentsSize, data ); ret = TQCommonStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, data, widget );
int w = ret.width(), h = ret.height(); int w = ret.width(), h = ret.height();
int dbi = pixelMetric( PM_ButtonDefaultIndicator, widget ) * 2; int dbi = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget ) * 2;
int mw = 80 - dbi, mh = 25 - dbi; int mw = 80 - dbi, mh = 25 - dbi;
// only expand the button if we are displaying text... // only expand the button if we are displaying text...
@ -1811,7 +1825,7 @@ TQSize LightStyleV3::tqsizeFromContents( ContentsType contents,
} }
default: default:
ret = TQCommonStyle::tqsizeFromContents(contents, widget, contentsSize, data); ret = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, data, widget);
break; break;
} }
@ -1819,9 +1833,11 @@ TQSize LightStyleV3::tqsizeFromContents( ContentsType contents,
} }
int LightStyleV3::styleHint( TQ_StyleHint stylehint, int LightStyleV3::styleHint( TQ_StyleHint stylehint,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption &option, const TQStyleOption &option,
TQStyleHintReturn* returnData ) const TQStyleHintReturn* returnData,
const TQWidget *widget ) const
{ {
int ret; int ret;
@ -1847,7 +1863,7 @@ int LightStyleV3::styleHint( TQ_StyleHint stylehint,
break; break;
default: default:
ret = TQCommonStyle::styleHint(stylehint, widget, option, returnData); ret = TQCommonStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
break; break;
} }
@ -1855,9 +1871,11 @@ int LightStyleV3::styleHint( TQ_StyleHint stylehint,
} }
TQPixmap LightStyleV3::stylePixmap( StylePixmap stylepixmap, TQPixmap LightStyleV3::stylePixmap( StylePixmap stylepixmap,
const TQWidget *widget, TQStyleControlElementData ceData,
const TQStyleOption &data ) const ControlElementFlags elementFlags,
const TQStyleOption &data,
const TQWidget *widget ) const
{ {
return basestyle->stylePixmap( stylepixmap, widget, data ); return basestyle->stylePixmap( stylepixmap, ceData, elementFlags, data, widget );
} }
#include "lightstyle-v3.moc" #include "lightstyle-v3.moc"

@ -48,41 +48,44 @@ public:
void polishPopupMenu( TQPopupMenu * ); void polishPopupMenu( TQPopupMenu * );
void tqdrawPrimitive(TQ_PrimitiveElement, TQPainter *, const TQRect &, const TQColorGroup &, void drawPrimitive(TQ_PrimitiveElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &,
SFlags = Style_Default, SFlags = Style_Default,
const TQStyleOption & = TQStyleOption::Default ) const; const TQStyleOption & = TQStyleOption::Default ) const;
void drawControl(TQ_ControlElement, TQPainter *, const TQWidget *, const TQRect &, void drawControl(TQ_ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &,
const TQColorGroup &, SFlags = Style_Default, const TQColorGroup &, SFlags = Style_Default,
const TQStyleOption & = TQStyleOption::Default ) const; const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
void drawControlMask(TQ_ControlElement, TQPainter *, const TQWidget *, const TQRect &, void drawControlMask(TQ_ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &,
const TQStyleOption & = TQStyleOption::Default) const; const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0) const;
TQRect subRect(SubRect, const TQWidget *) const; TQRect subRect(SubRect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *) const;
void drawComplexControl(TQ_ComplexControl, TQPainter *, const TQWidget *, const TQRect &, void drawComplexControl(TQ_ComplexControl, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &,
const TQColorGroup &, SFlags = Style_Default, const TQColorGroup &, SFlags = Style_Default,
SCFlags = SC_All, SCFlags = SC_None, SCFlags = SC_All, SCFlags = SC_None,
const TQStyleOption & = TQStyleOption::Default ) const; const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
TQRect querySubControlMetrics(TQ_ComplexControl, const TQWidget *, SubControl, TQRect querySubControlMetrics(TQ_ComplexControl, TQStyleControlElementData ceData, ControlElementFlags elementFlags, SubControl,
const TQStyleOption & = TQStyleOption::Default ) const; const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
SubControl querySubControl(TQ_ComplexControl, const TQWidget *, const TQPoint &, SubControl querySubControl(TQ_ComplexControl, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQPoint &,
const TQStyleOption &data = TQStyleOption::Default ) const; const TQStyleOption &data = TQStyleOption::Default, const TQWidget * = 0 ) const;
int pixelMetric(PixelMetric, const TQWidget * = 0 ) const; int pixelMetric(PixelMetric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * = 0 ) const;
TQSize tqsizeFromContents(ContentsType, const TQWidget *, const TQSize &, TQSize sizeFromContents(ContentsType, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQSize &,
const TQStyleOption & = TQStyleOption::Default ) const; const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
int styleHint(TQ_StyleHint, const TQWidget * = 0, int styleHint(TQ_StyleHint, 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, TQPixmap stylePixmap( StylePixmap stylepixmap,
const TQWidget* widget = 0, TQStyleControlElementData ceData,
const TQStyleOption& = TQStyleOption::Default ) const; ControlElementFlags elementFlags,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
}; };

@ -1192,11 +1192,13 @@ void PlastikStyle::renderTab(TQPainter *p,
void PlastikStyle::drawKStylePrimitive(KStylePrimitive kpe, void PlastikStyle::drawKStylePrimitive(KStylePrimitive kpe,
TQPainter *p, TQPainter *p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt) const const TQStyleOption& opt,
const TQWidget* widget) const
{ {
// some "global" vars... // some "global" vars...
const bool enabled = (flags & Style_Enabled); const bool enabled = (flags & Style_Enabled);
@ -1357,9 +1359,9 @@ void PlastikStyle::drawKStylePrimitive(KStylePrimitive kpe,
p->drawLine( centerx, centery - radius, centerx, centery + radius ); p->drawLine( centerx, centery - radius, centerx, centery + radius );
} else if(_drawTriangularExpander) { } else if(_drawTriangularExpander) {
if( flags & Style_On ) if( flags & Style_On )
tqdrawPrimitive(PE_ArrowRight, p, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags); drawPrimitive(PE_ArrowRight, p, ceData, elementFlags, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags);
if( flags & Style_Off ) if( flags & Style_Off )
tqdrawPrimitive(PE_ArrowDown, p, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags); drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags);
} }
break; break;
@ -1438,13 +1440,15 @@ void PlastikStyle::drawKStylePrimitive(KStylePrimitive kpe,
} }
default: default:
KStyle::drawKStylePrimitive(kpe, p, widget, r, cg, flags, opt); KStyle::drawKStylePrimitive(kpe, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, void PlastikStyle::drawPrimitive(TQ_PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -1661,7 +1665,7 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
surfaceFlags); surfaceFlags);
p->setPen(cg.foreground()); p->setPen(cg.foreground());
tqdrawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, r, cg, flags); drawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, ceData, elementFlags, r, cg, flags);
break; break;
} }
@ -1687,7 +1691,7 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
surfaceFlags); surfaceFlags);
p->setPen(cg.foreground()); p->setPen(cg.foreground());
tqdrawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, r, cg, flags); drawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, ceData, elementFlags, r, cg, flags);
break; break;
} }
@ -1716,7 +1720,7 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
renderSurface(p, TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2), renderSurface(p, TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2),
cg.background(), contentColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2), surfaceFlags); cg.background(), contentColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2), surfaceFlags);
tqdrawPrimitive(PE_CheckMark, p, r, cg, flags); drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, flags);
break; break;
} }
@ -2098,8 +2102,8 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
const TQWMatrix oldMatrix( p->worldMatrix() ); const TQWMatrix oldMatrix( p->worldMatrix() );
if (flags & Style_Down) { if (flags & Style_Down) {
p->translate(pixelMetric(PM_ButtonShiftHorizontal), p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags),
pixelMetric(PM_ButtonShiftVertical)); pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags));
} }
a.translate((r.x()+r.width()/2), (r.y()+r.height()/2)); a.translate((r.x()+r.width()/2), (r.y()+r.height()/2));
@ -2133,7 +2137,7 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
} }
default: { default: {
return KStyle::tqdrawPrimitive(pe, p, r, cg, flags, opt); return KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
} }
} }
} }
@ -2141,11 +2145,13 @@ void PlastikStyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
void PlastikStyle::drawControl(TQ_ControlElement element, void PlastikStyle::drawControl(TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt) const const TQStyleOption& opt,
const TQWidget *widget) const
{ {
const bool reverseLayout = TQApplication::reverseLayout(); const bool reverseLayout = TQApplication::reverseLayout();
@ -2337,7 +2343,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
renderTab(p, r, cg, mouseOver, selected, true, pos, false, cornerWidget); renderTab(p, r, cg, mouseOver, selected, true, pos, false, cornerWidget);
break; break;
default: default:
KStyle::drawControl(element, p, widget, r, cg, flags, opt); KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
break; break;
@ -2357,12 +2363,12 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
TQColorGroup g2 = cg; TQColorGroup g2 = cg;
if (isDefault) if (isDefault)
g2.setColor(TQColorGroup::Background, cg.background().dark(120) ); g2.setColor(TQColorGroup::Background, cg.background().dark(120) );
tqdrawPrimitive(PE_ButtonBevel, p, drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags,
isDefault?TQRect(r.x()+1,r.y()+1,r.width()-2,r.height()-2):r, isDefault?TQRect(r.x()+1,r.y()+1,r.width()-2,r.height()-2):r,
g2, flags, TQStyleOption(button) ); g2, flags, TQStyleOption(button) );
if (isDefault ) { if (isDefault ) {
tqdrawPrimitive(PE_ButtonDefault, p, r, cg, flags); drawPrimitive(PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags);
} }
break; break;
@ -2380,15 +2386,15 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
// Shift button contents if pushed. // Shift button contents if pushed.
if ( active ) if ( active )
{ {
x += pixelMetric(PM_ButtonShiftHorizontal, widget); x += pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget);
y += pixelMetric(PM_ButtonShiftVertical, widget); y += pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget);
flags |= Style_Sunken; flags |= Style_Sunken;
} }
// Does the button have a popup menu? // Does the button have a popup menu?
if ( button->isMenuButton() ) if ( button->isMenuButton() )
{ {
int dx = pixelMetric( PM_MenuButtonIndicator, widget ); int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget );
if ( button->iconSet() && !button->iconSet()->isNull() && if ( button->iconSet() && !button->iconSet()->isNull() &&
(dx + button->iconSet()->pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w ) (dx + button->iconSet()->pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w )
{ {
@ -2397,7 +2403,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
else else
{ {
p->setPen(cg.buttonText()); p->setPen(cg.buttonText());
tqdrawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ), drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ),
cg, flags, opt ); cg, flags, opt );
w -= dx; w -= dx;
} }
@ -2423,7 +2429,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
p->drawPixmap( x + 4, y + h / 2 - pixmap.height() / 2, pixmap ); p->drawPixmap( x + 4, y + h / 2 - pixmap.height() / 2, pixmap );
if (cornArrow) //Draw over the icon if (cornArrow) //Draw over the icon
tqdrawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ), drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ),
cg, flags, opt ); cg, flags, opt );
@ -2439,8 +2445,8 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
if ( flags & Style_HasFocus ) if ( flags & Style_HasFocus )
tqdrawPrimitive( PE_FocusRect, p, drawPrimitive( PE_FocusRect, p, ceData, elementFlags,
visualRect( subRect( SR_PushButtonFocusRect, widget ), widget ), visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ),
cg, flags ); cg, flags );
break; break;
} }
@ -2459,9 +2465,9 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
if (active && focused) { if (active && focused) {
if (down) { if (down) {
tqdrawPrimitive(PE_ButtonTool, p, r, cg, flags|Style_Down, opt); drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, flags|Style_Down, opt);
} else { } else {
tqdrawPrimitive(PE_ButtonTool, p, r, cg, flags, opt); drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, flags, opt);
} }
} }
@ -2490,7 +2496,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
bool enabled = mi->isEnabled(); bool enabled = mi->isEnabled();
bool checkable = popupmenu->isCheckable(); bool checkable = popupmenu->isCheckable();
bool active = flags & Style_Active; bool active = flags & Style_Active;
bool etchtext = styleHint( SH_EtchDisabledText ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
if ( checkable ) if ( checkable )
checkcol = QMAX( checkcol, 20 ); checkcol = QMAX( checkcol, 20 );
@ -2562,7 +2568,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
SFlags cflags = Style_On; SFlags cflags = Style_On;
if (enabled) if (enabled)
cflags |= Style_Enabled; cflags |= Style_Enabled;
tqdrawPrimitive( PE_CheckMark, p, cr, cg, cflags ); drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags );
} }
// Time to draw the menu item label... // Time to draw the menu item label...
@ -2669,7 +2675,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
// Does the menu item have a submenu? // Does the menu item have a submenu?
if ( mi->popup() ) { if ( mi->popup() ) {
TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
int dim = pixelMetric(PM_MenuButtonIndicator) - 1; int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags) - 1;
TQRect vr = visualRect( TQRect( r.x() + r.width() - 5 - 1 - dim, TQRect vr = visualRect( TQRect( r.x() + r.width() - 5 - 1 - dim,
r.y() + r.height() / 2 - dim / 2, dim, dim), r ); r.y() + r.height() / 2 - dim / 2, dim, dim), r );
@ -2681,9 +2687,9 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
TQColorGroup g2( discol, cg.highlight(), white, white, TQColorGroup g2( discol, cg.highlight(), white, white,
enabled ? white : discol, discol, white ); enabled ? white : discol, discol, white );
tqdrawPrimitive( arrow, p, vr, g2, Style_Enabled ); drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled );
} else } else
tqdrawPrimitive( arrow, p, vr, cg, drawPrimitive( arrow, p, ceData, elementFlags, vr, cg,
enabled ? Style_Enabled : Style_Default ); enabled ? Style_Enabled : Style_Default );
} }
break; break;
@ -2706,15 +2712,17 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
break; break;
default: default:
KStyle::drawControl(element, p, widget, r, cg, flags, opt); KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
void PlastikStyle::drawControlMask(TQ_ControlElement element, void PlastikStyle::drawControlMask(TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *w, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &opt) const const TQStyleOption &opt,
const TQWidget *w) const
{ {
switch (element) { switch (element) {
case CE_PushButton: { case CE_PushButton: {
@ -2725,16 +2733,18 @@ void PlastikStyle::drawControlMask(TQ_ControlElement element,
} }
default: { default: {
KStyle::drawControlMask (element, p, w, r, opt); KStyle::drawControlMask (element, p, ceData, elementFlags, r, opt, w);
} }
} }
} }
void PlastikStyle::drawComplexControlMask(TQ_ComplexControl c, void PlastikStyle::drawComplexControlMask(TQ_ComplexControl c,
TQPainter *p, TQPainter *p,
const TQWidget *w, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &o) const const TQStyleOption &o,
const TQWidget *w) const
{ {
switch (c) { switch (c) {
case CC_SpinWidget: case CC_SpinWidget:
@ -2746,20 +2756,22 @@ void PlastikStyle::drawComplexControlMask(TQ_ComplexControl c,
break; break;
} }
default: { default: {
KStyle::drawComplexControlMask (c, p, w, r, o); KStyle::drawComplexControlMask (c, p, ceData, elementFlags, r, o, w);
} }
} }
} }
void PlastikStyle::drawComplexControl(TQ_ComplexControl control, void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
SCFlags controls, SCFlags controls,
SCFlags active, SCFlags active,
const TQStyleOption& opt) const const TQStyleOption& opt,
const TQWidget *widget) const
{ {
const bool reverseLayout = TQApplication::reverseLayout(); const bool reverseLayout = TQApplication::reverseLayout();
@ -2791,7 +2803,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
if (_inputFocusHighlight && hasFocus && editable && enabled) if (_inputFocusHighlight && hasFocus && editable && enabled)
{ {
TQRect editField = querySubControlMetrics(control, widget, SC_ComboBoxEditField); TQRect editField = querySubControlMetrics(control, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget);
TQRect editFrame = r; TQRect editFrame = r;
TQRect buttonFrame = r; TQRect buttonFrame = r;
@ -2873,7 +2885,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
cg.background(), buttonColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2), cg.background(), buttonColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2),
surfaceFlags); surfaceFlags);
if (hasFocus) { if (hasFocus) {
tqdrawPrimitive(PE_FocusRect, p, drawPrimitive(PE_FocusRect, p, ceData, elementFlags,
TQRect(RcontentSurface.x() + 2, TQRect(RcontentSurface.x() + 2,
RcontentSurface.y() + 2, RcontentSurface.y() + 2,
RcontentSurface.width() - 4, RcontentSurface.width() - 4,
@ -2912,7 +2924,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
} }
p->setPen(cg.foreground()); p->setPen(cg.foreground());
tqdrawPrimitive(PE_SpinWidgetDown, p, RbuttonSurface, cg, Style_Default|Style_Enabled|Style_Raised); drawPrimitive(PE_SpinWidgetDown, p, ceData, elementFlags, RbuttonSurface, cg, Style_Default|Style_Enabled|Style_Raised);
// TQComboBox draws the text using cg.text(), we can override this // TQComboBox draws the text using cg.text(), we can override this
// from here // from here
@ -2927,14 +2939,14 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
const TQToolButton *tb = (const TQToolButton *) widget; const TQToolButton *tb = (const TQToolButton *) widget;
TQRect button, menuarea; TQRect button, menuarea;
button = querySubControlMetrics(control, widget, SC_ToolButton, opt); button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget);
menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget);
SFlags bflags = flags, SFlags bflags = flags,
mflags = flags; mflags = flags;
if (kornMode) { if (kornMode) {
tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
break; break;
} else { } else {
// don't want to have the buttoncolor as the background... // don't want to have the buttoncolor as the background...
@ -2951,7 +2963,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
if (controls & SC_ToolButton) { if (controls & SC_ToolButton) {
// If we're pressed, on, or raised... // If we're pressed, on, or raised...
if (bflags & (Style_Down | Style_On | Style_Raised) || widget==hoverWidget ) { if (bflags & (Style_Down | Style_On | Style_Raised) || widget==hoverWidget ) {
tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
} else if (tb->parentWidget() && } else if (tb->parentWidget() &&
tb->parentWidget()->backgroundPixmap() && tb->parentWidget()->backgroundPixmap() &&
!tb->parentWidget()->backgroundPixmap()->isNull()) { !tb->parentWidget()->backgroundPixmap()->isNull()) {
@ -2963,15 +2975,15 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
// Draw a toolbutton menu indicator if required // Draw a toolbutton menu indicator if required
if (controls & SC_ToolButtonMenu) { if (controls & SC_ToolButtonMenu) {
if (mflags & (Style_Down | Style_On | Style_Raised)) { if (mflags & (Style_Down | Style_On | Style_Raised)) {
tqdrawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, opt); drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
} }
tqdrawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, opt); drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
} }
if (tb->hasFocus() && !tb->focusProxy()) { if (tb->hasFocus() && !tb->focusProxy()) {
TQRect fr = tb->rect(); TQRect fr = tb->rect();
fr.addCoords(2, 2, -2, -2); fr.addCoords(2, 2, -2, -2);
tqdrawPrimitive(PE_FocusRect, p, fr, cg); drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg);
} }
// Set the color for the ToolButton menu indicator // Set the color for the ToolButton menu indicator
@ -3000,7 +3012,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
const bool heightDividable = ((r.height()%2) == 0); const bool heightDividable = ((r.height()%2) == 0);
if (_inputFocusHighlight && hasFocus && enabled) if (_inputFocusHighlight && hasFocus && enabled)
{ {
TQRect editField = querySubControlMetrics(control, widget, SC_SpinWidgetEditField); TQRect editField = querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetEditField, TQStyleOption::Default, widget);
TQRect editFrame = r; TQRect editFrame = r;
TQRect buttonFrame = r; TQRect buttonFrame = r;
@ -3031,7 +3043,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
} }
else else
{ {
renderContour(p, querySubControlMetrics(control, widget, SC_SpinWidgetFrame), renderContour(p, querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetFrame, TQStyleOption::Default, widget),
cg.background(), getColor(cg, ButtonContour, enabled) ); cg.background(), getColor(cg, ButtonContour, enabled) );
} }
p->setPen(alphaBlendColors(cg.background(), getColor(cg, ButtonContour, enabled), 50) ); p->setPen(alphaBlendColors(cg.background(), getColor(cg, ButtonContour, enabled), 50) );
@ -3095,7 +3107,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
else else
pe = PE_SpinWidgetUp; pe = PE_SpinWidgetUp;
p->setPen(cg.foreground()); p->setPen(cg.foreground());
tqdrawPrimitive(pe, p, upRect, cg, sflags); drawPrimitive(pe, p, ceData, elementFlags, upRect, cg, sflags);
sflags = Style_Default | Style_Enabled; sflags = Style_Default | Style_Enabled;
if (active == SC_SpinWidgetDown) { if (active == SC_SpinWidgetDown) {
@ -3108,7 +3120,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
else else
pe = PE_SpinWidgetDown; pe = PE_SpinWidgetDown;
p->setPen(cg.foreground()); p->setPen(cg.foreground());
tqdrawPrimitive(pe, p, downRect, cg, sflags); drawPrimitive(pe, p, ceData, elementFlags, downRect, cg, sflags);
// thin frame around the input area // thin frame around the input area
const TQRect Rcontent = TQRect(reverseLayout?r.left()+1+handleWidth+1:r.left()+1, r.top()+1, const TQRect Rcontent = TQRect(reverseLayout?r.left()+1+handleWidth+1:r.left()+1, r.top()+1,
@ -3141,19 +3153,19 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
} }
default: default:
KStyle::drawComplexControl(control, p, widget, KStyle::drawComplexControl(control, p, ceData, elementFlags,
r, cg, flags, controls, r, cg, flags, controls,
active, opt); active, opt, widget);
break; break;
} }
} }
TQRect PlastikStyle::subRect(SubRect r, const TQWidget *widget) const TQRect PlastikStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
switch (r) { switch (r) {
case SR_ComboBoxFocusRect: { case SR_ComboBoxFocusRect: {
return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ); return querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget );
} }
// Don't use KStyles progressbar subrect // Don't use KStyles progressbar subrect
@ -3168,15 +3180,17 @@ TQRect PlastikStyle::subRect(SubRect r, const TQWidget *widget) const
} }
default: { default: {
return KStyle::subRect(r, widget); return KStyle::subRect(r, ceData, elementFlags, widget);
} }
} }
} }
TQRect PlastikStyle::querySubControlMetrics(TQ_ComplexControl control, TQRect PlastikStyle::querySubControlMetrics(TQ_ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption &opt) const const TQStyleOption &opt,
const TQWidget *widget) const
{ {
if (!widget) { if (!widget) {
return TQRect(); return TQRect();
@ -3191,7 +3205,7 @@ TQRect PlastikStyle::querySubControlMetrics(TQ_ComplexControl control,
return TQRect(r.left()+2, r.top()+2, r.width()-4-15-1, r.height()-4); return TQRect(r.left()+2, r.top()+2, r.width()-4-15-1, r.height()-4);
} }
default: { default: {
return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
} }
} }
break; break;
@ -3235,18 +3249,18 @@ TQRect PlastikStyle::querySubControlMetrics(TQ_ComplexControl control,
return TQRect(buttonsLeft, r.top()+1, bs.width(), r.height()-2); return TQRect(buttonsLeft, r.top()+1, bs.width(), r.height()-2);
} }
default: { default: {
return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
} }
} }
break; break;
} }
default: { default: {
return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
} }
} }
} }
int PlastikStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const int PlastikStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
switch(m) { switch(m) {
// TABS // TABS
@ -3343,15 +3357,17 @@ int PlastikStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const
} }
default: default:
return KStyle::pixelMetric(m, widget); return KStyle::pixelMetric(m, ceData, elementFlags, widget);
} }
} }
TQSize PlastikStyle::tqsizeFromContents(ContentsType t, TQSize PlastikStyle::sizeFromContents(ContentsType t,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &s, const TQSize &s,
const TQStyleOption &opt) const const TQStyleOption &opt,
const TQWidget *widget) const
{ {
switch (t) { switch (t) {
case CT_PopupMenuItem: { case CT_PopupMenuItem: {
@ -3412,8 +3428,8 @@ TQSize PlastikStyle::tqsizeFromContents(ContentsType t,
{ {
const TQPushButton* btn = static_cast<const TQPushButton*>(widget); const TQPushButton* btn = static_cast<const TQPushButton*>(widget);
int w = s.width() + 2 * pixelMetric(PM_ButtonMargin, widget); int w = s.width() + 2 * pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget);
int h = s.height() + 2 * pixelMetric(PM_ButtonMargin, widget); int h = s.height() + 2 * pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget);
if ( btn->text().isEmpty() && s.width() < 32 ) return TQSize(w, h); if ( btn->text().isEmpty() && s.width() < 32 ) return TQSize(w, h);
return TQSize( w+25, h+5 ); return TQSize( w+25, h+5 );
@ -3424,27 +3440,29 @@ TQSize PlastikStyle::tqsizeFromContents(ContentsType t,
if(widget->parent() && ::tqqt_cast<TQToolBar*>(widget->parent()) ) if(widget->parent() && ::tqqt_cast<TQToolBar*>(widget->parent()) )
return TQSize( s.width()+2*4, s.height()+2*4 ); return TQSize( s.width()+2*4, s.height()+2*4 );
else else
return KStyle::tqsizeFromContents (t, widget, s, opt); return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget);
} }
default: default:
return KStyle::tqsizeFromContents (t, widget, s, opt); return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget);
} }
return KStyle::tqsizeFromContents (t, widget, s, opt); return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget);
} }
int PlastikStyle::styleHint( TQ_StyleHint stylehint, int PlastikStyle::styleHint( TQ_StyleHint stylehint,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption &option, const TQStyleOption &option,
TQStyleHintReturn* returnData ) const TQStyleHintReturn* returnData,
const TQWidget *widget ) const
{ {
switch (stylehint) { switch (stylehint) {
case SH_PopupMenu_SubMenuPopupDelay: case SH_PopupMenu_SubMenuPopupDelay:
return 96; // Motif-like delay... return 96; // Motif-like delay...
default: default:
return KStyle::styleHint(stylehint, widget, option, returnData); return KStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
} }
} }

@ -68,14 +68,18 @@ public:
void drawKStylePrimitive(KStylePrimitive kpe, void drawKStylePrimitive(KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, 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 tqdrawPrimitive(TQ_PrimitiveElement pe, void drawPrimitive(TQ_PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -83,49 +87,59 @@ public:
void drawControl(TQ_ControlElement element, void drawControl(TQ_ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, 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( TQ_ControlElement, TQPainter *, const TQWidget *, const TQRect &, const TQStyleOption &) const; void drawControlMask( TQ_ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQStyleOption &, const TQWidget * = 0) const;
void drawComplexControl(TQ_ComplexControl control, void drawComplexControl(TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, 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, 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, const ControlElementFlags elementFlags,
const TQWidget *widget ) const; const TQWidget *widget ) const;
TQRect querySubControlMetrics(TQ_ComplexControl control, TQRect querySubControlMetrics(TQ_ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption &opt = TQStyleOption::Default ) const; const TQStyleOption &opt = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControlMask(TQStyle::TQ_ComplexControl c, void drawComplexControlMask(TQStyle::TQ_ComplexControl c,
TQPainter *p, TQPainter *p,
const TQWidget *w, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &o=TQStyleOption::Default) const; const TQStyleOption &o=TQStyleOption::Default,
const TQWidget *w = 0) const;
TQSize tqsizeFromContents(TQStyle::ContentsType t, TQSize sizeFromContents(TQStyle::ContentsType t,
const TQWidget *w, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &s, const TQSize &s,
const TQStyleOption &o) const; const TQStyleOption &o,
const TQWidget *w = 0) const;
int styleHint(TQ_StyleHint, const TQWidget * = 0, int styleHint(TQ_StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQStyleOption & = TQStyleOption::Default, const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn * = 0 ) const; TQStyleHintReturn * = 0, const TQWidget * = 0 ) const;
protected: protected:
enum TabPosition enum TabPosition

@ -328,14 +328,27 @@ void KStyle::renderMenuBlendPixmap( KPixmap &pix, const TQColorGroup &cg,
pix.fill(cg.button()); // Just tint as the default behavior pix.fill(cg.button()); // Just tint as the default behavior
} }
void KStyle::drawKStylePrimitive( KStylePrimitive kpe, void KStyle::drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, const TQWidget* widget,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& /* opt */ ) const const TQStyleOption &opt ) const
{
TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
drawKStylePrimitive(kpe, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), r, cg, flags, opt);
}
void KStyle::drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags,
const TQStyleOption&, /* opt */
const TQWidget* widget ) const
{ {
switch( kpe ) switch( kpe )
{ {
@ -545,6 +558,8 @@ int KStyle::kPixelMetric( KStylePixelMetric kpm, const TQWidget* /* widget */) c
//void KStyle::tqdrawPrimitive( TQ_ControlElement pe, //void KStyle::tqdrawPrimitive( TQ_ControlElement pe,
// TQPainter* p, // TQPainter* p,
// TQStyleControlElementData ceData,
// ControlElementFlags elementFlags,
// const TQRect &r, // const TQRect &r,
// const TQColorGroup &cg, // const TQColorGroup &cg,
// SFlags flags, // SFlags flags,
@ -554,7 +569,7 @@ int KStyle::kPixelMetric( KStylePixelMetric kpm, const TQWidget* /* widget */) c
// // What should "widget" be in actuality? How should I get it? From where? // // What should "widget" be in actuality? How should I get it? From where?
// // Almost certainly it should not be null! // // Almost certainly it should not be null!
// TQWidget *widget = 0; // TQWidget *widget = 0;
// drawControl(pe, p, widget, r, cg, flags, opt); // drawControl(pe, p, ceData, elementFlags, r, cg, flags, opt, widget);
//} //}
// #endif // USE_QT4 // #endif // USE_QT4
@ -563,6 +578,8 @@ int KStyle::kPixelMetric( KStylePixelMetric kpm, const TQWidget* /* widget */) c
void KStyle::tqdrawPrimitive( TQ_PrimitiveElement pe, void KStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
TQPainter* p, TQPainter* p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -587,16 +604,16 @@ void KStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
(parent->inherits(TQMAINWINDOW_OBJECT_NAME_STRING)) )) // Collapsed dock (parent->inherits(TQMAINWINDOW_OBJECT_NAME_STRING)) )) // Collapsed dock
// Draw a toolbar handle // Draw a toolbar handle
drawKStylePrimitive( KPE_ToolBarHandle, p, widget, r, cg, flags, opt ); drawKStylePrimitive( KPE_ToolBarHandle, p, ceData, elementFlags, r, cg, flags, opt, widget );
else if ( widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) ) else if ( widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) )
// Draw a dock window handle // Draw a dock window handle
drawKStylePrimitive( KPE_DockWindowHandle, p, widget, r, cg, flags, opt ); drawKStylePrimitive( KPE_DockWindowHandle, p, ceData, elementFlags, r, cg, flags, opt, widget );
else else
// General handle, probably a kicker applet handle. // General handle, probably a kicker applet handle.
drawKStylePrimitive( KPE_GeneralHandle, p, widget, r, cg, flags, opt ); drawKStylePrimitive( KPE_GeneralHandle, p, ceData, elementFlags, r, cg, flags, opt, widget );
#if TQT_VERSION >= 0x030300 #if TQT_VERSION >= 0x030300
#ifdef HAVE_XRENDER #ifdef HAVE_XRENDER
} else if ( d->semiTransparentRubberband && pe == TQStyle::PE_RubberBand ) { } else if ( d->semiTransparentRubberband && pe == TQStyle::PE_RubberBand ) {
@ -649,18 +666,20 @@ void KStyle::tqdrawPrimitive( TQ_PrimitiveElement pe,
#endif #endif
#endif #endif
} else } else
TQCommonStyle::tqdrawPrimitive( pe, p, r, cg, flags, opt ); TQCommonStyle::tqdrawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
} }
void KStyle::drawControl( TQ_ControlElement element, void KStyle::drawControl( TQ_ControlElement element,
TQPainter* p, TQPainter* p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption &opt ) const const TQStyleOption &opt,
const TQWidget* widget ) const
{ {
switch (element) switch (element)
{ {
@ -832,8 +851,8 @@ void KStyle::drawControl( TQ_ControlElement element,
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case CE_PopupMenuScroller: { case CE_PopupMenuScroller: {
p->fillRect(r, cg.background()); p->fillRect(r, cg.background());
tqdrawPrimitive(PE_ButtonTool, p, r, cg, Style_Enabled); tqdrawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, Style_Enabled);
tqdrawPrimitive((flags & Style_Up) ? PE_ArrowUp : PE_ArrowDown, p, r, cg, Style_Enabled); tqdrawPrimitive((flags & Style_Up) ? PE_ArrowUp : PE_ArrowDown, p, ceData, elementFlags, r, cg, Style_Enabled);
break; break;
} }
@ -841,15 +860,15 @@ void KStyle::drawControl( TQ_ControlElement element,
// PROGRESSBAR // PROGRESSBAR
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case CE_ProgressBarGroove: { case CE_ProgressBarGroove: {
TQRect fr = subRect(SR_ProgressBarGroove, widget); TQRect fr = subRect(SR_ProgressBarGroove, ceData, elementFlags, widget);
tqdrawPrimitive(PE_Panel, p, fr, cg, Style_Sunken, TQStyleOption::SO_Default); tqdrawPrimitive(PE_Panel, p, ceData, elementFlags, fr, cg, Style_Sunken, TQStyleOption::SO_Default);
break; break;
} }
case CE_ProgressBarContents: { case CE_ProgressBarContents: {
// ### Take into account totalSteps() for busy indicator // ### Take into account totalSteps() for busy indicator
const TQProgressBar* pb = (const TQProgressBar*)widget; const TQProgressBar* pb = (const TQProgressBar*)widget;
TQRect cr = subRect(SR_ProgressBarContents, widget); TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget);
double progress = pb->progress(); double progress = pb->progress();
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
int steps = pb->totalSteps(); int steps = pb->totalSteps();
@ -913,7 +932,7 @@ void KStyle::drawControl( TQ_ControlElement element,
case CE_ProgressBarLabel: { case CE_ProgressBarLabel: {
const TQProgressBar* pb = (const TQProgressBar*)widget; const TQProgressBar* pb = (const TQProgressBar*)widget;
TQRect cr = subRect(SR_ProgressBarContents, widget); TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget);
double progress = pb->progress(); double progress = pb->progress();
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
int steps = pb->totalSteps(); int steps = pb->totalSteps();
@ -952,12 +971,12 @@ void KStyle::drawControl( TQ_ControlElement element,
} }
default: default:
TQCommonStyle::drawControl(element, p, widget, r, cg, flags, opt); TQCommonStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
TQRect KStyle::subRect(SubRect r, const TQWidget* widget) const TQRect KStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget* widget) const
{ {
switch(r) switch(r)
{ {
@ -974,12 +993,12 @@ TQRect KStyle::subRect(SubRect r, const TQWidget* widget) const
} }
default: default:
return TQCommonStyle::subRect(r, widget); return TQCommonStyle::subRect(r, ceData, elementFlags, widget);
} }
} }
int KStyle::pixelMetric(PixelMetric m, const TQWidget* widget) const int KStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget* widget) const
{ {
switch(m) switch(m)
{ {
@ -1000,7 +1019,7 @@ int KStyle::pixelMetric(PixelMetric m, const TQWidget* widget) const
&& widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) ) && widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) )
return widget->fontMetrics().lineSpacing(); return widget->fontMetrics().lineSpacing();
else else
return TQCommonStyle::pixelMetric(m, widget); return TQCommonStyle::pixelMetric(m, ceData, elementFlags, widget);
} }
// TABS // TABS
@ -1084,10 +1103,10 @@ int KStyle::pixelMetric(PixelMetric m, const TQWidget* widget) const
return 0; return 0;
case PM_PopupMenuScrollerHeight: case PM_PopupMenuScrollerHeight:
return pixelMetric( PM_ScrollBarExtent, 0); return pixelMetric( PM_ScrollBarExtent, ceData, elementFlags, 0);
default: default:
return TQCommonStyle::pixelMetric( m, widget ); return TQCommonStyle::pixelMetric( m, ceData, elementFlags, widget );
} }
} }
@ -1106,13 +1125,15 @@ static TQListViewItem* nextVisibleSibling(TQListViewItem* item)
void KStyle::drawComplexControl( TQ_ComplexControl control, void KStyle::drawComplexControl( TQ_ComplexControl control,
TQPainter* p, TQPainter* p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
SCFlags controls, SCFlags controls,
SCFlags active, SCFlags active,
const TQStyleOption &opt ) const const TQStyleOption &opt,
const TQWidget* widget ) const
{ {
switch(control) switch(control)
{ {
@ -1129,13 +1150,13 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
(maxedOut ? Style_Default : Style_Enabled)); (maxedOut ? Style_Default : Style_Enabled));
TQRect addline, subline, subline2, addpage, subpage, slider, first, last; TQRect addline, subline, subline2, addpage, subpage, slider, first, last;
subline = querySubControlMetrics(control, widget, SC_ScrollBarSubLine, opt); subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget);
addline = querySubControlMetrics(control, widget, SC_ScrollBarAddLine, opt); addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget);
subpage = querySubControlMetrics(control, widget, SC_ScrollBarSubPage, opt); subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget);
addpage = querySubControlMetrics(control, widget, SC_ScrollBarAddPage, opt); addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget);
slider = querySubControlMetrics(control, widget, SC_ScrollBarSlider, opt); slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget);
first = querySubControlMetrics(control, widget, SC_ScrollBarFirst, opt); first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, opt, widget);
last = querySubControlMetrics(control, widget, SC_ScrollBarLast, opt); last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, opt, widget);
subline2 = addline; subline2 = addline;
if ( useThreeButtonScrollBar ) { if ( useThreeButtonScrollBar ) {
@ -1149,50 +1170,50 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
// Draw the up/left button set // Draw the up/left button set
if ((controls & SC_ScrollBarSubLine) && subline.isValid()) { if ((controls & SC_ScrollBarSubLine) && subline.isValid()) {
tqdrawPrimitive(PE_ScrollBarSubLine, p, subline, cg, tqdrawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg,
sflags | (active == SC_ScrollBarSubLine ? sflags | (active == SC_ScrollBarSubLine ?
Style_Down : Style_Default)); Style_Down : Style_Default));
if (useThreeButtonScrollBar && subline2.isValid()) if (useThreeButtonScrollBar && subline2.isValid())
tqdrawPrimitive(PE_ScrollBarSubLine, p, subline2, cg, tqdrawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, cg,
sflags | (active == SC_ScrollBarSubLine ? sflags | (active == SC_ScrollBarSubLine ?
Style_Down : Style_Default)); Style_Down : Style_Default));
} }
if ((controls & SC_ScrollBarAddLine) && addline.isValid()) if ((controls & SC_ScrollBarAddLine) && addline.isValid())
tqdrawPrimitive(PE_ScrollBarAddLine, p, addline, cg, tqdrawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg,
sflags | ((active == SC_ScrollBarAddLine) ? sflags | ((active == SC_ScrollBarAddLine) ?
Style_Down : Style_Default)); Style_Down : Style_Default));
if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) if ((controls & SC_ScrollBarSubPage) && subpage.isValid())
tqdrawPrimitive(PE_ScrollBarSubPage, p, subpage, cg, tqdrawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg,
sflags | ((active == SC_ScrollBarSubPage) ? sflags | ((active == SC_ScrollBarSubPage) ?
Style_Down : Style_Default)); Style_Down : Style_Default));
if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) if ((controls & SC_ScrollBarAddPage) && addpage.isValid())
tqdrawPrimitive(PE_ScrollBarAddPage, p, addpage, cg, tqdrawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg,
sflags | ((active == SC_ScrollBarAddPage) ? sflags | ((active == SC_ScrollBarAddPage) ?
Style_Down : Style_Default)); Style_Down : Style_Default));
if ((controls & SC_ScrollBarFirst) && first.isValid()) if ((controls & SC_ScrollBarFirst) && first.isValid())
tqdrawPrimitive(PE_ScrollBarFirst, p, first, cg, tqdrawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg,
sflags | ((active == SC_ScrollBarFirst) ? sflags | ((active == SC_ScrollBarFirst) ?
Style_Down : Style_Default)); Style_Down : Style_Default));
if ((controls & SC_ScrollBarLast) && last.isValid()) if ((controls & SC_ScrollBarLast) && last.isValid())
tqdrawPrimitive(PE_ScrollBarLast, p, last, cg, tqdrawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg,
sflags | ((active == SC_ScrollBarLast) ? sflags | ((active == SC_ScrollBarLast) ?
Style_Down : Style_Default)); Style_Down : Style_Default));
if ((controls & SC_ScrollBarSlider) && slider.isValid()) { if ((controls & SC_ScrollBarSlider) && slider.isValid()) {
tqdrawPrimitive(PE_ScrollBarSlider, p, slider, cg, tqdrawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg,
sflags | ((active == SC_ScrollBarSlider) ? sflags | ((active == SC_ScrollBarSlider) ?
Style_Down : Style_Default)); Style_Down : Style_Default));
// Draw focus rect // Draw focus rect
if (sb->hasFocus()) { if (sb->hasFocus()) {
TQRect fr(slider.x() + 2, slider.y() + 2, TQRect fr(slider.x() + 2, slider.y() + 2,
slider.width() - 5, slider.height() - 5); slider.width() - 5, slider.height() - 5);
tqdrawPrimitive(PE_FocusRect, p, fr, cg, Style_Default); tqdrawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default);
} }
} }
break; break;
@ -1203,8 +1224,8 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
// ------------------------------------------------------------------- // -------------------------------------------------------------------
case CC_Slider: { case CC_Slider: {
const TQSlider* slider = (const TQSlider*)widget; const TQSlider* slider = (const TQSlider*)widget;
TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, opt); TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, opt, widget);
TQRect handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, opt); TQRect handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, opt, widget);
// Double-buffer slider for no flicker // Double-buffer slider for no flicker
TQPixmap pix(widget->size()); TQPixmap pix(widget->size());
@ -1221,23 +1242,23 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
// Draw slider groove // Draw slider groove
if ((controls & SC_SliderGroove) && groove.isValid()) { if ((controls & SC_SliderGroove) && groove.isValid()) {
drawKStylePrimitive( KPE_SliderGroove, &p2, widget, groove, cg, flags, opt ); drawKStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, flags, opt, widget );
// Draw the focus rect around the groove // Draw the focus rect around the groove
if (slider->hasFocus()) if (slider->hasFocus())
tqdrawPrimitive(PE_FocusRect, &p2, groove, cg); tqdrawPrimitive(PE_FocusRect, &p2, ceData, elementFlags, groove, cg);
} }
// Draw the tickmarks // Draw the tickmarks
if (controls & SC_SliderTickmarks) if (controls & SC_SliderTickmarks)
TQCommonStyle::drawComplexControl(control, &p2, widget, TQCommonStyle::drawComplexControl(control, &p2, ceData, elementFlags,
r, cg, flags, SC_SliderTickmarks, active, opt); r, cg, flags, SC_SliderTickmarks, active, opt, widget);
// Draw the slider handle // Draw the slider handle
if ((controls & SC_SliderHandle) && handle.isValid()) { if ((controls & SC_SliderHandle) && handle.isValid()) {
if (active == SC_SliderHandle) if (active == SC_SliderHandle)
flags |= Style_Active; flags |= Style_Active;
drawKStylePrimitive( KPE_SliderHandle, &p2, widget, handle, cg, flags, opt ); drawKStylePrimitive( KPE_SliderHandle, &p2, ceData, elementFlags, handle, cg, flags, opt, widget );
} }
p2.end(); p2.end();
@ -1263,7 +1284,7 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
// Paint the icon and text. // Paint the icon and text.
if ( controls & SC_ListView ) if ( controls & SC_ListView )
TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags, controls, active, opt ); TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget );
// If we're have a branch or are expanded... // If we're have a branch or are expanded...
if ( controls & (SC_ListViewBranch | SC_ListViewExpand) ) if ( controls & (SC_ListViewBranch | SC_ListViewExpand) )
@ -1325,7 +1346,7 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
boxflags = child->isOpen() ? TQStyle::Style_Off : TQStyle::Style_On; boxflags = child->isOpen() ? TQStyle::Style_Off : TQStyle::Style_On;
// KStyle extension: Draw the box and expand/collapse indicator // KStyle extension: Draw the box and expand/collapse indicator
drawKStylePrimitive( KPE_ListViewExpander, p, NULL, boxrect, cg, boxflags, opt ); drawKStylePrimitive( KPE_ListViewExpander, p, ceData, elementFlags, boxrect, cg, boxflags, opt, NULL );
// dotlinery // dotlinery
p->setPen( cg.mid() ); p->setPen( cg.mid() );
@ -1379,7 +1400,7 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
branchflags = TQStyle::Style_Horizontal; branchflags = TQStyle::Style_Horizontal;
// KStyle extension: Draw the horizontal branch // KStyle extension: Draw the horizontal branch
drawKStylePrimitive( KPE_ListViewBranch, p, NULL, branchrect, cg, branchflags, opt ); drawKStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL );
} else { } else {
// Vertical branch // Vertical branch
@ -1395,7 +1416,7 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
branchflags = TQStyle::Style_Default; branchflags = TQStyle::Style_Default;
// KStyle extension: Draw the vertical branch // KStyle extension: Draw the vertical branch
drawKStylePrimitive( KPE_ListViewBranch, p, NULL, branchrect, cg, branchflags, opt ); drawKStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL );
} }
} }
} }
@ -1403,19 +1424,21 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
} }
default: default:
TQCommonStyle::drawComplexControl( control, p, widget, r, cg, TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg,
flags, controls, active, opt ); flags, controls, active, opt, widget );
break; break;
} }
} }
TQStyle::SubControl KStyle::querySubControl( TQ_ComplexControl control, TQStyle::SubControl KStyle::querySubControl( TQ_ComplexControl control,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQPoint &pos, const TQPoint &pos,
const TQStyleOption &opt ) const const TQStyleOption &opt,
const TQWidget* widget ) const
{ {
TQStyle::SubControl ret = TQCommonStyle::querySubControl(control, widget, pos, opt); TQStyle::SubControl ret = TQCommonStyle::querySubControl(control, ceData, elementFlags, pos, opt, widget);
if (d->scrollbarType == ThreeButtonScrollBar) { if (d->scrollbarType == ThreeButtonScrollBar) {
// Enable third button // Enable third button
@ -1427,9 +1450,11 @@ TQStyle::SubControl KStyle::querySubControl( TQ_ComplexControl control,
TQRect KStyle::querySubControlMetrics( TQ_ComplexControl control, TQRect KStyle::querySubControlMetrics( TQ_ComplexControl control,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc, SubControl sc,
const TQStyleOption &opt ) const const TQStyleOption &opt,
const TQWidget* widget ) const
{ {
TQRect ret; TQRect ret;
@ -1442,7 +1467,7 @@ TQRect KStyle::querySubControlMetrics( TQ_ComplexControl control,
const TQScrollBar *sb = (const TQScrollBar*)widget; const TQScrollBar *sb = (const TQScrollBar*)widget;
bool horizontal = sb->orientation() == Qt::Horizontal; bool horizontal = sb->orientation() == Qt::Horizontal;
int sliderstart = sb->sliderStart(); int sliderstart = sb->sliderStart();
int sbextent = pixelMetric(PM_ScrollBarExtent, widget); int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget);
int maxlen = (horizontal ? sb->width() : sb->height()) int maxlen = (horizontal ? sb->width() : sb->height())
- (sbextent * (threeButtonScrollBar ? 3 : 2)); - (sbextent * (threeButtonScrollBar ? 3 : 2));
int sliderlen; int sliderlen;
@ -1453,7 +1478,7 @@ TQRect KStyle::querySubControlMetrics( TQ_ComplexControl control,
uint range = sb->maxValue() - sb->minValue(); uint range = sb->maxValue() - sb->minValue();
sliderlen = (sb->pageStep() * maxlen) / (range + sb->pageStep()); sliderlen = (sb->pageStep() * maxlen) / (range + sb->pageStep());
int slidermin = pixelMetric( PM_ScrollBarSliderMin, widget ); int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget );
if ( sliderlen < slidermin || range > INT_MAX / 2 ) if ( sliderlen < slidermin || range > INT_MAX / 2 )
sliderlen = slidermin; sliderlen = slidermin;
if ( sliderlen > maxlen ) if ( sliderlen > maxlen )
@ -1560,11 +1585,11 @@ TQRect KStyle::querySubControlMetrics( TQ_ComplexControl control,
} }
default: default:
ret = TQCommonStyle::querySubControlMetrics(control, widget, sc, opt); ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, opt, widget);
break; break;
} }
} else } else
ret = TQCommonStyle::querySubControlMetrics(control, widget, sc, opt); ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, opt, widget);
return ret; return ret;
} }
@ -1812,8 +1837,10 @@ static const char* const critical_xpm[]={
".............aaaaaaa............"}; ".............aaaaaaa............"};
TQPixmap KStyle::stylePixmap( StylePixmap stylepixmap, TQPixmap KStyle::stylePixmap( StylePixmap stylepixmap,
const TQWidget* widget, TQStyleControlElementData ceData,
const TQStyleOption& opt) const ControlElementFlags elementFlags,
const TQStyleOption& opt,
const TQWidget* widget) const
{ {
switch (stylepixmap) { switch (stylepixmap) {
case SP_TitleBarShadeButton: case SP_TitleBarShadeButton:
@ -1839,12 +1866,12 @@ TQPixmap KStyle::stylePixmap( StylePixmap stylepixmap,
default: default:
break; break;
} }
return TQCommonStyle::stylePixmap(stylepixmap, widget, opt); return TQCommonStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget);
} }
int KStyle::styleHint( TQ_StyleHint sh, const TQWidget* w, int KStyle::styleHint( TQ_StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQStyleOption &opt, TQStyleHintReturn* shr) const const TQStyleOption &opt, TQStyleHintReturn* shr, const TQWidget* w) const
{ {
switch (sh) switch (sh)
{ {
@ -1858,7 +1885,7 @@ int KStyle::styleHint( TQ_StyleHint sh, const TQWidget* w,
return d->menuAltKeyNavigation ? 1 : 0; return d->menuAltKeyNavigation ? 1 : 0;
case SH_PopupMenu_SubMenuPopupDelay: case SH_PopupMenu_SubMenuPopupDelay:
if ( styleHint( SH_PopupMenu_SloppySubMenus, w ) ) if ( styleHint( SH_PopupMenu_SloppySubMenus, ceData, elementFlags, TQStyleOption::Default, 0, w ) )
return QMIN( 100, d->popupMenuDelay ); return QMIN( 100, d->popupMenuDelay );
else else
return d->popupMenuDelay; return d->popupMenuDelay;
@ -1894,7 +1921,7 @@ int KStyle::styleHint( TQ_StyleHint sh, const TQWidget* w,
} }
default: default:
return TQCommonStyle::styleHint(sh, w, opt, shr); return TQCommonStyle::styleHint(sh, ceData, elementFlags, opt, shr, w);
} }
} }

@ -237,6 +237,19 @@ class TDEFX_EXPORT KStyle: public TQCommonStyle
KPE_ListViewBranch KPE_ListViewBranch
}; };
// Old API
// DEPRECATED
#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
__attribute__ ((deprecated))
#endif
virtual void drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p,
const TQWidget* widget,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::SO_Default ) const;
/** /**
* This function is identical to Qt's TQStyle::tqdrawPrimitive(), except that * This function is identical to Qt's TQStyle::tqdrawPrimitive(), except that
* it adds one further parameter, 'widget', that can be used to determine * it adds one further parameter, 'widget', that can be used to determine
@ -248,11 +261,13 @@ class TDEFX_EXPORT KStyle: public TQCommonStyle
*/ */
virtual void drawKStylePrimitive( KStylePrimitive kpe, virtual void drawKStylePrimitive( KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, 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::SO_Default ) const; const TQStyleOption& = TQStyleOption::SO_Default,
const TQWidget* widget = 0 ) const;
enum KStylePixelMetric { enum KStylePixelMetric {
@ -277,6 +292,8 @@ class TDEFX_EXPORT KStyle: public TQCommonStyle
void tqdrawPrimitive( TQ_PrimitiveElement pe, void tqdrawPrimitive( TQ_PrimitiveElement pe,
TQPainter* p, TQPainter* p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -286,6 +303,8 @@ class TDEFX_EXPORT KStyle: public TQCommonStyle
// void tqdrawPrimitive( TQ_ControlElement pe, // void tqdrawPrimitive( TQ_ControlElement pe,
// TQPainter* p, // TQPainter* p,
// TQStyleControlElementData ceData,
// ControlElementFlags elementFlags,
// const TQRect &r, // const TQRect &r,
// const TQColorGroup &cg, // const TQColorGroup &cg,
// SFlags flags = Style_Default, // SFlags flags = Style_Default,
@ -295,46 +314,57 @@ class TDEFX_EXPORT KStyle: public TQCommonStyle
void drawControl( TQ_ControlElement element, void drawControl( TQ_ControlElement element,
TQPainter* p, TQPainter* p,
const TQWidget* widget, 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::SO_Default ) const; const TQStyleOption& = TQStyleOption::SO_Default,
const TQWidget* widget = 0 ) const;
void drawComplexControl( TQ_ComplexControl control, void drawComplexControl( TQ_ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget* widget, 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::SO_Default ) const; const TQStyleOption& = TQStyleOption::SO_Default,
const TQWidget* widget = 0 ) const;
SubControl querySubControl( TQ_ComplexControl control, SubControl querySubControl( TQ_ComplexControl control,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQPoint &pos, const TQPoint &pos,
const TQStyleOption& = TQStyleOption::SO_Default ) const; const TQStyleOption& = TQStyleOption::SO_Default,
const TQWidget* widget = 0 ) const;
TQRect querySubControlMetrics( TQ_ComplexControl control, TQRect querySubControlMetrics( TQ_ComplexControl control,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc, SubControl sc,
const TQStyleOption& = TQStyleOption::SO_Default ) const; const TQStyleOption& = TQStyleOption::SO_Default,
const TQWidget* widget = 0 ) const;
int pixelMetric( PixelMetric m, int pixelMetric( PixelMetric m, 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, const ControlElementFlags elementFlags,
const TQWidget* widget ) const; const TQWidget* widget = 0 ) const;
TQPixmap stylePixmap( StylePixmap stylepixmap, TQPixmap stylePixmap( StylePixmap stylepixmap,
const TQWidget* widget = 0, TQStyleControlElementData ceData,
const TQStyleOption& = TQStyleOption::SO_Default ) const; ControlElementFlags elementFlags,
const TQStyleOption& = TQStyleOption::SO_Default,
const TQWidget* widget = 0 ) const;
int styleHint( TQ_StyleHint sh, int styleHint( TQ_StyleHint sh, TQStyleControlElementData ceData,
const TQWidget* w = 0, ControlElementFlags elementFlags,
const TQStyleOption &opt = TQStyleOption::SO_Default, const TQStyleOption &opt = TQStyleOption::SO_Default,
TQStyleHintReturn* shr = 0 ) const; TQStyleHintReturn* shr = 0,
const TQWidget* w = 0 ) const;
protected: protected:
bool eventFilter( TQObject* object, TQEvent* event ); bool eventFilter( TQObject* object, TQEvent* event );

Loading…
Cancel
Save