diff options
Diffstat (limited to 'styles/phase')
-rw-r--r-- | styles/phase/phasestyle.cpp | 242 | ||||
-rw-r--r-- | styles/phase/phasestyle.h | 52 |
2 files changed, 163 insertions, 131 deletions
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 &); |