|
|
@ -225,6 +225,9 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
SFlags flags,
|
|
|
|
SFlags flags,
|
|
|
|
const TQStyleOption& opt ) const
|
|
|
|
const TQStyleOption& opt ) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool dis = !(flags & Style_Enabled);
|
|
|
|
|
|
|
|
bool act = flags & Style_Active;
|
|
|
|
|
|
|
|
|
|
|
|
TQRect rr( r );
|
|
|
|
TQRect rr( r );
|
|
|
|
switch (pe) {
|
|
|
|
switch (pe) {
|
|
|
|
case PE_ButtonCommand:
|
|
|
|
case PE_ButtonCommand:
|
|
|
@ -568,6 +571,63 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case PE_MenuItemIndicatorFrame:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int x, y, w, h;
|
|
|
|
|
|
|
|
r.rect( &x, &y, &w, &h );
|
|
|
|
|
|
|
|
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQRect vrect = visualRect( TQRect( x, y, checkcol, h ), r );
|
|
|
|
|
|
|
|
int xvis = vrect.x();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( act && !dis ) {
|
|
|
|
|
|
|
|
qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
TQBrush fill( cg.light(), Dense4Pattern );
|
|
|
|
|
|
|
|
// set the brush origin for the hash pattern to the x/y coordinate
|
|
|
|
|
|
|
|
// of the menu item's checkmark... this way, the check marks have
|
|
|
|
|
|
|
|
// a consistent look
|
|
|
|
|
|
|
|
TQPoint origin = p->brushOrigin();
|
|
|
|
|
|
|
|
p->setBrushOrigin( xvis, y );
|
|
|
|
|
|
|
|
qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &fill );
|
|
|
|
|
|
|
|
// restore the previous brush origin
|
|
|
|
|
|
|
|
p->setBrushOrigin( origin );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case PE_MenuItemIndicatorIconFrame:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int x, y, w, h;
|
|
|
|
|
|
|
|
r.rect( &x, &y, &w, &h );
|
|
|
|
|
|
|
|
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQRect vrect = visualRect( TQRect( x, y, checkcol, h ), r );
|
|
|
|
|
|
|
|
int xvis = vrect.x();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qDrawShadePanel( p, xvis, y, w, h, cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case PE_MenuItemIndicatorCheck:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int x, y, w, h;
|
|
|
|
|
|
|
|
r.rect( &x, &y, &w, &h );
|
|
|
|
|
|
|
|
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int xp = x + windowsItemFrame;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SFlags cflags = Style_Default;
|
|
|
|
|
|
|
|
if (! dis)
|
|
|
|
|
|
|
|
cflags |= Style_Enabled;
|
|
|
|
|
|
|
|
if (act)
|
|
|
|
|
|
|
|
cflags |= Style_On;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, visualRect( TQRect(xp, y + windowsItemFrame, checkcol - 2*windowsItemFrame, h - 2*windowsItemFrame), r ), cg, cflags);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) {
|
|
|
|
if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) {
|
|
|
|
TQPointArray a;
|
|
|
|
TQPointArray a;
|
|
|
@ -809,21 +869,7 @@ void TQWindowsStyle::drawControl( ControlElement element,
|
|
|
|
TQRect vrect = visualRect( TQRect( xpos, y, checkcol, h ), r );
|
|
|
|
TQRect vrect = visualRect( TQRect( xpos, y, checkcol, h ), r );
|
|
|
|
int xvis = vrect.x();
|
|
|
|
int xvis = vrect.x();
|
|
|
|
if ( mi->isChecked() ) {
|
|
|
|
if ( mi->isChecked() ) {
|
|
|
|
if ( act && !dis )
|
|
|
|
drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt);
|
|
|
|
qDrawShadePanel( p, xvis, y, checkcol, h,
|
|
|
|
|
|
|
|
cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) );
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
TQBrush fill( cg.light(), Dense4Pattern );
|
|
|
|
|
|
|
|
// set the brush origin for the hash pattern to the x/y coordinate
|
|
|
|
|
|
|
|
// of the menu item's checkmark... this way, the check marks have
|
|
|
|
|
|
|
|
// a consistent look
|
|
|
|
|
|
|
|
TQPoint origin = p->brushOrigin();
|
|
|
|
|
|
|
|
p->setBrushOrigin( xvis, y );
|
|
|
|
|
|
|
|
qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1,
|
|
|
|
|
|
|
|
&fill );
|
|
|
|
|
|
|
|
// restore the previous brush origin
|
|
|
|
|
|
|
|
p->setBrushOrigin( origin );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (! act)
|
|
|
|
} else if (! act)
|
|
|
|
p->fillRect(xvis, y, checkcol , h, cg.brush( TQColorGroup::Button ));
|
|
|
|
p->fillRect(xvis, y, checkcol , h, cg.brush( TQColorGroup::Button ));
|
|
|
|
|
|
|
|
|
|
|
@ -839,8 +885,7 @@ void TQWindowsStyle::drawControl( ControlElement element,
|
|
|
|
int pixw = pixmap.width();
|
|
|
|
int pixw = pixmap.width();
|
|
|
|
int pixh = pixmap.height();
|
|
|
|
int pixh = pixmap.height();
|
|
|
|
if ( act && !dis && !mi->isChecked() )
|
|
|
|
if ( act && !dis && !mi->isChecked() )
|
|
|
|
qDrawShadePanel( p, xvis, y, checkcol, h, cg, FALSE, 1,
|
|
|
|
drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
|
|
|
|
&cg.brush( TQColorGroup::Button ) );
|
|
|
|
|
|
|
|
TQRect pmr( 0, 0, pixw, pixh );
|
|
|
|
TQRect pmr( 0, 0, pixw, pixh );
|
|
|
|
pmr.moveCenter( vrect.center() );
|
|
|
|
pmr.moveCenter( vrect.center() );
|
|
|
|
p->setPen( cg.text() );
|
|
|
|
p->setPen( cg.text() );
|
|
|
@ -851,20 +896,9 @@ void TQWindowsStyle::drawControl( ControlElement element,
|
|
|
|
cg.brush( TQColorGroup::Button ));
|
|
|
|
cg.brush( TQColorGroup::Button ));
|
|
|
|
int xp = xpos + checkcol + 1;
|
|
|
|
int xp = xpos + checkcol + 1;
|
|
|
|
p->fillRect( visualRect( TQRect( xp, y, w - checkcol - 1, h ), r ), fill);
|
|
|
|
p->fillRect( visualRect( TQRect( xp, y, w - checkcol - 1, h ), r ), fill);
|
|
|
|
} else if ( checkable ) { // just "checking"...
|
|
|
|
} else if ( checkable ) { // just "checking"...
|
|
|
|
if ( mi->isChecked() ) {
|
|
|
|
if ( mi->isChecked() ) {
|
|
|
|
int xp = xpos + windowsItemFrame;
|
|
|
|
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt);
|
|
|
|
|
|
|
|
|
|
|
|
SFlags cflags = Style_Default;
|
|
|
|
|
|
|
|
if (! dis)
|
|
|
|
|
|
|
|
cflags |= Style_Enabled;
|
|
|
|
|
|
|
|
if (act)
|
|
|
|
|
|
|
|
cflags |= Style_On;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drawPrimitive(PE_CheckMark, p, ceData, elementFlags,
|
|
|
|
|
|
|
|
visualRect( TQRect(xp, y + windowsItemFrame,
|
|
|
|
|
|
|
|
checkcol - 2*windowsItemFrame,
|
|
|
|
|
|
|
|
h - 2*windowsItemFrame), r ), cg, cflags);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1042,6 +1076,13 @@ int TQWindowsStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ce
|
|
|
|
ret = TQMAX( 6, TQApplication::globalStrut().width() );
|
|
|
|
ret = TQMAX( 6, TQApplication::globalStrut().width() );
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case PM_MenuIndicatorFrameHBorder:
|
|
|
|
|
|
|
|
case PM_MenuIndicatorFrameVBorder:
|
|
|
|
|
|
|
|
case PM_MenuIconIndicatorFrameHBorder:
|
|
|
|
|
|
|
|
case PM_MenuIconIndicatorFrameVBorder:
|
|
|
|
|
|
|
|
ret = windowsItemFrame;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget);
|
|
|
|
ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -1965,6 +2006,23 @@ int TQWindowsStyle::styleHint( StyleHint hint,
|
|
|
|
ret = 0;
|
|
|
|
ret = 0;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case SH_MenuIndicatorColumnWidth:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int maxpmw = opt.maxIconWidth();
|
|
|
|
|
|
|
|
bool checkable = ( elementFlags & CEF_IsCheckable );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( checkable ) {
|
|
|
|
|
|
|
|
// space for the checkmarks
|
|
|
|
|
|
|
|
if (use2000style)
|
|
|
|
|
|
|
|
maxpmw = TQMAX( maxpmw, 20 );
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
maxpmw = TQMAX( maxpmw, 12 );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret = maxpmw;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
|
|
|
|
ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|