|
|
|
@ -204,6 +204,8 @@ static void rot(TQPointArray& a, int n)
|
|
|
|
|
*/
|
|
|
|
|
void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
TQPainter *p,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQRect &r,
|
|
|
|
|
const TQColorGroup &cg,
|
|
|
|
|
SFlags flags,
|
|
|
|
@ -251,7 +253,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
case PE_ButtonTool:
|
|
|
|
|
case PE_HeaderSection:
|
|
|
|
|
qDrawShadePanel( p, r, cg, bool(flags & (Style_Down | Style_On )),
|
|
|
|
|
pixelMetric(PM_DefaultFrameWidth),
|
|
|
|
|
pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags),
|
|
|
|
|
&cg.brush(TQColorGroup::Button) );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -268,7 +270,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
r.x(), r.y() + r.height() - 1);
|
|
|
|
|
} else
|
|
|
|
|
qDrawShadePanel( p, r, cg, !showUp,
|
|
|
|
|
pixelMetric(PM_DefaultFrameWidth), &fill );
|
|
|
|
|
pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags), &fill );
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -509,7 +511,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
case PE_SpinWidgetMinus:
|
|
|
|
|
{
|
|
|
|
|
p->save();
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth );
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags );
|
|
|
|
|
TQRect br;
|
|
|
|
|
br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2,
|
|
|
|
|
r.height() - fw*2 );
|
|
|
|
@ -547,7 +549,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
case PE_SpinWidgetDown:
|
|
|
|
|
{
|
|
|
|
|
p->save();
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth );
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags );
|
|
|
|
|
TQRect br;
|
|
|
|
|
br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2,
|
|
|
|
|
r.height() - fw*2 );
|
|
|
|
@ -576,8 +578,8 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
int bsx = 0;
|
|
|
|
|
int bsy = 0;
|
|
|
|
|
if ( flags & Style_Sunken ) {
|
|
|
|
|
bsx = pixelMetric(PM_ButtonShiftHorizontal);
|
|
|
|
|
bsy = pixelMetric(PM_ButtonShiftVertical);
|
|
|
|
|
bsx = pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags);
|
|
|
|
|
bsy = pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags);
|
|
|
|
|
}
|
|
|
|
|
p->translate( sx + bsx, sy + bsy );
|
|
|
|
|
p->setPen( cg.buttonText() );
|
|
|
|
@ -665,7 +667,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
case PE_DockWindowResizeHandle:
|
|
|
|
|
{
|
|
|
|
|
const int motifOffset = 10;
|
|
|
|
|
int sw = pixelMetric( PM_SplitterWidth );
|
|
|
|
|
int sw = pixelMetric( PM_SplitterWidth, ceData, elementFlags );
|
|
|
|
|
if ( flags & Style_Horizontal ) {
|
|
|
|
|
TQCOORD yPos = r.y() + r.height() / 2;
|
|
|
|
|
TQCOORD kPos = r.width() - motifOffset - sw;
|
|
|
|
@ -694,7 +696,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
const int markH = 6;
|
|
|
|
|
int posX = r.x() + ( r.width() - markW ) / 2 - 1;
|
|
|
|
|
int posY = r.y() + ( r.height() - markH ) / 2;
|
|
|
|
|
int dfw = pixelMetric(PM_DefaultFrameWidth);
|
|
|
|
|
int dfw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags);
|
|
|
|
|
|
|
|
|
|
if (dfw < 2) {
|
|
|
|
|
// Could do with some optimizing/caching...
|
|
|
|
@ -736,12 +738,12 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
|
|
|
|
|
case PE_ScrollBarSubLine:
|
|
|
|
|
drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp),
|
|
|
|
|
p, r, cg, Style_Enabled | flags);
|
|
|
|
|
p, ceData, elementFlags, r, cg, Style_Enabled | flags);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PE_ScrollBarAddLine:
|
|
|
|
|
drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown),
|
|
|
|
|
p, r, cg, Style_Enabled | flags);
|
|
|
|
|
p, ceData, elementFlags, r, cg, Style_Enabled | flags);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PE_ScrollBarSubPage:
|
|
|
|
@ -750,7 +752,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PE_ScrollBarSlider:
|
|
|
|
|
drawPrimitive(PE_ButtonBevel, p, r, cg,
|
|
|
|
|
drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg,
|
|
|
|
|
(flags | Style_Raised) & ~Style_Down);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -760,7 +762,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
TQCommonStyle::drawPrimitive( pe, p, r, cg, flags, opt );
|
|
|
|
|
TQCommonStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -770,40 +772,40 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
*/
|
|
|
|
|
void TQMotifStyle::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
|
|
|
|
|
{
|
|
|
|
|
switch( element ) {
|
|
|
|
|
case CE_PushButton:
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_PUSHBUTTON
|
|
|
|
|
int diw, x1, y1, x2, y2;
|
|
|
|
|
const TQPushButton *btn;
|
|
|
|
|
TQColorGroup newCg = cg;
|
|
|
|
|
btn = ( const TQPushButton * )widget;
|
|
|
|
|
p->setPen( cg.foreground() );
|
|
|
|
|
p->setBrush( TQBrush( cg.button(), NoBrush ) );
|
|
|
|
|
diw = pixelMetric( PM_ButtonDefaultIndicator );
|
|
|
|
|
diw = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
|
|
|
|
|
r.coords( &x1, &y1, &x2, &y2 );
|
|
|
|
|
if ( btn->isDefault() || btn->autoDefault() ) {
|
|
|
|
|
if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) {
|
|
|
|
|
x1 += diw;
|
|
|
|
|
y1 += diw;
|
|
|
|
|
x2 -= diw;
|
|
|
|
|
y2 -= diw;
|
|
|
|
|
}
|
|
|
|
|
TQBrush fill;
|
|
|
|
|
if ( btn->isDown() )
|
|
|
|
|
if ( elementFlags & CEF_IsDown )
|
|
|
|
|
fill = newCg.brush( TQColorGroup::Mid );
|
|
|
|
|
else if ( btn->isOn() )
|
|
|
|
|
else if ( elementFlags & CEF_IsOn )
|
|
|
|
|
fill = TQBrush( newCg.mid(), Dense4Pattern );
|
|
|
|
|
else
|
|
|
|
|
fill = newCg.brush( TQColorGroup::Button );
|
|
|
|
|
|
|
|
|
|
newCg.setBrush( TQColorGroup::Button, fill );
|
|
|
|
|
if ( btn->isDefault() ) {
|
|
|
|
|
if ( elementFlags & CEF_IsDefault ) {
|
|
|
|
|
if ( diw == 0 ) {
|
|
|
|
|
TQPointArray a;
|
|
|
|
|
a.setPoints( 9,
|
|
|
|
@ -819,17 +821,17 @@ void TQMotifStyle::drawControl( ControlElement element,
|
|
|
|
|
qDrawShadePanel( p, r, newCg, TRUE );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( !btn->isFlat() || btn->isOn() || btn->isDown() ) {
|
|
|
|
|
if ( !( elementFlags & CEF_IsFlat ) || ( elementFlags & CEF_IsOn ) || ( elementFlags & CEF_IsDown ) ) {
|
|
|
|
|
TQRect tmp( x1, y1, x2 - x1 + 1, y2 - y1 + 1 );
|
|
|
|
|
SFlags flags = Style_Default;
|
|
|
|
|
if ( btn->isOn())
|
|
|
|
|
if ( elementFlags & CEF_IsOn )
|
|
|
|
|
flags |= Style_On;
|
|
|
|
|
if (btn->isDown())
|
|
|
|
|
if ( elementFlags & CEF_IsDown )
|
|
|
|
|
flags |= Style_Down;
|
|
|
|
|
p->save();
|
|
|
|
|
p->setBrushOrigin( -widget->backgroundOffset().x(),
|
|
|
|
|
-widget->backgroundOffset().y() );
|
|
|
|
|
drawPrimitive( PE_ButtonCommand, p,
|
|
|
|
|
p->setBrushOrigin( -ceData.bgOffset.x(),
|
|
|
|
|
-ceData.bgOffset.y() );
|
|
|
|
|
drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags,
|
|
|
|
|
tmp, newCg,
|
|
|
|
|
flags );
|
|
|
|
|
p->restore();
|
|
|
|
@ -843,47 +845,46 @@ void TQMotifStyle::drawControl( ControlElement element,
|
|
|
|
|
case CE_TabBarTab:
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_TABBAR
|
|
|
|
|
if ( !widget || !widget->parentWidget() || !opt.tab() )
|
|
|
|
|
if ( (elementFlags & CEF_UseGenericParameters) || !(elementFlags & CEF_HasParentWidget) || !opt.tab() )
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
const TQTabBar * tb = (const TQTabBar *) widget;
|
|
|
|
|
const TQTab * t = opt.tab();
|
|
|
|
|
|
|
|
|
|
int dfw = pixelMetric( PM_DefaultFrameWidth, tb );
|
|
|
|
|
int dfw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
|
|
|
|
|
bool selected = flags & Style_Selected;
|
|
|
|
|
int o = dfw > 1 ? 1 : 0;
|
|
|
|
|
bool lastTab = FALSE;
|
|
|
|
|
|
|
|
|
|
TQRect r2( r );
|
|
|
|
|
if ( tb->shape() == TQTabBar::RoundedAbove ) {
|
|
|
|
|
if ( styleHint( SH_TabBar_Alignment, tb ) == AlignRight &&
|
|
|
|
|
tb->indexOf( t->identifier() ) == tb->count()-1 )
|
|
|
|
|
if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) {
|
|
|
|
|
if ( styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, widget ) == AlignRight &&
|
|
|
|
|
ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1 )
|
|
|
|
|
lastTab = TRUE;
|
|
|
|
|
|
|
|
|
|
if ( o ) {
|
|
|
|
|
p->setPen( tb->colorGroup().light() );
|
|
|
|
|
p->setPen( ceData.colorGroup.light() );
|
|
|
|
|
p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() );
|
|
|
|
|
p->setPen( tb->colorGroup().light() );
|
|
|
|
|
p->setPen( ceData.colorGroup.light() );
|
|
|
|
|
p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 );
|
|
|
|
|
if ( r2.left() == 0 )
|
|
|
|
|
p->drawPoint( tb->rect().bottomLeft() );
|
|
|
|
|
p->drawPoint( ceData.rect.bottomLeft() );
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
p->setPen( tb->colorGroup().light() );
|
|
|
|
|
p->setPen( ceData.colorGroup.light() );
|
|
|
|
|
p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( selected ) {
|
|
|
|
|
p->fillRect( TQRect( r2.left()+1, r2.bottom()-o, r2.width()-3, 2),
|
|
|
|
|
tb->palette().active().brush( TQColorGroup::Background ));
|
|
|
|
|
p->setPen( tb->colorGroup().background() );
|
|
|
|
|
ceData.palette.active().brush( TQColorGroup::Background ));
|
|
|
|
|
p->setPen( ceData.colorGroup.background() );
|
|
|
|
|
// p->drawLine( r2.left()+1, r2.bottom(), r2.right()-2, r2.bottom() );
|
|
|
|
|
// if (o)
|
|
|
|
|
// p->drawLine( r2.left()+1, r2.bottom()-1, r2.right()-2, r2.bottom()-1 );
|
|
|
|
|
p->drawLine( r2.left()+1, r2.bottom(), r2.left()+1, r2.top()+2 );
|
|
|
|
|
p->setPen( tb->colorGroup().light() );
|
|
|
|
|
p->setPen( ceData.colorGroup.light() );
|
|
|
|
|
} else {
|
|
|
|
|
p->setPen( tb->colorGroup().light() );
|
|
|
|
|
p->setPen( ceData.colorGroup.light() );
|
|
|
|
|
r2.setRect( r2.left() + 2, r2.top() + 2,
|
|
|
|
|
r2.width() - 4, r2.height() - 2 );
|
|
|
|
|
}
|
|
|
|
@ -900,7 +901,7 @@ void TQMotifStyle::drawControl( ControlElement element,
|
|
|
|
|
r2.right() - 2, r2.top()+1 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p->setPen( tb->colorGroup().dark() );
|
|
|
|
|
p->setPen( ceData.colorGroup.dark() );
|
|
|
|
|
p->drawLine( r2.right() - 1, r2.top() + 2,
|
|
|
|
|
r2.right() - 1, r2.bottom() - 1 + (selected ? o : -o));
|
|
|
|
|
if ( o ) {
|
|
|
|
@ -910,19 +911,19 @@ void TQMotifStyle::drawControl( ControlElement element,
|
|
|
|
|
(selected ? (lastTab ? 0:1):1+o));
|
|
|
|
|
p->drawPoint( r2.right() - 1, r2.top() + 1 );
|
|
|
|
|
}
|
|
|
|
|
} else if ( tb->shape() == TQTabBar::RoundedBelow ) {
|
|
|
|
|
if ( styleHint( SH_TabBar_Alignment, tb ) == AlignLeft &&
|
|
|
|
|
tb->indexOf( t->identifier() ) == tb->count()-1 )
|
|
|
|
|
} else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) {
|
|
|
|
|
if ( styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, widget ) == AlignLeft &&
|
|
|
|
|
ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1 )
|
|
|
|
|
lastTab = TRUE;
|
|
|
|
|
if ( selected ) {
|
|
|
|
|
p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1),
|
|
|
|
|
tb->palette().active().brush( TQColorGroup::Background ));
|
|
|
|
|
p->setPen( tb->colorGroup().background() );
|
|
|
|
|
ceData.palette.active().brush( TQColorGroup::Background ));
|
|
|
|
|
p->setPen( ceData.colorGroup.background() );
|
|
|
|
|
// p->drawLine( r2.left()+1, r2.top(), r2.right()-2, r2.top() );
|
|
|
|
|
p->drawLine( r2.left()+1, r2.top(), r2.left()+1, r2.bottom()-2 );
|
|
|
|
|
p->setPen( tb->colorGroup().dark() );
|
|
|
|
|
p->setPen( ceData.colorGroup.dark() );
|
|
|
|
|
} else {
|
|
|
|
|
p->setPen( tb->colorGroup().dark() );
|
|
|
|
|
p->setPen( ceData.colorGroup.dark() );
|
|
|
|
|
p->drawLine( r2.left(), r2.top(), r2.right(), r2.top() );
|
|
|
|
|
p->drawLine( r2.left() + 1, r2.top() + 1,
|
|
|
|
|
r2.right() - (lastTab ? 0 : 2),
|
|
|
|
@ -946,14 +947,14 @@ void TQMotifStyle::drawControl( ControlElement element,
|
|
|
|
|
r2.left() + 2, r2.bottom() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p->setPen( tb->colorGroup().light() );
|
|
|
|
|
p->setPen( ceData.colorGroup.light() );
|
|
|
|
|
p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2),
|
|
|
|
|
r2.left(), r2.bottom() - 2 );
|
|
|
|
|
p->drawLine( r2.left() + 1, r2.top() + (selected ? 0 : 2),
|
|
|
|
|
r2.left() + 1, r2.bottom() - 3 );
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
TQCommonStyle::drawControl( element, p, widget, r, cg, flags, opt );
|
|
|
|
|
TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget );
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
@ -966,32 +967,31 @@ void TQMotifStyle::drawControl( ControlElement element,
|
|
|
|
|
case CE_ProgressBarLabel:
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_PROGRESSBAR
|
|
|
|
|
const TQProgressBar * pb = (const TQProgressBar *) widget;
|
|
|
|
|
const int unit_width = pixelMetric( PM_ProgressBarChunkWidth, pb );
|
|
|
|
|
const int unit_width = pixelMetric( PM_ProgressBarChunkWidth, ceData, elementFlags, widget );
|
|
|
|
|
int u = r.width() / unit_width;
|
|
|
|
|
int p_v = pb->progress();
|
|
|
|
|
int t_s = pb->totalSteps();
|
|
|
|
|
if ( u > 0 && pb->progress() >= INT_MAX / u && t_s >= u ) {
|
|
|
|
|
int p_v = ceData.currentStep;
|
|
|
|
|
int t_s = ceData.totalSteps;
|
|
|
|
|
if ( u > 0 && ceData.currentStep >= INT_MAX / u && t_s >= u ) {
|
|
|
|
|
// scale down to something usable.
|
|
|
|
|
p_v /= u;
|
|
|
|
|
t_s /= u;
|
|
|
|
|
}
|
|
|
|
|
if ( pb->percentageVisible() && pb->totalSteps() ) {
|
|
|
|
|
if ( ceData.percentageVisible && ceData.totalSteps ) {
|
|
|
|
|
int nu = ( u * p_v + t_s/2 ) / t_s;
|
|
|
|
|
int x = unit_width * nu;
|
|
|
|
|
if (pb->indicatorFollowsStyle() || pb->centerIndicator()) {
|
|
|
|
|
if ((elementFlags & CEF_IndicatorFollowsStyle) || (elementFlags & CEF_CenterIndicator)) {
|
|
|
|
|
p->setPen( cg.highlightedText() );
|
|
|
|
|
p->setClipRect( r.x(), r.y(), x, r.height() );
|
|
|
|
|
p->drawText( r, AlignCenter | SingleLine, pb->progressString() );
|
|
|
|
|
p->drawText( r, AlignCenter | SingleLine, ceData.progressText );
|
|
|
|
|
|
|
|
|
|
if ( pb->progress() != pb->totalSteps() ) {
|
|
|
|
|
if ( ceData.currentStep != ceData.totalSteps ) {
|
|
|
|
|
p->setClipRect( r.x() + x, r.y(), r.width() - x, r.height() );
|
|
|
|
|
p->setPen( cg.highlight() );
|
|
|
|
|
p->drawText( r, AlignCenter | SingleLine, pb->progressString() );
|
|
|
|
|
p->drawText( r, AlignCenter | SingleLine, ceData.progressText );
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
p->setPen( cg.text() );
|
|
|
|
|
p->drawText( r, AlignCenter | SingleLine, pb->progressString() );
|
|
|
|
|
p->drawText( r, AlignCenter | SingleLine, ceData.progressText );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
@ -1001,10 +1001,9 @@ void TQMotifStyle::drawControl( ControlElement element,
|
|
|
|
|
#ifndef QT_NO_POPUPMENU
|
|
|
|
|
case CE_PopupMenuItem:
|
|
|
|
|
{
|
|
|
|
|
if (! widget || opt.isDefault())
|
|
|
|
|
if ((elementFlags & CEF_UseGenericParameters) || opt.isDefault())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget;
|
|
|
|
|
TQMenuItem *mi = opt.menuItem();
|
|
|
|
|
if ( !mi )
|
|
|
|
|
break;
|
|
|
|
@ -1012,7 +1011,7 @@ void TQMotifStyle::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;
|
|
|
|
|
|
|
|
|
@ -1034,7 +1033,7 @@ void TQMotifStyle::drawControl( ControlElement element,
|
|
|
|
|
int pw = motifItemFrame;
|
|
|
|
|
|
|
|
|
|
if ( act && !dis ) { // active item frame
|
|
|
|
|
if (pixelMetric( PM_DefaultFrameWidth ) > 1)
|
|
|
|
|
if (pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) > 1)
|
|
|
|
|
qDrawShadePanel( p, x, y, w, h, cg, FALSE, pw,
|
|
|
|
|
&cg.brush( TQColorGroup::Button ) );
|
|
|
|
|
else
|
|
|
|
@ -1086,7 +1085,7 @@ void TQMotifStyle::drawControl( ControlElement element,
|
|
|
|
|
if (act)
|
|
|
|
|
cflags |= Style_On;
|
|
|
|
|
|
|
|
|
|
drawPrimitive(PE_CheckMark, p,
|
|
|
|
|
drawPrimitive(PE_CheckMark, p, ceData, elementFlags,
|
|
|
|
|
TQRect(xvis, y+motifItemFrame, mw, mh),
|
|
|
|
|
cg, cflags);
|
|
|
|
|
}
|
|
|
|
@ -1140,11 +1139,11 @@ void TQMotifStyle::drawControl( ControlElement element,
|
|
|
|
|
TQRect vr = visualRect( TQRect(x+w - motifArrowHMargin - motifItemFrame - dim,
|
|
|
|
|
y+h/2-dim/2, dim, dim), r );
|
|
|
|
|
if ( act )
|
|
|
|
|
drawPrimitive(arrow, p, vr, cg,
|
|
|
|
|
drawPrimitive(arrow, p, ceData, elementFlags, vr, cg,
|
|
|
|
|
(Style_Down |
|
|
|
|
|
(dis ? Style_Default : Style_Enabled)) );
|
|
|
|
|
else
|
|
|
|
|
drawPrimitive(arrow, p, vr, cg,
|
|
|
|
|
drawPrimitive(arrow, p, ceData, elementFlags, vr, cg,
|
|
|
|
|
(dis ? Style_Default : Style_Enabled));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1159,12 +1158,12 @@ void TQMotifStyle::drawControl( ControlElement element,
|
|
|
|
|
&cg.brush(TQColorGroup::Button) );
|
|
|
|
|
else // other item
|
|
|
|
|
p->fillRect( r, cg.brush(TQColorGroup::Button) );
|
|
|
|
|
TQCommonStyle::drawControl( element, p, widget, r, cg, flags, opt );
|
|
|
|
|
TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
TQCommonStyle::drawControl( element, p, widget, r, cg, flags, opt );
|
|
|
|
|
TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1220,20 +1219,22 @@ static void get_combo_parameters( const TQRect &r,
|
|
|
|
|
*/
|
|
|
|
|
void TQMotifStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
TQPainter *p,
|
|
|
|
|
const TQWidget *widget,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQRect &r,
|
|
|
|
|
const TQColorGroup &cg,
|
|
|
|
|
SFlags flags,
|
|
|
|
|
SCFlags sub,
|
|
|
|
|
SCFlags subActive,
|
|
|
|
|
const TQStyleOption& opt ) const
|
|
|
|
|
const TQStyleOption& opt,
|
|
|
|
|
const TQWidget *widget ) const
|
|
|
|
|
{
|
|
|
|
|
switch ( control ) {
|
|
|
|
|
case CC_SpinWidget: {
|
|
|
|
|
SCFlags drawSub = SC_None;
|
|
|
|
|
if ( sub & SC_SpinWidgetFrame )
|
|
|
|
|
qDrawShadePanel( p, r, cg, TRUE,
|
|
|
|
|
pixelMetric( PM_DefaultFrameWidth) );
|
|
|
|
|
pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) );
|
|
|
|
|
|
|
|
|
|
if ( sub & SC_SpinWidgetUp || sub & SC_SpinWidgetDown ) {
|
|
|
|
|
if ( sub & SC_SpinWidgetUp )
|
|
|
|
@ -1241,20 +1242,18 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
if ( sub & SC_SpinWidgetDown )
|
|
|
|
|
drawSub |= SC_SpinWidgetDown;
|
|
|
|
|
|
|
|
|
|
TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags,
|
|
|
|
|
drawSub, subActive, opt );
|
|
|
|
|
TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags,
|
|
|
|
|
drawSub, subActive, opt, widget );
|
|
|
|
|
}
|
|
|
|
|
break; }
|
|
|
|
|
|
|
|
|
|
case CC_Slider:
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_SLIDER
|
|
|
|
|
const TQSlider * slider = (const TQSlider *) widget;
|
|
|
|
|
|
|
|
|
|
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 ((sub & SC_SliderGroove) && groove.isValid()) {
|
|
|
|
|
qDrawShadePanel( p, groove, cg, TRUE, 2,
|
|
|
|
@ -1262,15 +1261,15 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( flags & Style_HasFocus ) {
|
|
|
|
|
TQRect fr = subRect( SR_SliderFocusRect, widget );
|
|
|
|
|
drawPrimitive( PE_FocusRect, p, fr, cg );
|
|
|
|
|
TQRect fr = subRect( SR_SliderFocusRect, ceData, elementFlags, widget );
|
|
|
|
|
drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (( sub & SC_SliderHandle ) && handle.isValid()) {
|
|
|
|
|
drawPrimitive( PE_ButtonBevel, p, handle, cg );
|
|
|
|
|
drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, handle, cg );
|
|
|
|
|
|
|
|
|
|
if ( slider->orientation() == Horizontal ) {
|
|
|
|
|
if ( ceData.orientation == Horizontal ) {
|
|
|
|
|
TQCOORD mid = handle.x() + handle.width() / 2;
|
|
|
|
|
qDrawShadeLine( p, mid, handle.y(), mid,
|
|
|
|
|
handle.y() + handle.height() - 2,
|
|
|
|
@ -1284,9 +1283,9 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( sub & SC_SliderTickmarks )
|
|
|
|
|
TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags,
|
|
|
|
|
TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags,
|
|
|
|
|
SC_SliderTickmarks, subActive,
|
|
|
|
|
opt );
|
|
|
|
|
opt, widget );
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -1296,12 +1295,12 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
if ( sub & SC_ComboBoxArrow ) {
|
|
|
|
|
const TQComboBox * cb = (const TQComboBox *) widget;
|
|
|
|
|
int awh, ax, ay, sh, sy, dh, ew;
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, cb);
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, cb);
|
|
|
|
|
|
|
|
|
|
drawPrimitive( PE_ButtonCommand, p, r, cg, flags );
|
|
|
|
|
TQRect ar = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, cb, SC_ComboBoxArrow,
|
|
|
|
|
opt ), cb );
|
|
|
|
|
drawPrimitive( PE_ArrowDown, p, ar, cg, flags | Style_Enabled );
|
|
|
|
|
drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags );
|
|
|
|
|
TQRect ar = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow,
|
|
|
|
|
opt, cb ), ceData, elementFlags );
|
|
|
|
|
drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags | Style_Enabled );
|
|
|
|
|
|
|
|
|
|
TQRect tr = r;
|
|
|
|
|
tr.addCoords( fw, fw, -fw, -fw );
|
|
|
|
@ -1316,16 +1315,16 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
p->drawLine( ar.x()+awh-1, sy+1, ar.x()+awh-1, sy+sh-1 );
|
|
|
|
|
|
|
|
|
|
if ( cb->hasFocus() ) {
|
|
|
|
|
TQRect re = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, cb ), cb );
|
|
|
|
|
drawPrimitive( PE_FocusRect, p, re, cg );
|
|
|
|
|
TQRect re = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, cb ), ceData, elementFlags );
|
|
|
|
|
drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( sub & SC_ComboBoxEditField ) {
|
|
|
|
|
TQComboBox * cb = (TQComboBox *) widget;
|
|
|
|
|
if ( cb->editable() ) {
|
|
|
|
|
TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, cb,
|
|
|
|
|
SC_ComboBoxEditField ), cb );
|
|
|
|
|
TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
|
|
|
|
|
SC_ComboBoxEditField, cb ), ceData, elementFlags );
|
|
|
|
|
er.addCoords( -1, -1, 1, 1);
|
|
|
|
|
qDrawShadePanel( p, er, cg, TRUE, 1,
|
|
|
|
|
&cg.brush( TQColorGroup::Button ));
|
|
|
|
@ -1340,11 +1339,11 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
if (sub == (SC_ScrollBarAddLine | SC_ScrollBarSubLine | SC_ScrollBarAddPage |
|
|
|
|
|
SC_ScrollBarSubPage | SC_ScrollBarFirst | SC_ScrollBarLast |
|
|
|
|
|
SC_ScrollBarSlider))
|
|
|
|
|
qDrawShadePanel(p, widget->rect(), cg, TRUE,
|
|
|
|
|
pixelMetric(PM_DefaultFrameWidth, widget),
|
|
|
|
|
qDrawShadePanel(p, ceData.rect, cg, TRUE,
|
|
|
|
|
pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget),
|
|
|
|
|
&cg.brush(TQColorGroup::Mid));
|
|
|
|
|
TQCommonStyle::drawComplexControl(control, p, widget, r, cg, flags, sub,
|
|
|
|
|
subActive, opt);
|
|
|
|
|
TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, sub,
|
|
|
|
|
subActive, opt, widget);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1352,7 +1351,7 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
case CC_ListView:
|
|
|
|
|
{
|
|
|
|
|
if ( sub & SC_ListView ) {
|
|
|
|
|
TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags, sub, subActive, opt );
|
|
|
|
|
TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, sub, subActive, opt, widget );
|
|
|
|
|
}
|
|
|
|
|
if ( sub & ( SC_ListViewBranch | SC_ListViewExpand ) ) {
|
|
|
|
|
if (opt.isDefault())
|
|
|
|
@ -1455,14 +1454,14 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
#endif // QT_NO_LISTVIEW
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags,
|
|
|
|
|
sub, subActive, opt );
|
|
|
|
|
TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags,
|
|
|
|
|
sub, subActive, opt, widget );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*! \reimp */
|
|
|
|
|
int TQMotifStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) const
|
|
|
|
|
int TQMotifStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
@ -1519,9 +1518,9 @@ int TQMotifStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) cons
|
|
|
|
|
#ifndef QT_NO_SLIDER
|
|
|
|
|
const TQSlider * sl = (const TQSlider *) widget;
|
|
|
|
|
if ( sl->orientation() == Horizontal )
|
|
|
|
|
ret = sl->width() - pixelMetric( PM_SliderLength, sl ) - 6;
|
|
|
|
|
ret = sl->width() - pixelMetric( PM_SliderLength, ceData, elementFlags, sl ) - 6;
|
|
|
|
|
else
|
|
|
|
|
ret = sl->height() - pixelMetric( PM_SliderLength, sl ) - 6;
|
|
|
|
|
ret = sl->height() - pixelMetric( PM_SliderLength, ceData, elementFlags, sl ) - 6;
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -1540,7 +1539,7 @@ int TQMotifStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) cons
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
ret = TQCommonStyle::pixelMetric( metric, widget );
|
|
|
|
|
ret = TQCommonStyle::pixelMetric( metric, ceData, elementFlags, widget );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
@ -1550,24 +1549,26 @@ int TQMotifStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) cons
|
|
|
|
|
/*!\reimp
|
|
|
|
|
*/
|
|
|
|
|
TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
|
|
|
|
|
const TQWidget *widget,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
SubControl sc,
|
|
|
|
|
const TQStyleOption& opt ) const
|
|
|
|
|
const TQStyleOption& opt,
|
|
|
|
|
const TQWidget *widget ) const
|
|
|
|
|
{
|
|
|
|
|
switch ( control ) {
|
|
|
|
|
case CC_SpinWidget: {
|
|
|
|
|
if ( !widget )
|
|
|
|
|
if ( elementFlags & CEF_UseGenericParameters )
|
|
|
|
|
return TQRect();
|
|
|
|
|
int fw = pixelMetric( PM_SpinBoxFrameWidth, 0 );
|
|
|
|
|
int fw = pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags, 0 );
|
|
|
|
|
TQSize bs;
|
|
|
|
|
bs.setHeight( widget->height()/2 );
|
|
|
|
|
bs.setHeight( ceData.rect.height()/2 );
|
|
|
|
|
if ( bs.height() < 8 )
|
|
|
|
|
bs.setHeight( 8 );
|
|
|
|
|
bs.setWidth( TQMIN( bs.height() * 8 / 5, widget->width() / 4 ) ); // 1.6 -approximate golden mean
|
|
|
|
|
bs.setWidth( TQMIN( bs.height() * 8 / 5, ceData.rect.width() / 4 ) ); // 1.6 -approximate golden mean
|
|
|
|
|
bs = bs.expandedTo( TQApplication::globalStrut() );
|
|
|
|
|
int y = 0;
|
|
|
|
|
int x, lx, rx;
|
|
|
|
|
x = widget->width() - y - bs.width();
|
|
|
|
|
x = ceData.rect.width() - y - bs.width();
|
|
|
|
|
lx = fw;
|
|
|
|
|
rx = x - fw * 2;
|
|
|
|
|
switch ( sc ) {
|
|
|
|
@ -1576,12 +1577,12 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
|
|
|
|
|
case SC_SpinWidgetDown:
|
|
|
|
|
return TQRect(x, y + bs.height(), bs.width(), bs.height());
|
|
|
|
|
case SC_SpinWidgetButtonField:
|
|
|
|
|
return TQRect(x, y, bs.width(), widget->height() - 2*fw);
|
|
|
|
|
return TQRect(x, y, bs.width(), ceData.rect.height() - 2*fw);
|
|
|
|
|
case SC_SpinWidgetEditField:
|
|
|
|
|
return TQRect(lx, fw, rx, widget->height() - 2*fw);
|
|
|
|
|
return TQRect(lx, fw, rx, ceData.rect.height() - 2*fw);
|
|
|
|
|
case SC_SpinWidgetFrame:
|
|
|
|
|
return TQRect( 0, 0,
|
|
|
|
|
widget->width() - bs.width(), widget->height() );
|
|
|
|
|
ceData.rect.width() - bs.width(), ceData.rect.height() );
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -1590,14 +1591,13 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
|
|
|
|
|
#ifndef QT_NO_SLIDER
|
|
|
|
|
case CC_Slider: {
|
|
|
|
|
if (sc == SC_SliderHandle) {
|
|
|
|
|
const TQSlider * sl = (const TQSlider *) widget;
|
|
|
|
|
int tickOffset = pixelMetric( PM_SliderTickmarkOffset, sl );
|
|
|
|
|
int thickness = pixelMetric( PM_SliderControlThickness, sl );
|
|
|
|
|
int sliderPos = sl->sliderStart();
|
|
|
|
|
int len = pixelMetric( PM_SliderLength, sl );
|
|
|
|
|
int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget );
|
|
|
|
|
int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
|
|
|
|
|
int sliderPos = ceData.startStep;
|
|
|
|
|
int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget );
|
|
|
|
|
int motifBorder = 3;
|
|
|
|
|
|
|
|
|
|
if ( sl->orientation() == Horizontal )
|
|
|
|
|
if ( ceData.orientation == Horizontal )
|
|
|
|
|
return TQRect( sliderPos + motifBorder, tickOffset + motifBorder, len,
|
|
|
|
|
thickness - 2*motifBorder );
|
|
|
|
|
return TQRect( tickOffset + motifBorder, sliderPos + motifBorder,
|
|
|
|
@ -1608,25 +1608,24 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
|
|
|
|
|
|
|
|
|
|
#ifndef QT_NO_SCROLLBAR
|
|
|
|
|
case CC_ScrollBar: {
|
|
|
|
|
if (! widget)
|
|
|
|
|
if (elementFlags & CEF_UseGenericParameters)
|
|
|
|
|
return TQRect();
|
|
|
|
|
|
|
|
|
|
const TQScrollBar *scrollbar = (const TQScrollBar *) widget;
|
|
|
|
|
int sliderstart = scrollbar->sliderStart();
|
|
|
|
|
int sbextent = pixelMetric(PM_ScrollBarExtent, widget);
|
|
|
|
|
int fw = pixelMetric(PM_DefaultFrameWidth, widget);
|
|
|
|
|
int sliderstart = ceData.startStep;
|
|
|
|
|
int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget);
|
|
|
|
|
int fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget);
|
|
|
|
|
int buttonw = sbextent - (fw * 2);
|
|
|
|
|
int buttonh = sbextent - (fw * 2);
|
|
|
|
|
int maxlen = ((scrollbar->orientation() == TQt::Horizontal) ?
|
|
|
|
|
scrollbar->width() : scrollbar->height()) -
|
|
|
|
|
int maxlen = ((ceData.orientation == TQt::Horizontal) ?
|
|
|
|
|
ceData.rect.width() : ceData.rect.height()) -
|
|
|
|
|
(buttonw * 2) - (fw * 2);
|
|
|
|
|
int sliderlen;
|
|
|
|
|
|
|
|
|
|
// calculate slider length
|
|
|
|
|
if (scrollbar->maxValue() != scrollbar->minValue()) {
|
|
|
|
|
uint range = scrollbar->maxValue() - scrollbar->minValue();
|
|
|
|
|
sliderlen = (scrollbar->pageStep() * maxlen) /
|
|
|
|
|
(range + scrollbar->pageStep());
|
|
|
|
|
if (ceData.maxSteps != ceData.minSteps) {
|
|
|
|
|
uint range = ceData.maxSteps - ceData.minSteps;
|
|
|
|
|
sliderlen = (ceData.pageStep * maxlen) /
|
|
|
|
|
(range + ceData.pageStep);
|
|
|
|
|
|
|
|
|
|
if ( sliderlen < 9 || range > INT_MAX/2 )
|
|
|
|
|
sliderlen = 9;
|
|
|
|
@ -1638,47 +1637,47 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
|
|
|
|
|
switch (sc) {
|
|
|
|
|
case SC_ScrollBarSubLine:
|
|
|
|
|
// top/left button
|
|
|
|
|
if (scrollbar->orientation() == TQt::Horizontal) {
|
|
|
|
|
if ( scrollbar->width()/2 < sbextent )
|
|
|
|
|
buttonw = scrollbar->width()/2 - (fw*2);
|
|
|
|
|
if (ceData.orientation == TQt::Horizontal) {
|
|
|
|
|
if ( ceData.rect.width()/2 < sbextent )
|
|
|
|
|
buttonw = ceData.rect.width()/2 - (fw*2);
|
|
|
|
|
return TQRect(fw, fw, buttonw, buttonh);
|
|
|
|
|
} else {
|
|
|
|
|
if ( scrollbar->height()/2 < sbextent )
|
|
|
|
|
buttonh = scrollbar->height()/2 - (fw*2);
|
|
|
|
|
if ( ceData.rect.height()/2 < sbextent )
|
|
|
|
|
buttonh = ceData.rect.height()/2 - (fw*2);
|
|
|
|
|
return TQRect(fw, fw, buttonw, buttonh);
|
|
|
|
|
}
|
|
|
|
|
case SC_ScrollBarAddLine:
|
|
|
|
|
// bottom/right button
|
|
|
|
|
if (scrollbar->orientation() == TQt::Horizontal) {
|
|
|
|
|
if ( scrollbar->width()/2 < sbextent )
|
|
|
|
|
buttonw = scrollbar->width()/2 - (fw*2);
|
|
|
|
|
return TQRect(scrollbar->width() - buttonw - fw, fw,
|
|
|
|
|
if (ceData.orientation == TQt::Horizontal) {
|
|
|
|
|
if ( ceData.rect.width()/2 < sbextent )
|
|
|
|
|
buttonw = ceData.rect.width()/2 - (fw*2);
|
|
|
|
|
return TQRect(ceData.rect.width() - buttonw - fw, fw,
|
|
|
|
|
buttonw, buttonh);
|
|
|
|
|
} else {
|
|
|
|
|
if ( scrollbar->height()/2 < sbextent )
|
|
|
|
|
buttonh = scrollbar->height()/2 - (fw*2);
|
|
|
|
|
return TQRect(fw, scrollbar->height() - buttonh - fw,
|
|
|
|
|
if ( ceData.rect.height()/2 < sbextent )
|
|
|
|
|
buttonh = ceData.rect.height()/2 - (fw*2);
|
|
|
|
|
return TQRect(fw, ceData.rect.height() - buttonh - fw,
|
|
|
|
|
buttonw, buttonh);
|
|
|
|
|
}
|
|
|
|
|
case SC_ScrollBarSubPage:
|
|
|
|
|
if (scrollbar->orientation() == TQt::Horizontal)
|
|
|
|
|
if (ceData.orientation == TQt::Horizontal)
|
|
|
|
|
return TQRect(buttonw + fw, fw, sliderstart - buttonw - fw, buttonw);
|
|
|
|
|
return TQRect(fw, buttonw + fw, buttonw, sliderstart - buttonw - fw);
|
|
|
|
|
|
|
|
|
|
case SC_ScrollBarAddPage:
|
|
|
|
|
if (scrollbar->orientation() == TQt::Horizontal)
|
|
|
|
|
if (ceData.orientation == TQt::Horizontal)
|
|
|
|
|
return TQRect(sliderstart + sliderlen, fw,
|
|
|
|
|
maxlen - sliderstart - sliderlen + buttonw + fw, buttonw);
|
|
|
|
|
return TQRect(fw, sliderstart + sliderlen, buttonw,
|
|
|
|
|
maxlen - sliderstart - sliderlen + buttonw + fw);
|
|
|
|
|
|
|
|
|
|
case SC_ScrollBarGroove:
|
|
|
|
|
if (scrollbar->orientation() == TQt::Horizontal)
|
|
|
|
|
if (ceData.orientation == TQt::Horizontal)
|
|
|
|
|
return TQRect(buttonw + fw, fw, maxlen, buttonw);
|
|
|
|
|
return TQRect(fw, buttonw + fw, buttonw, maxlen);
|
|
|
|
|
|
|
|
|
|
case SC_ScrollBarSlider:
|
|
|
|
|
if (scrollbar->orientation() == TQt::Horizontal)
|
|
|
|
|
if (ceData.orientation == TQt::Horizontal)
|
|
|
|
|
return TQRect(sliderstart, fw, sliderlen, buttonw);
|
|
|
|
|
return TQRect(fw, sliderstart, buttonw, sliderlen);
|
|
|
|
|
|
|
|
|
@ -1693,18 +1692,16 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
|
|
|
|
|
|
|
|
|
|
switch ( sc ) {
|
|
|
|
|
case SC_ComboBoxArrow: {
|
|
|
|
|
const TQComboBox * cb = (const TQComboBox *) widget;
|
|
|
|
|
int ew, awh, sh, dh, ax, ay, sy;
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, cb );
|
|
|
|
|
TQRect cr = cb->rect();
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
|
|
|
|
|
TQRect cr = ceData.rect;
|
|
|
|
|
cr.addCoords( fw, fw, -fw, -fw );
|
|
|
|
|
get_combo_parameters( cr, ew, awh, ax, ay, sh, dh, sy );
|
|
|
|
|
return TQRect( ax, ay, awh, awh ); }
|
|
|
|
|
|
|
|
|
|
case SC_ComboBoxEditField: {
|
|
|
|
|
const TQComboBox * cb = (const TQComboBox *) widget;
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, cb );
|
|
|
|
|
TQRect rect = cb->rect();
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
|
|
|
|
|
TQRect rect = ceData.rect;
|
|
|
|
|
rect.addCoords( fw, fw, -fw, -fw );
|
|
|
|
|
int ew = get_combo_extra_width( rect.height(), rect.width() );
|
|
|
|
|
rect.addCoords( 1, 1, -1-ew, -1 );
|
|
|
|
@ -1717,15 +1714,17 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
|
|
|
|
|
#endif
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
|
|
|
|
return TQCommonStyle::querySubControlMetrics( control, widget, sc, opt );
|
|
|
|
|
return TQCommonStyle::querySubControlMetrics( control, ceData, elementFlags, sc, opt, widget );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!\reimp
|
|
|
|
|
*/
|
|
|
|
|
TQSize TQMotifStyle::sizeFromContents( ContentsType contents,
|
|
|
|
|
const TQWidget *widget,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQSize &contentsSize,
|
|
|
|
|
const TQStyleOption& opt ) const
|
|
|
|
|
const TQStyleOption& opt,
|
|
|
|
|
const TQWidget *widget ) const
|
|
|
|
|
{
|
|
|
|
|
TQSize sz(contentsSize);
|
|
|
|
|
|
|
|
|
@ -1733,10 +1732,9 @@ TQSize TQMotifStyle::sizeFromContents( ContentsType contents,
|
|
|
|
|
case CT_PushButton:
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_PUSHBUTTON
|
|
|
|
|
const TQPushButton *button = (const TQPushButton *) widget;
|
|
|
|
|
sz = TQCommonStyle::sizeFromContents(contents, widget, contentsSize, opt);
|
|
|
|
|
if ((button->isDefault() || button->autoDefault()) &&
|
|
|
|
|
sz.width() < 80 && ! button->pixmap())
|
|
|
|
|
sz = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, opt, widget);
|
|
|
|
|
if (((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) &&
|
|
|
|
|
sz.width() < 80 && ceData.fgPixmap.isNull())
|
|
|
|
|
sz.setWidth(80);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
@ -1745,11 +1743,10 @@ TQSize TQMotifStyle::sizeFromContents( ContentsType contents,
|
|
|
|
|
case CT_PopupMenuItem:
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_POPUPMENU
|
|
|
|
|
if (! widget || opt.isDefault())
|
|
|
|
|
if ((elementFlags & CEF_UseGenericParameters) || opt.isDefault())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
const TQPopupMenu *popup = (TQPopupMenu *) widget;
|
|
|
|
|
bool checkable = popup->isCheckable();
|
|
|
|
|
bool checkable = (elementFlags & CEF_IsCheckable);
|
|
|
|
|
TQMenuItem *mi = opt.menuItem();
|
|
|
|
|
int maxpmw = opt.maxIconWidth();
|
|
|
|
|
int w = sz.width(), h = sz.height();
|
|
|
|
@ -1794,7 +1791,7 @@ TQSize TQMotifStyle::sizeFromContents( ContentsType contents,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
sz = TQCommonStyle::sizeFromContents( contents, widget, contentsSize, opt );
|
|
|
|
|
sz = TQCommonStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, opt, widget );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1803,21 +1800,21 @@ TQSize TQMotifStyle::sizeFromContents( ContentsType contents,
|
|
|
|
|
|
|
|
|
|
/*!\reimp
|
|
|
|
|
*/
|
|
|
|
|
TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const
|
|
|
|
|
TQRect TQMotifStyle::subRect( SubRect r, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const
|
|
|
|
|
{
|
|
|
|
|
TQRect rect;
|
|
|
|
|
TQRect wrect = widget->rect();
|
|
|
|
|
TQRect wrect = ceData.rect;
|
|
|
|
|
|
|
|
|
|
switch ( r ) {
|
|
|
|
|
case SR_SliderFocusRect:
|
|
|
|
|
rect = TQCommonStyle::subRect( r, widget );
|
|
|
|
|
rect = TQCommonStyle::subRect( r, ceData, elementFlags, widget );
|
|
|
|
|
rect.addCoords( 2, 2, -2, -2 );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SR_ComboBoxFocusRect:
|
|
|
|
|
{
|
|
|
|
|
int awh, ax, ay, sh, sy, dh, ew;
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, widget );
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
|
|
|
|
|
TQRect tr = wrect;
|
|
|
|
|
|
|
|
|
|
tr.addCoords( fw, fw, -fw, -fw );
|
|
|
|
@ -1829,17 +1826,16 @@ TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const
|
|
|
|
|
case SR_DockWindowHandleRect:
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_MAINWINDOW
|
|
|
|
|
if ( !widget || !widget->parent() )
|
|
|
|
|
if ( (elementFlags & CEF_UseGenericParameters) || !(elementFlags & CEF_HasParentWidget) )
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
const TQDockWindow * dw = (const TQDockWindow *) widget->parent();
|
|
|
|
|
if ( !dw->area() || !dw->isCloseEnabled() )
|
|
|
|
|
rect.setRect( 0, 0, widget->width(), widget->height() );
|
|
|
|
|
if ( !ceData.dwData.hasDockArea || !ceData.dwData.closeEnabled )
|
|
|
|
|
rect.setRect( 0, 0, ceData.rect.width(), ceData.rect.height() );
|
|
|
|
|
else {
|
|
|
|
|
if ( dw->area()->orientation() == Horizontal )
|
|
|
|
|
rect.setRect(2, 15, widget->width()-2, widget->height() - 15);
|
|
|
|
|
if ( ceData.dwData.areaOrientation == Horizontal )
|
|
|
|
|
rect.setRect(2, 15, ceData.rect.width()-2, ceData.rect.height() - 15);
|
|
|
|
|
else
|
|
|
|
|
rect.setRect(0, 2, widget->width() - 15, widget->height() - 2);
|
|
|
|
|
rect.setRect(0, 2, ceData.rect.width() - 15, ceData.rect.height() - 2);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
@ -1849,15 +1845,14 @@ TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const
|
|
|
|
|
case SR_ProgressBarContents:
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_PROGRESSBAR
|
|
|
|
|
TQFontMetrics fm( ( widget ? widget->fontMetrics() :
|
|
|
|
|
TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) :
|
|
|
|
|
TQApplication::fontMetrics() ) );
|
|
|
|
|
const TQProgressBar *progressbar = (const TQProgressBar *) widget;
|
|
|
|
|
int textw = 0;
|
|
|
|
|
if (progressbar->percentageVisible())
|
|
|
|
|
if (ceData.percentageVisible)
|
|
|
|
|
textw = fm.width("100%") + 6;
|
|
|
|
|
|
|
|
|
|
if (progressbar->indicatorFollowsStyle() ||
|
|
|
|
|
progressbar->centerIndicator())
|
|
|
|
|
if ((elementFlags & CEF_IndicatorFollowsStyle) ||
|
|
|
|
|
(elementFlags & CEF_CenterIndicator))
|
|
|
|
|
rect = wrect;
|
|
|
|
|
else
|
|
|
|
|
rect.setCoords(wrect.left(), wrect.top(),
|
|
|
|
@ -1869,15 +1864,14 @@ TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const
|
|
|
|
|
case SR_ProgressBarLabel:
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_PROGRESSBAR
|
|
|
|
|
TQFontMetrics fm( ( widget ? widget->fontMetrics() :
|
|
|
|
|
TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) :
|
|
|
|
|
TQApplication::fontMetrics() ) );
|
|
|
|
|
const TQProgressBar *progressbar = (const TQProgressBar *) widget;
|
|
|
|
|
int textw = 0;
|
|
|
|
|
if (progressbar->percentageVisible())
|
|
|
|
|
if (ceData.percentageVisible)
|
|
|
|
|
textw = fm.width("100%") + 6;
|
|
|
|
|
|
|
|
|
|
if (progressbar->indicatorFollowsStyle() ||
|
|
|
|
|
progressbar->centerIndicator())
|
|
|
|
|
if ((elementFlags & CEF_IndicatorFollowsStyle) ||
|
|
|
|
|
(elementFlags & CEF_CenterIndicator))
|
|
|
|
|
rect = wrect;
|
|
|
|
|
else
|
|
|
|
|
rect.setCoords(wrect.right() - textw, wrect.top(),
|
|
|
|
@ -1889,7 +1883,7 @@ TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const
|
|
|
|
|
case SR_CheckBoxContents:
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_CHECKBOX
|
|
|
|
|
TQRect ir = subRect(SR_CheckBoxIndicator, widget);
|
|
|
|
|
TQRect ir = subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget);
|
|
|
|
|
rect.setRect(ir.right() + 10, wrect.y(),
|
|
|
|
|
wrect.width() - ir.width() - 10, wrect.height());
|
|
|
|
|
#endif
|
|
|
|
@ -1898,14 +1892,14 @@ TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const
|
|
|
|
|
|
|
|
|
|
case SR_RadioButtonContents:
|
|
|
|
|
{
|
|
|
|
|
TQRect ir = subRect(SR_RadioButtonIndicator, widget);
|
|
|
|
|
TQRect ir = subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget);
|
|
|
|
|
rect.setRect(ir.right() + 10, wrect.y(),
|
|
|
|
|
wrect.width() - ir.width() - 10, wrect.height());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
rect = TQCommonStyle::subRect( r, widget );
|
|
|
|
|
rect = TQCommonStyle::subRect( r, ceData, elementFlags, widget );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rect;
|
|
|
|
@ -2228,8 +2222,10 @@ static const char *const question_xpm[] = {
|
|
|
|
|
\reimp
|
|
|
|
|
*/
|
|
|
|
|
TQPixmap TQMotifStyle::stylePixmap(StylePixmap sp,
|
|
|
|
|
const TQWidget *widget,
|
|
|
|
|
const TQStyleOption& opt) const
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQStyleOption& opt,
|
|
|
|
|
const TQWidget *widget) const
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_IMAGEIO_XPM
|
|
|
|
|
switch (sp) {
|
|
|
|
@ -2306,15 +2302,17 @@ TQPixmap TQMotifStyle::stylePixmap(StylePixmap sp,
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return TQCommonStyle::stylePixmap(sp, widget, opt);
|
|
|
|
|
return TQCommonStyle::stylePixmap(sp, ceData, elementFlags, opt, widget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*! \reimp */
|
|
|
|
|
int TQMotifStyle::styleHint(StyleHint hint,
|
|
|
|
|
const TQWidget *widget,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQStyleOption &opt,
|
|
|
|
|
TQStyleHintReturn *returnData) const
|
|
|
|
|
TQStyleHintReturn *returnData,
|
|
|
|
|
const TQWidget *widget) const
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
@ -2348,7 +2346,7 @@ int TQMotifStyle::styleHint(StyleHint hint,
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
ret = TQCommonStyle::styleHint(hint, widget, opt, returnData);
|
|
|
|
|
ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|