diff options
Diffstat (limited to 'styles/phase/phasestyle.cpp')
-rw-r--r-- | styles/phase/phasestyle.cpp | 93 |
1 files changed, 41 insertions, 52 deletions
diff --git a/styles/phase/phasestyle.cpp b/styles/phase/phasestyle.cpp index 067fe804..4a113795 100644 --- a/styles/phase/phasestyle.cpp +++ b/styles/phase/phasestyle.cpp @@ -638,8 +638,8 @@ void PhaseStyle::drawPrimitive(TQ_PrimitiveElement element, horiz = true; } - if ((widget) && ((widget->inherits(TQPOPUPMENU_OBJECT_NAME_STRING)) || - (widget->inherits("KPopupTitle")))) { + if ((ceData.widgetObjectTypes.contains(TQPOPUPMENU_OBJECT_NAME_STRING)) || + (ceData.widgetObjectTypes.contains("KPopupTitle"))) { // kicker/kdesktop menu titles drawPhaseBevel(painter, x,y,w,h, group, group.background(), depress, !horiz); @@ -894,12 +894,11 @@ void PhaseStyle::drawPrimitive(TQ_PrimitiveElement element, widget = dynamic_cast<TQWidget*>(painter->device()); bool flat = true; - if (widget && widget->parent() && - widget->parent()->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) { + if (ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING)) { TQToolBar *toolbar = ::tqqt_cast<TQToolBar*>(widget->parent()); if (toolbar) { // toolbar not floating or in a TQMainWindow - flat = flatToolbar(toolbar); + flat = flatToolbar(ceData, elementFlags, toolbar); } } @@ -1113,15 +1112,12 @@ void PhaseStyle::drawKStylePrimitive(KStylePrimitive element, break; case KPE_SliderGroove: { - const TQSlider* slider = ::tqqt_cast<const TQSlider*>(widget); - if (slider) { - if (slider->orientation() ==Qt::Horizontal) { - y = cy - 3; - h = 7; - } else { - x = cx - 3; - w = 7; - } + if (ceData.orientation == TQt::Horizontal) { + y = cy - 3; + h = 7; + } else { + x = cx - 3; + w = 7; } drawPhasePanel(painter, x, y, w, h, group, true, &group.brush(TQColorGroup::Mid)); @@ -1129,22 +1125,19 @@ void PhaseStyle::drawKStylePrimitive(KStylePrimitive element, } case KPE_SliderHandle: { - const TQSlider* slider = ::tqqt_cast<const TQSlider*>(widget); - if (slider) { - TQColor color = (flags & Style_MouseOver) - ? TQColor(group.button().light(contrast)) - : group.button(); - if (slider->orientation() ==Qt::Horizontal) { - drawPhaseBevel(painter, cx-5, y, 6, h, group, color, - false, false, false); - drawPhaseBevel(painter, cx, y, 6, h, group, color, - false, false, false); - } else { - drawPhaseBevel(painter, x, cy-5, w, 6, group, color, - false, true, false); - drawPhaseBevel(painter, x, cy, w, 6, group, color, - false, true, false); - } + TQColor color = (flags & Style_MouseOver) + ? TQColor(group.button().light(contrast)) + : group.button(); + if (ceData.orientation == TQt::Horizontal) { + drawPhaseBevel(painter, cx-5, y, 6, h, group, color, + false, false, false); + drawPhaseBevel(painter, cx, y, 6, h, group, color, + false, false, false); + } else { + drawPhaseBevel(painter, x, cy-5, w, 6, group, color, + false, true, false); + drawPhaseBevel(painter, x, cy, w, 6, group, color, + false, true, false); } break; } @@ -1308,7 +1301,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element, const TQToolBar *tb = ::tqqt_cast<const TQToolBar*>(widget); if (tb) { // toolbar not floating or in a TQMainWindow - if (flatToolbar(tb)) { + if (flatToolbar(ceData, elementFlags, tb)) { if (tb->backgroundMode() == PaletteButton) // force default button color to background color painter->fillRect(rect, group.background()); @@ -1381,9 +1374,8 @@ void PhaseStyle::drawControl(TQ_ControlElement element, // draw background if (active && enabled) { painter->fillRect(x, y, w, h, group.highlight()); - } else if (widget->erasePixmap() && - !widget->erasePixmap()->isNull()) { - painter->drawPixmap(x, y, *widget->erasePixmap(), x, y, w, h); + } else if (!ceData.bgPixmap.isNull()) { + painter->drawPixmap(x, y, ceData.bgPixmap, x, y, w, h); } else { painter->fillRect(x, y, w, h, group.background()); } @@ -1879,7 +1871,7 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control, if (toolbar) { horiz = (toolbar->orientation() == Qt::Horizontal); if (normal) { // draw background - if (flatToolbar(toolbar)) { + if (flatToolbar(ceData, elementFlags, toolbar)) { // toolbar not floating or in a TQMainWindow painter->fillRect(rect, group.background()); } else { @@ -2071,7 +2063,7 @@ TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control, TQRect rect; const int fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget); - int w = widget->width(), h = widget->height(); + int w = ceData.rect.width(), h = ceData.rect.height(); int xc; switch (control) { @@ -2081,7 +2073,7 @@ TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control, switch (subcontrol) { case SC_ComboBoxFrame: // total combobox area - rect = widget->rect(); + rect = ceData.rect; break; case SC_ComboBoxArrow: // the right side @@ -2103,10 +2095,7 @@ TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control, } case CC_ScrollBar: { - const TQScrollBar *sb = ::tqqt_cast<const TQScrollBar*>(widget); - if (!sb) break; - - bool horizontal = (sb->orientation() == Qt::Horizontal); + bool horizontal = (ceData.orientation == TQt::Horizontal); rect = KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, option, widget); @@ -2119,7 +2108,7 @@ TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control, } case CC_SpinWidget: { - bool odd = widget->height() % 2; + bool odd = ceData.rect.height() % 2; xc = (h * 3 / 4) + odd; // position between edit and arrows switch (subcontrol) { @@ -2132,7 +2121,7 @@ TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control, break; case SC_SpinWidgetFrame: - rect = widget->rect(); + rect = ceData.rect; break; case SC_SpinWidgetUp: @@ -2254,7 +2243,7 @@ TQSize PhaseStyle::sizeFromContents(ContentsType contents, // ------------- // Is the toolbar "flat" -bool PhaseStyle::flatToolbar(const TQToolBar *toolbar) const +bool PhaseStyle::flatToolbar(const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQToolBar *toolbar) const { if (!toolbar) return true; // not on a toolbar if (!toolbar->isMovingEnabled()) return true; // immobile toolbars are flat @@ -2280,7 +2269,7 @@ int PhaseStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, Contro } break; default: - ret = TQCommonStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w); + ret = KStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w); break; } @@ -2316,7 +2305,7 @@ bool PhaseStyle::objectEventHandler( TQStyleControlElementData ceData, ControlEl if (object->parent() && !qstrcmp(object->name(), KTOOLBARWIDGET)) { if (0 == (widget = ::tqqt_cast<TQWidget*>(object))) return false; TQWidget *parent = ::tqqt_cast<TQWidget*>(object->parent()); - int px = widget->x(), py = widget->y(); + int px = ceData.rect.x(), py = ceData.rect.y(); // find the toolbar while (parent && parent->parent() && !::tqqt_cast<TQToolBar*>(parent)) { @@ -2325,18 +2314,18 @@ bool PhaseStyle::objectEventHandler( TQStyleControlElementData ceData, ControlEl parent = ::tqqt_cast<TQWidget*>(parent->parent()); } if (!parent) return false; - TQT_TQRECT_OBJECT(widget->rect()).rect(&x, &y, &w, &h); + TQT_TQRECT_OBJECT(ceData.rect).rect(&x, &y, &w, &h); TQRect prect = parent->rect(); toolbar = ::tqqt_cast<TQToolBar*>(parent); horiz = (toolbar) ? (toolbar->orientation() == Qt::Horizontal) : (prect.height() < prect.width()); TQPainter painter(widget); - if (flatToolbar(toolbar)) { - painter.fillRect(widget->rect(), + if (flatToolbar(ceData, elementFlags, toolbar)) { + painter.fillRect(ceData.rect, parent->colorGroup().background()); } else { - drawPhaseGradient(&painter, widget->rect(), + drawPhaseGradient(&painter, ceData.rect, parent->colorGroup().background(), !horiz, px, py, prect.width(), prect.height(), true); @@ -2356,9 +2345,9 @@ bool PhaseStyle::objectEventHandler( TQStyleControlElementData ceData, ControlEl if (0 == (widget = ::tqqt_cast<TQWidget*>(object))) return false; horiz = (toolbar->orientation() == Qt::Horizontal); TQPainter painter(widget); - TQT_TQRECT_OBJECT(widget->rect()).rect(&x, &y, &w, &h); + TQT_TQRECT_OBJECT(ceData.rect).rect(&x, &y, &w, &h); // draw the extension - drawPhaseGradient(&painter, widget->rect(), + drawPhaseGradient(&painter, ceData.rect, toolbar->colorGroup().background(), !horiz, x, y, w-1, h-1, true); if (horiz) { |