diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2016-04-08 03:07:37 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2016-04-08 03:07:37 +0200 |
commit | c678579b70f19d2cec2537f56d927e698a688aef (patch) | |
tree | 3678b04eba6975d301cccfb6df6f49d5fe5d9d12 | |
parent | 8f61d29f9c7b9387d5bfe5d269273650d9089b96 (diff) | |
download | tde-style-domino-c678579b70f19d2cec2537f56d927e698a688aef.tar.gz tde-style-domino-c678579b70f19d2cec2537f56d927e698a688aef.zip |
Update to new style API
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r-- | domino/domino.cpp | 359 | ||||
-rw-r--r-- | domino/domino.h | 70 | ||||
-rw-r--r-- | domino/eventfilter.cpp | 43 | ||||
-rw-r--r-- | dominoConfig/dominoconf.cpp | 16 |
4 files changed, 289 insertions, 199 deletions
diff --git a/domino/domino.cpp b/domino/domino.cpp index aa9d7d3..998ba54 100644 --- a/domino/domino.cpp +++ b/domino/domino.cpp @@ -658,8 +658,12 @@ DominoStyle::~DominoStyle() delete buttonContour; } -void DominoStyle::polish(TQApplication* app) +void DominoStyle::applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { + if (!ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) { + return; + } + TQApplication *app = reinterpret_cast<TQApplication*>(ptr); if(!qstrcmp(app->name(), "konsole")) konsoleMode = true; else if(!qstrcmp(app->name(), "konqueror")) @@ -692,9 +696,13 @@ void DominoStyle::polish(TQPalette &p) { } } -void DominoStyle::polish(TQWidget* widget) +void DominoStyle::polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { - + if (!ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { + return; + } + TQWidget *widget = reinterpret_cast<TQWidget*>(ptr); + if(!strcmp(widget->name(), "__tdehtml")) { // is it a tdehtml widget...? tdehtmlWidgets[widget] = true; connect(widget, SIGNAL(destroyed(TQObject*)), this, SLOT(tdehtmlWidgetDestroyed(TQObject*))); @@ -721,11 +729,11 @@ void DominoStyle::polish(TQWidget* widget) } } - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQCheckBox*>(widget)) { ((DominoTQWidget*)widget)->setWFlags(TQt::WNoAutoErase); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TDEToolBarButton*>(widget)) { TDEToolBarButton* tb = static_cast<TDEToolBarButton*>(widget); @@ -733,7 +741,7 @@ void DominoStyle::polish(TQWidget* widget) if(tb->popupDelay() < 1) tb->setPopupDelay(5); // now we have time to draw a pressed button - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQToolButton*>(widget)) { TQToolButton* tb = static_cast<TQToolButton*>(widget); @@ -758,12 +766,12 @@ void DominoStyle::polish(TQWidget* widget) // if(widget->isA("TaskContainer")) // ((DominoTQWidget*)widget)->setWFlags(TQt::WNoAutoErase); // else - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); ((DominoTQWidget*)widget)->setWFlags(TQt::WNoAutoErase); } else if(dynamic_cast<TQRadioButton*>(widget)) { ((DominoTQWidget*)widget)->setWFlags(TQt::WNoAutoErase); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQComboBox*>(widget)) { TQComboBox* cb = static_cast<TQComboBox*>(widget); @@ -777,7 +785,7 @@ void DominoStyle::polish(TQWidget* widget) setDominoButtonPalette(widget, Palette_Widget); if(cb->listBox()) cb->listBox()->setFrameStyle(TQFrame::Panel|TQFrame::Sunken); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQGroupBox*>(widget)) { TQGroupBox* gb = dynamic_cast<TQGroupBox*>(widget); @@ -807,7 +815,7 @@ void DominoStyle::polish(TQWidget* widget) } connect(widget, SIGNAL(destroyed(TQObject*)), this, SLOT(groupBoxDestroyed(TQObject*))); } - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQSpinWidget*>(widget)) { // Don't like this widget... too much private stuff and the spinBox/spinWidget mess. @@ -823,7 +831,7 @@ void DominoStyle::polish(TQWidget* widget) } ((DominoTQWidget*)widget)->setWFlags(TQt::WNoAutoErase); setDominoButtonPalette(widget, Palette_Widget); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQSpinBox*>(widget)) { connect(dynamic_cast<TQSpinBox*>(widget), SIGNAL(valueChanged(int)), this, SLOT(spinBoxValueChanged(int))); @@ -832,17 +840,17 @@ void DominoStyle::polish(TQWidget* widget) TQLineEdit* le = dynamic_cast<TQLineEdit*>(widget); TQRect r = le->rect(); le->setFrameRect(TQRect(r.x()+1, r.y(), r.width()-1, r.height())); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQScrollBar*>(widget)) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQStatusBar*>(widget)) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQHeader*>(widget)) { setDominoButtonPalette(widget, Palette_Widget); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQPopupMenu*>(widget)) { @@ -850,10 +858,10 @@ void DominoStyle::polish(TQWidget* widget) widget->setPaletteForegroundColor(alphaBlendColors(_popupMenuColor, tqApp->palette().active().foreground(), 150)); widget->setBackgroundMode( NoBackground ); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQTabWidget*>(widget)) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQTabBar*>(widget)) { TQTabBar* tb = dynamic_cast<TQTabBar*>(widget); @@ -864,17 +872,17 @@ void DominoStyle::polish(TQWidget* widget) connect(tb, SIGNAL(layoutChanged()), this, SLOT(updateTabWidgetFrame())); connect(tb, SIGNAL(selected(int)), this, SLOT(updateTabWidgetFrame())); setDominoButtonPalette(widget, Palette_Widget); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQIconView*>(widget)) { ((DominoTQWidget*)dynamic_cast<TQIconView*>(widget)->viewport())->setWFlags(TQt::WNoAutoErase); ((DominoTQWidget*)widget)->setWFlags(TQt::WNoAutoErase); - dynamic_cast<TQIconView*>(widget)->viewport()->installEventFilter(this); // rubberband + installObjectEventHandler(ceData, elementFlags, dynamic_cast<TQIconView*>(widget)->viewport(), this); // rubberband if(strcmp(widget->className(), "KDIconView")) - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQListView*>(widget)) { - dynamic_cast<TQListView*>(widget)->viewport()->installEventFilter(this); // rubberband + installObjectEventHandler(ceData, elementFlags, dynamic_cast<TQListView*>(widget)->viewport(), this); // rubberband if(widget->isA("KonqTreeViewWidget")) { // konqi frames TQFrame* f = dynamic_cast<TQFrame*>(widget); f->setFrameStyle(TQFrame::Box|TQFrame::Plain); @@ -882,51 +890,51 @@ void DominoStyle::polish(TQWidget* widget) } if(!widget->isA("KopeteContactListView") && !widget->isA("ViewTree")) // they have their own mousewheel handling - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(widget->isA("KActiveLabel")) { // before TQScrollView if(dynamic_cast<TQGroupBox*>(widget->parentWidget())) widget->setPaletteBackgroundColor(widget->parentWidget()->paletteBackgroundColor()); } else if(dynamic_cast<TQTextEdit*>(widget)) { - dynamic_cast<TQTextEdit*>(widget)->viewport()->installEventFilter(this); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, dynamic_cast<TQTextEdit*>(widget)->viewport(), this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQScrollView*>(widget)) { TQFrame* f = dynamic_cast<TQFrame*>(widget); if((konquerorMode && widget->isA("TDEHTMLView")) || f->parentWidget() && !strcmp(f->parentWidget()->name(), "KonqFrame")) { // konqi frames f->setFrameStyle(TQFrame::Box|TQFrame::Plain); f->setLineWidth(1); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(_smoothScrolling && !widget->isA("TaskBar") && !widget->isA("Gwenview::ImageView")) - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQSlider*>(widget)) { ((DominoTQWidget*)widget)->setWFlags(TQt::WNoAutoErase); } else if(dynamic_cast<TQListBox*>(widget)) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TDEToolBarSeparator*>(widget) || dynamic_cast<TQToolBar*>(widget)) { widget->setBackgroundMode(TQt::PaletteBackground); } else if(widget->isA("KonqCheckBox")) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(widget->isA("TQTipLabel")) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(widget->isA("TQWhatsThat")) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(widget->isA("KonqFileTip")) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQButton*>(widget) && widget->parentWidget() && widget->parentWidget()->isA("TQToolBox")) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if( dynamic_cast<TQProgressBar*>(widget) && _animateProgressBar) { @@ -936,10 +944,10 @@ void DominoStyle::polish(TQWidget* widget) connect(widget, SIGNAL(destroyed(TQObject*)), this, SLOT(progressBarDestroyed(TQObject*))); // if (!animationTimer->isActive()) // animationTimer->start( 50, false ); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TDEPopupTitle*>(widget)) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(dynamic_cast<TQFrame*>(widget)) { TQFrame* f = dynamic_cast<TQFrame*>(widget); @@ -956,10 +964,10 @@ void DominoStyle::polish(TQWidget* widget) } case TQFrame::WinPanel: f->setLineWidth(1); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); break; case TQFrame::LineEditPanel: { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); break; } case TQFrame::TabWidgetPanel: @@ -986,17 +994,17 @@ void DominoStyle::polish(TQWidget* widget) } case TQFrame::HLine: case TQFrame::VLine: { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); break; } case TQFrame::StyledPanel: if(dynamic_cast<TQDockWindow*>(widget)) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(widget->isA("TQWorkspaceChild")) { f->setFrameStyle(TQFrame::Panel|TQFrame::Sunken); f->setLineWidth(1); - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(widget->isA("KAnimWidget")) f->setLineWidth(0); @@ -1006,29 +1014,33 @@ void DominoStyle::polish(TQWidget* widget) } } // else if (dynamic_cast<KDockSplitter*>(widget)) { -// widget->installEventFilter(this); +// installObjectEventHandler(ceData, elementFlags, ptr, this); // } else if (dynamic_cast<KDockWidgetAbstractHeaderDrag*>(widget)) { -// widget->installEventFilter(this); +// installObjectEventHandler(ceData, elementFlags, ptr, this); else if(widget->isA("TQDateTimeEditor")) { - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(widget->inherits("TQDockWindowHandle") || widget->isA("TQDockWindowResizeHandle") || widget->isA("AppletHandleDrag")) { // !qstrcmp(widget->name(), "qt_dockwidget_internal") - widget->installEventFilter(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); } else if(widget->isA("KDockWidget") && widget->parentWidget() && widget->parentWidget()->parentWidget() && widget->parentWidget()->parentWidget()->isA("Sidebar_Widget")) { widget->setEraseColor(widget->palette().active().base()); } -// widget->installEventFilter(this); +// installObjectEventHandler(ceData, elementFlags, ptr, this); //tqDebug("className %s, name: %s", widget->className(), widget->name()); } -void DominoStyle::unPolish(TQWidget* widget) +void DominoStyle::unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { - + if (!ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { + return; + } + TQWidget *widget = reinterpret_cast<TQWidget*>(ptr); + if( !strcmp(widget->name(), "__tdehtml") || (!strcmp(widget->name(), "tdefile button") && !strcmp(widget->parentWidget()->name(), "__tdehtml"))) { // is it a tdehtml widget...? tdehtmlWidgets.remove(widget); } @@ -1156,7 +1168,7 @@ void DominoStyle::unPolish(TQWidget* widget) } - TDEStyle::unPolish(widget); + TDEStyle::unPolish( ceData, elementFlags, ptr ); } void DominoStyle::tdehtmlWidgetDestroyed(TQObject* obj) @@ -2687,13 +2699,15 @@ void DominoStyle::renderTab(TQPainter *p, void DominoStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, TQPainter *p, - const TQWidget* widget, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, - const TQStyleOption& opt) const + const TQStyleOption& opt, + const TQWidget* widget) const { - //return TDEStyle::drawTDEStylePrimitive(kpe, p, widget, r, cg, flags, opt); + //return TDEStyle::drawTDEStylePrimitive(kpe, p, ceData, elementFlags, r, cg, flags, opt, widget); // SLIDER // ------ @@ -3021,13 +3035,15 @@ void DominoStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, } default: - TDEStyle::drawTDEStylePrimitive(kpe, p, widget, r, cg, flags, opt); + TDEStyle::drawTDEStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget ); } } void DominoStyle::drawPrimitive(PrimitiveElement pe, TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, @@ -3049,7 +3065,7 @@ void DominoStyle::drawPrimitive(PrimitiveElement pe, - //return TDEStyle::drawPrimitive(pe, p, r, cg, flags, opt); + //return TDEStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); switch(pe) { @@ -3080,7 +3096,7 @@ void DominoStyle::drawPrimitive(PrimitiveElement pe, TQPoint po = w->mapFrom(sv, r.topLeft()); TQRect re = TQRect(po.x(), po.y(), r.width(), r.height()); - drawPrimitive(PE_RubberBand, p, r, cg, flags, opt); + drawPrimitive(PE_RubberBand, p, ceData, elementFlags, r, cg, flags, opt); break; } } @@ -3617,7 +3633,7 @@ void DominoStyle::drawPrimitive(PrimitiveElement pe, TQColor color = dynamic_cast<TQWidget*>(p->device()) ? dynamic_cast<TQWidget*>(p->device())->palette().active().buttonText() : cg.buttonText(); p->setPen(color); - drawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, ar, cg, flags); + drawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, ceData, elementFlags, ar, cg, flags); break; } @@ -3652,7 +3668,7 @@ void DominoStyle::drawPrimitive(PrimitiveElement pe, TQColor color = dynamic_cast<TQWidget*>(p->device()) ? dynamic_cast<TQWidget*>(p->device())->palette().active().buttonText() : cg.buttonText(); p->setPen(color); - drawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, ar, cg, flags); + drawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, ceData, elementFlags, ar, cg, flags); break; @@ -3687,7 +3703,7 @@ void DominoStyle::drawPrimitive(PrimitiveElement pe, TQColor color = dynamic_cast<TQWidget*>(p->device()) ? dynamic_cast<TQWidget*>(p->device())->palette().active().buttonText() : cg.buttonText(); p->setPen(color); - drawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, ar, cg, flags); + drawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, ceData, elementFlags, ar, cg, flags); break; } @@ -4365,7 +4381,7 @@ void DominoStyle::drawPrimitive(PrimitiveElement pe, p->restore(); } else { - TDEStyle::drawPrimitive(pe, p, r, cg, flags, opt); + TDEStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); } break; } @@ -4642,23 +4658,25 @@ void DominoStyle::drawPrimitive(PrimitiveElement pe, } default: { - return TDEStyle::drawPrimitive(pe, p, r, cg, flags, opt); + return TDEStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); } } } void DominoStyle::drawControl(ControlElement element, TQPainter *p, - const TQWidget *widget, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, - const TQStyleOption& opt) const + const TQStyleOption& opt, + const TQWidget *widget) const { const bool enabled = (flags & Style_Enabled); - //return TDEStyle::drawControl(element, p, widget, r, cg, flags, opt); + //return TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); switch (element) { @@ -4816,7 +4834,7 @@ void DominoStyle::drawControl(ControlElement element, case TQt::DownArrow: pe = PE_ArrowDown; break; } - drawPrimitive(pe, p, rect, cg, flags, opt); + drawPrimitive(pe, p, ceData, elementFlags, rect, cg, flags, opt); } else { @@ -4824,7 +4842,7 @@ void DominoStyle::drawControl(ControlElement element, if (toolbutton->iconSet().isNull() && ! toolbutton->text().isNull() && ! toolbutton->usesTextLabel()) { int alignment = AlignCenter | ShowPrefix; - if (!styleHint(SH_UnderlineAccelerator, widget, TQStyleOption::Default, 0)) + if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) alignment |= NoAccel; dominoDrawItem( p, rect, alignment, cg, enabled, 0, toolbutton->text(), toolbutton->text().length(), &btext, textEffectSettings.mode > 0 ? 1 : 0); } @@ -4864,7 +4882,7 @@ void DominoStyle::drawControl(ControlElement element, p->setFont( toolbutton->font() ); TQRect pr = rect, tr = rect; int alignment = ShowPrefix; - if (!styleHint(SH_UnderlineAccelerator, widget, TQStyleOption::Default, 0)) + if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) alignment |= NoAccel; if ( toolbutton->textPosition() == TQToolButton::Under ) { @@ -4904,7 +4922,7 @@ void DominoStyle::drawControl(ControlElement element, // PROGRESSBAR // ----------- case CE_ProgressBarGroove: { - drawPrimitive(PE_Panel, p, r, cg, flags, opt); + drawPrimitive(PE_Panel, p, ceData, elementFlags, r, cg, flags, opt); break; } @@ -5110,7 +5128,7 @@ void DominoStyle::drawControl(ControlElement element, TQPixmap pix = TQPixmap(checkbox); if(flags&Style_On || flags&Style_NoChange) { painter.begin(&pix); - drawPrimitive(PE_CheckMark, &painter, r, cg, flags); + drawPrimitive(PE_CheckMark, &painter, ceData, elementFlags, r, cg, flags); painter.end(); } @@ -5122,10 +5140,10 @@ void DominoStyle::drawControl(ControlElement element, const TQCheckBox *cb = (const TQCheckBox *) widget; int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; - if (!styleHint(SH_UnderlineAccelerator, widget, TQStyleOption::Default, 0)) + if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) alignment |= NoAccel; - TQRect re = focusIndicatorSettings.drawUnderline ? subRect(SR_CheckBoxFocusRect, cb) : r; + TQRect re = focusIndicatorSettings.drawUnderline ? subRect(SR_CheckBoxFocusRect, ceData, elementFlags, cb) : r; if (flags& Style_HasFocus && focusIndicatorSettings.indicateFocus) drawFocusIndicator(p, re, alignment | AlignVCenter |ShowPrefix, cg, flags & Style_Enabled, cb->pixmap(), cb->text(), -1, focusIndicatorSettings.color, focusIndicatorSettings.drawUnderline); @@ -5184,10 +5202,10 @@ void DominoStyle::drawControl(ControlElement element, const TQRadioButton *radiobutton = (const TQRadioButton *) widget; int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; - if (!styleHint(SH_UnderlineAccelerator, widget, TQStyleOption::Default, 0)) + if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) alignment |= NoAccel; - TQRect re = focusIndicatorSettings.drawUnderline ? subRect(SR_RadioButtonFocusRect, radiobutton) : r; + TQRect re = focusIndicatorSettings.drawUnderline ? subRect(SR_RadioButtonFocusRect, ceData, elementFlags, radiobutton) : r; if (flags& Style_HasFocus && focusIndicatorSettings.indicateFocus) drawFocusIndicator(p, re, alignment | AlignVCenter |ShowPrefix, cg, flags & Style_Enabled, radiobutton->pixmap(), radiobutton->text(), -1, focusIndicatorSettings.color, focusIndicatorSettings.drawUnderline); @@ -5243,7 +5261,7 @@ void DominoStyle::drawControl(ControlElement element, renderTab(p, r, cg, (flags & Style_MouseOver), selected, true, pos, false, false, konqTab); break; default: - TDEStyle::drawControl(element, p, widget, r, cg, flags, opt); + TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); } // TQt3 uses this painter to draw the iconSet between CE_TabBarTab and CE_TabBarLabel. If we clip the painter here @@ -5389,7 +5407,7 @@ void DominoStyle::drawControl(ControlElement element, // Does the button have a popup menu? if ( button->popup() ) { - int dx = pixelMetric( PM_MenuButtonIndicator, widget ); + int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget ); if ( button->iconSet() && !button->iconSet()->isNull() && (dx + button->iconSet()->pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w ) { @@ -5397,7 +5415,7 @@ void DominoStyle::drawControl(ControlElement element, } else { - drawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - dx - 8, y + 3, dx, h - 3), r ), cg, flags, opt ); + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - dx - 8, y + 3, dx, h - 3), r ), cg, flags, opt ); w -= dx; } } @@ -5437,13 +5455,13 @@ void DominoStyle::drawControl(ControlElement element, } if (cornArrow) //Draw over the icon - drawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ), cg, flags, opt ); + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ), cg, flags, opt ); x += pw + 4; w -= pw + 4; } - TQRect re = focusIndicatorSettings.drawUnderline ? subRect(SR_PushButtonFocusRect, button) : TQRect(x, y, w, h); + TQRect re = focusIndicatorSettings.drawUnderline ? subRect(SR_PushButtonFocusRect, ceData, elementFlags, button) : TQRect(x, y, w, h); if(hasFocus && focusIndicatorSettings.indicateFocus && !button->text().isNull()) drawFocusIndicator(p, re, AlignCenter|ShowPrefix, cg, button->isEnabled(), 0, button->text(), -1, focusIndicatorSettings.buttonColor, focusIndicatorSettings.drawUnderline, true); @@ -5536,7 +5554,7 @@ void DominoStyle::drawControl(ControlElement element, ir.setRight( tr.right() - 2 ); int yoff = 0; if(!currentTab) { - yoff = pixelMetric(TQStyle::PM_TabBarTabShiftVertical, tb); + yoff = pixelMetric(TQStyle::PM_TabBarTabShiftVertical, ceData, elementFlags, tb); } switch(tb->shape()) { @@ -5675,11 +5693,11 @@ void DominoStyle::drawControl(ControlElement element, cflags |= Style_Enabled; if(reverse && _indentPopupMenuItems) - drawPrimitive( PE_CheckMark, p, TQRect(cmr.x() + (maxpmw ? (maxpmw-16)/2-4 : -1), cmr.y(), cmr.width(), cmr.height()), cg, cflags ); + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect(cmr.x() + (maxpmw ? (maxpmw-16)/2-4 : -1), cmr.y(), cmr.width(), cmr.height()), cg, cflags ); else if(_indentPopupMenuItems) - drawPrimitive( PE_CheckMark, p, TQRect(cmr.x() + (maxpmw ? (maxpmw-16)/2-3 : -6), cmr.y(), cmr.width(), cmr.height()), cg, cflags ); + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect(cmr.x() + (maxpmw ? (maxpmw-16)/2-3 : -6), cmr.y(), cmr.width(), cmr.height()), cg, cflags ); else - drawPrimitive( PE_CheckMark, p, TQRect(reverse ? cmr.x()+cmr.width()-15 : cmr.x()-3, cmr.y(), cmr.width(), cmr.height()), cg, cflags ); + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect(reverse ? cmr.x()+cmr.width()-15 : cmr.x()-3, cmr.y(), cmr.width(), cmr.height()), cg, cflags ); @@ -5791,7 +5809,7 @@ void DominoStyle::drawControl(ControlElement element, if ( mi->popup() ) { PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; - int dim = pixelMetric(PM_MenuButtonIndicator) - 1; + int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags) - 1; TQRect vr = visualRect( TQRect( r.x() + r.width() - 5 - 1 - dim, r.y() + r.height() / 2 - dim / 2, dim, dim), r ); @@ -5800,11 +5818,11 @@ void DominoStyle::drawControl(ControlElement element, textEffectSettings.mode = TextEffect_None; if(enabled) { p->setPen(active? cg.highlightedText(): cg.foreground()); - drawPrimitive( arrow, p, vr, cg, Style_Enabled); + drawPrimitive( arrow, p, ceData, elementFlags, vr, cg, Style_Enabled); } else { p->setPen(cg.mid()); - drawPrimitive( arrow, p, vr, cg, Style_Default); + drawPrimitive( arrow, p, ceData, elementFlags, vr, cg, Style_Default); } textEffectSettings.mode = textEffectMode_save; } @@ -5836,7 +5854,7 @@ void DominoStyle::drawControl(ControlElement element, else { arrow = PE_ArrowRight; } - drawPrimitive(arrow, &painter, re, cg, Style_Enabled); + drawPrimitive(arrow, &painter, ceData, elementFlags, re, cg, Style_Enabled); p->drawPixmap(r.x(), r.y(), pix); break; @@ -5873,15 +5891,17 @@ void DominoStyle::drawControl(ControlElement element, break; } default: - TDEStyle::drawControl(element, p, widget, r, cg, flags, opt); + TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); } } void DominoStyle::drawControlMask(ControlElement element, TQPainter *p, - const TQWidget *w, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &opt) const + const TQStyleOption &opt, + const TQWidget *w) const { switch (element) { @@ -5889,35 +5909,37 @@ void DominoStyle::drawControlMask(ControlElement element, break; } case CE_CheckBox: { - drawPrimitive(PE_IndicatorMask, p, r, w->colorGroup(), Style_Default, opt); + drawPrimitive(PE_IndicatorMask, p, ceData, elementFlags, r, w->colorGroup(), Style_Default, opt); break; } case CE_RadioButton : { - drawPrimitive(PE_ExclusiveIndicatorMask, p, r, w->colorGroup(), Style_Default, opt); + drawPrimitive(PE_ExclusiveIndicatorMask, p, ceData, elementFlags, r, w->colorGroup(), Style_Default, opt); break; } default: { break; - //TDEStyle::drawControlMask (element, p, w, r, opt); + //TDEStyle::drawControlMask (element, p, ceData, elementFlags, r, opt, w); } } } void DominoStyle::drawComplexControl(ComplexControl control, TQPainter *p, - const TQWidget *widget, + const 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 { const bool reverseLayout = TQApplication::reverseLayout(); const bool enabled = (flags & Style_Enabled); - //return TDEStyle::drawComplexControl(control, p, widget, r, cg, flags, controls, active, opt); + //return TDEStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget); switch(control) { @@ -6012,7 +6034,7 @@ void DominoStyle::drawComplexControl(ComplexControl control, TQRect ar(reverseLayout ? r.left()+3 : r.width()-handleWidth-1, r.height()/2-2, handleWidth, 6); if(hasFocus && focusIndicatorSettings.indicateFocus && enabled && cb) { - TQRect editField = querySubControlMetrics(control, widget, SC_ComboBoxEditField); + TQRect editField = querySubControlMetrics(control, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget); int pw = hasPixmap ? (cb->pixmap(cb->currentItem()))->width()+2 : 0; if(!editable) { @@ -6021,7 +6043,7 @@ void DominoStyle::drawComplexControl(ComplexControl control, editField.addCoords(pw+17, editField.height()/2-fmheight/2-1,0 , 0); else editField.addCoords(2+pw, editField.height()/2-fmheight/2-1,0 , 0); - TQRect re = focusIndicatorSettings.drawUnderline ? subRect(SR_ComboBoxFocusRect, cb) : editField; + TQRect re = focusIndicatorSettings.drawUnderline ? subRect(SR_ComboBoxFocusRect, ceData, elementFlags, cb) : editField; drawFocusIndicator(p, re, AlignLeft, cg, true, 0, cb->currentText(), -1, focusIndicatorSettings.buttonColor, focusIndicatorSettings.drawUnderline, true); } } @@ -6047,7 +6069,7 @@ void DominoStyle::drawComplexControl(ComplexControl control, uint aflags = Style_Default|Style_Raised; if(enabled) aflags |= Style_Enabled; - drawPrimitive(PE_ArrowDown, p, ar, cg, aflags); + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, ar, cg, aflags); p->setPen(cg.foreground()); break; @@ -6213,7 +6235,7 @@ void DominoStyle::drawComplexControl(ComplexControl control, renderSurface(&painter, sr, cg.background(), cg.background(), cg.background(), surfaceFlags); - drawControl(CE_ToolButtonLabel, &painter, widget, r, cg, flags,opt); + drawControl(CE_ToolButtonLabel, &painter, ceData, elementFlags, r, cg, flags, opt, widget); renderContour(&painter, cr, cg.background(), cg.background(), contourFlags); @@ -6387,7 +6409,7 @@ void DominoStyle::drawComplexControl(ComplexControl control, if(kickerMode && !(flags&(Style_Raised))) break; - const TQRect br = querySubControlMetrics(control, widget, SC_ToolButton, opt); + const TQRect br = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget); if(br.width() < 16 || br.height()< 16) break; @@ -6466,7 +6488,7 @@ void DominoStyle::drawComplexControl(ComplexControl control, painter.setClipping(false); } if(isKbtn) - drawControl(CE_ToolButtonLabel, &painter, widget, r, cg, flags,opt); + drawControl(CE_ToolButtonLabel, &painter, ceData, elementFlags, r, cg, flags, opt, widget); if(isOn) { TQColor color = buttonContour->contourColor(Contour_Default); @@ -6627,7 +6649,7 @@ void DominoStyle::drawComplexControl(ComplexControl control, } else pe = PE_SpinWidgetUp; - drawPrimitive(pe, p, upRect, cg, sflags); + drawPrimitive(pe, p, ceData, elementFlags, upRect, cg, sflags); sflags = Style_Default; if(enabled) @@ -6641,7 +6663,7 @@ void DominoStyle::drawComplexControl(ComplexControl control, pe = PE_SpinWidgetMinus; else pe = PE_SpinWidgetDown; - drawPrimitive(pe, p, downRect, cg, sflags); + drawPrimitive(pe, p, ceData, elementFlags, downRect, cg, sflags); break; } @@ -6655,13 +6677,13 @@ void DominoStyle::drawComplexControl(ComplexControl control, (maxedOut ? Style_Default : Style_Enabled)); TQRect addline, subline, subline2, addpage, subpage, slider, first, last; - subline = querySubControlMetrics(control, widget, SC_ScrollBarSubLine, opt); - addline = querySubControlMetrics(control, widget, SC_ScrollBarAddLine, opt); - subpage = querySubControlMetrics(control, widget, SC_ScrollBarSubPage, opt); - addpage = querySubControlMetrics(control, widget, SC_ScrollBarAddPage, opt); - slider = querySubControlMetrics(control, widget, SC_ScrollBarSlider, opt); -// first = querySubControlMetrics(control, widget, SC_ScrollBarFirst, opt); -// last = querySubControlMetrics(control, widget, SC_ScrollBarLast, opt); + subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget); + addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget); + subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget); + addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget); + slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget); +// first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, opt, widget); +// last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, opt, widget); // subline2 = addline; // if (horizontal) @@ -6671,7 +6693,7 @@ void DominoStyle::drawComplexControl(ComplexControl control, // Draw the up/left button set if ((controls & SC_ScrollBarSubLine) && subline.isValid()) { - drawPrimitive(PE_ScrollBarSubLine, p, subline, cg, + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, sflags | (active == SC_ScrollBarSubLine ? Style_Down : Style_Default)); @@ -6683,38 +6705,39 @@ void DominoStyle::drawComplexControl(ComplexControl control, subline2.moveBy(0, -addline.height()); if (subline2.isValid()) - drawPrimitive((TQStyle::PrimitiveElement)PE_ScrollBarSubLine2, p, subline2, cg, + drawPrimitive((TQStyle::PrimitiveElement)PE_ScrollBarSubLine2, p, + ceData, elementFlags, subline2, cg, sflags | (active == SC_ScrollBarSubLine ? Style_Down : Style_Default)); } if ((controls & SC_ScrollBarAddLine) && addline.isValid()) - drawPrimitive(PE_ScrollBarAddLine, p, addline, cg, + drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, sflags | ((active == SC_ScrollBarAddLine) ? Style_Down : Style_Default)); if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) - drawPrimitive(PE_ScrollBarSubPage, p, subpage, cg, + drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg, sflags | ((active == SC_ScrollBarSubPage) ? Style_Down : Style_Default)); if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) - drawPrimitive(PE_ScrollBarAddPage, p, addpage, cg, + drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, sflags | ((active == SC_ScrollBarAddPage) ? Style_Down : Style_Default)); // if ((controls & SC_ScrollBarFirst) && first.isValid()) -// drawPrimitive(PE_ScrollBarFirst, p, first, cg, +// drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, // sflags | ((active == SC_ScrollBarFirst) ? // Style_Down : Style_Default)); // // if ((controls & SC_ScrollBarLast) && last.isValid()) -// drawPrimitive(PE_ScrollBarLast, p, last, cg, +// drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, // sflags | ((active == SC_ScrollBarLast) ? // Style_Down : Style_Default)); if ((controls & SC_ScrollBarSlider) && slider.isValid()) { - drawPrimitive(PE_ScrollBarSlider, p, slider, cg, + drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, sflags | ((active == SC_ScrollBarSlider) ? Style_Down : Style_Default)); } @@ -6739,33 +6762,33 @@ void DominoStyle::drawComplexControl(ComplexControl control, painter.drawLine(0, r.bottom(), 10, r.bottom()); p->drawTiledPixmap(0,0, r.width(), r.height(), pix); - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarLabel ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarLabel, TQStyleOption::Default, widget ), widget ); p->setPen( g.foreground() ); p->drawText(ir.x()+2, ir.y(), ir.width()-2, ir.height(), AlignCenter | AlignVCenter | SingleLine, widget->caption() ); } if ( controls & SC_TitleBarCloseButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarCloseButton ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarCloseButton, TQStyleOption::Default, widget ), widget ); down = active & SC_TitleBarCloseButton; p->drawPixmap(ir.x(), ir.y(), qembed_findImage("DockCloseButton"), 0, down ? 12 : 0, 12, 12); } if ( controls & SC_TitleBarMaxButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarMaxButton ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarMaxButton, TQStyleOption::Default, widget ), widget ); down = active & SC_TitleBarMaxButton; p->drawPixmap(ir.x(), ir.y(), qembed_findImage("OverlapButton"), 0, down ? 12 : 0, 12, 12); } if ( controls & SC_TitleBarNormalButton) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarNormalButton ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarNormalButton, TQStyleOption::Default, widget ), widget ); down = active & SC_TitleBarNormalButton; p->drawPixmap(ir.x(), ir.y(), qembed_findImage("ToDesktopButton"), 0, down ? 12 : 0, 12, 12); } if ( controls & SC_TitleBarMinButton) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarMinButton ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarMinButton, TQStyleOption::Default, widget ), widget ); down = active & SC_TitleBarMinButton; p->drawPixmap(ir.x(), ir.y(), qembed_findImage("DockbackButton"), 0, down ? 12 : 0, 12, 12); } if ( controls & SC_TitleBarSysMenu ) { if ( widget->icon() ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarSysMenu ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarSysMenu, TQStyleOption::Default, widget ), widget ); drawItem( p, ir, AlignCenter, widget->colorGroup(), TRUE, widget->icon(), TQString::null ); } } @@ -6773,14 +6796,17 @@ void DominoStyle::drawComplexControl(ComplexControl control, break; } default: - TDEStyle::drawComplexControl(control, p, widget, + TDEStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, controls, - active, opt); + active, opt, widget); break; } } -TQRect DominoStyle::subRect(SubRect r, const TQWidget *widget) const +TQRect DominoStyle::subRect(SubRect r, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget) const { switch (r) { case SR_PushButtonContents: { @@ -6796,11 +6822,11 @@ TQRect DominoStyle::subRect(SubRect r, const TQWidget *widget) const const TQPushButton *button = (const TQPushButton *) widget; int dbw1 = 0, dbw2 = 0; if (button->isDefault() || button->autoDefault()) { - dbw1 = pixelMetric(PM_ButtonDefaultIndicator, widget); + dbw1 = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); dbw2 = dbw1 * 2; } - int dfw1 = pixelMetric(PM_DefaultFrameWidth, widget) * 2, + int dfw1 = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2, dfw2 = dfw1 * 2; rect.setRect(wrect.x() + dfw1 + dbw1, @@ -6811,12 +6837,12 @@ TQRect DominoStyle::subRect(SubRect r, const TQWidget *widget) const } case SR_ComboBoxFocusRect: { return TQRect(4, 3, widget->width()-8, widget->height()-7); -// return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ); +// return querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget ); } case SR_CheckBoxFocusRect: { - TQRect cr = subRect(SR_CheckBoxContents, widget); - TQRect fr = TDEStyle::subRect(r, widget); + TQRect cr = subRect(SR_CheckBoxContents, ceData, elementFlags, widget); + TQRect fr = TDEStyle::subRect(r, ceData, elementFlags, widget); if(cr.width() <= 0) // no text fr.setHeight(fr.height()+2); else @@ -6825,8 +6851,8 @@ TQRect DominoStyle::subRect(SubRect r, const TQWidget *widget) const } case SR_RadioButtonFocusRect: { - TQRect cr = subRect(SR_CheckBoxContents, widget); - TQRect fr = TDEStyle::subRect(r, widget); + TQRect cr = subRect(SR_CheckBoxContents, ceData, elementFlags, widget); + TQRect fr = TDEStyle::subRect(r, ceData, elementFlags, widget); if(cr.width() <= 0) // no text fr.setHeight(fr.height()+2); else @@ -6846,7 +6872,7 @@ TQRect DominoStyle::subRect(SubRect r, const TQWidget *widget) const return TQRect(rw.left()+18, rw.top(), rw.width()-18, rw.height()); } default: { - return TDEStyle::subRect(r, widget); + return TDEStyle::subRect(r, ceData, elementFlags, widget); } } } @@ -6854,9 +6880,11 @@ TQRect DominoStyle::subRect(SubRect r, const TQWidget *widget) const TQRect DominoStyle::querySubControlMetrics(ComplexControl control, - const TQWidget *widget, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption &opt) const + const TQStyleOption &opt, + const TQWidget *widget) const { if (!widget) { return TQRect(); @@ -6876,7 +6904,7 @@ TQRect DominoStyle::querySubControlMetrics(ComplexControl control, return TQRect(r.left()+3, r.top()+3, r.width()-4-15-2, r.height()-7); } default: { - return TDEStyle::querySubControlMetrics(control, widget, subcontrol, opt); + return TDEStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); } } break; @@ -6908,7 +6936,7 @@ TQRect DominoStyle::querySubControlMetrics(ComplexControl control, return TQRect(buttonsLeft, r.top()+2, buttonsWidth, r.height()-5); } default: { - return TDEStyle::querySubControlMetrics(control, widget, subcontrol, opt); + return TDEStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); } } break; @@ -6973,14 +7001,17 @@ TQRect DominoStyle::querySubControlMetrics(ComplexControl control, } } default: { - return TDEStyle::querySubControlMetrics(control, widget, subcontrol, opt); + return TDEStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); } } } -int DominoStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const +int DominoStyle::pixelMetric(PixelMetric m, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget) const { - //return TDEStyle::pixelMetric(m, widget); + //return TDEStyle::pixelMetric(m, ceData, elementFlags, widget); switch(m) { // FRAMES @@ -7123,17 +7154,19 @@ int DominoStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const // case PM_PopupMenuFrameHorizontalExtra: // return 1; default: - return TDEStyle::pixelMetric(m, widget); + return TDEStyle::pixelMetric(m, ceData, elementFlags, widget); } } TQSize DominoStyle::sizeFromContents(ContentsType t, - const TQWidget *widget, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQSize &s, - const TQStyleOption &opt) const + const TQStyleOption &opt, + const TQWidget *widget) const { - //return TDEStyle::sizeFromContents (t, widget, s, opt); + //return TDEStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget); switch (t) { @@ -7144,20 +7177,20 @@ TQSize DominoStyle::sizeFromContents(ContentsType t, int w = s.width(); int h = s.height(); if ( btn->text().isEmpty() && s.width() < 32 ) { - w += pixelMetric(PM_ButtonMargin, widget)*2; - h += pixelMetric(PM_ButtonMargin, widget)*2; + w += pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget)*2; + h += pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget)*2; return TQSize(w, h); } - 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; w += bm + fw + 22; h += bm + fw; return TQSize(w, h < 26 ? 26+_buttonHeightAdjustment : h+4 ); } case CT_ComboBox: { - 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; int w = s.width(); int h = s.height(); w += bm + fw + 22; @@ -7189,7 +7222,7 @@ TQSize DominoStyle::sizeFromContents(ContentsType t, if((dots*minTabLength+44)*count >= tb->width()) // 44 = frame+iconwidth return TQSize(s.width(), s.height()); - TQSize sz = TDEStyle::sizeFromContents( t, widget, s, opt ); + TQSize sz = TDEStyle::sizeFromContents( t, ceData, elementFlags, s, opt, widget ); TQString str; str.fill(' ', minTabLength); @@ -7217,16 +7250,16 @@ TQSize DominoStyle::sizeFromContents(ContentsType t, return TQSize( s.width()+9, s.height()+7 ); return TQSize( s.width()+11, s.height()+7 ); } - return TDEStyle::sizeFromContents (t, widget, s, opt); // KMultiTabBar buttons + return TDEStyle::sizeFromContents( t, ceData, elementFlags, s, opt, widget ); // KMultiTabBar buttons } case CT_SpinBox: { - TQSize sz = TDEStyle::sizeFromContents( t, widget, s, opt ); + TQSize sz = TDEStyle::sizeFromContents( t, ceData, elementFlags, s, opt, widget ); int h = sz.height()%2 != 0 ? sz.height()+1 : sz.height(); return ( TQSize( sz.width(), h < 24 ? 24 : h) ); } case CT_Header: { - TQSize sz = TDEStyle::sizeFromContents( t, widget, s, opt ); + TQSize sz = TDEStyle::sizeFromContents( t, ceData, elementFlags, s, opt, widget ); return TQSize(sz.width(), sz.height()-2); } @@ -7292,16 +7325,18 @@ TQSize DominoStyle::sizeFromContents(ContentsType t, return TQSize(w, h); } default: - return TDEStyle::sizeFromContents (t, widget, s, opt); + return TDEStyle::sizeFromContents( t, ceData, elementFlags, s, opt, widget ); } - return TDEStyle::sizeFromContents (t, widget, s, opt); + return TDEStyle::sizeFromContents( t, ceData, elementFlags, s, opt, widget ); } int DominoStyle::styleHint( StyleHint stylehint, - const TQWidget *widget, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQStyleOption &option, - TQStyleHintReturn* returnData ) const + TQStyleHintReturn* returnData, + const TQWidget *widget ) const { switch (stylehint) { case SH_PopupMenu_SubMenuPopupDelay: @@ -7335,11 +7370,15 @@ int DominoStyle::styleHint( StyleHint stylehint, return '*'; } default: - return TDEStyle::styleHint(stylehint, widget, option, returnData); + return TDEStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget); } } -TQPixmap DominoStyle::stylePixmap(StylePixmap stylepixmap, const TQWidget* widget, const TQStyleOption& opt) const { +TQPixmap DominoStyle::stylePixmap(StylePixmap stylepixmap, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption& opt, + const TQWidget* widget ) const { switch (stylepixmap) { case SP_DockWindowCloseButton: @@ -7352,7 +7391,7 @@ TQPixmap DominoStyle::stylePixmap(StylePixmap stylepixmap, const TQWidget* widge case SP_TitleBarNormalButton: return TQPixmap(qembed_findImage("ToDesktopButton").copy(0,0,12,12)); default: - return TDEStyle::stylePixmap(stylepixmap, widget, opt); + return TDEStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget); } } diff --git a/domino/domino.h b/domino/domino.h index 115748e..e243456 100644 --- a/domino/domino.h +++ b/domino/domino.h @@ -108,21 +108,25 @@ public: Palette_Widget }; - void polish(TQApplication* app ); - void polish(TQWidget* widget ); + void applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); void polish( TQPalette &p ); - void unPolish(TQWidget* widget ); + void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); void drawTDEStylePrimitive(TDEStylePrimitive kpe, TQPainter* p, - const TQWidget* widget, + const 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 drawPrimitive(PrimitiveElement pe, TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, @@ -130,46 +134,71 @@ public: void drawControl(ControlElement element, TQPainter *p, - const TQWidget *widget, + const 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( ControlElement, TQPainter *, const TQWidget *, const TQRect &, const TQStyleOption &) const; + void drawControlMask( TQ_ControlElement, + TQPainter *, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &, + const TQStyleOption &, + const TQWidget *) const; - void drawComplexControl(ComplexControl control, + void drawComplexControl(TQ_ComplexControl control, TQPainter *p, - const TQWidget *widget, + const 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, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; TQRect subRect(SubRect r, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQWidget *widget ) const; TQRect querySubControlMetrics(ComplexControl control, - const TQWidget *widget, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, SubControl subcontrol, - const TQStyleOption &opt = TQStyleOption::Default ) const; + const TQStyleOption &opt = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; TQSize sizeFromContents(TQStyle::ContentsType t, - const TQWidget *w, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQSize &s, - const TQStyleOption &o) const; + const TQStyleOption &o, + const TQWidget *w = 0) const; - int styleHint(StyleHint, const TQWidget * = 0, + int styleHint(TQ_StyleHint, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, - TQStyleHintReturn * = 0 ) const; + TQStyleHintReturn * = 0, + const TQWidget * = 0 ) const; - TQPixmap stylePixmap(StylePixmap stylepixmap, const TQWidget* widget, const TQStyleOption& opt) const; + TQPixmap stylePixmap(StylePixmap stylepixmap, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption& opt, + const TQWidget* widget = 0) const; void drawItem( TQPainter *p, const TQRect &r, int flags, const TQColorGroup &g, bool enabled, @@ -371,7 +400,10 @@ protected: DSurface headerSurface; DSurface checkItemSurface; - bool eventFilter(TQObject *, TQEvent *); + virtual bool objectEventHandler( const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + void* source, + TQEvent *ev ); TQString configMode; void removeCachedSbPix(const TQColor &color) { diff --git a/domino/eventfilter.cpp b/domino/eventfilter.cpp index d3ec418..16f7c2e 100644 --- a/domino/eventfilter.cpp +++ b/domino/eventfilter.cpp @@ -16,8 +16,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) +bool DominoStyle::objectEventHandler( const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + void* source, + TQEvent *ev ) { + if (TDEStyle::objectEventHandler(ceData, elementFlags, source, ev)) { + return true; + } + + if (!ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) { + return false; + } + TQObject* obj = reinterpret_cast<TQObject*>(source); // tqDebug("className: %s -- name: %s", obj->className(), obj->name()); @@ -59,10 +70,10 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) if(!cb->listBox()) { - drawComplexControl( TQStyle::CC_ComboBox, &p, cb, cb->rect(), g, - flags, (uint)TQStyle::SC_All, /*(cb->arrowDown ? */TQStyle::SC_ComboBoxArrow /*: TQStyle::SC_None )*/); + drawComplexControl( TQStyle::CC_ComboBox, &p, ceData, elementFlags, cb->rect(), g, + flags, (uint)TQStyle::SC_All, /*(cb->arrowDown ? */TQStyle::SC_ComboBoxArrow /*: TQStyle::SC_None )*/, TQStyleOption::Default, cb); - TQRect re = querySubControlMetrics( TQStyle::CC_ComboBox, cb, TQStyle::SC_ComboBoxEditField ); + TQRect re = querySubControlMetrics( TQStyle::CC_ComboBox, ceData, elementFlags, TQStyle::SC_ComboBoxEditField, TQStyleOption::Default, cb ); re = TQStyle::visualRect(re, cb); p.setClipRect( re ); @@ -93,9 +104,9 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) } } else { - drawComplexControl( TQStyle::CC_ComboBox, &p, cb, cb->rect(), g, - flags, (uint)TQStyle::SC_All, /*(d->arrowDown ? */TQStyle::SC_ComboBoxArrow/* : TQStyle::SC_None )*/); - TQRect re = querySubControlMetrics( TQStyle::CC_ComboBox, cb, TQStyle::SC_ComboBoxEditField ); + drawComplexControl( TQStyle::CC_ComboBox, &p, ceData, elementFlags, cb->rect(), g, + flags, (uint)TQStyle::SC_All, /*(d->arrowDown ? */TQStyle::SC_ComboBoxArrow/* : TQStyle::SC_None )*/, TQStyleOption::Default, cb); + TQRect re = querySubControlMetrics( TQStyle::CC_ComboBox, ceData, elementFlags, TQStyle::SC_ComboBoxEditField, TQStyleOption::Default, cb ); re = TQStyle::visualRect(re, cb); p.setClipRect( re ); @@ -801,8 +812,8 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) flags |= TQStyle::Style_HasFocus; if(spinWidgetDown && sw->hasMouse()) flags |= TQStyle::Style_Down; - TQRect fr = TQStyle::visualRect(querySubControlMetrics( TQStyle::CC_SpinWidget, sw, TQStyle::SC_SpinWidgetFrame ), sw ); - drawComplexControl( TQStyle::CC_SpinWidget, &p, sw, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None ); + TQRect fr = TQStyle::visualRect(querySubControlMetrics( TQStyle::CC_SpinWidget, ceData, elementFlags, TQStyle::SC_SpinWidgetFrame, TQStyleOption::Default, sw ), sw ); + drawComplexControl( TQStyle::CC_SpinWidget, &p, ceData, elementFlags, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None, TQStyleOption::Default, sw ); p.end(); p.begin(sw); p.drawPixmap(0,0,buffer); @@ -834,7 +845,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) if(spinWidgetDown) { if(sw->paletteBackgroundPixmap()) sw->erase(); - drawComplexControl( TQStyle::CC_SpinWidget, &p, sw, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None); + drawComplexControl( TQStyle::CC_SpinWidget, &p, ceData, elementFlags, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None, TQStyleOption::Default, sw); } return false; @@ -844,7 +855,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) if(sw->paletteBackgroundPixmap()) sw->erase(); - drawComplexControl( TQStyle::CC_SpinWidget, &p, sw, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None); + drawComplexControl( TQStyle::CC_SpinWidget, &p, ceData, elementFlags, sw->rect(), sw->colorGroup(), flags, (uint)TQStyle::SC_All, TQStyle::SC_None, TQStyleOption::Default, sw); return false; } case TQEvent::Enter: { @@ -1058,7 +1069,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) else if(btn == hoverWidget && btn->isEnabled()) buttonContour->setState(Contour_MouseOver); - drawComplexControl(TQStyle::CC_ToolButton, &p, btn, btn->rect(), btn->colorGroup(), flags, TQStyle::SC_ToolButton, active, TQStyleOption()); + drawComplexControl(TQStyle::CC_ToolButton, &p, ceData, elementFlags, btn->rect(), btn->colorGroup(), flags, TQStyle::SC_ToolButton, active, TQStyleOption(), btn); buttonContour->reset(); return true; } @@ -1146,7 +1157,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) flags |= TQStyle::Style_Off; TQPainter p(rb); - drawControl(CE_RadioButton, &p, rb, TQRect(0,0,17,17), rb->palette().active(), flags); + drawControl(CE_RadioButton, &p, ceData, elementFlags, TQRect(0,0,17,17), rb->palette().active(), flags, TQStyleOption::Default, rb); return true; } if (ev->type() == TQEvent::Show && !strcmp(obj->name(), "__tdehtml")) { @@ -1165,7 +1176,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) TQPixmap pix(btn->size()); pix.fill(tqApp->palette().active().background()); TQPainter p(&pix); - drawControl( CE_CheckBox, &p, btn, TQRect(0,0,18,19), tqApp->palette().active(), Style_Default|Style_Off, TQStyleOption::Default); + drawControl( CE_CheckBox, &p, ceData, elementFlags, TQRect(0,0,18,19), tqApp->palette().active(), Style_Default|Style_Off, TQStyleOption::Default, btn); btn->setErasePixmap(pix); return true; } @@ -1182,7 +1193,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) if ( btn->isEnabled() ) flags |= Style_Enabled; TQPainter p(btn); - drawPrimitive(PE_CheckMark, &p, TQRect(0,0,16,17), tqApp->palette().active(), flags); + drawPrimitive(PE_CheckMark, &p, ceData, elementFlags, TQRect(0,0,16,17), tqApp->palette().active(), flags); return true; } return false; @@ -1224,7 +1235,7 @@ bool DominoStyle::eventFilter(TQObject *obj, TQEvent *ev) flags |= TQStyle::Style_NoChange; TQPainter p(cb); - drawControl(CE_CheckBox, &p, cb, TQRect(0,0,18,19), cb->palette().active(), flags); + drawControl(CE_CheckBox, &p, ceData, elementFlags, TQRect(0,0,18,19), cb->palette().active(), flags, TQStyleOption::Default, cb); return true; } return false; diff --git a/dominoConfig/dominoconf.cpp b/dominoConfig/dominoconf.cpp index 2861b29..6aed86b 100644 --- a/dominoConfig/dominoconf.cpp +++ b/dominoConfig/dominoconf.cpp @@ -2722,7 +2722,9 @@ void PreviewCheckBox::drawButton(TQPainter *p) { TQPixmap pix(18,19); TQPainter painter(&pix); pix.fill(backgroundColor()); - style().drawControl(TQStyle::CE_CheckBox, &painter, this, irect, colorGroup(), flags); + const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(this, TQStyleOption()); + TQStyle::ControlElementFlags elementFlags = getControlElementFlagsForObject(this, TQStyleOption()); + style().drawControl(TQStyle::CE_CheckBox, &painter, ceData, elementFlags, irect, colorGroup(), flags, TQStyleOption::Default, this); bitBlt(this, 0, 0, &pix); } @@ -2756,7 +2758,9 @@ void PreviewRadioButton::drawButton(TQPainter *p) { TQPixmap pix(17,17); TQPainter painter(&pix); pix.fill(backgroundColor()); - style().drawControl(TQStyle::CE_RadioButton, &painter, this, irect, colorGroup(), flags); + const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(this, TQStyleOption()); + TQStyle::ControlElementFlags elementFlags = getControlElementFlagsForObject(this, TQStyleOption()); + style().drawControl(TQStyle::CE_RadioButton, &painter, ceData, elementFlags, irect, colorGroup(), flags, TQStyleOption::Default, this); bitBlt(this, 0, 0, &pix); } @@ -2831,7 +2835,9 @@ void IndicatorPrevButton::paintEvent(TQPaintEvent* /*event*/) TQPainter p(&buffer); buffer.fill(paletteBackgroundColor()); - previewStyle->drawControl(TQStyle::CE_PushButton, &p, this, rect(), colorGroup(), flags); + const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(this, TQStyleOption()); + TQStyle::ControlElementFlags elementFlags = getControlElementFlagsForObject(this, TQStyleOption()); + previewStyle->drawControl(TQStyle::CE_PushButton, &p, ceData, elementFlags, rect(), colorGroup(), flags, TQStyleOption::Default, this); previewStyle->drawFocusIndicator(&p, style().subRect(TQStyle::SR_PushButtonFocusRect, this), AlignHCenter| AlignVCenter |ShowPrefix, colorGroup(), true, 0, indicatorPreviewText, -1, indicatorBtnColor->color(), (indicatorModeCombo->currentItem() == 1), true); @@ -2894,7 +2900,9 @@ void TextEffectPrevButton::paintEvent(TQPaintEvent* /*event*/) TQPixmap buffer(width(), height()); TQPainter p(&buffer); - previewStyle->drawControl(TQStyle::CE_PushButton, &p, this, rect(), colorGroup(), flags); + const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(this, TQStyleOption()); + TQStyle::ControlElementFlags elementFlags = getControlElementFlagsForObject(this, TQStyleOption()); + previewStyle->drawControl(TQStyle::CE_PushButton, &p, ceData, elementFlags, rect(), colorGroup(), flags, TQStyleOption::Default, this); drawButtonLabel(&p); |