summaryrefslogtreecommitdiffstats
path: root/src/styles/qmotifplusstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/styles/qmotifplusstyle.cpp')
-rw-r--r--src/styles/qmotifplusstyle.cpp311
1 files changed, 152 insertions, 159 deletions
diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp
index 36358792f..129f0a2d2 100644
--- a/src/styles/qmotifplusstyle.cpp
+++ b/src/styles/qmotifplusstyle.cpp
@@ -227,7 +227,7 @@ void TQMotifPlusStyle::unPolish(TQApplication *)
/*! \reimp */
-int TQMotifPlusStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) const
+int TQMotifPlusStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{
int ret;
@@ -259,7 +259,7 @@ int TQMotifPlusStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) co
break;
default:
- ret = TQMotifStyle::pixelMetric(metric, widget);
+ ret = TQMotifStyle::pixelMetric(metric, ceData, elementFlags, widget);
break;
}
@@ -270,6 +270,8 @@ int TQMotifPlusStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) co
/*! \reimp */
void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe,
TQPainter *p,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags,
@@ -303,11 +305,11 @@ void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe,
break;
case PE_SpinWidgetUp:
- drawPrimitive(PE_ArrowUp, p, r, cg, flags, opt);
+ drawPrimitive(PE_ArrowUp, p, ceData, elementFlags, r, cg, flags, opt);
break;
case PE_SpinWidgetDown:
- drawPrimitive(PE_ArrowDown, p, r, cg, flags, opt);
+ drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, r, cg, flags, opt);
break;
case PE_Indicator:
@@ -632,7 +634,7 @@ void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe,
}
default:
- TQMotifStyle::drawPrimitive(pe, p, r, cg, flags, opt);
+ TQMotifStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
break;
}
}
@@ -642,11 +644,13 @@ void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe,
*/
void TQMotifPlusStyle::drawControl( ControlElement element,
TQPainter *p,
- const TQWidget *widget,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags,
- const TQStyleOption& opt ) const
+ const TQStyleOption& opt,
+ const TQWidget *widget) const
{
if (widget == singleton->hoverWidget)
flags |= Style_MouseOver;
@@ -655,12 +659,11 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
case CE_PushButton:
{
#ifndef QT_NO_PUSHBUTTON
- const TQPushButton *button = (const TQPushButton *) widget;
TQRect br = r;
- int dbi = pixelMetric(PM_ButtonDefaultIndicator, widget);
+ int dbi = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget);
- if (button->isDefault() || button->autoDefault()) {
- if (button->isDefault())
+ if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) {
+ if (elementFlags & CEF_IsDefault)
drawMotifPlusShade(p, br, cg, TRUE, FALSE,
&cg.brush(TQColorGroup::Background));
@@ -673,9 +676,9 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
if (flags & Style_HasFocus)
br.addCoords(1, 1, -1, -1);
p->save();
- p->setBrushOrigin( -button->backgroundOffset().x(),
- -button->backgroundOffset().y() );
- drawPrimitive(PE_ButtonCommand, p, br, cg, flags);
+ p->setBrushOrigin( -ceData.bgOffset.x(),
+ -ceData.bgOffset.y() );
+ drawPrimitive(PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags);
p->restore();
#endif
break;
@@ -684,23 +687,21 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
case CE_CheckBoxLabel:
{
#ifndef QT_NO_CHECKBOX
- const TQCheckBox *checkbox = (const TQCheckBox *) widget;
-
if (flags & Style_MouseOver) {
- TQRegion r(checkbox->rect());
- r -= visualRect(subRect(SR_CheckBoxIndicator, widget), widget);
+ TQRegion r(ceData.rect);
+ r -= visualRect(subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget), ceData, elementFlags);
p->setClipRegion(r);
- p->fillRect(checkbox->rect(), cg.brush(TQColorGroup::Midlight));
+ p->fillRect(ceData.rect, cg.brush(TQColorGroup::Midlight));
p->setClipping(FALSE);
}
int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft;
drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg,
- flags & Style_Enabled, checkbox->pixmap(), checkbox->text());
+ flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text);
- if (checkbox->hasFocus()) {
- TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, widget), widget);
- drawPrimitive(PE_FocusRect, p, fr, cg, flags);
+ if (elementFlags & CEF_HasFocus) {
+ TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags);
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags);
}
#endif
break;
@@ -709,23 +710,21 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
case CE_RadioButtonLabel:
{
#ifndef QT_NO_RADIOBUTTON
- const TQRadioButton *radiobutton = (const TQRadioButton *) widget;
-
if (flags & Style_MouseOver) {
- TQRegion r(radiobutton->rect());
- r -= visualRect(subRect(SR_RadioButtonIndicator, widget), widget);
+ TQRegion r(ceData.rect);
+ r -= visualRect(subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget), ceData, elementFlags);
p->setClipRegion(r);
- p->fillRect(radiobutton->rect(), cg.brush(TQColorGroup::Midlight));
+ p->fillRect(ceData.rect, cg.brush(TQColorGroup::Midlight));
p->setClipping(FALSE);
}
int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft;
drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg,
- flags & Style_Enabled, radiobutton->pixmap(), radiobutton->text());
+ flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text);
- if (radiobutton->hasFocus()) {
- TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, widget), widget);
- drawPrimitive(PE_FocusRect, p, fr, cg, flags);
+ if (elementFlags & CEF_HasFocus) {
+ TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, widget), ceData, elementFlags);
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags);
}
#endif
break;
@@ -757,7 +756,6 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
if (! widget || opt.isDefault())
break;
- TQPopupMenu *popupmenu = (TQPopupMenu *) widget;
TQMenuItem *mi = opt.menuItem();
if ( !mi )
break;
@@ -765,7 +763,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
int tab = opt.tabWidth();
int maxpmw = opt.maxIconWidth();
bool dis = ! (flags & Style_Enabled);
- bool checkable = popupmenu->isCheckable();
+ bool checkable = (elementFlags & CEF_IsCheckable);
bool act = flags & Style_Active;
int x, y, w, h;
@@ -834,7 +832,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
if (act)
cflags |= Style_On;
- drawPrimitive(PE_CheckMark, p, vrect, cg, cflags);
+ drawPrimitive(PE_CheckMark, p, ceData, elementFlags, vrect, cg, cflags);
}
}
@@ -883,6 +881,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
TQStyle::PrimitiveElement arrow = (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight);
vrect = visualRect( TQRect(x + w - hh - 6, y + (hh / 2), hh, hh), r );
drawPrimitive(arrow, p,
+ ceData, elementFlags,
vrect, cg,
((act && !dis) ?
Style_Down : Style_Default) |
@@ -895,16 +894,15 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
case CE_TabBarTab:
{
#ifndef QT_NO_TABBAR
- const TQTabBar *tabbar = (const TQTabBar *) widget;
bool selected = flags & Style_Selected;
- TQColorGroup g = tabbar->colorGroup();
+ TQColorGroup g = ceData.colorGroup;
TQPen oldpen = p->pen();
TQRect fr(r);
if (! selected) {
- if (tabbar->shape() == TQTabBar::RoundedAbove ||
- tabbar->shape() == TQTabBar::TriangularAbove) {
+ if (ceData.tabBarData.shape == TQTabBar::RoundedAbove ||
+ ceData.tabBarData.shape == TQTabBar::TriangularAbove) {
fr.setTop(fr.top() + 2);
} else {
fr.setBottom(fr.bottom() - 2);
@@ -917,7 +915,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
(selected) ? cg.brush(TQColorGroup::Button)
: cg.brush(TQColorGroup::Mid));
- if (tabbar->shape() == TQTabBar::RoundedAbove) {
+ if (ceData.tabBarData.shape == TQTabBar::RoundedAbove) {
// "rounded" tabs on top
fr.setBottom(fr.bottom() - 1);
@@ -941,7 +939,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
p->setPen(black);
p->drawLine(fr.right(), fr.top() + 1,
fr.right(), fr.bottom() - 1);
- } else if (tabbar->shape() == TQTabBar::RoundedBelow) {
+ } else if (ceData.tabBarData.shape == TQTabBar::RoundedBelow) {
// "rounded" tabs on bottom
fr.setTop(fr.top() + 1);
@@ -987,7 +985,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
}
} else
// triangular drawing code
- TQMotifStyle::drawControl(element, p, widget, r, cg, flags, opt);
+ TQMotifStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
p->setPen(oldpen);
#endif
@@ -995,7 +993,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
}
default:
- TQMotifStyle::drawControl(element, p, widget, r, cg, flags, opt);
+ TQMotifStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
break;
}
}
@@ -1003,7 +1001,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
/*! \reimp
*/
-TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const
+TQRect TQMotifPlusStyle::subRect(SubRect r, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{
TQRect rect;
@@ -1011,11 +1009,10 @@ TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const
case SR_PushButtonFocusRect:
{
#ifndef QT_NO_PUSHBUTTON
- const TQPushButton *button = (const TQPushButton *) widget;
- int dfi = pixelMetric(PM_ButtonDefaultIndicator, widget);
+ int dfi = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget);
- rect = button->rect();
- if (button->isDefault() || button->autoDefault())
+ rect = ceData.rect;
+ if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault))
rect.addCoords(dfi, dfi, -dfi, -dfi);
#endif
break;
@@ -1023,38 +1020,36 @@ TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const
case SR_CheckBoxIndicator:
{
- int h = pixelMetric( PM_IndicatorHeight );
- rect.setRect(( widget->rect().height() - h ) / 2,
- ( widget->rect().height() - h ) / 2,
- pixelMetric( PM_IndicatorWidth ), h );
+ int h = pixelMetric( PM_IndicatorHeight, ceData, elementFlags );
+ rect.setRect(( ceData.rect.height() - h ) / 2,
+ ( ceData.rect.height() - h ) / 2,
+ pixelMetric( PM_IndicatorWidth, ceData, elementFlags ), h );
break;
}
case SR_RadioButtonIndicator:
{
- int h = pixelMetric( PM_ExclusiveIndicatorHeight );
- rect.setRect( ( widget->rect().height() - h ) / 2,
- ( widget->rect().height() - h ) / 2,
- pixelMetric( PM_ExclusiveIndicatorWidth ), h );
+ int h = pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags );
+ rect.setRect( ( ceData.rect.height() - h ) / 2,
+ ( ceData.rect.height() - h ) / 2,
+ pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ), h );
break;
}
case SR_CheckBoxFocusRect:
case SR_RadioButtonFocusRect:
- rect = widget->rect();
+ rect = ceData.rect;
break;
case SR_ComboBoxFocusRect:
{
#ifndef QT_NO_COMBOBOX
- const TQComboBox *combobox = (const TQComboBox *) widget;
-
- if (combobox->editable()) {
- rect = querySubControlMetrics(CC_ComboBox, widget,
- SC_ComboBoxEditField);
+ if (elementFlags & CEF_IsEditable) {
+ rect = querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
+ SC_ComboBoxEditField, TQStyleOption::Default, widget);
rect.addCoords(-3, -3, 3, 3);
} else
- rect = combobox->rect();
+ rect = ceData.rect;
#endif
break;
}
@@ -1062,21 +1057,20 @@ TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const
case SR_SliderFocusRect:
{
#ifndef QT_NO_SLIDER
- const TQSlider *slider = (const TQSlider *) widget;
- int tickOffset = pixelMetric( PM_SliderTickmarkOffset, widget );
- int thickness = pixelMetric( PM_SliderControlThickness, widget );
+ int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget );
+ int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
int x, y, wi, he;
- if ( slider->orientation() == Horizontal ) {
+ if ( ceData.orientation == Horizontal ) {
x = 0;
y = tickOffset;
- wi = slider->width();
+ wi = ceData.rect.width();
he = thickness;
} else {
x = tickOffset;
y = 0;
wi = thickness;
- he = slider->height();
+ he = ceData.rect.height();
}
rect.setRect(x, y, wi, he);
@@ -1085,7 +1079,7 @@ TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const
}
default:
- rect = TQMotifStyle::subRect(r, widget);
+ rect = TQMotifStyle::subRect(r, ceData, elementFlags, widget);
break;
}
@@ -1096,13 +1090,15 @@ TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const
/*! \reimp */
void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
TQPainter *p,
- const TQWidget *widget,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags,
SCFlags controls,
SCFlags active,
- const TQStyleOption& opt ) const
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
{
if (widget == singleton->hoverWidget)
flags |= Style_MouseOver;
@@ -1111,17 +1107,16 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
case CC_ScrollBar:
{
#ifndef QT_NO_SCROLLBAR
- const TQScrollBar *scrollbar = (const TQScrollBar *) widget;
TQRect addline, subline, addpage, subpage, slider, first, last;
- bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue());
+ bool maxedOut = (ceData.minSteps == ceData.maxSteps);
- 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);
bool skipUpdate = FALSE;
if (singleton->hovering) {
@@ -1157,67 +1152,67 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
&cg.brush(TQColorGroup::Mid));
if ((controls & SC_ScrollBarSubLine) && subline.isValid())
- drawPrimitive(PE_ScrollBarSubLine, p, subline, cg,
+ drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg,
((active == SC_ScrollBarSubLine ||
singleton->scrollbarElement == SC_ScrollBarSubLine) ?
Style_MouseOver: Style_Default) |
((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarSubLine) ?
Style_Down : Style_Default) |
- ((scrollbar->orientation() == TQt::Horizontal) ?
+ ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarAddLine) && addline.isValid())
- drawPrimitive(PE_ScrollBarAddLine, p, addline, cg,
+ drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg,
((active == SC_ScrollBarAddLine ||
singleton->scrollbarElement == SC_ScrollBarAddLine) ?
Style_MouseOver: Style_Default) |
((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarAddLine) ?
Style_Down : Style_Default) |
- ((scrollbar->orientation() == TQt::Horizontal) ?
+ ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarSubPage) && subpage.isValid())
- drawPrimitive(PE_ScrollBarSubPage, p, subpage, cg,
+ drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg,
((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarSubPage) ?
Style_Down : Style_Default) |
- ((scrollbar->orientation() == TQt::Horizontal) ?
+ ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarAddPage) && addpage.isValid())
- drawPrimitive(PE_ScrollBarAddPage, p, addpage, cg,
+ drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg,
((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarAddPage) ?
Style_Down : Style_Default) |
- ((scrollbar->orientation() == TQt::Horizontal) ?
+ ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarFirst) && first.isValid())
- drawPrimitive(PE_ScrollBarFirst, p, first, cg,
+ drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg,
((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarFirst) ?
Style_Down : Style_Default) |
- ((scrollbar->orientation() == TQt::Horizontal) ?
+ ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarLast) && last.isValid())
- drawPrimitive(PE_ScrollBarLast, p, last, cg,
+ drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg,
((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarLast) ?
Style_Down : Style_Default) |
- ((scrollbar->orientation() == TQt::Horizontal) ?
+ ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarSlider) && slider.isValid()) {
- drawPrimitive(PE_ScrollBarSlider, p, slider, cg,
+ drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg,
((active == SC_ScrollBarSlider ||
singleton->scrollbarElement == SC_ScrollBarSlider) ?
Style_MouseOver: Style_Default) |
((maxedOut) ? Style_Default : Style_Enabled) |
- ((scrollbar->orientation() == TQt::Horizontal) ?
+ ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default));
// ### perhaps this should not be able to accept focus if maxedOut?
- if (scrollbar->hasFocus()) {
+ if (elementFlags & CEF_HasFocus) {
TQRect fr(slider.x() + 2, slider.y() + 2,
slider.width() - 5, slider.height() - 5);
- drawPrimitive(PE_FocusRect, p, fr, cg, Style_Default);
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default);
}
}
#endif
@@ -1227,27 +1222,25 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
case CC_ComboBox:
{
#ifndef QT_NO_COMBOBOX
- const TQComboBox *combobox = (const TQComboBox *) widget;
-
TQRect editfield, arrow;
editfield =
visualRect(querySubControlMetrics(CC_ComboBox,
- combobox,
+ ceData, elementFlags,
SC_ComboBoxEditField,
- opt), widget);
+ opt, widget), ceData, elementFlags);
arrow =
visualRect(querySubControlMetrics(CC_ComboBox,
- combobox,
+ ceData, elementFlags,
SC_ComboBoxArrow,
- opt), widget);
+ opt, widget), ceData, elementFlags);
- if (combobox->editable()) {
+ if (elementFlags & CEF_IsEditable) {
if (controls & SC_ComboBoxEditField && editfield.isValid()) {
editfield.addCoords(-3, -3, 3, 3);
- if (combobox->hasFocus())
+ if (elementFlags & CEF_HasFocus)
editfield.addCoords(1, 1, -1, -1);
drawMotifPlusShade(p, editfield, cg, TRUE, FALSE,
- (widget->isEnabled() ?
+ ((elementFlags & CEF_IsEnabled) ?
&cg.brush(TQColorGroup::Base) :
&cg.brush(TQColorGroup::Background)));
}
@@ -1261,12 +1254,12 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
if (active == SC_ComboBoxArrow)
flags |= Style_Sunken;
- drawPrimitive(PE_ArrowDown, p, arrow, cg, flags);
+ drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, arrow, cg, flags);
}
} else {
if (controls & SC_ComboBoxEditField && editfield.isValid()) {
editfield.addCoords(-3, -3, 3, 3);
- if (combobox->hasFocus())
+ if (elementFlags & CEF_HasFocus)
editfield.addCoords(1, 1, -1, -1);
drawMotifPlusShade(p, editfield, cg, FALSE,
(flags & Style_MouseOver));
@@ -1276,10 +1269,10 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
drawMotifPlusShade(p, arrow, cg, FALSE, (flags & Style_MouseOver));
}
- if (combobox->hasFocus() ||
- (combobox->editable() && combobox->lineEdit()->hasFocus())) {
- TQRect fr = visualRect(subRect(SR_ComboBoxFocusRect, widget), widget);
- drawPrimitive(PE_FocusRect, p, fr, cg, flags);
+ if ((elementFlags & CEF_HasFocus) ||
+ ((elementFlags & CEF_IsEditable) && (ceData.comboBoxLineEditFlags & CEF_HasFocus))) {
+ TQRect fr = visualRect(subRect(SR_ComboBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags);
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags);
}
#endif
break;
@@ -1288,7 +1281,6 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
case CC_SpinWidget:
{
#ifndef QT_NO_SPINWIDGET
- const TQSpinWidget * sw = (const TQSpinWidget *) widget;
SFlags flags = Style_Default;
if (controls & SC_SpinWidgetFrame)
@@ -1300,14 +1292,14 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
flags |= Style_Down;
PrimitiveElement pe;
- if ( sw->buttonSymbols() == TQSpinWidget::PlusMinus )
+ if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus )
pe = PE_SpinWidgetPlus;
else
pe = PE_SpinWidgetUp;
- TQRect re = sw->upRect();
- TQColorGroup ucg = sw->isUpEnabled() ? cg : sw->palette().disabled();
- drawPrimitive(pe, p, re, ucg, flags);
+ TQRect re = ceData.spinWidgetData.upRect;
+ TQColorGroup ucg = ceData.spinWidgetData.upEnabled ? cg : ceData.palette.disabled();
+ drawPrimitive(pe, p, ceData, elementFlags, re, ucg, flags);
}
if (controls & SC_SpinWidgetDown) {
@@ -1316,14 +1308,14 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
flags |= Style_Down;
PrimitiveElement pe;
- if ( sw->buttonSymbols() == TQSpinWidget::PlusMinus )
+ if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus )
pe = PE_SpinWidgetMinus;
else
pe = PE_SpinWidgetDown;
- TQRect re = sw->downRect();
- TQColorGroup dcg = sw->isDownEnabled() ? cg : sw->palette().disabled();
- drawPrimitive(pe, p, re, dcg, flags);
+ TQRect re = ceData.spinWidgetData.downRect;
+ TQColorGroup dcg = ceData.spinWidgetData.downEnabled ? cg : ceData.palette.disabled();
+ drawPrimitive(pe, p, ceData, elementFlags, re, dcg, flags);
}
#endif
break;
@@ -1332,21 +1324,20 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
case CC_Slider:
{
#ifndef QT_NO_SLIDER
- const TQSlider *slider = (const TQSlider *) widget;
bool mouseover = (flags & Style_MouseOver);
- TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove,
- opt),
- handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle,
- opt);
+ TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove,
+ opt, widget),
+ handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle,
+ opt, widget);
if ((controls & SC_SliderGroove) && groove.isValid()) {
drawMotifPlusShade(p, groove, cg, TRUE, FALSE,
&cg.brush(TQColorGroup::Mid));
if ( flags & Style_HasFocus ) {
- TQRect fr = subRect( SR_SliderFocusRect, widget );
- drawPrimitive( PE_FocusRect, p, fr, cg, flags );
+ TQRect fr = subRect( SR_SliderFocusRect, ceData, elementFlags, widget );
+ drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg, flags );
}
}
@@ -1356,9 +1347,9 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
flags |= Style_MouseOver;
else
flags &= ~Style_MouseOver;
- drawPrimitive(PE_ButtonBevel, p, handle, cg, flags | Style_Raised);
+ drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, handle, cg, flags | Style_Raised);
- if ( slider->orientation() == Horizontal ) {
+ if ( ceData.orientation == Horizontal ) {
TQCOORD mid = handle.x() + handle.width() / 2;
qDrawShadeLine( p, mid, handle.y() + 1, mid ,
handle.y() + handle.height() - 3,
@@ -1372,15 +1363,15 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
}
if (controls & SC_SliderTickmarks)
- TQMotifStyle::drawComplexControl(control, p, widget, r, cg, flags,
- SC_SliderTickmarks, active, opt);
+ TQMotifStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
+ SC_SliderTickmarks, active, opt, widget);
#endif
break;
}
default:
- TQMotifStyle::drawComplexControl(control, p, widget, r, cg, flags,
- controls, active, opt);
+ TQMotifStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
+ controls, active, opt, widget);
}
}
@@ -1388,22 +1379,24 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
/*! \reimp
*/
TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control,
- const TQWidget *widget,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
SubControl subcontrol,
- const TQStyleOption& opt) const
+ const TQStyleOption& opt,
+ const TQWidget *widget) const
{
switch (control) {
case CC_SpinWidget: {
- int fw = pixelMetric( PM_SpinBoxFrameWidth, 0 );
+ int fw = pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags, 0 );
TQSize bs;
- bs.setHeight( (widget->height() + 1)/2 );
+ bs.setHeight( (ceData.rect.height() + 1)/2 );
if ( bs.height() < 10 )
bs.setHeight( 10 );
bs.setWidth( bs.height() ); // 1.6 -approximate golden mean
bs = bs.expandedTo( TQApplication::globalStrut() );
int y = 0;
int x, lx, rx, h;
- x = widget->width() - y - bs.width();
+ x = ceData.rect.width() - y - bs.width();
lx = fw;
rx = x - fw * 2;
h = bs.height() * 2;
@@ -1418,7 +1411,7 @@ TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control,
case SC_SpinWidgetEditField:
return TQRect(lx, fw, rx, h - 2*fw);
case SC_SpinWidgetFrame:
- return TQRect( 0, 0, widget->width() - bs.width(), h);
+ return TQRect( 0, 0, ceData.rect.width() - bs.width(), h);
default:
break;
}
@@ -1426,34 +1419,33 @@ TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control,
#ifndef QT_NO_COMBOBOX
case CC_ComboBox: {
- const TQComboBox *combobox = (const TQComboBox *) widget;
- if (combobox->editable()) {
- int space = (combobox->height() - 13) / 2;
+ if (elementFlags & CEF_IsEditable) {
+ int space = (ceData.rect.height() - 13) / 2;
switch (subcontrol) {
case SC_ComboBoxFrame:
return TQRect();
case SC_ComboBoxEditField: {
- TQRect rect = widget->rect();
+ TQRect rect = ceData.rect;
rect.setWidth(rect.width() - 13 - space * 2);
rect.addCoords(3, 3, -3, -3);
return rect; }
case SC_ComboBoxArrow:
- return TQRect(combobox->width() - 13 - space * 2, 0,
- 13 + space * 2, combobox->height());
+ return TQRect(ceData.rect.width() - 13 - space * 2, 0,
+ 13 + space * 2, ceData.rect.height());
default: break; // shouldn't get here
}
} else {
- int space = (combobox->height() - 7) / 2;
+ int space = (ceData.rect.height() - 7) / 2;
switch (subcontrol) {
case SC_ComboBoxFrame:
return TQRect();
case SC_ComboBoxEditField: {
- TQRect rect = widget->rect();
+ TQRect rect = ceData.rect;
rect.addCoords(3, 3, -3, -3);
return rect; }
case SC_ComboBoxArrow: // 12 wide, 7 tall
- return TQRect(combobox->width() - 12 - space, space, 12, 7);
+ return TQRect(ceData.rect.width() - 12 - space, space, 12, 7);
default: break; // shouldn't get here
}
}
@@ -1464,14 +1456,13 @@ TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control,
case CC_Slider: {
if (subcontrol == SC_SliderHandle) {
- const TQSlider *slider = (const TQSlider *) widget;
- int tickOffset = pixelMetric( PM_SliderTickmarkOffset, widget );
- int thickness = pixelMetric( PM_SliderControlThickness, widget );
- int len = pixelMetric( PM_SliderLength, widget ) + 2;
- int sliderPos = slider->sliderStart();
+ int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget );
+ int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
+ int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ) + 2;
+ int sliderPos = ceData.startStep;
int motifBorder = 2;
- if ( slider->orientation() == Horizontal )
+ if ( ceData.orientation == Horizontal )
return TQRect( sliderPos + motifBorder, tickOffset + motifBorder, len,
thickness - 2*motifBorder );
return TQRect( tickOffset + motifBorder, sliderPos + motifBorder,
@@ -1481,7 +1472,7 @@ TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control,
#endif
default: break;
}
- return TQMotifStyle::querySubControlMetrics(control, widget, subcontrol, opt);
+ return TQMotifStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
}
@@ -1564,9 +1555,11 @@ bool TQMotifPlusStyle::eventFilter(TQObject *object, TQEvent *event)
/*! \reimp */
int TQMotifPlusStyle::styleHint(StyleHint hint,
- const TQWidget *widget,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
const TQStyleOption &opt,
- TQStyleHintReturn *returnData) const
+ TQStyleHintReturn *returnData,
+ const TQWidget *widget) const
{
int ret;
switch (hint) {
@@ -1574,7 +1567,7 @@ int TQMotifPlusStyle::styleHint(StyleHint hint,
ret = 1;
break;
default:
- ret = TQMotifStyle::styleHint(hint, widget, opt, returnData);
+ ret = TQMotifStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
break;
}
return ret;