diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-08-05 01:04:09 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-08-05 01:04:09 -0500 |
commit | 7e44aacf1792efdc4e725f1bbaf3de4cda75d9b1 (patch) | |
tree | e148e5cfc3c48fbed20645d81d281b04372f50e5 /styles | |
parent | fd38e21445e6d62f1503fe3900f1bd1d1651cef5 (diff) | |
download | tdeartwork-7e44aacf1792efdc4e725f1bbaf3de4cda75d9b1.tar.gz tdeartwork-7e44aacf1792efdc4e725f1bbaf3de4cda75d9b1.zip |
Update to new style API
Diffstat (limited to 'styles')
-rw-r--r-- | styles/dotnet/dotnet.cpp | 167 | ||||
-rw-r--r-- | styles/dotnet/dotnet.h | 50 | ||||
-rw-r--r-- | styles/phase/phasestyle.cpp | 242 | ||||
-rw-r--r-- | styles/phase/phasestyle.h | 52 |
4 files changed, 286 insertions, 225 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() diff --git a/styles/dotnet/dotnet.h b/styles/dotnet/dotnet.h index a5760aac..90cac23e 100644 --- a/styles/dotnet/dotnet.h +++ b/styles/dotnet/dotnet.h @@ -49,14 +49,18 @@ public: void drawKStylePrimitive( KStylePrimitive kpe, TQPainter* p, - const TQWidget* widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; - void tqdrawPrimitive( TQ_PrimitiveElement pe, + void drawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, @@ -64,45 +68,55 @@ public: void drawControl( TQ_ControlElement element, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; - void drawControlMask( 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, TQPainter *p, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, SCFlags controls = SC_All, SCFlags active = SC_None, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; - int pixelMetric( PixelMetric m, + int pixelMetric( PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; - TQRect subRect( SubRect r, - const TQWidget *widget ) const; + TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, + const TQWidget *widget = 0 ) const; TQRect querySubControlMetrics( ComplexControl control, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption &opt = TQStyleOption::Default ) const; + const TQStyleOption &opt = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; void drawComplexControlMask(TQStyle::ComplexControl c, TQPainter *p, - const TQWidget *w, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &o=TQStyleOption::Default) const; + const TQStyleOption &o=TQStyleOption::Default, + const TQWidget *w = 0) const; - TQSize tqsizeFromContents(TQStyle::ContentsType t, - const TQWidget *w, + TQSize sizeFromContents(TQStyle::ContentsType t, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &s, - const TQStyleOption &o) const; + const TQStyleOption &o, + const TQWidget *w = 0) const; protected: void renderButton(TQPainter *p, diff --git a/styles/phase/phasestyle.cpp b/styles/phase/phasestyle.cpp index e2d66ecd..a36584ba 100644 --- a/styles/phase/phasestyle.cpp +++ b/styles/phase/phasestyle.cpp @@ -567,12 +567,14 @@ void PhaseStyle::drawPhaseTab(TQPainter *painter, } ////////////////////////////////////////////////////////////////////////////// -// tqdrawPrimitive() +// drawPrimitive() // --------------- // Draw the primitive element -void PhaseStyle::tqdrawPrimitive(TQ_PrimitiveElement element, +void PhaseStyle::drawPrimitive(TQ_PrimitiveElement element, TQPainter *painter, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &rect, const TQColorGroup &group, SFlags flags, @@ -663,9 +665,9 @@ void PhaseStyle::tqdrawPrimitive(TQ_PrimitiveElement element, case PE_HeaderArrow: if (flags & Style_Up) - tqdrawPrimitive(PE_ArrowUp, painter, rect, group, Style_Enabled); + drawPrimitive(PE_ArrowUp, painter, ceData, elementFlags, rect, group, Style_Enabled); else - tqdrawPrimitive(PE_ArrowDown, painter, rect, group, Style_Enabled); + drawPrimitive(PE_ArrowDown, painter, ceData, elementFlags, rect, group, Style_Enabled); break; 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; } @@ -999,7 +1001,7 @@ void PhaseStyle::tqdrawPrimitive(TQ_PrimitiveElement element, break; 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, TQPainter *painter, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &rect, const TQColorGroup &group, SFlags flags, - const TQStyleOption &option) const + const TQStyleOption &option, + const TQWidget *widget) const { bool horiz = flags & Style_Horizontal; int x, y, w, h, x2, y2, n, cx, cy; @@ -1121,8 +1125,8 @@ void PhaseStyle::drawKStylePrimitive(KStylePrimitive element, } default: - KStyle::drawKStylePrimitive(element, painter, widget, rect, - group, flags, option); + KStyle::drawKStylePrimitive(element, painter, ceData, elementFlags, rect, + group, flags, option, widget); } } @@ -1133,11 +1137,13 @@ void PhaseStyle::drawKStylePrimitive(KStylePrimitive element, void PhaseStyle::drawControl(TQ_ControlElement element, TQPainter *painter, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &rect, const TQColorGroup &group, SFlags flags, - const TQStyleOption &option) const + const TQStyleOption &option, + const TQWidget *widget) const { bool active, enabled, depress; int x, y, w, h, x2, y2, dx; @@ -1153,7 +1159,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element, switch (element) { case CE_PushButton: { 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) { drawPhasePanel(painter, x, y, w, h, group, true, @@ -1171,8 +1177,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element, } if (flags & Style_HasFocus) { // draw focus - tqdrawPrimitive(PE_FocusRect, painter, - subRect(SR_PushButtonFocusRect, widget), + drawPrimitive(PE_FocusRect, painter, ceData, elementFlags, + subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget), group, flags); } break; @@ -1181,8 +1187,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element, case CE_PushButtonLabel: { const TQPushButton* button = ::tqqt_cast<const TQPushButton*>(widget); if (!button) { - KStyle::drawControl(element, painter, widget, rect, group, - flags, option); + KStyle::drawControl(element, painter, ceData, elementFlags, rect, group, + flags, option, widget); return; } active = button->isOn() || button->isDown(); @@ -1193,8 +1199,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element, } if (button->isMenuButton()) { // menu indicator - int dx = pixelMetric(PM_MenuButtonIndicator, widget); - tqdrawPrimitive(PE_ArrowDown, painter, + int dx = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags, widget); + drawPrimitive(PE_ArrowDown, painter, ceData, elementFlags, TQRect(x+w-dx-2, y+2, dx, h-4), group, flags, option); w -= dx; @@ -1265,9 +1271,9 @@ void PhaseStyle::drawControl(TQ_ControlElement element, // only draw focus if content (forms on html won't) if ((flags & Style_HasFocus) && ((!b->text().isNull()) || b->pixmap())) { - tqdrawPrimitive(PE_FocusRect, painter, - visualRect(subRect(SR_RadioButtonFocusRect, - widget), widget), + drawPrimitive(PE_FocusRect, painter, ceData, elementFlags, + visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, + widget), ceData, elementFlags), group, flags); } break; @@ -1296,8 +1302,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element, case CE_MenuBarItem: { const TQMenuBar *mbar = ::tqqt_cast<const TQMenuBar*>(widget); if (!mbar) { - KStyle::drawControl(element, painter, widget, rect, group, - flags, option); + KStyle::drawControl(element, painter, ceData, elementFlags, rect, group, + flags, option, widget); return; } mi = option.menuItem(); @@ -1327,8 +1333,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element, case CE_PopupMenuItem: { const TQPopupMenu *popup = ::tqqt_cast<const TQPopupMenu*>(widget); if (!popup) { - KStyle::drawControl(element, painter, widget, rect, group, - flags, option); + KStyle::drawControl(element, painter, ceData, elementFlags, rect, group, + flags, option, widget); return; } @@ -1341,7 +1347,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element, int tabwidth = option.tabWidth(); int checkwidth = option.maxIconWidth(); bool checkable = popup->isCheckable(); - bool etchtext = styleHint(SH_EtchDisabledText); + bool etchtext = styleHint(SH_EtchDisabledText, ceData, elementFlags); active = flags & Style_Active; enabled = mi->isEnabled(); TQRect vrect; @@ -1388,7 +1394,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element, // draw check if (mi->isChecked()) { int cx = reverse_ ? x+w - checkwidth : x; - tqdrawPrimitive(PE_CheckMark, painter, + drawPrimitive(PE_CheckMark, painter, ceData, elementFlags, TQRect(cx + ITEMFRAME, y + ITEMFRAME, checkwidth - ITEMFRAME*2, h - ITEMFRAME*2), group, Style_Default | @@ -1479,7 +1485,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element, int dim = (h-2*ITEMFRAME) / 2; vrect = visualRect(TQRect(x + w - ARROWMARGIN - ITEMFRAME - dim, 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); } break; @@ -1495,8 +1501,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element, drawPhaseTab(painter, x, y, w, h, group, tab, option, flags); } else { // not a tabbar - KStyle::drawControl(element, painter, widget, rect, group, - flags, option); + KStyle::drawControl(element, painter, ceData, elementFlags, rect, group, + flags, option, widget); return; } break; @@ -1511,18 +1517,18 @@ void PhaseStyle::drawControl(TQ_ControlElement element, case CE_ProgressBarContents: { const TQProgressBar* pbar = ::tqqt_cast<const TQProgressBar*>(widget); if (!pbar) { - KStyle::drawControl(element, painter, widget, rect, group, - flags, option); + KStyle::drawControl(element, painter, ceData, elementFlags, rect, group, + flags, option, widget); 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->setPen(group.dark()); if (!pbar->totalSteps()) { // 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); if (progress > (w-bar)) progress = 2 * (w-bar) - progress; painter->drawRect(x+progress+1, y+1, bar-2, h-2); @@ -1540,8 +1546,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element, case CE_ToolBoxTab: { const TQToolBox *box = ::tqqt_cast<const TQToolBox*>(widget); if (!box) { - KStyle::drawControl(element, painter, widget, rect, group, - flags, option); + KStyle::drawControl(element, painter, ceData, elementFlags, rect, group, + flags, option, widget); return; } @@ -1575,8 +1581,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element, } default: - KStyle::drawControl(element, painter, widget, rect, group, - flags, option); + KStyle::drawControl(element, painter, ceData, elementFlags, rect, group, + flags, option, widget); } } @@ -1587,9 +1593,11 @@ void PhaseStyle::drawControl(TQ_ControlElement element, void PhaseStyle::drawControlMask(TQ_ControlElement element, TQPainter *painter, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &rect, - const TQStyleOption &option) const + const TQStyleOption &option, + const TQWidget *widget) const { switch (element) { case CE_PushButton: @@ -1598,7 +1606,7 @@ void PhaseStyle::drawControlMask(TQ_ControlElement element, break; 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, TQPainter *painter, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &rect, const TQColorGroup &group, SFlags flags, SCFlags controls, SCFlags active, - const TQStyleOption &option) const + const TQStyleOption &option, + const TQWidget *widget) const { bool down = flags & Style_Down; bool on = flags & Style_On; @@ -1629,8 +1639,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, case CC_ComboBox: { const TQComboBox * combo = ::tqqt_cast<const TQComboBox*>(widget); if (!combo) { - KStyle::drawComplexControl(control, painter, widget, rect, group, - flags, controls, active, option); + KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group, + flags, controls, active, option, widget); return; } @@ -1641,8 +1651,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, : group.button(), sunken); if (controls & SC_ComboBoxArrow) { // draw arrow box - subrect = visualRect(querySubControlMetrics(CC_ComboBox, widget, - SC_ComboBoxArrow), widget); + subrect = visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, + SC_ComboBoxArrow, TQStyleOption::Default, widget), ceData, elementFlags); subrect.rect(&x, &y, &w, &h); 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 (combo->editable()) { // editable box subrect = visualRect(querySubControlMetrics(CC_ComboBox, - widget, SC_ComboBoxEditField), widget); + ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget), ceData, elementFlags); x2 = subrect.right(); y2 = subrect.bottom(); painter->setPen(group.dark()); painter->drawLine(x2+1, y, x2+1, y2); @@ -1664,9 +1674,9 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, painter->setPen(group.button()); painter->drawPoint(x2+2, y2); } else if (combo->hasFocus()) { // non editable box - subrect = visualRect(subRect(SR_ComboBoxFocusRect, - combo), widget); - tqdrawPrimitive(PE_FocusRect, painter, subrect, group, + subrect = visualRect(subRect(SR_ComboBoxFocusRect, ceData, elementFlags, + combo), ceData, elementFlags); + drawPrimitive(PE_FocusRect, painter, ceData, elementFlags, subrect, group, Style_FocusAtBorder, TQStyleOption(group.highlight())); } @@ -1680,8 +1690,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, // always a three button scrollbar const TQScrollBar *sb = ::tqqt_cast<const TQScrollBar*>(widget); if (!sb) { - KStyle::drawComplexControl(control, painter, widget, rect, group, - flags, controls, active, option); + KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group, + flags, controls, active, option, widget); return; } @@ -1694,10 +1704,10 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, // addline if (controls & SC_ScrollBarAddLine) { - srect = querySubControlMetrics(control, widget, - SC_ScrollBarAddLine, option); + srect = querySubControlMetrics(control, ceData, elementFlags, + SC_ScrollBarAddLine, option, widget); if (srect.isValid()) - tqdrawPrimitive(PE_ScrollBarAddLine, painter, srect, group, + drawPrimitive(PE_ScrollBarAddLine, painter, ceData, elementFlags, srect, group, scrollflags | ((active == SC_ScrollBarAddLine) ? Style_Down : Style_Default)); } @@ -1705,19 +1715,19 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, // subline (two of them) if (controls & SC_ScrollBarSubLine) { // top/left subline - srect = querySubControlMetrics(control, widget, - SC_ScrollBarSubLine, option); + srect = querySubControlMetrics(control, ceData, elementFlags, + SC_ScrollBarSubLine, option, widget); if (srect.isValid()) - tqdrawPrimitive(PE_ScrollBarSubLine, painter, srect, group, + drawPrimitive(PE_ScrollBarSubLine, painter, ceData, elementFlags, srect, group, scrollflags | ((active == SC_ScrollBarSubLine) ? Style_Down : Style_Default)); // bottom/right subline - srect = querySubControlMetrics(control, widget, - SC_ScrollBarAddLine, option); + srect = querySubControlMetrics(control, ceData, elementFlags, + SC_ScrollBarAddLine, option, widget); if (srect.isValid()) { if (horizontal) srect.moveBy(-srect.width()+1, 0); 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) ? Style_Down : Style_Default)); } @@ -1725,12 +1735,12 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, // addpage if (controls & SC_ScrollBarAddPage) { - srect = querySubControlMetrics(control, widget, - SC_ScrollBarAddPage, option); + srect = querySubControlMetrics(control, ceData, elementFlags, + SC_ScrollBarAddPage, option, widget); if (srect.isValid()) { if (horizontal) srect.addCoords(1, 0, 1, 0); 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) ? Style_Down : Style_Default)); } @@ -1738,10 +1748,10 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, // subpage if (controls & SC_ScrollBarSubPage) { - srect = querySubControlMetrics(control, widget, - SC_ScrollBarSubPage, option); + srect = querySubControlMetrics(control, ceData, elementFlags, + SC_ScrollBarSubPage, option, widget); if (srect.isValid()) { - tqdrawPrimitive(PE_ScrollBarSubPage, painter, srect, group, + drawPrimitive(PE_ScrollBarSubPage, painter, ceData, elementFlags, srect, group, scrollflags | ((active == SC_ScrollBarSubPage) ? Style_Down : Style_Default)); } @@ -1751,22 +1761,22 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, if (controls & SC_ScrollBarSlider) { if (sb->minValue() == sb->maxValue()) { // maxed out - srect = querySubControlMetrics(control, widget, - SC_ScrollBarGroove, option); + srect = querySubControlMetrics(control, ceData, elementFlags, + SC_ScrollBarGroove, option, widget); } else { - srect = querySubControlMetrics(control, widget, - SC_ScrollBarSlider, option); + srect = querySubControlMetrics(control, ceData, elementFlags, + SC_ScrollBarSlider, option, widget); } if (srect.isValid()) { if (horizontal) srect.addCoords(0, 0, 1, 0); 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) ? Style_Down : Style_Default)); // focus if (sb->hasFocus()) { srect.addCoords(2, 2, -2, -2); - tqdrawPrimitive(PE_FocusRect, painter, srect, group, + drawPrimitive(PE_FocusRect, painter, ceData, elementFlags, srect, group, Style_Default); } } @@ -1777,8 +1787,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, case CC_SpinWidget: { const TQSpinWidget *spin = ::tqqt_cast<const TQSpinWidget*>(widget); if (!spin) { - KStyle::drawComplexControl(control, painter, widget, rect, group, - flags, controls, active, option); + KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group, + flags, controls, active, option, widget); return; } @@ -1791,9 +1801,9 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, // draw button field if (controls & SC_SpinWidgetButtonField) { - subrect = querySubControlMetrics(CC_SpinWidget, widget, + subrect = querySubControlMetrics(CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetButtonField, - option); + option, widget); if (reverse_) subrect.moveLeft(spin->upRect().left()); drawPhaseBevel(painter, subrect.x(), subrect.y(), subrect.width(), subrect.height(), group, @@ -1812,7 +1822,7 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, else element = PE_SpinWidgetUp; - tqdrawPrimitive(element, painter, subrect, group, flags + drawPrimitive(element, painter, ceData, elementFlags, subrect, group, flags | ((active == SC_SpinWidgetUp) ? Style_On | Style_Sunken : Style_Raised)); } @@ -1827,7 +1837,7 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, else element = PE_SpinWidgetDown; - tqdrawPrimitive(element, painter, subrect, group, flags + drawPrimitive(element, painter, ceData, elementFlags, subrect, group, flags | ((active == SC_SpinWidgetDown) ? Style_On | Style_Sunken : Style_Raised)); } @@ -1837,8 +1847,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, case CC_ToolButton: { const TQToolButton *btn = ::tqqt_cast<const TQToolButton*>(widget); if (!btn) { - KStyle::drawComplexControl(control, painter, widget, rect, group, - flags, controls, active, option); + KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group, + flags, controls, active, option, widget); return; } @@ -1915,8 +1925,8 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, } default: - KStyle::drawComplexControl(control, painter, widget, rect, group, - flags, controls, active, option); + KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group, + flags, controls, active, option, widget); break; } } @@ -1928,9 +1938,11 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, void PhaseStyle::drawComplexControlMask(TQ_ComplexControl control, TQPainter *painter, - const TQWidget *widget, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, const TQRect &rect, - const TQStyleOption &option) const + const TQStyleOption &option, + const TQWidget *widget) const { switch (control) { case CC_ComboBox: @@ -1941,7 +1953,7 @@ void PhaseStyle::drawComplexControlMask(TQ_ComplexControl control, } 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 -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 int em = TQMAX(TQApplication::fontMetrics().strikeOutPos() * 3, 17); @@ -2000,7 +2012,7 @@ int PhaseStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) const return em; 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 -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) { case SR_ComboBoxFocusRect: { - TQRect r = querySubControlMetrics(CC_ComboBox, widget, - SC_ComboBoxEditField); + TQRect r = querySubControlMetrics(CC_ComboBox, ceData, elementFlags, + SC_ComboBoxEditField, TQStyleOption::Default, widget); r.addCoords(1, 1,-1,-1); return r; } 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 TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption &option) const + const TQStyleOption &option, + const TQWidget *widget) const { 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 xc; @@ -2073,8 +2087,8 @@ TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control, if (!sb) break; bool horizontal = (sb->orientation() == Qt::Horizontal); - rect = KStyle::querySubControlMetrics(control, widget, - subcontrol, option); + rect = KStyle::querySubControlMetrics(control, ceData, elementFlags, + subcontrol, option, widget); // adjust the standard metrics so controls can "overlap" if (subcontrol == SC_ScrollBarGroove) { @@ -2116,22 +2130,24 @@ TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control, } default: - rect = KStyle::querySubControlMetrics(control, widget, subcontrol, - option); + rect = KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, + option, widget); } return rect; } ////////////////////////////////////////////////////////////////////////////// -// tqsizeFromContents() +// sizeFromContents() // ------------------ // Returns the size of widget based on the contentsize -TQSize PhaseStyle::tqsizeFromContents(ContentsType contents, - const TQWidget* widget, +TQSize PhaseStyle::sizeFromContents(ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentsize, - const TQStyleOption &option ) const + const TQStyleOption &option, + const TQWidget* widget ) const { int w = contentsize.width(); int h = contentsize.height(); @@ -2140,11 +2156,11 @@ TQSize PhaseStyle::tqsizeFromContents(ContentsType contents, case CT_PushButton: { const TQPushButton* button = ::tqqt_cast<const TQPushButton*>(widget); if (!button) { - return KStyle::tqsizeFromContents(contents, widget, contentsize, - option); + return KStyle::sizeFromContents(contents, ceData, elementFlags, contentsize, + option, widget); } - int margin = pixelMetric(PM_ButtonMargin, widget) - + pixelMetric(PM_DefaultFrameWidth, widget) + 4; + int margin = pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget) + + pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) + 4; w += margin + 6; // add room for bold font h += margin; @@ -2161,8 +2177,8 @@ TQSize PhaseStyle::tqsizeFromContents(ContentsType contents, if (!widget || option.isDefault()) return contentsize; const TQPopupMenu *popup = ::tqqt_cast<const TQPopupMenu*>(widget); if (!popup) { - return KStyle::tqsizeFromContents(contents, widget, contentsize, - option); + return KStyle::sizeFromContents(contents, ceData, elementFlags, contentsize, + option, widget); } TQMenuItem *item = option.menuItem(); @@ -2205,8 +2221,8 @@ TQSize PhaseStyle::tqsizeFromContents(ContentsType contents, } default: - return KStyle::tqsizeFromContents(contents, widget, contentsize, - option); + return KStyle::sizeFromContents(contents, ceData, elementFlags, contentsize, + option, widget); } } diff --git a/styles/phase/phasestyle.h b/styles/phase/phasestyle.h index 631653af..b2263822 100644 --- a/styles/phase/phasestyle.h +++ b/styles/phase/phasestyle.h @@ -67,8 +67,10 @@ public: void polish(TQPalette &pal); void unPolish(TQWidget *widget); - void tqdrawPrimitive(TQ_PrimitiveElement element, + void drawPrimitive(TQ_PrimitiveElement element, TQPainter *painter, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &rect, const TQColorGroup &group, SFlags flags = Style_Default, @@ -76,56 +78,70 @@ public: void drawKStylePrimitive(KStylePrimitive element, TQPainter *painter, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &rect, const TQColorGroup &group, 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, TQPainter *painter, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &rect, const TQColorGroup &group, 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, TQPainter *painter, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &rect, - const TQStyleOption &option = TQStyleOption::Default) const; + const TQStyleOption &option = TQStyleOption::Default, + const TQWidget *widget = 0) const; void drawComplexControl(TQ_ComplexControl control, TQPainter *painter, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQRect &rect, const TQColorGroup &group, SFlags flags = Style_Default, SCFlags controls = SC_All, 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, TQPainter *painter, - const TQWidget *widget, + const TQStyleControlElementData ceData, + const ControlElementFlags elementFlags, 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; - 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, - const TQWidget *widget, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption &option = TQStyleOption::Default) const; + const TQStyleOption &option = TQStyleOption::Default, + const TQWidget *widget = 0) const; - TQSize tqsizeFromContents(ContentsType contents, - const TQWidget *widget, + TQSize sizeFromContents(ContentsType contents, + TQStyleControlElementData ceData, + ControlElementFlags elementFlags, const TQSize &contentsize, - const TQStyleOption& option = TQStyleOption::Default) const; + const TQStyleOption& option = TQStyleOption::Default, + const TQWidget *widget = 0) const; private: PhaseStyle(const PhaseStyle &); |