|
|
|
@ -918,7 +918,7 @@ void StyleCheckStyle::accelManageRecursive(TQWidget* widget)
|
|
|
|
|
void StyleCheckStyle::slotAccelManage()
|
|
|
|
|
{
|
|
|
|
|
//Walk through top-levels
|
|
|
|
|
TQWidgetList* topLevels = TQApplication::tqtopLevelWidgets();
|
|
|
|
|
TQWidgetList* topLevels = TQApplication::topLevelWidgets();
|
|
|
|
|
if (!topLevels)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
@ -1392,7 +1392,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
case PE_WindowFrame:
|
|
|
|
|
case PE_PanelLineEdit: {
|
|
|
|
|
bool sunken = flags & Style_Sunken;
|
|
|
|
|
int lw = opt.isDefault() ? tqpixelMetric(PM_DefaultFrameWidth)
|
|
|
|
|
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth)
|
|
|
|
|
: opt.lineWidth();
|
|
|
|
|
if (lw == 2)
|
|
|
|
|
{
|
|
|
|
@ -1502,8 +1502,8 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
|
|
|
|
|
p->save();
|
|
|
|
|
if ( flags & Style_Down )
|
|
|
|
|
p->translate( tqpixelMetric( PM_ButtonShiftHorizontal ),
|
|
|
|
|
tqpixelMetric( PM_ButtonShiftVertical ) );
|
|
|
|
|
p->translate( pixelMetric( PM_ButtonShiftHorizontal ),
|
|
|
|
|
pixelMetric( PM_ButtonShiftVertical ) );
|
|
|
|
|
|
|
|
|
|
if ( flags & Style_Enabled ) {
|
|
|
|
|
a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
|
|
|
|
@ -1705,7 +1705,7 @@ void StyleCheckStyle::drawKStylePrimitive( KStylePrimitive kpe,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
|
TQPainter *p,
|
|
|
|
|
const TQWidget *widget,
|
|
|
|
|
const TQRect &r,
|
|
|
|
@ -1727,7 +1727,7 @@ void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
|
|
|
|
|
if ( btnDefault || button->autoDefault() ) {
|
|
|
|
|
// Compensate for default indicator
|
|
|
|
|
static int di = tqpixelMetric( PM_ButtonDefaultIndicator );
|
|
|
|
|
static int di = pixelMetric( PM_ButtonDefaultIndicator );
|
|
|
|
|
br.addCoords( di, di, -di, -di );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1750,14 +1750,14 @@ void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
|
|
|
|
|
// Shift button contents if pushed.
|
|
|
|
|
if ( active ) {
|
|
|
|
|
x += tqpixelMetric(PM_ButtonShiftHorizontal, widget);
|
|
|
|
|
y += tqpixelMetric(PM_ButtonShiftVertical, widget);
|
|
|
|
|
x += pixelMetric(PM_ButtonShiftHorizontal, widget);
|
|
|
|
|
y += pixelMetric(PM_ButtonShiftVertical, widget);
|
|
|
|
|
flags |= Style_Sunken;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Does the button have a popup menu?
|
|
|
|
|
if ( button->isMenuButton() ) {
|
|
|
|
|
int dx = tqpixelMetric( PM_MenuButtonIndicator, widget );
|
|
|
|
|
int dx = pixelMetric( PM_MenuButtonIndicator, widget );
|
|
|
|
|
drawPrimitive( PE_ArrowDown, p, TQRect(x + w - dx - 2, y + 2, dx, h - 4),
|
|
|
|
|
cg, flags, opt );
|
|
|
|
|
w -= dx;
|
|
|
|
@ -1786,7 +1786,7 @@ void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
// Make the label indicate if the button is a default button or not
|
|
|
|
|
if ( active || button->isDefault() ) {
|
|
|
|
|
// Draw "fake" bold text - this enables the font metrics to remain
|
|
|
|
|
// the same as computed in TQPushButton::tqsizeHint(), but gives
|
|
|
|
|
// the same as computed in TQPushButton::sizeHint(), but gives
|
|
|
|
|
// a reasonable bold effect.
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
@ -1794,25 +1794,25 @@ void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
if (button->isEnabled()) // Don't draw double-shadow when disabled
|
|
|
|
|
for(i=0; i<2; i++)
|
|
|
|
|
drawItem( p, TQRect(x+i+1, y+1, w, h), AlignCenter | ShowPrefix,
|
|
|
|
|
button->tqcolorGroup(), button->isEnabled(), button->pixmap(),
|
|
|
|
|
button->colorGroup(), button->isEnabled(), button->pixmap(),
|
|
|
|
|
removedXX(stripAccelViolations(button->text())), -1,
|
|
|
|
|
active ? &button->tqcolorGroup().dark() : &button->tqcolorGroup().mid() );
|
|
|
|
|
active ? &button->colorGroup().dark() : &button->colorGroup().mid() );
|
|
|
|
|
|
|
|
|
|
// Normal Text
|
|
|
|
|
for(i=0; i<2; i++)
|
|
|
|
|
drawItem( p, TQRect(x+i, y, w, h), AlignCenter | ShowPrefix,
|
|
|
|
|
button->tqcolorGroup(), button->isEnabled(), button->pixmap(),
|
|
|
|
|
button->colorGroup(), button->isEnabled(), button->pixmap(),
|
|
|
|
|
removedXX(stripAccelViolations(button->text())), -1,
|
|
|
|
|
active ? &button->tqcolorGroup().light() : &button->tqcolorGroup().buttonText() );
|
|
|
|
|
active ? &button->colorGroup().light() : &button->colorGroup().buttonText() );
|
|
|
|
|
} else
|
|
|
|
|
drawItem( p, TQRect(x, y, w, h), AlignCenter | ShowPrefix, button->tqcolorGroup(),
|
|
|
|
|
drawItem( p, TQRect(x, y, w, h), AlignCenter | ShowPrefix, button->colorGroup(),
|
|
|
|
|
button->isEnabled(), button->pixmap(), removedXX(stripAccelViolations(button->text())), -1,
|
|
|
|
|
active ? &button->tqcolorGroup().light() : &button->tqcolorGroup().buttonText() );
|
|
|
|
|
active ? &button->colorGroup().light() : &button->colorGroup().buttonText() );
|
|
|
|
|
|
|
|
|
|
// Draw a focus rect if the button has focus
|
|
|
|
|
if ( flags & Style_HasFocus )
|
|
|
|
|
drawPrimitive( PE_FocusRect, p,
|
|
|
|
|
TQStyle::tqvisualRect(subRect(SR_PushButtonFocusRect, widget), widget),
|
|
|
|
|
TQStyle::visualRect(subRect(SR_PushButtonFocusRect, widget), widget),
|
|
|
|
|
cg, flags );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -1828,7 +1828,7 @@ void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
TQRect tr = r;
|
|
|
|
|
if ( t->identifier() == tb->currentTab() )
|
|
|
|
|
tr.setBottom( tr.bottom() -
|
|
|
|
|
tqpixelMetric( TQStyle::PM_DefaultFrameWidth, tb ) );
|
|
|
|
|
pixelMetric( TQStyle::PM_DefaultFrameWidth, tb ) );
|
|
|
|
|
|
|
|
|
|
TQValueVector<StyleGuideViolation> violations = checkTitleStyle(t->text(), ShortTitle, HasAccels);
|
|
|
|
|
renderViolations(violations, p, r, AlignCenter |ShowPrefix, t->text());
|
|
|
|
@ -1857,7 +1857,7 @@ void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
|
|
|
|
|
if (flags & Style_HasFocus)
|
|
|
|
|
{
|
|
|
|
|
TQRect fr = tqvisualRect(subRect(SR_CheckBoxFocusRect, widget), widget);
|
|
|
|
|
TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, widget), widget);
|
|
|
|
|
drawPrimitive(PE_FocusRect, p, fr, cg, flags);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@ -1878,7 +1878,7 @@ void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
|
|
|
|
|
if (flags & Style_HasFocus)
|
|
|
|
|
{
|
|
|
|
|
TQRect fr = tqvisualRect(subRect(SR_CheckBoxFocusRect, widget), widget);
|
|
|
|
|
TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, widget), widget);
|
|
|
|
|
drawPrimitive(PE_FocusRect, p, fr, cg, flags);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@ -1933,7 +1933,7 @@ void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
bool enabled = mi->isEnabled();
|
|
|
|
|
bool checkable = popupmenu->isCheckable();
|
|
|
|
|
bool active = flags & Style_Active;
|
|
|
|
|
bool etchtext = tqstyleHint( SH_EtchDisabledText );
|
|
|
|
|
bool etchtext = styleHint( SH_EtchDisabledText );
|
|
|
|
|
bool reverse = TQApplication::reverseLayout();
|
|
|
|
|
int x, y, w, h;
|
|
|
|
|
r.rect( &x, &y, &w, &h );
|
|
|
|
@ -1964,7 +1964,7 @@ void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
// Do we have an icon?
|
|
|
|
|
if ( mi->iconSet() ) {
|
|
|
|
|
TQIconSet::Mode mode;
|
|
|
|
|
TQRect cr = tqvisualRect( TQRect(x, y, checkcol, h), r );
|
|
|
|
|
TQRect cr = visualRect( TQRect(x, y, checkcol, h), r );
|
|
|
|
|
|
|
|
|
|
// Select the correct icon from the iconset
|
|
|
|
|
if ( active )
|
|
|
|
@ -2110,8 +2110,8 @@ void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
// Does the menu item have a submenu?
|
|
|
|
|
if ( mi->popup() ) {
|
|
|
|
|
PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
|
|
|
|
|
int dim = tqpixelMetric(PM_MenuButtonIndicator);
|
|
|
|
|
TQRect vr = tqvisualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim,
|
|
|
|
|
int dim = pixelMetric(PM_MenuButtonIndicator);
|
|
|
|
|
TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim,
|
|
|
|
|
y + h / 2 - dim / 2, dim, dim), r );
|
|
|
|
|
|
|
|
|
|
// Draw an arrow at the far end of the menu item
|
|
|
|
@ -2164,12 +2164,12 @@ void StyleCheckStyle::tqdrawControl( ControlElement element,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
KStyle::tqdrawControl(element, p, widget, r, cg, flags, opt);
|
|
|
|
|
KStyle::drawControl(element, p, widget, r, cg, flags, opt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StyleCheckStyle::tqdrawControlMask( ControlElement element,
|
|
|
|
|
void StyleCheckStyle::drawControlMask( ControlElement element,
|
|
|
|
|
TQPainter *p,
|
|
|
|
|
const TQWidget *widget,
|
|
|
|
|
const TQRect &r,
|
|
|
|
@ -2190,12 +2190,12 @@ void StyleCheckStyle::tqdrawControlMask( ControlElement element,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
KStyle::tqdrawControlMask(element, p, widget, r, opt);
|
|
|
|
|
KStyle::drawControlMask(element, p, widget, r, opt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StyleCheckStyle::tqdrawComplexControl( ComplexControl control,
|
|
|
|
|
void StyleCheckStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
TQPainter *p,
|
|
|
|
|
const TQWidget *widget,
|
|
|
|
|
const TQRect &r,
|
|
|
|
@ -2246,7 +2246,7 @@ void StyleCheckStyle::tqdrawComplexControl( ComplexControl control,
|
|
|
|
|
p->drawLine(x+1, y+2, x+1, y2-2);
|
|
|
|
|
|
|
|
|
|
// Get the button bounding box
|
|
|
|
|
TQRect ar = TQStyle::tqvisualRect(
|
|
|
|
|
TQRect ar = TQStyle::visualRect(
|
|
|
|
|
querySubControlMetrics(CC_ComboBox, widget, SC_ComboBoxArrow),
|
|
|
|
|
widget );
|
|
|
|
|
|
|
|
|
@ -2265,7 +2265,7 @@ void StyleCheckStyle::tqdrawComplexControl( ComplexControl control,
|
|
|
|
|
if ( controls & SC_ComboBoxEditField )
|
|
|
|
|
{
|
|
|
|
|
const TQComboBox * cb = (const TQComboBox *) widget;
|
|
|
|
|
TQRect re = TQStyle::tqvisualRect(
|
|
|
|
|
TQRect re = TQStyle::visualRect(
|
|
|
|
|
querySubControlMetrics( CC_ComboBox, widget,
|
|
|
|
|
SC_ComboBoxEditField), widget );
|
|
|
|
|
|
|
|
|
@ -2289,7 +2289,7 @@ void StyleCheckStyle::tqdrawComplexControl( ComplexControl control,
|
|
|
|
|
p->fillRect( re.x(), re.y(), re.width(), re.height(),
|
|
|
|
|
cg.brush( TQColorGroup::Highlight ) );
|
|
|
|
|
|
|
|
|
|
TQRect re = TQStyle::tqvisualRect(
|
|
|
|
|
TQRect re = TQStyle::visualRect(
|
|
|
|
|
subRect(SR_ComboBoxFocusRect, cb), widget);
|
|
|
|
|
|
|
|
|
|
drawPrimitive( PE_FocusRect, p, re, cg,
|
|
|
|
@ -2377,14 +2377,14 @@ void StyleCheckStyle::tqdrawComplexControl( ComplexControl control,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
KStyle::tqdrawComplexControl(control, p, widget,
|
|
|
|
|
KStyle::drawComplexControl(control, p, widget,
|
|
|
|
|
r, cg, flags, controls, active, opt);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StyleCheckStyle::tqdrawComplexControlMask( ComplexControl control,
|
|
|
|
|
void StyleCheckStyle::drawComplexControlMask( ComplexControl control,
|
|
|
|
|
TQPainter *p,
|
|
|
|
|
const TQWidget *widget,
|
|
|
|
|
const TQRect &r,
|
|
|
|
@ -2406,7 +2406,7 @@ void StyleCheckStyle::tqdrawComplexControlMask( ComplexControl control,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
KStyle::tqdrawComplexControlMask(control, p, widget, r, opt);
|
|
|
|
|
KStyle::drawComplexControlMask(control, p, widget, r, opt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2422,11 +2422,11 @@ TQRect StyleCheckStyle::subRect(SubRect r, const TQWidget *widget) const
|
|
|
|
|
int dbw1 = 0, dbw2 = 0;
|
|
|
|
|
|
|
|
|
|
if (button->isDefault() || button->autoDefault()) {
|
|
|
|
|
dbw1 = tqpixelMetric(PM_ButtonDefaultIndicator, widget);
|
|
|
|
|
dbw1 = pixelMetric(PM_ButtonDefaultIndicator, widget);
|
|
|
|
|
dbw2 = dbw1 * 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int dfw1 = tqpixelMetric(PM_DefaultFrameWidth, widget) * 2,
|
|
|
|
|
int dfw1 = pixelMetric(PM_DefaultFrameWidth, widget) * 2,
|
|
|
|
|
dfw2 = dfw1 * 2;
|
|
|
|
|
|
|
|
|
|
return TQRect(wrect.x() + dfw1 + dbw1 + 1,
|
|
|
|
@ -2438,7 +2438,7 @@ TQRect StyleCheckStyle::subRect(SubRect r, const TQWidget *widget) const
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int StyleCheckStyle::tqpixelMetric(PixelMetric m, const TQWidget *widget) const
|
|
|
|
|
int StyleCheckStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const
|
|
|
|
|
{
|
|
|
|
|
switch(m)
|
|
|
|
|
{
|
|
|
|
@ -2465,7 +2465,7 @@ int StyleCheckStyle::tqpixelMetric(PixelMetric m, const TQWidget *widget) const
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return KStyle::tqpixelMetric(m, widget);
|
|
|
|
|
return KStyle::pixelMetric(m, widget);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2483,8 +2483,8 @@ TQSize StyleCheckStyle::sizeFromContents( ContentsType contents,
|
|
|
|
|
const TQPushButton* button = (const TQPushButton*) widget;
|
|
|
|
|
int w = contentSize.width();
|
|
|
|
|
int h = contentSize.height();
|
|
|
|
|
int bm = tqpixelMetric( PM_ButtonMargin, widget );
|
|
|
|
|
int fw = tqpixelMetric( PM_DefaultFrameWidth, widget ) * 2;
|
|
|
|
|
int bm = pixelMetric( PM_ButtonMargin, widget );
|
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2;
|
|
|
|
|
|
|
|
|
|
w += bm + fw + 6; // ### Add 6 to make way for bold font.
|
|
|
|
|
h += bm + fw;
|
|
|
|
@ -2495,7 +2495,7 @@ TQSize StyleCheckStyle::sizeFromContents( ContentsType contents,
|
|
|
|
|
w = 80;
|
|
|
|
|
|
|
|
|
|
// Compensate for default indicator
|
|
|
|
|
int di = tqpixelMetric( PM_ButtonDefaultIndicator );
|
|
|
|
|
int di = pixelMetric( PM_ButtonDefaultIndicator );
|
|
|
|
|
w += di * 2;
|
|
|
|
|
h += di * 2;
|
|
|
|
|
}
|
|
|
|
@ -2520,8 +2520,8 @@ TQSize StyleCheckStyle::sizeFromContents( ContentsType contents,
|
|
|
|
|
int w = contentSize.width(), h = contentSize.height();
|
|
|
|
|
|
|
|
|
|
if ( mi->custom() ) {
|
|
|
|
|
w = mi->custom()->tqsizeHint().width();
|
|
|
|
|
h = mi->custom()->tqsizeHint().height();
|
|
|
|
|
w = mi->custom()->sizeHint().width();
|
|
|
|
|
h = mi->custom()->sizeHint().height();
|
|
|
|
|
if ( ! mi->custom()->fullSpan() )
|
|
|
|
|
h += 2*itemVMargin + 2*itemFrame;
|
|
|
|
|
}
|
|
|
|
@ -2658,7 +2658,7 @@ bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event )
|
|
|
|
|
{
|
|
|
|
|
renderViolations(violations, &p, cr,lb->tqalignment() | ShowPrefix, lb->text() );
|
|
|
|
|
// ordinary text or pixmap label
|
|
|
|
|
drawItem( &p, cr, lb->tqalignment(), lb->tqcolorGroup(), lb->isEnabled(),
|
|
|
|
|
drawItem( &p, cr, lb->tqalignment(), lb->colorGroup(), lb->isEnabled(),
|
|
|
|
|
0, removedXX(stripAccelViolations(lb->text())) );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -2666,7 +2666,7 @@ bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event )
|
|
|
|
|
renderViolations(violations, &p, cr,lb->tqalignment(), lb->text() );
|
|
|
|
|
|
|
|
|
|
// ordinary text or pixmap label
|
|
|
|
|
drawItem( &p, cr, lb->tqalignment(), lb->tqcolorGroup(), lb->isEnabled(),
|
|
|
|
|
drawItem( &p, cr, lb->tqalignment(), lb->colorGroup(), lb->isEnabled(),
|
|
|
|
|
0, removedXX(stripAccelViolations(lb->text())) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2723,7 +2723,7 @@ bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event )
|
|
|
|
|
|
|
|
|
|
renderViolations( violations, &paint, r, AlignCenter | ShowPrefix, gb->title() );
|
|
|
|
|
|
|
|
|
|
drawItem(&paint, r, AlignCenter | ShowPrefix, gb->tqcolorGroup(),
|
|
|
|
|
drawItem(&paint, r, AlignCenter | ShowPrefix, gb->colorGroup(),
|
|
|
|
|
gb->isEnabled(), 0, stripped_title );
|
|
|
|
|
|
|
|
|
|
paint.setClipRegion( pevent->region().subtract( r ) );
|
|
|
|
@ -2740,7 +2740,7 @@ bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event )
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tqdrawPrimitive( TQStyle::PE_GroupBoxFrame, &paint, gb->frameRect(),
|
|
|
|
|
gb->tqcolorGroup(), TQStyle::Style_Default,
|
|
|
|
|
gb->colorGroup(), TQStyle::Style_Default,
|
|
|
|
|
TQStyleOption(gb->lineWidth(), gb->midLineWidth(),
|
|
|
|
|
gb->frameShape(), gb->frameShadow()) );
|
|
|
|
|
}
|
|
|
|
|