|
|
@ -934,7 +934,7 @@ void StyleCheckStyle::slotAccelManage()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StyleCheckStyle::polish(TQWidget* widget)
|
|
|
|
void StyleCheckStyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Having a global view on the widget makes accel
|
|
|
|
/* Having a global view on the widget makes accel
|
|
|
|
easier to catch. However, just intruding on the main window
|
|
|
|
easier to catch. However, just intruding on the main window
|
|
|
@ -944,49 +944,55 @@ void StyleCheckStyle::polish(TQWidget* widget)
|
|
|
|
topLevelAccelManageTimer->start(200, true);
|
|
|
|
topLevelAccelManageTimer->start(200, true);
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
// Put in order of highest occurance to maximise hit rate
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
|
|
|
|
if (widget->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING)) {
|
|
|
|
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
|
|
|
|
widget->installEventFilter(this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (widget->inherits(TQLABEL_OBJECT_NAME_STRING))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
widget->installEventFilter(this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (widget->inherits(TQGROUPBOX_OBJECT_NAME_STRING))
|
|
|
|
// Put in order of highest occurance to maximise hit rate
|
|
|
|
{
|
|
|
|
if (widget->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING)) {
|
|
|
|
widget->installEventFilter(this);
|
|
|
|
installObjectEventHandler(ceData, elementFlags, ptr, this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (widget->inherits(TQMAINWINDOW_OBJECT_NAME_STRING) || widget->inherits(TQDIALOG_OBJECT_NAME_STRING) )
|
|
|
|
if (widget->inherits(TQLABEL_OBJECT_NAME_STRING))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
watcher->addWatched(widget);
|
|
|
|
installObjectEventHandler(ceData, elementFlags, ptr, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (widget->inherits(TQGROUPBOX_OBJECT_NAME_STRING))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
installObjectEventHandler(ceData, elementFlags, ptr, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (widget->inherits(TQMAINWINDOW_OBJECT_NAME_STRING) || widget->inherits(TQDIALOG_OBJECT_NAME_STRING) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
watcher->addWatched(widget);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KStyle::polish( widget );
|
|
|
|
KStyle::polish( ceData, elementFlags, ptr );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StyleCheckStyle::unPolish(TQWidget* widget)
|
|
|
|
void StyleCheckStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (widget->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING)) {
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
|
|
|
|
widget->removeEventFilter(this);
|
|
|
|
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (widget->inherits(TQLABEL_OBJECT_NAME_STRING))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
widget->removeEventFilter(this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (widget->inherits(TQGROUPBOX_OBJECT_NAME_STRING))
|
|
|
|
if (widget->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING)) {
|
|
|
|
{
|
|
|
|
removeObjectEventHandler(ceData, elementFlags, ptr, this);
|
|
|
|
widget->removeEventFilter(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (widget->inherits(TQLABEL_OBJECT_NAME_STRING))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
removeObjectEventHandler(ceData, elementFlags, ptr, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (widget->inherits(TQGROUPBOX_OBJECT_NAME_STRING))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
removeObjectEventHandler(ceData, elementFlags, ptr, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KStyle::unPolish( ceData, elementFlags, ptr );
|
|
|
|
|
|
|
|
|
|
|
|
KStyle::unPolish( widget );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -994,6 +1000,8 @@ void StyleCheckStyle::unPolish(TQWidget* widget)
|
|
|
|
// This function draws primitive elements as well as their masks.
|
|
|
|
// This function draws primitive elements as well as their masks.
|
|
|
|
void StyleCheckStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
void StyleCheckStyle::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,
|
|
|
@ -1161,7 +1169,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
// Small hack to ensure scrollbar gradients are drawn the right way.
|
|
|
|
// Small hack to ensure scrollbar gradients are drawn the right way.
|
|
|
|
flags ^= Style_Horizontal;
|
|
|
|
flags ^= Style_Horizontal;
|
|
|
|
|
|
|
|
|
|
|
|
drawPrimitive(PE_ButtonBevel, p, r, cg, flags | Style_Enabled | Style_Raised);
|
|
|
|
drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags | Style_Enabled | Style_Raised);
|
|
|
|
|
|
|
|
|
|
|
|
// Draw a scrollbar riffle (note direction after above changes)
|
|
|
|
// Draw a scrollbar riffle (note direction after above changes)
|
|
|
|
// HighColor & Default scrollbar
|
|
|
|
// HighColor & Default scrollbar
|
|
|
@ -1225,21 +1233,21 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case PE_ScrollBarAddLine: {
|
|
|
|
case PE_ScrollBarAddLine: {
|
|
|
|
drawPrimitive( PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) |
|
|
|
|
drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) |
|
|
|
|
((flags & Style_Down) ? Style_Down : Style_Raised) );
|
|
|
|
((flags & Style_Down) ? Style_Down : Style_Raised) );
|
|
|
|
|
|
|
|
|
|
|
|
drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown),
|
|
|
|
drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown),
|
|
|
|
p, r, cg, flags );
|
|
|
|
p, ceData, elementFlags, r, cg, flags );
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case PE_ScrollBarSubLine: {
|
|
|
|
case PE_ScrollBarSubLine: {
|
|
|
|
drawPrimitive( PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) |
|
|
|
|
drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) |
|
|
|
|
((flags & Style_Down) ? Style_Down : Style_Raised) );
|
|
|
|
((flags & Style_Down) ? Style_Down : Style_Raised) );
|
|
|
|
|
|
|
|
|
|
|
|
drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp),
|
|
|
|
drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp),
|
|
|
|
p, r, cg, flags );
|
|
|
|
p, ceData, elementFlags, r, cg, flags );
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1392,7 +1400,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
case PE_WindowFrame:
|
|
|
|
case PE_WindowFrame:
|
|
|
|
case PE_PanelLineEdit: {
|
|
|
|
case PE_PanelLineEdit: {
|
|
|
|
bool sunken = flags & Style_Sunken;
|
|
|
|
bool sunken = flags & Style_Sunken;
|
|
|
|
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth)
|
|
|
|
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
|
|
|
|
: opt.lineWidth();
|
|
|
|
: opt.lineWidth();
|
|
|
|
if (lw == 2)
|
|
|
|
if (lw == 2)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1415,7 +1423,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
p->drawLine(x+1, y+1, x+1, y2-1);
|
|
|
|
p->drawLine(x+1, y+1, x+1, y2-1);
|
|
|
|
p->setPen(oldPen);
|
|
|
|
p->setPen(oldPen);
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
KStyle::tqdrawPrimitive(pe, p, r, cg, flags, opt);
|
|
|
|
KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1502,8 +1510,8 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
|
|
|
|
|
|
|
p->save();
|
|
|
|
p->save();
|
|
|
|
if ( flags & Style_Down )
|
|
|
|
if ( flags & Style_Down )
|
|
|
|
p->translate( pixelMetric( PM_ButtonShiftHorizontal ),
|
|
|
|
p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ),
|
|
|
|
pixelMetric( PM_ButtonShiftVertical ) );
|
|
|
|
pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) );
|
|
|
|
|
|
|
|
|
|
|
|
if ( flags & Style_Enabled ) {
|
|
|
|
if ( flags & Style_Enabled ) {
|
|
|
|
a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
|
|
|
|
a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
|
|
|
@ -1520,7 +1528,7 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
p->restore();
|
|
|
|
p->restore();
|
|
|
|
|
|
|
|
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
KStyle::tqdrawPrimitive( pe, p, r, cg, flags, opt );
|
|
|
|
KStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1528,11 +1536,13 @@ void StyleCheckStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
|
|
|
|
|
|
|
void StyleCheckStyle::drawKStylePrimitive( KStylePrimitive kpe,
|
|
|
|
void StyleCheckStyle::drawKStylePrimitive( KStylePrimitive kpe,
|
|
|
|
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 ( kpe )
|
|
|
|
switch ( kpe )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1700,18 +1710,20 @@ void StyleCheckStyle::drawKStylePrimitive( KStylePrimitive kpe,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
KStyle::drawKStylePrimitive( kpe, p, widget, r, cg, flags, opt);
|
|
|
|
KStyle::drawKStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
void StyleCheckStyle::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)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1727,14 +1739,14 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
|
|
|
|
|
|
|
|
if ( btnDefault || button->autoDefault() ) {
|
|
|
|
if ( btnDefault || button->autoDefault() ) {
|
|
|
|
// Compensate for default indicator
|
|
|
|
// Compensate for default indicator
|
|
|
|
static int di = pixelMetric( PM_ButtonDefaultIndicator );
|
|
|
|
static int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
|
|
|
|
br.addCoords( di, di, -di, -di );
|
|
|
|
br.addCoords( di, di, -di, -di );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( btnDefault )
|
|
|
|
if ( btnDefault )
|
|
|
|
drawPrimitive( PE_ButtonDefault, p, r, cg, flags );
|
|
|
|
drawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags );
|
|
|
|
|
|
|
|
|
|
|
|
drawPrimitive( PE_ButtonCommand, p, br, cg, flags );
|
|
|
|
drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags );
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1750,15 +1762,15 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
|
|
|
|
|
|
|
|
// Shift button contents if pushed.
|
|
|
|
// Shift button contents if pushed.
|
|
|
|
if ( active ) {
|
|
|
|
if ( active ) {
|
|
|
|
x += pixelMetric(PM_ButtonShiftHorizontal, widget);
|
|
|
|
x += pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget);
|
|
|
|
y += pixelMetric(PM_ButtonShiftVertical, widget);
|
|
|
|
y += pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget);
|
|
|
|
flags |= Style_Sunken;
|
|
|
|
flags |= Style_Sunken;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Does the button have a popup menu?
|
|
|
|
// Does the button have a popup menu?
|
|
|
|
if ( button->isMenuButton() ) {
|
|
|
|
if ( button->isMenuButton() ) {
|
|
|
|
int dx = pixelMetric( PM_MenuButtonIndicator, widget );
|
|
|
|
int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget );
|
|
|
|
drawPrimitive( PE_ArrowDown, p, TQRect(x + w - dx - 2, y + 2, dx, h - 4),
|
|
|
|
drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect(x + w - dx - 2, y + 2, dx, h - 4),
|
|
|
|
cg, flags, opt );
|
|
|
|
cg, flags, opt );
|
|
|
|
w -= dx;
|
|
|
|
w -= dx;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1811,8 +1823,8 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
|
|
|
|
|
|
|
|
// Draw a focus rect if the button has focus
|
|
|
|
// Draw a focus rect if the button has focus
|
|
|
|
if ( flags & Style_HasFocus )
|
|
|
|
if ( flags & Style_HasFocus )
|
|
|
|
drawPrimitive( PE_FocusRect, p,
|
|
|
|
drawPrimitive( PE_FocusRect, p, ceData, elementFlags,
|
|
|
|
TQStyle::visualRect(subRect(SR_PushButtonFocusRect, widget), widget),
|
|
|
|
TQStyle::visualRect(subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget), ceData, elementFlags),
|
|
|
|
cg, flags );
|
|
|
|
cg, flags );
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1828,7 +1840,7 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
TQRect tr = r;
|
|
|
|
TQRect tr = r;
|
|
|
|
if ( t->identifier() == tb->currentTab() )
|
|
|
|
if ( t->identifier() == tb->currentTab() )
|
|
|
|
tr.setBottom( tr.bottom() -
|
|
|
|
tr.setBottom( tr.bottom() -
|
|
|
|
pixelMetric( TQStyle::PM_DefaultFrameWidth, tb ) );
|
|
|
|
pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, tb ) );
|
|
|
|
|
|
|
|
|
|
|
|
TQValueVector<StyleGuideViolation> violations = checkTitleStyle(t->text(), ShortTitle, HasAccels);
|
|
|
|
TQValueVector<StyleGuideViolation> violations = checkTitleStyle(t->text(), ShortTitle, HasAccels);
|
|
|
|
renderViolations(violations, p, r, AlignCenter |ShowPrefix, t->text());
|
|
|
|
renderViolations(violations, p, r, AlignCenter |ShowPrefix, t->text());
|
|
|
@ -1837,7 +1849,7 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
flags & Style_Enabled, 0, removedXX(stripAccelViolations(t->text())) );
|
|
|
|
flags & Style_Enabled, 0, removedXX(stripAccelViolations(t->text())) );
|
|
|
|
|
|
|
|
|
|
|
|
if ( (flags & Style_HasFocus) && !t->text().isEmpty() )
|
|
|
|
if ( (flags & Style_HasFocus) && !t->text().isEmpty() )
|
|
|
|
drawPrimitive( PE_FocusRect, p, r, cg );
|
|
|
|
drawPrimitive( PE_FocusRect, p, ceData, elementFlags, r, cg );
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1857,8 +1869,8 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
|
|
|
|
|
|
|
|
if (flags & Style_HasFocus)
|
|
|
|
if (flags & Style_HasFocus)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, widget), widget);
|
|
|
|
TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags);
|
|
|
|
drawPrimitive(PE_FocusRect, p, fr, cg, flags);
|
|
|
|
drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1878,8 +1890,8 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
|
|
|
|
|
|
|
|
if (flags & Style_HasFocus)
|
|
|
|
if (flags & Style_HasFocus)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, widget), widget);
|
|
|
|
TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags);
|
|
|
|
drawPrimitive(PE_FocusRect, p, fr, cg, flags);
|
|
|
|
drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1933,7 +1945,7 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
bool enabled = mi->isEnabled();
|
|
|
|
bool enabled = mi->isEnabled();
|
|
|
|
bool checkable = popupmenu->isCheckable();
|
|
|
|
bool checkable = popupmenu->isCheckable();
|
|
|
|
bool active = flags & Style_Active;
|
|
|
|
bool active = flags & Style_Active;
|
|
|
|
bool etchtext = styleHint( SH_EtchDisabledText );
|
|
|
|
bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
|
|
|
|
bool reverse = TQApplication::reverseLayout();
|
|
|
|
bool reverse = TQApplication::reverseLayout();
|
|
|
|
int x, y, w, h;
|
|
|
|
int x, y, w, h;
|
|
|
|
r.rect( &x, &y, &w, &h );
|
|
|
|
r.rect( &x, &y, &w, &h );
|
|
|
@ -1998,7 +2010,7 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
SFlags cflags = Style_Default;
|
|
|
|
SFlags cflags = Style_Default;
|
|
|
|
cflags |= active ? Style_Enabled : Style_On;
|
|
|
|
cflags |= active ? Style_Enabled : Style_On;
|
|
|
|
|
|
|
|
|
|
|
|
drawPrimitive( PE_CheckMark, p, TQRect( cx + itemFrame, y + itemFrame,
|
|
|
|
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame,
|
|
|
|
checkcol - itemFrame*2, h - itemFrame*2), cg, cflags );
|
|
|
|
checkcol - itemFrame*2, h - itemFrame*2), cg, cflags );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2110,7 +2122,7 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
// Does the menu item have a submenu?
|
|
|
|
// Does the menu item have a submenu?
|
|
|
|
if ( mi->popup() ) {
|
|
|
|
if ( mi->popup() ) {
|
|
|
|
PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
|
|
|
|
PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
|
|
|
|
int dim = pixelMetric(PM_MenuButtonIndicator);
|
|
|
|
int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags);
|
|
|
|
TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim,
|
|
|
|
TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim,
|
|
|
|
y + h / 2 - dim / 2, dim, dim), r );
|
|
|
|
y + h / 2 - dim / 2, dim, dim), r );
|
|
|
|
|
|
|
|
|
|
|
@ -2122,9 +2134,9 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
TQColorGroup g2( discol, cg.highlight(), white, white,
|
|
|
|
TQColorGroup g2( discol, cg.highlight(), white, white,
|
|
|
|
enabled ? white : discol, discol, white );
|
|
|
|
enabled ? white : discol, discol, white );
|
|
|
|
|
|
|
|
|
|
|
|
drawPrimitive( arrow, p, vr, g2, Style_Enabled );
|
|
|
|
drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled );
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
drawPrimitive( arrow, p, vr, cg,
|
|
|
|
drawPrimitive( arrow, p, ceData, elementFlags, vr, cg,
|
|
|
|
enabled ? Style_Enabled : Style_Default );
|
|
|
|
enabled ? Style_Enabled : Style_Default );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -2164,16 +2176,18 @@ void StyleCheckStyle::drawControl( ControlElement element,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
KStyle::drawControl(element, p, widget, r, cg, flags, opt);
|
|
|
|
KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StyleCheckStyle::drawControlMask( ControlElement element,
|
|
|
|
void StyleCheckStyle::drawControlMask( ControlElement element,
|
|
|
|
TQPainter *p,
|
|
|
|
TQPainter *p,
|
|
|
|
const TQWidget *widget,
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
const TQRect &r,
|
|
|
|
const TQRect &r,
|
|
|
|
const TQStyleOption& opt ) const
|
|
|
|
const TQStyleOption& opt,
|
|
|
|
|
|
|
|
const TQWidget *widget ) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (element)
|
|
|
|
switch (element)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2190,20 +2204,22 @@ void StyleCheckStyle::drawControlMask( ControlElement element,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
KStyle::drawControlMask(element, p, widget, r, opt);
|
|
|
|
KStyle::drawControlMask(element, p, ceData, elementFlags, r, opt, widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StyleCheckStyle::drawComplexControl( ComplexControl control,
|
|
|
|
void StyleCheckStyle::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 controls,
|
|
|
|
SCFlags controls,
|
|
|
|
SCFlags active,
|
|
|
|
SCFlags active,
|
|
|
|
const TQStyleOption& opt ) const
|
|
|
|
const TQStyleOption& opt,
|
|
|
|
|
|
|
|
const TQWidget *widget ) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch(control)
|
|
|
|
switch(control)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2247,8 +2263,8 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
|
|
|
|
|
|
|
// Get the button bounding box
|
|
|
|
// Get the button bounding box
|
|
|
|
TQRect ar = TQStyle::visualRect(
|
|
|
|
TQRect ar = TQStyle::visualRect(
|
|
|
|
querySubControlMetrics(CC_ComboBox, widget, SC_ComboBoxArrow),
|
|
|
|
querySubControlMetrics(CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget),
|
|
|
|
widget );
|
|
|
|
ceData, elementFlags );
|
|
|
|
|
|
|
|
|
|
|
|
// Are we enabled?
|
|
|
|
// Are we enabled?
|
|
|
|
if ( widget->isEnabled() )
|
|
|
|
if ( widget->isEnabled() )
|
|
|
@ -2258,7 +2274,7 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control,
|
|
|
|
if ( active & Style_Sunken )
|
|
|
|
if ( active & Style_Sunken )
|
|
|
|
flags |= Style_Sunken;
|
|
|
|
flags |= Style_Sunken;
|
|
|
|
|
|
|
|
|
|
|
|
drawPrimitive(PE_ArrowDown, p, ar, cg, flags);
|
|
|
|
drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Draw an edit field if required
|
|
|
|
// Draw an edit field if required
|
|
|
@ -2266,8 +2282,8 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const TQComboBox * cb = (const TQComboBox *) widget;
|
|
|
|
const TQComboBox * cb = (const TQComboBox *) widget;
|
|
|
|
TQRect re = TQStyle::visualRect(
|
|
|
|
TQRect re = TQStyle::visualRect(
|
|
|
|
querySubControlMetrics( CC_ComboBox, widget,
|
|
|
|
querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
|
|
|
|
SC_ComboBoxEditField), widget );
|
|
|
|
SC_ComboBoxEditField, TQStyleOption::Default, widget), ceData, elementFlags );
|
|
|
|
|
|
|
|
|
|
|
|
// Draw the indent
|
|
|
|
// Draw the indent
|
|
|
|
if (cb->editable()) {
|
|
|
|
if (cb->editable()) {
|
|
|
@ -2290,9 +2306,9 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control,
|
|
|
|
cg.brush( TQColorGroup::Highlight ) );
|
|
|
|
cg.brush( TQColorGroup::Highlight ) );
|
|
|
|
|
|
|
|
|
|
|
|
TQRect re = TQStyle::visualRect(
|
|
|
|
TQRect re = TQStyle::visualRect(
|
|
|
|
subRect(SR_ComboBoxFocusRect, cb), widget);
|
|
|
|
subRect(SR_ComboBoxFocusRect, ceData, elementFlags, cb), ceData, elementFlags);
|
|
|
|
|
|
|
|
|
|
|
|
drawPrimitive( PE_FocusRect, p, re, cg,
|
|
|
|
drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg,
|
|
|
|
Style_FocusAtBorder, TQStyleOption(cg.highlight()));
|
|
|
|
Style_FocusAtBorder, TQStyleOption(cg.highlight()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2305,8 +2321,8 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control,
|
|
|
|
const TQToolButton *toolbutton = (const TQToolButton *) widget;
|
|
|
|
const TQToolButton *toolbutton = (const TQToolButton *) widget;
|
|
|
|
|
|
|
|
|
|
|
|
TQRect button, menuarea;
|
|
|
|
TQRect button, menuarea;
|
|
|
|
button = querySubControlMetrics(control, widget, SC_ToolButton, opt);
|
|
|
|
button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget);
|
|
|
|
menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt);
|
|
|
|
menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget);
|
|
|
|
|
|
|
|
|
|
|
|
SFlags bflags = flags,
|
|
|
|
SFlags bflags = flags,
|
|
|
|
mflags = flags;
|
|
|
|
mflags = flags;
|
|
|
@ -2320,7 +2336,7 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// If we're pressed, on, or raised...
|
|
|
|
// If we're pressed, on, or raised...
|
|
|
|
if (bflags & (Style_Down | Style_On | Style_Raised))
|
|
|
|
if (bflags & (Style_Down | Style_On | Style_Raised))
|
|
|
|
drawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt);
|
|
|
|
drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
|
|
|
|
|
|
|
|
|
|
|
|
// Check whether to draw a background pixmap
|
|
|
|
// Check whether to draw a background pixmap
|
|
|
|
else if ( toolbutton->parentWidget() &&
|
|
|
|
else if ( toolbutton->parentWidget() &&
|
|
|
@ -2362,14 +2378,14 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control,
|
|
|
|
if (controls & SC_ToolButtonMenu)
|
|
|
|
if (controls & SC_ToolButtonMenu)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (mflags & (Style_Down | Style_On | Style_Raised))
|
|
|
|
if (mflags & (Style_Down | Style_On | Style_Raised))
|
|
|
|
drawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, opt);
|
|
|
|
drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
|
|
|
|
drawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, opt);
|
|
|
|
drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (toolbutton->hasFocus() && !toolbutton->focusProxy()) {
|
|
|
|
if (toolbutton->hasFocus() && !toolbutton->focusProxy()) {
|
|
|
|
TQRect fr = toolbutton->rect();
|
|
|
|
TQRect fr = toolbutton->rect();
|
|
|
|
fr.addCoords(3, 3, -3, -3);
|
|
|
|
fr.addCoords(3, 3, -3, -3);
|
|
|
|
drawPrimitive(PE_FocusRect, p, fr, cg);
|
|
|
|
drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -2377,8 +2393,8 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
KStyle::drawComplexControl(control, p, widget,
|
|
|
|
KStyle::drawComplexControl(control, p, ceData, elementFlags,
|
|
|
|
r, cg, flags, controls, active, opt);
|
|
|
|
r, cg, flags, controls, active, opt, widget);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2386,9 +2402,11 @@ void StyleCheckStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
|
|
|
|
|
|
|
void StyleCheckStyle::drawComplexControlMask( ComplexControl control,
|
|
|
|
void StyleCheckStyle::drawComplexControlMask( ComplexControl control,
|
|
|
|
TQPainter *p,
|
|
|
|
TQPainter *p,
|
|
|
|
const TQWidget *widget,
|
|
|
|
const TQStyleControlElementData ceData,
|
|
|
|
|
|
|
|
const ControlElementFlags elementFlags,
|
|
|
|
const TQRect &r,
|
|
|
|
const TQRect &r,
|
|
|
|
const TQStyleOption& opt ) const
|
|
|
|
const TQStyleOption& opt,
|
|
|
|
|
|
|
|
const TQWidget *widget ) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (control)
|
|
|
|
switch (control)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2406,12 +2424,12 @@ void StyleCheckStyle::drawComplexControlMask( ComplexControl control,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
KStyle::drawComplexControlMask(control, p, widget, r, opt);
|
|
|
|
KStyle::drawComplexControlMask(control, p, ceData, elementFlags, r, opt, widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQRect StyleCheckStyle::subRect(SubRect r, const TQWidget *widget) const
|
|
|
|
TQRect StyleCheckStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// We want the focus rect for buttons to be adjusted from
|
|
|
|
// We want the focus rect for buttons to be adjusted from
|
|
|
|
// the TQt3 defaults to be similar to TQt 2's defaults.
|
|
|
|
// the TQt3 defaults to be similar to TQt 2's defaults.
|
|
|
@ -2422,11 +2440,11 @@ TQRect StyleCheckStyle::subRect(SubRect r, const TQWidget *widget) const
|
|
|
|
int dbw1 = 0, dbw2 = 0;
|
|
|
|
int dbw1 = 0, dbw2 = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (button->isDefault() || button->autoDefault()) {
|
|
|
|
if (button->isDefault() || button->autoDefault()) {
|
|
|
|
dbw1 = pixelMetric(PM_ButtonDefaultIndicator, widget);
|
|
|
|
dbw1 = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget);
|
|
|
|
dbw2 = dbw1 * 2;
|
|
|
|
dbw2 = dbw1 * 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int dfw1 = pixelMetric(PM_DefaultFrameWidth, widget) * 2,
|
|
|
|
int dfw1 = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2,
|
|
|
|
dfw2 = dfw1 * 2;
|
|
|
|
dfw2 = dfw1 * 2;
|
|
|
|
|
|
|
|
|
|
|
|
return TQRect(wrect.x() + dfw1 + dbw1 + 1,
|
|
|
|
return TQRect(wrect.x() + dfw1 + dbw1 + 1,
|
|
|
@ -2434,11 +2452,11 @@ TQRect StyleCheckStyle::subRect(SubRect r, const TQWidget *widget) const
|
|
|
|
wrect.width() - dfw2 - dbw2 - 1,
|
|
|
|
wrect.width() - dfw2 - dbw2 - 1,
|
|
|
|
wrect.height() - dfw2 - dbw2 - 1);
|
|
|
|
wrect.height() - dfw2 - dbw2 - 1);
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
return KStyle::subRect(r, widget);
|
|
|
|
return KStyle::subRect(r, ceData, elementFlags, widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int StyleCheckStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const
|
|
|
|
int StyleCheckStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch(m)
|
|
|
|
switch(m)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2465,15 +2483,17 @@ int StyleCheckStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return KStyle::pixelMetric(m, widget);
|
|
|
|
return KStyle::pixelMetric(m, ceData, elementFlags, widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQSize StyleCheckStyle::sizeFromContents( ContentsType contents,
|
|
|
|
TQSize StyleCheckStyle::sizeFromContents( ContentsType contents,
|
|
|
|
const TQWidget* widget,
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
const TQSize &contentSize,
|
|
|
|
const TQSize &contentSize,
|
|
|
|
const TQStyleOption& opt ) const
|
|
|
|
const TQStyleOption& opt,
|
|
|
|
|
|
|
|
const TQWidget* widget ) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (contents)
|
|
|
|
switch (contents)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2483,8 +2503,8 @@ TQSize StyleCheckStyle::sizeFromContents( ContentsType contents,
|
|
|
|
const TQPushButton* button = (const TQPushButton*) widget;
|
|
|
|
const TQPushButton* button = (const TQPushButton*) widget;
|
|
|
|
int w = contentSize.width();
|
|
|
|
int w = contentSize.width();
|
|
|
|
int h = contentSize.height();
|
|
|
|
int h = contentSize.height();
|
|
|
|
int bm = pixelMetric( PM_ButtonMargin, widget );
|
|
|
|
int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget );
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2;
|
|
|
|
int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2;
|
|
|
|
|
|
|
|
|
|
|
|
w += bm + fw + 6; // ### Add 6 to make way for bold font.
|
|
|
|
w += bm + fw + 6; // ### Add 6 to make way for bold font.
|
|
|
|
h += bm + fw;
|
|
|
|
h += bm + fw;
|
|
|
@ -2495,7 +2515,7 @@ TQSize StyleCheckStyle::sizeFromContents( ContentsType contents,
|
|
|
|
w = 80;
|
|
|
|
w = 80;
|
|
|
|
|
|
|
|
|
|
|
|
// Compensate for default indicator
|
|
|
|
// Compensate for default indicator
|
|
|
|
int di = pixelMetric( PM_ButtonDefaultIndicator );
|
|
|
|
int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
|
|
|
|
w += di * 2;
|
|
|
|
w += di * 2;
|
|
|
|
h += di * 2;
|
|
|
|
h += di * 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2566,15 +2586,17 @@ TQSize StyleCheckStyle::sizeFromContents( ContentsType contents,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return KStyle::tqsizeFromContents( contents, widget, contentSize, opt );
|
|
|
|
return KStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fix TQt's wacky image alignment
|
|
|
|
// Fix TQt's wacky image alignment
|
|
|
|
TQPixmap StyleCheckStyle::stylePixmap(StylePixmap stylepixmap,
|
|
|
|
TQPixmap StyleCheckStyle::stylePixmap(StylePixmap stylepixmap,
|
|
|
|
const TQWidget* widget,
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
const TQStyleOption& opt) const
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
|
|
|
const TQStyleOption& opt,
|
|
|
|
|
|
|
|
const TQWidget* widget) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (stylepixmap) {
|
|
|
|
switch (stylepixmap) {
|
|
|
|
case SP_TitleBarMinButton:
|
|
|
|
case SP_TitleBarMinButton:
|
|
|
@ -2585,166 +2607,169 @@ TQPixmap StyleCheckStyle::stylePixmap(StylePixmap stylepixmap,
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return KStyle::stylePixmap(stylepixmap, widget, opt);
|
|
|
|
return KStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool StyleCheckStyle::eventFilter( TQObject *object, TQEvent *event )
|
|
|
|
bool StyleCheckStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (KStyle::eventFilter( object, event ))
|
|
|
|
if (KStyle::objectEventHandler( ceData, elementFlags, source, event ))
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
|
|
|
|
|
|
|
|
TQObject* object = reinterpret_cast<TQObject*>(source);
|
|
|
|
|
|
|
|
|
|
|
|
// Handle push button hover effects.
|
|
|
|
// Handle push button hover effects.
|
|
|
|
TQPushButton* button = dynamic_cast<TQPushButton*>(object);
|
|
|
|
TQPushButton* button = dynamic_cast<TQPushButton*>(object);
|
|
|
|
if ( button )
|
|
|
|
if ( button )
|
|
|
|
{
|
|
|
|
|
|
|
|
if ( (event->type() == TQEvent::Enter) &&
|
|
|
|
|
|
|
|
(button->isEnabled()) ) {
|
|
|
|
|
|
|
|
hoverWidget = button;
|
|
|
|
|
|
|
|
button->repaint( false );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ( (event->type() == TQEvent::Leave) &&
|
|
|
|
|
|
|
|
(TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(hoverWidget)) ) {
|
|
|
|
|
|
|
|
hoverWidget = 0L;
|
|
|
|
|
|
|
|
button->repaint( false );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( event->type() == TQEvent::Paint && object->inherits(TQLABEL_OBJECT_NAME_STRING) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TQLabel* lb = static_cast<TQLabel*>(TQT_TQWIDGET(object));
|
|
|
|
|
|
|
|
if (lb->pixmap() || lb->picture() || lb->movie() || (lb->textFormat() == TQt::RichText) ||
|
|
|
|
|
|
|
|
(lb->textFormat() == TQt::AutoText && TQStyleSheet::mightBeRichText(lb->text())) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQPainter p(lb);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQRect cr = lb->contentsRect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int m = lb->indent();
|
|
|
|
|
|
|
|
if ( m < 0 && lb->frameWidth() ) // no indent, but we do have a frame
|
|
|
|
|
|
|
|
m = lb->fontMetrics().width('x') / 2 - lb->margin();
|
|
|
|
|
|
|
|
if ( m > 0 )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int hAlign = TQApplication::horizontalAlignment( lb->alignment() );
|
|
|
|
|
|
|
|
if ( hAlign & AlignLeft )
|
|
|
|
|
|
|
|
cr.setLeft( cr.left() + m );
|
|
|
|
|
|
|
|
if ( hAlign & AlignRight )
|
|
|
|
|
|
|
|
cr.setRight( cr.right() - m );
|
|
|
|
|
|
|
|
if ( lb->alignment() & AlignTop )
|
|
|
|
|
|
|
|
cr.setTop( cr.top() + m );
|
|
|
|
|
|
|
|
if ( lb->alignment() & AlignBottom )
|
|
|
|
|
|
|
|
cr.setBottom( cr.bottom() - m );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQValueVector<StyleGuideViolation> violations;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (TQCString(lb->name()) == "KJanusWidgetTitleLabel" || lb->font().bold())
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// We're a page title
|
|
|
|
if ( (event->type() == TQEvent::Enter) &&
|
|
|
|
violations = checkTitleStyle(lb->text(), LongTitle, lb->buddy() ? HasAccels : NoAccels);
|
|
|
|
(button->isEnabled()) ) {
|
|
|
|
}
|
|
|
|
hoverWidget = button;
|
|
|
|
else
|
|
|
|
button->repaint( false );
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// We're probably, maybe, not a page title label
|
|
|
|
else if ( (event->type() == TQEvent::Leave) &&
|
|
|
|
// Further checks might be needed, depending on how often this comes up in the wild
|
|
|
|
(TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(hoverWidget)) ) {
|
|
|
|
violations = checkSentenceStyle(lb->text(), lb->buddy() ? BuddiedWidget: BuddylessWidget, lb->buddy() ? HasAccels : NoAccels);
|
|
|
|
hoverWidget = 0L;
|
|
|
|
}
|
|
|
|
button->repaint( false );
|
|
|
|
|
|
|
|
}
|
|
|
|
if (lb->buddy())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
renderViolations(violations, &p, cr,lb->alignment() | ShowPrefix, lb->text() );
|
|
|
|
|
|
|
|
// ordinary text or pixmap label
|
|
|
|
|
|
|
|
drawItem( &p, cr, lb->alignment(), lb->colorGroup(), lb->isEnabled(),
|
|
|
|
|
|
|
|
0, removedXX(stripAccelViolations(lb->text())) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
renderViolations(violations, &p, cr,lb->alignment(), lb->text() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ordinary text or pixmap label
|
|
|
|
|
|
|
|
drawItem( &p, cr, lb->alignment(), lb->colorGroup(), lb->isEnabled(),
|
|
|
|
|
|
|
|
0, removedXX(stripAccelViolations(lb->text())) );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
p.end();
|
|
|
|
if ( event->type() == TQEvent::Paint && object->inherits(TQLABEL_OBJECT_NAME_STRING) )
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( event->type() == TQEvent::Paint && object->inherits(TQGROUPBOX_OBJECT_NAME_STRING) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TQPaintEvent * pevent = TQT_TQPAINTEVENT(event);
|
|
|
|
|
|
|
|
TQGroupBox* gb = static_cast<TQGroupBox*>(TQT_TQWIDGET(object));
|
|
|
|
|
|
|
|
bool nestedGroupBox = false;
|
|
|
|
|
|
|
|
TQString stripped_title = removedXX(stripAccelViolations(gb->title()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Walk parent hierarchy to check whether any are groupboxes too..
|
|
|
|
|
|
|
|
TQObject* parent = TQT_TQOBJECT(gb);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GCC suggested parentheses around assignment used as truth value
|
|
|
|
|
|
|
|
// I suggested that it could eat me. GCC won.
|
|
|
|
|
|
|
|
while ( (parent = parent->parent()) )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (parent->inherits(TQGROUPBOX_OBJECT_NAME_STRING))
|
|
|
|
TQLabel* lb = static_cast<TQLabel*>(TQT_TQWIDGET(object));
|
|
|
|
|
|
|
|
if (lb->pixmap() || lb->picture() || lb->movie() || (lb->textFormat() == TQt::RichText) ||
|
|
|
|
|
|
|
|
(lb->textFormat() == TQt::AutoText && TQStyleSheet::mightBeRichText(lb->text())) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nestedGroupBox = true;
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQPainter p(lb);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQRect cr = lb->contentsRect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int m = lb->indent();
|
|
|
|
|
|
|
|
if ( m < 0 && lb->frameWidth() ) // no indent, but we do have a frame
|
|
|
|
|
|
|
|
m = lb->fontMetrics().width('x') / 2 - lb->margin();
|
|
|
|
|
|
|
|
if ( m > 0 )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int hAlign = TQApplication::horizontalAlignment( lb->alignment() );
|
|
|
|
|
|
|
|
if ( hAlign & AlignLeft )
|
|
|
|
|
|
|
|
cr.setLeft( cr.left() + m );
|
|
|
|
|
|
|
|
if ( hAlign & AlignRight )
|
|
|
|
|
|
|
|
cr.setRight( cr.right() - m );
|
|
|
|
|
|
|
|
if ( lb->alignment() & AlignTop )
|
|
|
|
|
|
|
|
cr.setTop( cr.top() + m );
|
|
|
|
|
|
|
|
if ( lb->alignment() & AlignBottom )
|
|
|
|
|
|
|
|
cr.setBottom( cr.bottom() - m );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQValueVector<StyleGuideViolation> violations;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (TQCString(lb->name()) == "KJanusWidgetTitleLabel" || lb->font().bold())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// We're a page title
|
|
|
|
|
|
|
|
violations = checkTitleStyle(lb->text(), LongTitle, lb->buddy() ? HasAccels : NoAccels);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// We're probably, maybe, not a page title label
|
|
|
|
|
|
|
|
// Further checks might be needed, depending on how often this comes up in the wild
|
|
|
|
|
|
|
|
violations = checkSentenceStyle(lb->text(), lb->buddy() ? BuddiedWidget: BuddylessWidget, lb->buddy() ? HasAccels : NoAccels);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (lb->buddy())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
renderViolations(violations, &p, cr,lb->alignment() | ShowPrefix, lb->text() );
|
|
|
|
|
|
|
|
// ordinary text or pixmap label
|
|
|
|
|
|
|
|
drawItem( &p, cr, lb->alignment(), lb->colorGroup(), lb->isEnabled(),
|
|
|
|
|
|
|
|
0, removedXX(stripAccelViolations(lb->text())) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
renderViolations(violations, &p, cr,lb->alignment(), lb->text() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ordinary text or pixmap label
|
|
|
|
|
|
|
|
drawItem( &p, cr, lb->alignment(), lb->colorGroup(), lb->isEnabled(),
|
|
|
|
|
|
|
|
0, removedXX(stripAccelViolations(lb->text())) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
p.end();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQPainter paint( gb );
|
|
|
|
if ( event->type() == TQEvent::Paint && object->inherits(TQGROUPBOX_OBJECT_NAME_STRING) )
|
|
|
|
if ( stripped_title.length() )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// draw title
|
|
|
|
TQPaintEvent * pevent = TQT_TQPAINTEVENT(event);
|
|
|
|
TQFontMetrics fm = paint.fontMetrics();
|
|
|
|
TQGroupBox* gb = static_cast<TQGroupBox*>(TQT_TQWIDGET(object));
|
|
|
|
int h = fm.height();
|
|
|
|
bool nestedGroupBox = false;
|
|
|
|
int tw = fm.width( stripped_title, stripped_title.length() ) + 2*fm.width(TQChar(' '));
|
|
|
|
TQString stripped_title = removedXX(stripAccelViolations(gb->title()));
|
|
|
|
int x;
|
|
|
|
|
|
|
|
if ( gb->alignment() & AlignHCenter ) // center alignment
|
|
|
|
//Walk parent hierarchy to check whether any are groupboxes too..
|
|
|
|
x = gb->frameRect().width()/2 - tw/2;
|
|
|
|
TQObject* parent = TQT_TQOBJECT(gb);
|
|
|
|
else if ( gb->alignment() & AlignRight ) // right alignment
|
|
|
|
|
|
|
|
x = gb->frameRect().width() - tw - 8;
|
|
|
|
// GCC suggested parentheses around assignment used as truth value
|
|
|
|
else if ( gb->alignment() & AlignLeft ) // left alignment
|
|
|
|
// I suggested that it could eat me. GCC won.
|
|
|
|
x = 8;
|
|
|
|
while ( (parent = parent->parent()) )
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{ // auto align
|
|
|
|
if (parent->inherits(TQGROUPBOX_OBJECT_NAME_STRING))
|
|
|
|
if( TQApplication::reverseLayout() )
|
|
|
|
{
|
|
|
|
|
|
|
|
nestedGroupBox = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQPainter paint( gb );
|
|
|
|
|
|
|
|
if ( stripped_title.length() )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// draw title
|
|
|
|
|
|
|
|
TQFontMetrics fm = paint.fontMetrics();
|
|
|
|
|
|
|
|
int h = fm.height();
|
|
|
|
|
|
|
|
int tw = fm.width( stripped_title, stripped_title.length() ) + 2*fm.width(TQChar(' '));
|
|
|
|
|
|
|
|
int x;
|
|
|
|
|
|
|
|
if ( gb->alignment() & AlignHCenter ) // center alignment
|
|
|
|
|
|
|
|
x = gb->frameRect().width()/2 - tw/2;
|
|
|
|
|
|
|
|
else if ( gb->alignment() & AlignRight ) // right alignment
|
|
|
|
x = gb->frameRect().width() - tw - 8;
|
|
|
|
x = gb->frameRect().width() - tw - 8;
|
|
|
|
else
|
|
|
|
else if ( gb->alignment() & AlignLeft ) // left alignment
|
|
|
|
x = 8;
|
|
|
|
x = 8;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{ // auto align
|
|
|
|
|
|
|
|
if( TQApplication::reverseLayout() )
|
|
|
|
|
|
|
|
x = gb->frameRect().width() - tw - 8;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
x = 8;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
TQRect r( x, 0, tw, h );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQValueVector<StyleGuideViolation> violations = checkTitleStyle( gb->title(), ShortTitle, HasAccels );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
renderViolations( violations, &paint, r, AlignCenter | ShowPrefix, gb->title() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drawItem(&paint, r, AlignCenter | ShowPrefix, gb->colorGroup(),
|
|
|
|
|
|
|
|
gb->isEnabled(), 0, stripped_title );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
paint.setClipRegion( pevent->region().subtract( r ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TQRect r( x, 0, tw, h );
|
|
|
|
|
|
|
|
|
|
|
|
if (nestedGroupBox)
|
|
|
|
TQValueVector<StyleGuideViolation> violations = checkTitleStyle( gb->title(), ShortTitle, HasAccels );
|
|
|
|
{
|
|
|
|
|
|
|
|
paint.save();
|
|
|
|
renderViolations( violations, &paint, r, AlignCenter | ShowPrefix, gb->title() );
|
|
|
|
TQPen errorPen(TQt::red, 4, TQPen::DashDotDotLine);
|
|
|
|
|
|
|
|
paint.setPen(errorPen);
|
|
|
|
drawItem(&paint, r, AlignCenter | ShowPrefix, gb->colorGroup(),
|
|
|
|
paint.drawRect( gb->frameRect() );
|
|
|
|
gb->isEnabled(), 0, stripped_title );
|
|
|
|
paint.restore();
|
|
|
|
|
|
|
|
}
|
|
|
|
paint.setClipRegion( pevent->region().subtract( r ) );
|
|
|
|
else
|
|
|
|
}
|
|
|
|
{
|
|
|
|
|
|
|
|
drawPrimitive( TQStyle::PE_GroupBoxFrame, &paint, ceData, elementFlags, gb->frameRect(),
|
|
|
|
if (nestedGroupBox)
|
|
|
|
gb->colorGroup(), TQStyle::Style_Default,
|
|
|
|
{
|
|
|
|
TQStyleOption(gb->lineWidth(), gb->midLineWidth(),
|
|
|
|
paint.save();
|
|
|
|
gb->frameShape(), gb->frameShadow()) );
|
|
|
|
TQPen errorPen(TQt::red, 4, TQPen::DashDotDotLine);
|
|
|
|
}
|
|
|
|
paint.setPen(errorPen);
|
|
|
|
return true; //We already drew the everything
|
|
|
|
paint.drawRect( gb->frameRect() );
|
|
|
|
|
|
|
|
paint.restore();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
tqdrawPrimitive( TQStyle::PE_GroupBoxFrame, &paint, gb->frameRect(),
|
|
|
|
|
|
|
|
gb->colorGroup(), TQStyle::Style_Default,
|
|
|
|
|
|
|
|
TQStyleOption(gb->lineWidth(), gb->midLineWidth(),
|
|
|
|
|
|
|
|
gb->frameShape(), gb->frameShadow()) );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true; //We already drew the everything
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|