diff options
Diffstat (limited to 'styles/dotnet/dotnet.cpp')
-rw-r--r-- | styles/dotnet/dotnet.cpp | 167 |
1 files changed, 91 insertions, 76 deletions
diff --git a/styles/dotnet/dotnet.cpp b/styles/dotnet/dotnet.cpp index 9c42ccb4..52651849 100644 --- a/styles/dotnet/dotnet.cpp +++ b/styles/dotnet/dotnet.cpp @@ -119,12 +119,12 @@ void dotNETstyle::polish(TQWidget* widget) // we can't simply set a palette -- upon color-theme changes, we have // to update the palette again. - bool extraPalette = false; +// bool extraPalette = false; if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) && !inheritsKHTML(widget)) { widget->installEventFilter (this); updatePalette( (TQComboBox*) widget ); - extraPalette = true; +// extraPalette = true; } else { winstyle->polish(widget); } @@ -370,11 +370,13 @@ void dotNETstyle::renderPanel(TQPainter *p, void dotNETstyle::drawKStylePrimitive(KStylePrimitive kpe, TQPainter *p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, - const TQStyleOption& opt) const + const TQStyleOption& opt, + const TQWidget* widget) const { // SLIDER // ------ @@ -410,14 +412,16 @@ void dotNETstyle::drawKStylePrimitive(KStylePrimitive kpe, } 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. -void dotNETstyle::tqdrawPrimitive(TQ_PrimitiveElement pe, +void dotNETstyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, @@ -493,16 +497,16 @@ void dotNETstyle::tqdrawPrimitive(TQ_PrimitiveElement pe, // SCROLLBAR BUTTONS // ----------------- 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()); - tqdrawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, r, cg, flags); + drawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, ceData, elementFlags, r, cg, flags); break; } 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()); - tqdrawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, r, cg, flags); + drawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, ceData, elementFlags, r, cg, flags); break; } @@ -719,8 +723,8 @@ void dotNETstyle::tqdrawPrimitive(TQ_PrimitiveElement pe, p->save(); if (flags & Style_Down) { - p->translate(pixelMetric(PM_ButtonShiftHorizontal), - pixelMetric(PM_ButtonShiftVertical)); + p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags)); } if (flags & Style_Enabled) { @@ -751,7 +755,7 @@ void dotNETstyle::tqdrawPrimitive(TQ_PrimitiveElement pe, } 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, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, - const TQStyleOption& opt) const + const TQStyleOption& opt, + const TQWidget *widget) const { switch (element) { // CHECKBOXES // ---------- 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) { p->setPen(cg.foreground()); - tqdrawPrimitive(PE_CheckMark, p, r, cg, flags); + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, flags); } break; } @@ -840,7 +846,7 @@ void dotNETstyle::drawControl(TQ_ControlElement element, // RADIOBUTTONS // ------------ 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) { 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: - winstyle->drawControl(element, p, widget, r, cg, flags, opt); + winstyle->drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); } break; @@ -1039,14 +1045,14 @@ void dotNETstyle::drawControl(TQ_ControlElement element, p->setPen(flags & Style_Enabled ? TQColor(cg.foreground()) : TQColor(cg.mid().dark())); if (!flags & Style_Selected) { - p->translate(pixelMetric(PM_ButtonShiftHorizontal), - pixelMetric(PM_ButtonShiftVertical)); + p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags)); } p->drawText(r, text_flags, opt.tab()->text()); if (flags & Style_HasFocus) - tqdrawPrimitive(PE_FocusRect, p, r, cg); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, r, cg); p->restore(); break; @@ -1057,14 +1063,14 @@ void dotNETstyle::drawControl(TQ_ControlElement element, TQRect br = r; bool btnDefault = button->isDefault(); - static int di = pixelMetric(PM_ButtonDefaultIndicator); + static int di = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags); br.addCoords(di, di, -di, -di); 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; } @@ -1076,8 +1082,8 @@ void dotNETstyle::drawControl(TQ_ControlElement element, TQRect ur(r); if (flags & Style_Down) { - p->translate(pixelMetric(PM_ButtonShiftHorizontal), - pixelMetric(PM_ButtonShiftVertical)); + p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags)); } if (!pb->text().isEmpty() && (flags & Style_ButtonDefault)) { @@ -1125,8 +1131,8 @@ void dotNETstyle::drawControl(TQ_ControlElement element, } if ( flags & Style_HasFocus ) - tqdrawPrimitive( PE_FocusRect, p, - visualRect( subRect( SR_PushButtonFocusRect, widget ), widget ), + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, + visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ), cg, flags ); break; @@ -1335,7 +1341,7 @@ void dotNETstyle::drawControl(TQ_ControlElement element, } if (mi->popup()) { - int dim = pixelMetric(PM_MenuButtonIndicator); + int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags); 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); if (TQApplication::reverseLayout()) 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) { @@ -1366,7 +1372,7 @@ void dotNETstyle::drawControl(TQ_ControlElement element, if (TQApplication::reverseLayout()) 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()); break; 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, TQPainter *p, - const TQWidget *w, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &opt) const + const TQStyleOption &opt, + const TQWidget *w) const { switch (element) { case CE_PushButton: { @@ -1407,16 +1415,18 @@ void dotNETstyle::drawControlMask(TQ_ControlElement element, } default: { - KStyle::drawControlMask (element, p, w, r, opt); + KStyle::drawControlMask (element, p, ceData, elementFlags, r, opt, w); } } } void dotNETstyle::drawComplexControlMask(ComplexControl c, TQPainter *p, - const TQWidget *w, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &o) const + const TQStyleOption &o, + const TQWidget *w) const { switch (c) { case CC_ComboBox: { @@ -1434,20 +1444,22 @@ void dotNETstyle::drawComplexControlMask(ComplexControl c, break; } default: { - KStyle::drawComplexControlMask (c, p, w, r, o); + KStyle::drawComplexControlMask (c, p, ceData, elementFlags, r, o, w); } } } void dotNETstyle::drawComplexControl(ComplexControl control, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, SCFlags controls, SCFlags active, - const TQStyleOption& opt) const + const TQStyleOption& opt, + const TQWidget *widget) const { switch(control) { // COMBOBOX @@ -1559,8 +1571,8 @@ void dotNETstyle::drawComplexControl(ComplexControl control, const TQToolButton *tb = (const TQToolButton *) widget; TQRect button, menuarea; - button = querySubControlMetrics(control, widget, SC_ToolButton, opt); - menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); + button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget); + menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget); SFlags bflags = flags, mflags = flags; @@ -1574,7 +1586,7 @@ void dotNETstyle::drawComplexControl(ComplexControl control, if (controls & SC_ToolButton) { // If we're pressed, on, or 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() && tb->parentWidget()->backgroundPixmap() && !tb->parentWidget()->backgroundPixmap()->isNull()) { @@ -1586,15 +1598,15 @@ void dotNETstyle::drawComplexControl(ComplexControl control, // Draw a toolbutton menu indicator if required if (controls & SC_ToolButtonMenu) { 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()) { TQRect fr = tb->rect(); fr.addCoords(2, 2, -2, -2); - tqdrawPrimitive(PE_FocusRect, p, fr, cg); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg); } break; @@ -1607,8 +1619,8 @@ void dotNETstyle::drawComplexControl(ComplexControl control, SFlags flags; TQ_PrimitiveElement pe; - TQRect swf = querySubControlMetrics(control, sw, SC_SpinWidgetFrame); - swf = visualRect( swf, sw ); + TQRect swf = querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetFrame, TQStyleOption::Default, sw); + swf = visualRect( swf, ceData, elementFlags ); if (controls & SC_SpinWidgetFrame) { // Don't draw the WindowsStyle thick frame. @@ -1644,7 +1656,7 @@ void dotNETstyle::drawComplexControl(ComplexControl control, } re.setX(re.x() + 1); 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) { @@ -1683,32 +1695,32 @@ void dotNETstyle::drawComplexControl(ComplexControl control, } p->setPen(flags & Style_Raised ? dcg.foreground() : dcg.highlightedText()); re.setX(re.x() + 1); - tqdrawPrimitive(pe, p, re, dcg, flags); + drawPrimitive(pe, p, ceData, elementFlags, re, dcg, flags); } break; } default: - KStyle::drawComplexControl(control, p, widget, + KStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, controls, - active, opt); + active, opt, widget); 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 switch (r) { case SR_ComboBoxFocusRect: { - return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ); + return querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget ); } case SR_PushButtonFocusRect: { 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); return rect; @@ -1717,18 +1729,20 @@ TQRect dotNETstyle::subRect(SubRect r, const TQWidget *widget) const case SR_ProgressBarGroove: case SR_ProgressBarContents: case SR_ProgressBarLabel: { - return winstyle->subRect(r, widget); + return winstyle->subRect(r, ceData, elementFlags, widget); } default: { - return KStyle::subRect(r, widget); + return KStyle::subRect(r, ceData, elementFlags, widget); } } } TQRect dotNETstyle::querySubControlMetrics(ComplexControl control, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption &opt) const + const TQStyleOption &opt, + const TQWidget *widget) const { if (!widget) { 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); } default: { - return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); + return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); } } break; } case CC_SpinWidget: { - int fw = pixelMetric(PM_SpinBoxFrameWidth, widget); + int fw = pixelMetric(PM_SpinBoxFrameWidth, ceData, elementFlags, widget); TQSize bs; bs.setHeight(TQMAX(8, widget->height()/2)); bs.setWidth(TQMIN(bs.height() * 8 / 5, widget->width() / 4)); int y = fw; - int x, lx, rx; + int x, lx; x = widget->width() - y - bs.width(); lx = fw; - rx = x - fw; switch (subcontrol) { case SC_SpinWidgetUp: { @@ -1784,10 +1797,10 @@ TQRect dotNETstyle::querySubControlMetrics(ComplexControl control, 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) { // TABS @@ -1878,15 +1891,17 @@ int dotNETstyle::pixelMetric(PixelMetric m, const TQWidget *widget) const } default: - return KStyle::pixelMetric(m, widget); + return KStyle::pixelMetric(m, ceData, elementFlags, widget); } } -TQSize dotNETstyle::tqsizeFromContents(ContentsType t, - const TQWidget *widget, +TQSize dotNETstyle::sizeFromContents(ContentsType t, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &s, - const TQStyleOption &opt) const + const TQStyleOption &opt, + const TQWidget *widget) const { switch (t) { @@ -1945,8 +1960,8 @@ TQSize dotNETstyle::tqsizeFromContents(ContentsType t, const TQPushButton* button = (const TQPushButton*) widget; int w = s.width(); int h = s.height(); - int bm = pixelMetric( PM_ButtonMargin, widget ); - int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2; + int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ); + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2; //We use bold font sometimes, so that make take more space than TQt allocated. TQFontMetrics origFM = button->fontMetrics(); @@ -1968,7 +1983,7 @@ TQSize dotNETstyle::tqsizeFromContents(ContentsType t, // Compensate for default indicator. Doing it for all widgets lets us // 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; h += di * 2; @@ -1983,11 +1998,11 @@ TQSize dotNETstyle::tqsizeFromContents(ContentsType t, } 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 winstyle->tqsizeFromContents(t, widget, s, opt); + return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget); +// return winstyle->sizeFromContents(t, ceData, elementFlags, s, opt, widget); } void dotNETstyle::paletteChanged() |