Update to new style API

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

@ -119,12 +119,12 @@ void dotNETstyle::polish(TQWidget* widget)
// we can't simply set a palette -- upon color-theme changes, we have // we can't simply set a palette -- upon color-theme changes, we have
// to update the palette again. // to update the palette again.
bool extraPalette = false; // bool extraPalette = false;
if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) && !inheritsKHTML(widget)) { if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) && !inheritsKHTML(widget)) {
widget->installEventFilter (this); widget->installEventFilter (this);
updatePalette( (TQComboBox*) widget ); updatePalette( (TQComboBox*) widget );
extraPalette = true; // extraPalette = true;
} else { } else {
winstyle->polish(widget); winstyle->polish(widget);
} }
@ -370,11 +370,13 @@ void dotNETstyle::renderPanel(TQPainter *p,
void dotNETstyle::drawKStylePrimitive(KStylePrimitive kpe, void dotNETstyle::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
{ {
// SLIDER // SLIDER
// ------ // ------
@ -410,14 +412,16 @@ void dotNETstyle::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);
} }
} }
// This function draws primitive elements as well as their masks. // This function draws primitive elements as well as their masks.
void dotNETstyle::tqdrawPrimitive(TQ_PrimitiveElement pe, void dotNETstyle::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,
@ -493,16 +497,16 @@ void dotNETstyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
// SCROLLBAR BUTTONS // SCROLLBAR BUTTONS
// ----------------- // -----------------
case PE_ScrollBarSubLine: { case PE_ScrollBarSubLine: {
tqdrawPrimitive(PE_ButtonBevel, p, r, cg, flags); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags);
p->setPen(down ? cg.highlightedText() : cg.foreground()); p->setPen(down ? cg.highlightedText() : 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;
} }
case PE_ScrollBarAddLine: { case PE_ScrollBarAddLine: {
tqdrawPrimitive(PE_ButtonBevel, p, r, cg, flags); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags);
p->setPen(down ? cg.highlightedText() : cg.foreground()); p->setPen(down ? cg.highlightedText() : 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;
} }
@ -719,8 +723,8 @@ void dotNETstyle::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) {
@ -751,7 +755,7 @@ void dotNETstyle::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);
} }
} }
} }
@ -759,20 +763,22 @@ void dotNETstyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
void dotNETstyle::drawControl(TQ_ControlElement element, void dotNETstyle::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) {
// CHECKBOXES // CHECKBOXES
// ---------- // ----------
case CE_CheckBox: { case CE_CheckBox: {
tqdrawPrimitive(PE_Indicator, p, r, cg, flags); drawPrimitive(PE_Indicator, p, ceData, elementFlags, r, cg, flags);
if (flags & Style_On || flags & Style_Down) { if (flags & Style_On || flags & Style_Down) {
p->setPen(cg.foreground()); p->setPen(cg.foreground());
tqdrawPrimitive(PE_CheckMark, p, r, cg, flags); drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, flags);
} }
break; break;
} }
@ -840,7 +846,7 @@ void dotNETstyle::drawControl(TQ_ControlElement element,
// RADIOBUTTONS // RADIOBUTTONS
// ------------ // ------------
case CE_RadioButton: { case CE_RadioButton: {
tqdrawPrimitive(PE_ExclusiveIndicator, p, r, cg, flags); drawPrimitive(PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, flags);
if (flags & Style_On || flags & Style_Down) { if (flags & Style_On || flags & Style_Down) {
TQCOORD center[] = { 4, 5, 4, 7, 5, 8, 7, 8, 8, 7, 8, 5, 7, 4, 5, 4 }; TQCOORD center[] = { 4, 5, 4, 7, 5, 8, 7, 8, 8, 7, 8, 5, 7, 4, 5, 4 };
@ -1019,7 +1025,7 @@ void dotNETstyle::drawControl(TQ_ControlElement element,
} }
default: default:
winstyle->drawControl(element, p, widget, r, cg, flags, opt); winstyle->drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
break; break;
@ -1039,14 +1045,14 @@ void dotNETstyle::drawControl(TQ_ControlElement element,
p->setPen(flags & Style_Enabled ? TQColor(cg.foreground()) : TQColor(cg.mid().dark())); p->setPen(flags & Style_Enabled ? TQColor(cg.foreground()) : TQColor(cg.mid().dark()));
if (!flags & Style_Selected) { if (!flags & Style_Selected) {
p->translate(pixelMetric(PM_ButtonShiftHorizontal), p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags),
pixelMetric(PM_ButtonShiftVertical)); pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags));
} }
p->drawText(r, text_flags, opt.tab()->text()); p->drawText(r, text_flags, opt.tab()->text());
if (flags & Style_HasFocus) if (flags & Style_HasFocus)
tqdrawPrimitive(PE_FocusRect, p, r, cg); drawPrimitive(PE_FocusRect, p, ceData, elementFlags, r, cg);
p->restore(); p->restore();
break; break;
@ -1057,14 +1063,14 @@ void dotNETstyle::drawControl(TQ_ControlElement element,
TQRect br = r; TQRect br = r;
bool btnDefault = button->isDefault(); bool btnDefault = button->isDefault();
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_ButtonBevel, p, br, cg, flags); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, br, cg, flags);
break; break;
} }
@ -1076,8 +1082,8 @@ void dotNETstyle::drawControl(TQ_ControlElement element,
TQRect ur(r); TQRect ur(r);
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 (!pb->text().isEmpty() && (flags & Style_ButtonDefault)) { if (!pb->text().isEmpty() && (flags & Style_ButtonDefault)) {
@ -1125,8 +1131,8 @@ void dotNETstyle::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;
@ -1335,7 +1341,7 @@ void dotNETstyle::drawControl(TQ_ControlElement element,
} }
if (mi->popup()) { if (mi->popup()) {
int dim = pixelMetric(PM_MenuButtonIndicator); int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags);
xpos = x+w - arrowHMargin - 2*itemFrame - dim; xpos = x+w - arrowHMargin - 2*itemFrame - dim;
@ -1348,7 +1354,7 @@ void dotNETstyle::drawControl(TQ_ControlElement element,
TQRect rr = TQRect(xpos, y + h/2 - dim/2, dim, dim); TQRect rr = TQRect(xpos, y + h/2 - dim/2, dim, dim);
if (TQApplication::reverseLayout()) if (TQApplication::reverseLayout())
rr = visualRect( rr, r ); rr = visualRect( rr, r );
tqdrawPrimitive((TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight), p, rr, cg, Style_Enabled); drawPrimitive((TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight), p, ceData, elementFlags, rr, cg, Style_Enabled);
} }
if (checkable) { if (checkable) {
@ -1366,7 +1372,7 @@ void dotNETstyle::drawControl(TQ_ControlElement element,
if (TQApplication::reverseLayout()) if (TQApplication::reverseLayout())
rr = visualRect( rr, r ); rr = visualRect( rr, r );
tqdrawPrimitive(PE_CheckMark, p, rr, cg, cflags); drawPrimitive(PE_CheckMark, p, ceData, elementFlags, rr, cg, cflags);
} }
} }
@ -1380,15 +1386,17 @@ void dotNETstyle::drawControl(TQ_ControlElement element,
p->fillRect(r, cg.button()); p->fillRect(r, cg.button());
break; break;
default: default:
winstyle->drawControl(element, p, widget, r, cg, flags, opt); winstyle->drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
void dotNETstyle::drawControlMask(TQ_ControlElement element, void dotNETstyle::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: {
@ -1407,16 +1415,18 @@ void dotNETstyle::drawControlMask(TQ_ControlElement element,
} }
default: { default: {
KStyle::drawControlMask (element, p, w, r, opt); KStyle::drawControlMask (element, p, ceData, elementFlags, r, opt, w);
} }
} }
} }
void dotNETstyle::drawComplexControlMask(ComplexControl c, void dotNETstyle::drawComplexControlMask(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_ComboBox: { case CC_ComboBox: {
@ -1434,20 +1444,22 @@ void dotNETstyle::drawComplexControlMask(ComplexControl c,
break; break;
} }
default: { default: {
KStyle::drawComplexControlMask (c, p, w, r, o); KStyle::drawComplexControlMask (c, p, ceData, elementFlags, r, o, w);
} }
} }
} }
void dotNETstyle::drawComplexControl(ComplexControl control, void dotNETstyle::drawComplexControl(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) {
// COMBOBOX // COMBOBOX
@ -1559,8 +1571,8 @@ void dotNETstyle::drawComplexControl(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;
@ -1574,7 +1586,7 @@ void dotNETstyle::drawComplexControl(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)) { 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);
} else if (tb->parentWidget() && } else if (tb->parentWidget() &&
tb->parentWidget()->backgroundPixmap() && tb->parentWidget()->backgroundPixmap() &&
!tb->parentWidget()->backgroundPixmap()->isNull()) { !tb->parentWidget()->backgroundPixmap()->isNull()) {
@ -1586,15 +1598,15 @@ void dotNETstyle::drawComplexControl(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);
} }
break; break;
@ -1607,8 +1619,8 @@ void dotNETstyle::drawComplexControl(ComplexControl control,
SFlags flags; SFlags flags;
TQ_PrimitiveElement pe; TQ_PrimitiveElement pe;
TQRect swf = querySubControlMetrics(control, sw, SC_SpinWidgetFrame); TQRect swf = querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetFrame, TQStyleOption::Default, sw);
swf = visualRect( swf, sw ); swf = visualRect( swf, ceData, elementFlags );
if (controls & SC_SpinWidgetFrame) { if (controls & SC_SpinWidgetFrame) {
// Don't draw the WindowsStyle thick frame. // Don't draw the WindowsStyle thick frame.
@ -1644,7 +1656,7 @@ void dotNETstyle::drawComplexControl(ComplexControl control,
} }
re.setX(re.x() + 1); re.setX(re.x() + 1);
p->setPen(flags & Style_Raised ? ucg.foreground() : ucg.highlightedText()); p->setPen(flags & Style_Raised ? ucg.foreground() : ucg.highlightedText());
tqdrawPrimitive(pe, p, re, ucg, flags); drawPrimitive(pe, p, ceData, elementFlags, re, ucg, flags);
} }
if (controls & SC_SpinWidgetDown) { if (controls & SC_SpinWidgetDown) {
@ -1683,32 +1695,32 @@ void dotNETstyle::drawComplexControl(ComplexControl control,
} }
p->setPen(flags & Style_Raised ? dcg.foreground() : dcg.highlightedText()); p->setPen(flags & Style_Raised ? dcg.foreground() : dcg.highlightedText());
re.setX(re.x() + 1); re.setX(re.x() + 1);
tqdrawPrimitive(pe, p, re, dcg, flags); drawPrimitive(pe, p, ceData, elementFlags, re, dcg, flags);
} }
break; break;
} }
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 dotNETstyle::subRect(SubRect r, const TQWidget *widget) const TQRect dotNETstyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
// Don't use KStyles progressbar subrect // Don't use KStyles progressbar subrect
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 );
} }
case SR_PushButtonFocusRect: { case SR_PushButtonFocusRect: {
TQRect rect = widget->rect(); TQRect rect = widget->rect();
int margin = pixelMetric(PM_ButtonDefaultIndicator, widget) + pixelMetric(PM_DefaultFrameWidth, widget) + 2; int margin = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget) + pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) + 2;
rect.addCoords(margin, margin, -margin, -margin); rect.addCoords(margin, margin, -margin, -margin);
return rect; return rect;
@ -1717,18 +1729,20 @@ TQRect dotNETstyle::subRect(SubRect r, const TQWidget *widget) const
case SR_ProgressBarGroove: case SR_ProgressBarGroove:
case SR_ProgressBarContents: case SR_ProgressBarContents:
case SR_ProgressBarLabel: { case SR_ProgressBarLabel: {
return winstyle->subRect(r, widget); return winstyle->subRect(r, ceData, elementFlags, widget);
} }
default: { default: {
return KStyle::subRect(r, widget); return KStyle::subRect(r, ceData, elementFlags, widget);
} }
} }
} }
TQRect dotNETstyle::querySubControlMetrics(ComplexControl control, TQRect dotNETstyle::querySubControlMetrics(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();
@ -1742,23 +1756,22 @@ TQRect dotNETstyle::querySubControlMetrics(ComplexControl control,
return TQRect(r.x() + 2, r.y() + 2, r.width() - 19, r.height() - 4); return TQRect(r.x() + 2, r.y() + 2, r.width() - 19, r.height() - 4);
} }
default: { default: {
return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
} }
} }
break; break;
} }
case CC_SpinWidget: { case CC_SpinWidget: {
int fw = pixelMetric(PM_SpinBoxFrameWidth, widget); int fw = pixelMetric(PM_SpinBoxFrameWidth, ceData, elementFlags, widget);
TQSize bs; TQSize bs;
bs.setHeight(TQMAX(8, widget->height()/2)); bs.setHeight(TQMAX(8, widget->height()/2));
bs.setWidth(TQMIN(bs.height() * 8 / 5, widget->width() / 4)); bs.setWidth(TQMIN(bs.height() * 8 / 5, widget->width() / 4));
int y = fw; int y = fw;
int x, lx, rx; int x, lx;
x = widget->width() - y - bs.width(); x = widget->width() - y - bs.width();
lx = fw; lx = fw;
rx = x - fw;
switch (subcontrol) { switch (subcontrol) {
case SC_SpinWidgetUp: { case SC_SpinWidgetUp: {
@ -1784,10 +1797,10 @@ TQRect dotNETstyle::querySubControlMetrics(ComplexControl control,
default: { default: {
} }
} }
return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
} }
int dotNETstyle::pixelMetric(PixelMetric m, const TQWidget *widget) const int dotNETstyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
switch(m) { switch(m) {
// TABS // TABS
@ -1878,15 +1891,17 @@ int dotNETstyle::pixelMetric(PixelMetric m, const TQWidget *widget) const
} }
default: default:
return KStyle::pixelMetric(m, widget); return KStyle::pixelMetric(m, ceData, elementFlags, widget);
} }
} }
TQSize dotNETstyle::tqsizeFromContents(ContentsType t, TQSize dotNETstyle::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) {
@ -1945,8 +1960,8 @@ TQSize dotNETstyle::tqsizeFromContents(ContentsType t,
const TQPushButton* button = (const TQPushButton*) widget; const TQPushButton* button = (const TQPushButton*) widget;
int w = s.width(); int w = s.width();
int h = s.height(); int h = s.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;
//We use bold font sometimes, so that make take more space than TQt allocated. //We use bold font sometimes, so that make take more space than TQt allocated.
TQFontMetrics origFM = button->fontMetrics(); TQFontMetrics origFM = button->fontMetrics();
@ -1968,7 +1983,7 @@ TQSize dotNETstyle::tqsizeFromContents(ContentsType t,
// Compensate for default indicator. Doing it for all widgets lets us // Compensate for default indicator. Doing it for all widgets lets us
// workaround changes in auto-default behavior in KDialogBase in 3.3 // workaround changes in auto-default behavior in KDialogBase in 3.3
int di = pixelMetric( PM_ButtonDefaultIndicator ); int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
w += di * 2; w += di * 2;
h += di * 2; h += di * 2;
@ -1983,11 +1998,11 @@ TQSize dotNETstyle::tqsizeFromContents(ContentsType t,
} }
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);
// return winstyle->tqsizeFromContents(t, widget, s, opt); // return winstyle->sizeFromContents(t, ceData, elementFlags, s, opt, widget);
} }
void dotNETstyle::paletteChanged() void dotNETstyle::paletteChanged()

@ -49,14 +49,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,
@ -64,45 +68,55 @@ 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( ComplexControl control, void drawComplexControl( 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 = 0 ) const;
TQRect querySubControlMetrics( ComplexControl control, TQRect querySubControlMetrics( 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::ComplexControl c, void drawComplexControlMask(TQStyle::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;
protected: protected:
void renderButton(TQPainter *p, void renderButton(TQPainter *p,

@ -567,12 +567,14 @@ void PhaseStyle::drawPhaseTab(TQPainter *painter,
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// tqdrawPrimitive() // drawPrimitive()
// --------------- // ---------------
// Draw the primitive element // Draw the primitive element
void PhaseStyle::tqdrawPrimitive(TQ_PrimitiveElement element, void PhaseStyle::drawPrimitive(TQ_PrimitiveElement element,
TQPainter *painter, TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQColorGroup &group, const TQColorGroup &group,
SFlags flags, SFlags flags,
@ -663,9 +665,9 @@ void PhaseStyle::tqdrawPrimitive(TQ_PrimitiveElement element,
case PE_HeaderArrow: case PE_HeaderArrow:
if (flags & Style_Up) if (flags & Style_Up)
tqdrawPrimitive(PE_ArrowUp, painter, rect, group, Style_Enabled); drawPrimitive(PE_ArrowUp, painter, ceData, elementFlags, rect, group, Style_Enabled);
else else
tqdrawPrimitive(PE_ArrowDown, painter, rect, group, Style_Enabled); drawPrimitive(PE_ArrowDown, painter, ceData, elementFlags, rect, group, Style_Enabled);
break; break;
case PE_ScrollBarAddPage: case PE_ScrollBarAddPage:
@ -703,7 +705,7 @@ void PhaseStyle::tqdrawPrimitive(TQ_PrimitiveElement element,
} }
} }
tqdrawPrimitive(arrow, painter, TQRect(x,y,h,w), group, flags); drawPrimitive(arrow, painter, ceData, elementFlags, TQRect(x,y,h,w), group, flags);
break; break;
} }
@ -999,7 +1001,7 @@ void PhaseStyle::tqdrawPrimitive(TQ_PrimitiveElement element,
break; break;
default: default:
KStyle::tqdrawPrimitive(element, painter, rect, group, flags, option); KStyle::drawPrimitive(element, painter, ceData, elementFlags, rect, group, flags, option);
} }
} }
@ -1010,11 +1012,13 @@ void PhaseStyle::tqdrawPrimitive(TQ_PrimitiveElement element,
void PhaseStyle::drawKStylePrimitive(KStylePrimitive element, void PhaseStyle::drawKStylePrimitive(KStylePrimitive element,
TQPainter *painter, TQPainter *painter,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQColorGroup &group, const TQColorGroup &group,
SFlags flags, SFlags flags,
const TQStyleOption &option) const const TQStyleOption &option,
const TQWidget *widget) const
{ {
bool horiz = flags & Style_Horizontal; bool horiz = flags & Style_Horizontal;
int x, y, w, h, x2, y2, n, cx, cy; int x, y, w, h, x2, y2, n, cx, cy;
@ -1121,8 +1125,8 @@ void PhaseStyle::drawKStylePrimitive(KStylePrimitive element,
} }
default: default:
KStyle::drawKStylePrimitive(element, painter, widget, rect, KStyle::drawKStylePrimitive(element, painter, ceData, elementFlags, rect,
group, flags, option); group, flags, option, widget);
} }
} }
@ -1133,11 +1137,13 @@ void PhaseStyle::drawKStylePrimitive(KStylePrimitive element,
void PhaseStyle::drawControl(TQ_ControlElement element, void PhaseStyle::drawControl(TQ_ControlElement element,
TQPainter *painter, TQPainter *painter,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQColorGroup &group, const TQColorGroup &group,
SFlags flags, SFlags flags,
const TQStyleOption &option) const const TQStyleOption &option,
const TQWidget *widget) const
{ {
bool active, enabled, depress; bool active, enabled, depress;
int x, y, w, h, x2, y2, dx; int x, y, w, h, x2, y2, dx;
@ -1153,7 +1159,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
switch (element) { switch (element) {
case CE_PushButton: { case CE_PushButton: {
depress = flags & (Style_Down | Style_On); depress = flags & (Style_Down | Style_On);
int bd = pixelMetric(PM_ButtonDefaultIndicator, widget) + 1; int bd = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget) + 1;
if ((flags & Style_ButtonDefault) && !depress) { if ((flags & Style_ButtonDefault) && !depress) {
drawPhasePanel(painter, x, y, w, h, group, true, drawPhasePanel(painter, x, y, w, h, group, true,
@ -1171,8 +1177,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
} }
if (flags & Style_HasFocus) { // draw focus if (flags & Style_HasFocus) { // draw focus
tqdrawPrimitive(PE_FocusRect, painter, drawPrimitive(PE_FocusRect, painter, ceData, elementFlags,
subRect(SR_PushButtonFocusRect, widget), subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget),
group, flags); group, flags);
} }
break; break;
@ -1181,8 +1187,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
case CE_PushButtonLabel: { case CE_PushButtonLabel: {
const TQPushButton* button = ::tqqt_cast<const TQPushButton*>(widget); const TQPushButton* button = ::tqqt_cast<const TQPushButton*>(widget);
if (!button) { if (!button) {
KStyle::drawControl(element, painter, widget, rect, group, KStyle::drawControl(element, painter, ceData, elementFlags, rect, group,
flags, option); flags, option, widget);
return; return;
} }
active = button->isOn() || button->isDown(); active = button->isOn() || button->isDown();
@ -1193,8 +1199,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
} }
if (button->isMenuButton()) { // menu indicator if (button->isMenuButton()) { // menu indicator
int dx = pixelMetric(PM_MenuButtonIndicator, widget); int dx = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags, widget);
tqdrawPrimitive(PE_ArrowDown, painter, drawPrimitive(PE_ArrowDown, painter, ceData, elementFlags,
TQRect(x+w-dx-2, y+2, dx, h-4), TQRect(x+w-dx-2, y+2, dx, h-4),
group, flags, option); group, flags, option);
w -= dx; w -= dx;
@ -1265,9 +1271,9 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
// only draw focus if content (forms on html won't) // only draw focus if content (forms on html won't)
if ((flags & Style_HasFocus) && ((!b->text().isNull()) || b->pixmap())) { if ((flags & Style_HasFocus) && ((!b->text().isNull()) || b->pixmap())) {
tqdrawPrimitive(PE_FocusRect, painter, drawPrimitive(PE_FocusRect, painter, ceData, elementFlags,
visualRect(subRect(SR_RadioButtonFocusRect, visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags,
widget), widget), widget), ceData, elementFlags),
group, flags); group, flags);
} }
break; break;
@ -1296,8 +1302,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
case CE_MenuBarItem: { case CE_MenuBarItem: {
const TQMenuBar *mbar = ::tqqt_cast<const TQMenuBar*>(widget); const TQMenuBar *mbar = ::tqqt_cast<const TQMenuBar*>(widget);
if (!mbar) { if (!mbar) {
KStyle::drawControl(element, painter, widget, rect, group, KStyle::drawControl(element, painter, ceData, elementFlags, rect, group,
flags, option); flags, option, widget);
return; return;
} }
mi = option.menuItem(); mi = option.menuItem();
@ -1327,8 +1333,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
case CE_PopupMenuItem: { case CE_PopupMenuItem: {
const TQPopupMenu *popup = ::tqqt_cast<const TQPopupMenu*>(widget); const TQPopupMenu *popup = ::tqqt_cast<const TQPopupMenu*>(widget);
if (!popup) { if (!popup) {
KStyle::drawControl(element, painter, widget, rect, group, KStyle::drawControl(element, painter, ceData, elementFlags, rect, group,
flags, option); flags, option, widget);
return; return;
} }
@ -1341,7 +1347,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
int tabwidth = option.tabWidth(); int tabwidth = option.tabWidth();
int checkwidth = option.maxIconWidth(); int checkwidth = option.maxIconWidth();
bool checkable = popup->isCheckable(); bool checkable = popup->isCheckable();
bool etchtext = styleHint(SH_EtchDisabledText); bool etchtext = styleHint(SH_EtchDisabledText, ceData, elementFlags);
active = flags & Style_Active; active = flags & Style_Active;
enabled = mi->isEnabled(); enabled = mi->isEnabled();
TQRect vrect; TQRect vrect;
@ -1388,7 +1394,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
// draw check // draw check
if (mi->isChecked()) { if (mi->isChecked()) {
int cx = reverse_ ? x+w - checkwidth : x; int cx = reverse_ ? x+w - checkwidth : x;
tqdrawPrimitive(PE_CheckMark, painter, drawPrimitive(PE_CheckMark, painter, ceData, elementFlags,
TQRect(cx + ITEMFRAME, y + ITEMFRAME, TQRect(cx + ITEMFRAME, y + ITEMFRAME,
checkwidth - ITEMFRAME*2, h - ITEMFRAME*2), checkwidth - ITEMFRAME*2, h - ITEMFRAME*2),
group, Style_Default | group, Style_Default |
@ -1479,7 +1485,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
int dim = (h-2*ITEMFRAME) / 2; int dim = (h-2*ITEMFRAME) / 2;
vrect = visualRect(TQRect(x + w - ARROWMARGIN - ITEMFRAME - dim, vrect = visualRect(TQRect(x + w - ARROWMARGIN - ITEMFRAME - dim,
y + h / 2 - dim / 2, dim, dim), rect); y + h / 2 - dim / 2, dim, dim), rect);
tqdrawPrimitive(arrow, painter, vrect, group, drawPrimitive(arrow, painter, ceData, elementFlags, vrect, group,
enabled ? Style_Enabled : Style_Default); enabled ? Style_Enabled : Style_Default);
} }
break; break;
@ -1495,8 +1501,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
drawPhaseTab(painter, x, y, w, h, group, tab, option, drawPhaseTab(painter, x, y, w, h, group, tab, option,
flags); flags);
} else { // not a tabbar } else { // not a tabbar
KStyle::drawControl(element, painter, widget, rect, group, KStyle::drawControl(element, painter, ceData, elementFlags, rect, group,
flags, option); flags, option, widget);
return; return;
} }
break; break;
@ -1511,18 +1517,18 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
case CE_ProgressBarContents: { case CE_ProgressBarContents: {
const TQProgressBar* pbar = ::tqqt_cast<const TQProgressBar*>(widget); const TQProgressBar* pbar = ::tqqt_cast<const TQProgressBar*>(widget);
if (!pbar) { if (!pbar) {
KStyle::drawControl(element, painter, widget, rect, group, KStyle::drawControl(element, painter, ceData, elementFlags, rect, group,
flags, option); flags, option, widget);
return; return;
} }
subRect(SR_ProgressBarContents, widget).rect(&x, &y, &w, &h); subRect(SR_ProgressBarContents, ceData, elementFlags, widget).rect(&x, &y, &w, &h);
painter->setBrush(group.brush(TQColorGroup::Highlight)); painter->setBrush(group.brush(TQColorGroup::Highlight));
painter->setPen(group.dark()); painter->setPen(group.dark());
if (!pbar->totalSteps()) { if (!pbar->totalSteps()) {
// busy indicator // busy indicator
int bar = pixelMetric(PM_ProgressBarChunkWidth, widget) + 2; int bar = pixelMetric(PM_ProgressBarChunkWidth, ceData, elementFlags, widget) + 2;
int progress = pbar->progress() % ((w-bar) * 2); int progress = pbar->progress() % ((w-bar) * 2);
if (progress > (w-bar)) progress = 2 * (w-bar) - progress; if (progress > (w-bar)) progress = 2 * (w-bar) - progress;
painter->drawRect(x+progress+1, y+1, bar-2, h-2); painter->drawRect(x+progress+1, y+1, bar-2, h-2);
@ -1540,8 +1546,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
case CE_ToolBoxTab: { case CE_ToolBoxTab: {
const TQToolBox *box = ::tqqt_cast<const TQToolBox*>(widget); const TQToolBox *box = ::tqqt_cast<const TQToolBox*>(widget);
if (!box) { if (!box) {
KStyle::drawControl(element, painter, widget, rect, group, KStyle::drawControl(element, painter, ceData, elementFlags, rect, group,
flags, option); flags, option, widget);
return; return;
} }
@ -1575,8 +1581,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
} }
default: default:
KStyle::drawControl(element, painter, widget, rect, group, KStyle::drawControl(element, painter, ceData, elementFlags, rect, group,
flags, option); flags, option, widget);
} }
} }
@ -1587,9 +1593,11 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
void PhaseStyle::drawControlMask(TQ_ControlElement element, void PhaseStyle::drawControlMask(TQ_ControlElement element,
TQPainter *painter, TQPainter *painter,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQStyleOption &option) const const TQStyleOption &option,
const TQWidget *widget) const
{ {
switch (element) { switch (element) {
case CE_PushButton: case CE_PushButton:
@ -1598,7 +1606,7 @@ void PhaseStyle::drawControlMask(TQ_ControlElement element,
break; break;
default: default:
KStyle::drawControlMask(element, painter, widget, rect, option); KStyle::drawControlMask(element, painter, ceData, elementFlags, rect, option, widget);
} }
} }
@ -1609,13 +1617,15 @@ void PhaseStyle::drawControlMask(TQ_ControlElement element,
void PhaseStyle::drawComplexControl(TQ_ComplexControl control, void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
TQPainter *painter, TQPainter *painter,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQColorGroup &group, const TQColorGroup &group,
SFlags flags, SFlags flags,
SCFlags controls, SCFlags controls,
SCFlags active, SCFlags active,
const TQStyleOption &option) const const TQStyleOption &option,
const TQWidget *widget) const
{ {
bool down = flags & Style_Down; bool down = flags & Style_Down;
bool on = flags & Style_On; bool on = flags & Style_On;
@ -1629,8 +1639,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
case CC_ComboBox: { case CC_ComboBox: {
const TQComboBox * combo = ::tqqt_cast<const TQComboBox*>(widget); const TQComboBox * combo = ::tqqt_cast<const TQComboBox*>(widget);
if (!combo) { if (!combo) {
KStyle::drawComplexControl(control, painter, widget, rect, group, KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group,
flags, controls, active, option); flags, controls, active, option, widget);
return; return;
} }
@ -1641,8 +1651,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
: group.button(), sunken); : group.button(), sunken);
if (controls & SC_ComboBoxArrow) { // draw arrow box if (controls & SC_ComboBoxArrow) { // draw arrow box
subrect = visualRect(querySubControlMetrics(CC_ComboBox, widget, subrect = visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
SC_ComboBoxArrow), widget); SC_ComboBoxArrow, TQStyleOption::Default, widget), ceData, elementFlags);
subrect.rect(&x, &y, &w, &h); subrect.rect(&x, &y, &w, &h);
int slot = TQMAX(h/4, 6) + (h % 2); int slot = TQMAX(h/4, 6) + (h % 2);
@ -1655,7 +1665,7 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
if (controls & SC_ComboBoxEditField) { // draw edit box if (controls & SC_ComboBoxEditField) { // draw edit box
if (combo->editable()) { // editable box if (combo->editable()) { // editable box
subrect = visualRect(querySubControlMetrics(CC_ComboBox, subrect = visualRect(querySubControlMetrics(CC_ComboBox,
widget, SC_ComboBoxEditField), widget); ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget), ceData, elementFlags);
x2 = subrect.right(); y2 = subrect.bottom(); x2 = subrect.right(); y2 = subrect.bottom();
painter->setPen(group.dark()); painter->setPen(group.dark());
painter->drawLine(x2+1, y, x2+1, y2); painter->drawLine(x2+1, y, x2+1, y2);
@ -1664,9 +1674,9 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
painter->setPen(group.button()); painter->setPen(group.button());
painter->drawPoint(x2+2, y2); painter->drawPoint(x2+2, y2);
} else if (combo->hasFocus()) { // non editable box } else if (combo->hasFocus()) { // non editable box
subrect = visualRect(subRect(SR_ComboBoxFocusRect, subrect = visualRect(subRect(SR_ComboBoxFocusRect, ceData, elementFlags,
combo), widget); combo), ceData, elementFlags);
tqdrawPrimitive(PE_FocusRect, painter, subrect, group, drawPrimitive(PE_FocusRect, painter, ceData, elementFlags, subrect, group,
Style_FocusAtBorder, Style_FocusAtBorder,
TQStyleOption(group.highlight())); TQStyleOption(group.highlight()));
} }
@ -1680,8 +1690,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
// always a three button scrollbar // always a three button scrollbar
const TQScrollBar *sb = ::tqqt_cast<const TQScrollBar*>(widget); const TQScrollBar *sb = ::tqqt_cast<const TQScrollBar*>(widget);
if (!sb) { if (!sb) {
KStyle::drawComplexControl(control, painter, widget, rect, group, KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group,
flags, controls, active, option); flags, controls, active, option, widget);
return; return;
} }
@ -1694,10 +1704,10 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
// addline // addline
if (controls & SC_ScrollBarAddLine) { if (controls & SC_ScrollBarAddLine) {
srect = querySubControlMetrics(control, widget, srect = querySubControlMetrics(control, ceData, elementFlags,
SC_ScrollBarAddLine, option); SC_ScrollBarAddLine, option, widget);
if (srect.isValid()) if (srect.isValid())
tqdrawPrimitive(PE_ScrollBarAddLine, painter, srect, group, drawPrimitive(PE_ScrollBarAddLine, painter, ceData, elementFlags, srect, group,
scrollflags | ((active == SC_ScrollBarAddLine) scrollflags | ((active == SC_ScrollBarAddLine)
? Style_Down : Style_Default)); ? Style_Down : Style_Default));
} }
@ -1705,19 +1715,19 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
// subline (two of them) // subline (two of them)
if (controls & SC_ScrollBarSubLine) { if (controls & SC_ScrollBarSubLine) {
// top/left subline // top/left subline
srect = querySubControlMetrics(control, widget, srect = querySubControlMetrics(control, ceData, elementFlags,
SC_ScrollBarSubLine, option); SC_ScrollBarSubLine, option, widget);
if (srect.isValid()) if (srect.isValid())
tqdrawPrimitive(PE_ScrollBarSubLine, painter, srect, group, drawPrimitive(PE_ScrollBarSubLine, painter, ceData, elementFlags, srect, group,
scrollflags | ((active == SC_ScrollBarSubLine) scrollflags | ((active == SC_ScrollBarSubLine)
? Style_Down : Style_Default)); ? Style_Down : Style_Default));
// bottom/right subline // bottom/right subline
srect = querySubControlMetrics(control, widget, srect = querySubControlMetrics(control, ceData, elementFlags,
SC_ScrollBarAddLine, option); SC_ScrollBarAddLine, option, widget);
if (srect.isValid()) { if (srect.isValid()) {
if (horizontal) srect.moveBy(-srect.width()+1, 0); if (horizontal) srect.moveBy(-srect.width()+1, 0);
else srect.moveBy(0, -srect.height()+1); else srect.moveBy(0, -srect.height()+1);
tqdrawPrimitive(PE_ScrollBarSubLine, painter, srect, group, drawPrimitive(PE_ScrollBarSubLine, painter, ceData, elementFlags, srect, group,
scrollflags | ((active == SC_ScrollBarSubLine) scrollflags | ((active == SC_ScrollBarSubLine)
? Style_Down : Style_Default)); ? Style_Down : Style_Default));
} }
@ -1725,12 +1735,12 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
// addpage // addpage
if (controls & SC_ScrollBarAddPage) { if (controls & SC_ScrollBarAddPage) {
srect = querySubControlMetrics(control, widget, srect = querySubControlMetrics(control, ceData, elementFlags,
SC_ScrollBarAddPage, option); SC_ScrollBarAddPage, option, widget);
if (srect.isValid()) { if (srect.isValid()) {
if (horizontal) srect.addCoords(1, 0, 1, 0); if (horizontal) srect.addCoords(1, 0, 1, 0);
else srect.addCoords(0, 1, 0, 1); else srect.addCoords(0, 1, 0, 1);
tqdrawPrimitive(PE_ScrollBarAddPage, painter, srect, group, drawPrimitive(PE_ScrollBarAddPage, painter, ceData, elementFlags, srect, group,
scrollflags | ((active == SC_ScrollBarAddPage) scrollflags | ((active == SC_ScrollBarAddPage)
? Style_Down : Style_Default)); ? Style_Down : Style_Default));
} }
@ -1738,10 +1748,10 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
// subpage // subpage
if (controls & SC_ScrollBarSubPage) { if (controls & SC_ScrollBarSubPage) {
srect = querySubControlMetrics(control, widget, srect = querySubControlMetrics(control, ceData, elementFlags,
SC_ScrollBarSubPage, option); SC_ScrollBarSubPage, option, widget);
if (srect.isValid()) { if (srect.isValid()) {
tqdrawPrimitive(PE_ScrollBarSubPage, painter, srect, group, drawPrimitive(PE_ScrollBarSubPage, painter, ceData, elementFlags, srect, group,
scrollflags | ((active == SC_ScrollBarSubPage) scrollflags | ((active == SC_ScrollBarSubPage)
? Style_Down : Style_Default)); ? Style_Down : Style_Default));
} }
@ -1751,22 +1761,22 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
if (controls & SC_ScrollBarSlider) { if (controls & SC_ScrollBarSlider) {
if (sb->minValue() == sb->maxValue()) { if (sb->minValue() == sb->maxValue()) {
// maxed out // maxed out
srect = querySubControlMetrics(control, widget, srect = querySubControlMetrics(control, ceData, elementFlags,
SC_ScrollBarGroove, option); SC_ScrollBarGroove, option, widget);
} else { } else {
srect = querySubControlMetrics(control, widget, srect = querySubControlMetrics(control, ceData, elementFlags,
SC_ScrollBarSlider, option); SC_ScrollBarSlider, option, widget);
} }
if (srect.isValid()) { if (srect.isValid()) {
if (horizontal) srect.addCoords(0, 0, 1, 0); if (horizontal) srect.addCoords(0, 0, 1, 0);
else srect.addCoords(0, 0, 0, 1); else srect.addCoords(0, 0, 0, 1);
tqdrawPrimitive(PE_ScrollBarSlider, painter, srect, group, drawPrimitive(PE_ScrollBarSlider, painter, ceData, elementFlags, srect, group,
scrollflags | ((active == SC_ScrollBarSlider) scrollflags | ((active == SC_ScrollBarSlider)
? Style_Down : Style_Default)); ? Style_Down : Style_Default));
// focus // focus
if (sb->hasFocus()) { if (sb->hasFocus()) {
srect.addCoords(2, 2, -2, -2); srect.addCoords(2, 2, -2, -2);
tqdrawPrimitive(PE_FocusRect, painter, srect, group, drawPrimitive(PE_FocusRect, painter, ceData, elementFlags, srect, group,
Style_Default); Style_Default);
} }
} }
@ -1777,8 +1787,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
case CC_SpinWidget: { case CC_SpinWidget: {
const TQSpinWidget *spin = ::tqqt_cast<const TQSpinWidget*>(widget); const TQSpinWidget *spin = ::tqqt_cast<const TQSpinWidget*>(widget);
if (!spin) { if (!spin) {
KStyle::drawComplexControl(control, painter, widget, rect, group, KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group,
flags, controls, active, option); flags, controls, active, option, widget);
return; return;
} }
@ -1791,9 +1801,9 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
// draw button field // draw button field
if (controls & SC_SpinWidgetButtonField) { if (controls & SC_SpinWidgetButtonField) {
subrect = querySubControlMetrics(CC_SpinWidget, widget, subrect = querySubControlMetrics(CC_SpinWidget, ceData, elementFlags,
SC_SpinWidgetButtonField, SC_SpinWidgetButtonField,
option); option, widget);
if (reverse_) subrect.moveLeft(spin->upRect().left()); if (reverse_) subrect.moveLeft(spin->upRect().left());
drawPhaseBevel(painter, subrect.x(), subrect.y(), drawPhaseBevel(painter, subrect.x(), subrect.y(),
subrect.width(), subrect.height(), group, subrect.width(), subrect.height(), group,
@ -1812,7 +1822,7 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
else else
element = PE_SpinWidgetUp; element = PE_SpinWidgetUp;
tqdrawPrimitive(element, painter, subrect, group, flags drawPrimitive(element, painter, ceData, elementFlags, subrect, group, flags
| ((active == SC_SpinWidgetUp) | ((active == SC_SpinWidgetUp)
? Style_On | Style_Sunken : Style_Raised)); ? Style_On | Style_Sunken : Style_Raised));
} }
@ -1827,7 +1837,7 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
else else
element = PE_SpinWidgetDown; element = PE_SpinWidgetDown;
tqdrawPrimitive(element, painter, subrect, group, flags drawPrimitive(element, painter, ceData, elementFlags, subrect, group, flags
| ((active == SC_SpinWidgetDown) | ((active == SC_SpinWidgetDown)
? Style_On | Style_Sunken : Style_Raised)); ? Style_On | Style_Sunken : Style_Raised));
} }
@ -1837,8 +1847,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
case CC_ToolButton: { case CC_ToolButton: {
const TQToolButton *btn = ::tqqt_cast<const TQToolButton*>(widget); const TQToolButton *btn = ::tqqt_cast<const TQToolButton*>(widget);
if (!btn) { if (!btn) {
KStyle::drawComplexControl(control, painter, widget, rect, group, KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group,
flags, controls, active, option); flags, controls, active, option, widget);
return; return;
} }
@ -1915,8 +1925,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
} }
default: default:
KStyle::drawComplexControl(control, painter, widget, rect, group, KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group,
flags, controls, active, option); flags, controls, active, option, widget);
break; break;
} }
} }
@ -1928,9 +1938,11 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
void PhaseStyle::drawComplexControlMask(TQ_ComplexControl control, void PhaseStyle::drawComplexControlMask(TQ_ComplexControl control,
TQPainter *painter, TQPainter *painter,
const TQWidget *widget, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQStyleOption &option) const const TQStyleOption &option,
const TQWidget *widget) const
{ {
switch (control) { switch (control) {
case CC_ComboBox: case CC_ComboBox:
@ -1941,7 +1953,7 @@ void PhaseStyle::drawComplexControlMask(TQ_ComplexControl control,
} }
default: default:
KStyle::drawComplexControlMask(control,painter,widget,rect,option); KStyle::drawComplexControlMask(control,painter,ceData,elementFlags,rect,option,widget);
} }
} }
@ -1950,7 +1962,7 @@ void PhaseStyle::drawComplexControlMask(TQ_ComplexControl control,
// ------------- // -------------
// Get the pixel metric for metric // Get the pixel metric for metric
int PhaseStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) const int PhaseStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
// not using widget's font, so that all metrics are uniform // not using widget's font, so that all metrics are uniform
int em = TQMAX(TQApplication::fontMetrics().strikeOutPos() * 3, 17); int em = TQMAX(TQApplication::fontMetrics().strikeOutPos() * 3, 17);
@ -2000,7 +2012,7 @@ int PhaseStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) const
return em; return em;
default: default:
return KStyle::pixelMetric(metric, widget); return KStyle::pixelMetric(metric, ceData, elementFlags, widget);
} }
} }
@ -2009,18 +2021,18 @@ int PhaseStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) const
// --------- // ---------
// Return subrect for the widget in logical coordinates // Return subrect for the widget in logical coordinates
TQRect PhaseStyle::subRect(SubRect rect, const TQWidget *widget) const TQRect PhaseStyle::subRect(SubRect rect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
switch (rect) { switch (rect) {
case SR_ComboBoxFocusRect: { case SR_ComboBoxFocusRect: {
TQRect r = querySubControlMetrics(CC_ComboBox, widget, TQRect r = querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
SC_ComboBoxEditField); SC_ComboBoxEditField, TQStyleOption::Default, widget);
r.addCoords(1, 1,-1,-1); r.addCoords(1, 1,-1,-1);
return r; return r;
} }
default: default:
return KStyle::subRect(rect, widget); return KStyle::subRect(rect, ceData, elementFlags, widget);
} }
} }
@ -2030,13 +2042,15 @@ TQRect PhaseStyle::subRect(SubRect rect, const TQWidget *widget) const
// Get metrics for subcontrols of complex controls // Get metrics for subcontrols of complex controls
TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control, TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption &option) const const TQStyleOption &option,
const TQWidget *widget) const
{ {
TQRect rect; TQRect rect;
const int fw = pixelMetric(PM_DefaultFrameWidth, widget); const int fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget);
int w = widget->width(), h = widget->height(); int w = widget->width(), h = widget->height();
int xc; int xc;
@ -2073,8 +2087,8 @@ TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control,
if (!sb) break; if (!sb) break;
bool horizontal = (sb->orientation() == Qt::Horizontal); bool horizontal = (sb->orientation() == Qt::Horizontal);
rect = KStyle::querySubControlMetrics(control, widget, rect = KStyle::querySubControlMetrics(control, ceData, elementFlags,
subcontrol, option); subcontrol, option, widget);
// adjust the standard metrics so controls can "overlap" // adjust the standard metrics so controls can "overlap"
if (subcontrol == SC_ScrollBarGroove) { if (subcontrol == SC_ScrollBarGroove) {
@ -2116,22 +2130,24 @@ TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control,
} }
default: default:
rect = KStyle::querySubControlMetrics(control, widget, subcontrol, rect = KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol,
option); option, widget);
} }
return rect; return rect;
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// tqsizeFromContents() // sizeFromContents()
// ------------------ // ------------------
// Returns the size of widget based on the contentsize // Returns the size of widget based on the contentsize
TQSize PhaseStyle::tqsizeFromContents(ContentsType contents, TQSize PhaseStyle::sizeFromContents(ContentsType contents,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsize, const TQSize &contentsize,
const TQStyleOption &option ) const const TQStyleOption &option,
const TQWidget* widget ) const
{ {
int w = contentsize.width(); int w = contentsize.width();
int h = contentsize.height(); int h = contentsize.height();
@ -2140,11 +2156,11 @@ TQSize PhaseStyle::tqsizeFromContents(ContentsType contents,
case CT_PushButton: { case CT_PushButton: {
const TQPushButton* button = ::tqqt_cast<const TQPushButton*>(widget); const TQPushButton* button = ::tqqt_cast<const TQPushButton*>(widget);
if (!button) { if (!button) {
return KStyle::tqsizeFromContents(contents, widget, contentsize, return KStyle::sizeFromContents(contents, ceData, elementFlags, contentsize,
option); option, widget);
} }
int margin = pixelMetric(PM_ButtonMargin, widget) int margin = pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget)
+ pixelMetric(PM_DefaultFrameWidth, widget) + 4; + pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) + 4;
w += margin + 6; // add room for bold font w += margin + 6; // add room for bold font
h += margin; h += margin;
@ -2161,8 +2177,8 @@ TQSize PhaseStyle::tqsizeFromContents(ContentsType contents,
if (!widget || option.isDefault()) return contentsize; if (!widget || option.isDefault()) return contentsize;
const TQPopupMenu *popup = ::tqqt_cast<const TQPopupMenu*>(widget); const TQPopupMenu *popup = ::tqqt_cast<const TQPopupMenu*>(widget);
if (!popup) { if (!popup) {
return KStyle::tqsizeFromContents(contents, widget, contentsize, return KStyle::sizeFromContents(contents, ceData, elementFlags, contentsize,
option); option, widget);
} }
TQMenuItem *item = option.menuItem(); TQMenuItem *item = option.menuItem();
@ -2205,8 +2221,8 @@ TQSize PhaseStyle::tqsizeFromContents(ContentsType contents,
} }
default: default:
return KStyle::tqsizeFromContents(contents, widget, contentsize, return KStyle::sizeFromContents(contents, ceData, elementFlags, contentsize,
option); option, widget);
} }
} }

@ -67,8 +67,10 @@ public:
void polish(TQPalette &pal); void polish(TQPalette &pal);
void unPolish(TQWidget *widget); void unPolish(TQWidget *widget);
void tqdrawPrimitive(TQ_PrimitiveElement element, void drawPrimitive(TQ_PrimitiveElement element,
TQPainter *painter, TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQColorGroup &group, const TQColorGroup &group,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -76,56 +78,70 @@ public:
void drawKStylePrimitive(KStylePrimitive element, void drawKStylePrimitive(KStylePrimitive element,
TQPainter *painter, TQPainter *painter,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQColorGroup &group, const TQColorGroup &group,
SFlags flags = Style_Default, SFlags flags = Style_Default,
const TQStyleOption &option = TQStyleOption::Default) const; const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawControl(TQ_ControlElement element, void drawControl(TQ_ControlElement element,
TQPainter *painter, TQPainter *painter,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQColorGroup &group, const TQColorGroup &group,
SFlags flags = Style_Default, SFlags flags = Style_Default,
const TQStyleOption &option = TQStyleOption::Default) const; const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawControlMask(TQ_ControlElement element, void drawControlMask(TQ_ControlElement element,
TQPainter *painter, TQPainter *painter,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQStyleOption &option = TQStyleOption::Default) const; const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawComplexControl(TQ_ComplexControl control, void drawComplexControl(TQ_ComplexControl control,
TQPainter *painter, TQPainter *painter,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQColorGroup &group, const TQColorGroup &group,
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 &option = TQStyleOption::Default) const; const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawComplexControlMask(TQ_ComplexControl control, void drawComplexControlMask(TQ_ComplexControl control,
TQPainter *painter, TQPainter *painter,
const TQWidget *widget, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &rect, const TQRect &rect,
const TQStyleOption &option = TQStyleOption::Default) const; const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
int pixelMetric(PixelMetric metric, int pixelMetric(PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQWidget *widget = 0) const; const TQWidget *widget = 0) const;
TQRect subRect(SubRect rect, const TQWidget *widget) const; TQRect subRect(SubRect rect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, 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 &option = TQStyleOption::Default) const; const TQStyleOption &option = TQStyleOption::Default,
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& option = TQStyleOption::Default) const; const TQStyleOption& option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
private: private:
PhaseStyle(const PhaseStyle &); PhaseStyle(const PhaseStyle &);

Loading…
Cancel
Save