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