Automated update from Qt3

pull/1/head
Timothy Pearson 13 years ago
parent b6053b1b40
commit 6df11f9b12

@ -41,113 +41,129 @@ MetalStyle::MetalStyle() : TQWindowsStyle() { }
/*! /*!
Reimplementation from TQStyle Reimplementation from TQStyle
*/ */
void MetalStyle::polish( TQApplication *app) void MetalStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
{ {
oldPalette = app->palette(); if (ceData.widgetObjectTypes.contains("TQApplication")) {
TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
// we simply create a nice TQColorGroup with a couple of fancy
// pixmaps here and apply to it all widgets oldPalette = app->palette();
TQFont f("times", app->font().pointSize() ); // we simply create a nice TQColorGroup with a couple of fancy
f.setBold( TRUE ); // pixmaps here and apply to it all widgets
f.setItalic( TRUE );
app->setFont( f, TRUE, "TQMenuBar"); TQFont f("times", app->font().pointSize() );
app->setFont( f, TRUE, "TQPopupMenu"); f.setBold( TRUE );
f.setItalic( TRUE );
app->setFont( f, TRUE, "TQMenuBar");
app->setFont( f, TRUE, "TQPopupMenu");
// TQPixmap button( stonedark_xpm );
TQColor gold("#B9B9A5A54040"); //same as topgrad below
TQPixmap button( 1, 1 ); button.fill( gold ); // TQPixmap button( stonedark_xpm );
TQPixmap background(marble_xpm); TQColor gold("#B9B9A5A54040"); //same as topgrad below
TQPixmap dark( 1, 1 ); dark.fill( red.dark() ); TQPixmap button( 1, 1 ); button.fill( gold );
TQPixmap mid( stone1_xpm );
TQPixmap light( stone1_xpm );//1, 1 ); light.fill( green ); TQPixmap background(marble_xpm);
TQPixmap dark( 1, 1 ); dark.fill( red.dark() );
TQPalette op = app->palette(); TQPixmap mid( stone1_xpm );
TQPixmap light( stone1_xpm );//1, 1 ); light.fill( green );
TQColor backCol( 227,227,227 );
TQPalette op = app->palette();
// TQPalette op(white);
TQColorGroup active (op.active().foreground(), TQColor backCol( 227,227,227 );
TQBrush(op.active().button(),button),
TQBrush(op.active().light(), light), // TQPalette op(white);
TQBrush(op.active().dark(), dark), TQColorGroup active (op.active().foreground(),
TQBrush(op.active().mid(), mid), TQBrush(op.active().button(),button),
op.active().text(), TQBrush(op.active().light(), light),
TQt::white, TQBrush(op.active().dark(), dark),
op.active().base(),// TQColor(236,182,120), TQBrush(op.active().mid(), mid),
TQBrush(backCol, background) op.active().text(),
); TQt::white,
active.setColor( TQColorGroup::ButtonText, TQt::white ); op.active().base(),// TQColor(236,182,120),
active.setColor( TQColorGroup::Shadow, TQt::black ); TQBrush(backCol, background)
TQColorGroup disabled (op.disabled().foreground(), );
TQBrush(op.disabled().button(),button), active.setColor( TQColorGroup::ButtonText, TQt::white );
TQBrush(op.disabled().light(), light), active.setColor( TQColorGroup::Shadow, TQt::black );
op.disabled().dark(), TQColorGroup disabled (op.disabled().foreground(),
TQBrush(op.disabled().mid(), mid), TQBrush(op.disabled().button(),button),
op.disabled().text(), TQBrush(op.disabled().light(), light),
TQt::white, op.disabled().dark(),
op.disabled().base(),// TQColor(236,182,120), TQBrush(op.disabled().mid(), mid),
TQBrush(backCol, background) op.disabled().text(),
); TQt::white,
op.disabled().base(),// TQColor(236,182,120),
TQPalette newPalette( active, disabled, active ); TQBrush(backCol, background)
app->setPalette( newPalette, TRUE ); );
TQPalette newPalette( active, disabled, active );
app->setPalette( newPalette, TRUE );
}
} }
/*! /*!
Reimplementation from TQStyle Reimplementation from TQStyle
*/ */
void MetalStyle::unPolish( TQApplication *app) void MetalStyle::applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
{ {
app->setPalette(oldPalette, TRUE); if (ceData.widgetObjectTypes.contains("TQApplication")) {
app->setFont( app->font(), TRUE ); TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
app->setPalette(oldPalette, TRUE);
app->setFont( app->font(), TRUE );
}
} }
/*! /*!
Reimplementation from TQStyle Reimplementation from TQStyle
*/ */
void MetalStyle::polish( TQWidget* w) void MetalStyle::polish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
{ {
if (ceData.widgetObjectTypes.contains("TQWidget")) {
// the polish function sets some widgets to transparent mode and TQWidget *w = reinterpret_cast<TQWidget*>(ptr);
// some to translate background mode in order to get the full
// benefit from the nice pixmaps in the color group. // the polish function sets some widgets to transparent mode and
// some to translate background mode in order to get the full
if (w->inherits("TQPushButton")){ // benefit from the nice pixmaps in the color group.
w->setBackgroundMode( TQWidget::NoBackground );
return; if (w->inherits("TQPushButton")){
} w->setBackgroundMode( TQWidget::NoBackground );
return;
if ( !w->isTopLevel() ) { }
if ( w->backgroundPixmap() )
w->setBackgroundOrigin( TQWidget::WindowOrigin ); if ( !w->isTopLevel() ) {
} if ( w->backgroundPixmap() ) {
w->setBackgroundOrigin( TQWidget::WindowOrigin );
}
}
}
} }
void MetalStyle::unPolish( TQWidget* w) void MetalStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
{ {
if (ceData.widgetObjectTypes.contains("TQWidget")) {
// the polish function sets some widgets to transparent mode and TQWidget *w = reinterpret_cast<TQWidget*>(ptr);
// some to translate background mode in order to get the full
// benefit from the nice pixmaps in the color group. // the polish function sets some widgets to transparent mode and
// some to translate background mode in order to get the full
if (w->inherits("TQPushButton")){ // benefit from the nice pixmaps in the color group.
w->setBackgroundMode( TQWidget::PaletteButton );
return; if (w->inherits("TQPushButton")){
} w->setBackgroundMode( TQWidget::PaletteButton );
if ( !w->isTopLevel() ) { return;
if ( w->backgroundPixmap() ) }
w->setBackgroundOrigin( TQWidget::WidgetOrigin ); if ( !w->isTopLevel() ) {
} if ( w->backgroundPixmap() )
w->setBackgroundOrigin( TQWidget::WidgetOrigin );
}
}
} }
void MetalStyle::drawPrimitive( PrimitiveElement pe, void MetalStyle::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, const TQStyleOption& opt ) const SFlags flags, const TQStyleOption& opt ) const
@ -170,13 +186,13 @@ void MetalStyle::drawPrimitive( PrimitiveElement pe,
drawMetalButton( p, r.x(), r.y(), r.width(), r.height(), drawMetalButton( p, r.x(), r.y(), r.width(), r.height(),
flags & Style_Down, !( flags & Style_Horizontal ) ); flags & Style_Down, !( flags & Style_Horizontal ) );
drawPrimitive( (flags & Style_Horizontal) ? PE_ArrowRight :PE_ArrowDown, drawPrimitive( (flags & Style_Horizontal) ? PE_ArrowRight :PE_ArrowDown,
p, r, cg, flags, opt ); p, ceData, elementFlags, r, cg, flags, opt );
break; break;
case PE_ScrollBarSubLine: case PE_ScrollBarSubLine:
drawMetalButton( p, r.x(), r.y(), r.width(), r.height(), drawMetalButton( p, r.x(), r.y(), r.width(), r.height(),
flags & Style_Down, !( flags & Style_Horizontal ) ); flags & Style_Down, !( flags & Style_Horizontal ) );
drawPrimitive( (flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp, drawPrimitive( (flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp,
p, r, cg, flags, opt ); p, ceData, elementFlags, r, cg, flags, opt );
break; break;
@ -185,18 +201,20 @@ void MetalStyle::drawPrimitive( PrimitiveElement pe,
flags & Style_Horizontal ); flags & Style_Horizontal );
break; break;
default: default:
TQWindowsStyle::drawPrimitive( pe, p, r, cg, flags, opt ); TQWindowsStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
break; break;
} }
} }
void MetalStyle::drawControl( ControlElement element, void MetalStyle::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 how, SFlags how,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch( element ) { switch( element ) {
case CE_PushButton: case CE_PushButton:
@ -238,7 +256,7 @@ void MetalStyle::drawControl( ControlElement element,
flags |= Style_Down; flags |= Style_Down;
if ( !btn->isFlat() && !btn->isDown() ) if ( !btn->isFlat() && !btn->isDown() )
flags |= Style_Raised; flags |= Style_Raised;
drawPrimitive( PE_ButtonCommand, p, drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags,
TQRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1), TQRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1),
cg, flags, opt ); cg, flags, opt );
@ -248,7 +266,7 @@ void MetalStyle::drawControl( ControlElement element,
flags |= Style_Enabled; flags |= Style_Enabled;
int dx = ( y1 - y2 - 4 ) / 3; int dx = ( y1 - y2 - 4 ) / 3;
drawPrimitive( PE_ArrowDown, p, drawPrimitive( PE_ArrowDown, p, ceData, elementFlags,
TQRect(x2 - dx, dx, y1, y2 - y1), TQRect(x2 - dx, dx, y1, y2 - y1),
cg, flags, opt ); cg, flags, opt );
} }
@ -289,29 +307,31 @@ void MetalStyle::drawControl( ControlElement element,
break; break;
} }
default: default:
TQWindowsStyle::drawControl( element, p, widget, r, cg, how, opt ); TQWindowsStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget );
break; break;
} }
} }
void MetalStyle::drawComplexControl( ComplexControl cc, void MetalStyle::drawComplexControl( ComplexControl cc,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how, SFlags how,
SCFlags sub, SCFlags sub,
SCFlags subActive, SCFlags subActive,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch ( cc ) { switch ( cc ) {
case CC_Slider: case CC_Slider:
{ {
const TQSlider *slider = ( const TQSlider* ) widget; const TQSlider *slider = ( const TQSlider* ) widget;
TQRect handle = querySubControlMetrics( CC_Slider, widget, TQRect handle = querySubControlMetrics( CC_Slider, ceData, elementFlags,
SC_SliderHandle, opt); SC_SliderHandle, opt, widget);
if ( sub & SC_SliderGroove ) if ( sub & SC_SliderGroove )
TQWindowsStyle::drawComplexControl( cc, p, widget, r, cg, how, TQWindowsStyle::drawComplexControl( cc, p, ceData, elementFlags, r, cg, how,
SC_SliderGroove, subActive, opt ); SC_SliderGroove, subActive, opt, widget );
if ( (sub & SC_SliderHandle) && handle.isValid() ) if ( (sub & SC_SliderHandle) && handle.isValid() )
drawMetalButton( p, handle.x(), handle.y(), handle.width(), drawMetalButton( p, handle.x(), handle.y(), handle.width(),
handle.height(), FALSE, handle.height(), FALSE,
@ -328,7 +348,7 @@ void MetalStyle::drawComplexControl( ComplexControl cc,
&cg.brush( TQColorGroup::Background ) ); &cg.brush( TQColorGroup::Background ) );
drawMetalButton( p, r.x() + r.width() - 2 - 16, r.y() + 2, 16, r.height() - 4, drawMetalButton( p, r.x() + r.width() - 2 - 16, r.y() + 2, 16, r.height() - 4,
how & Style_Sunken, TRUE ); how & Style_Sunken, TRUE );
drawPrimitive( PE_ArrowDown, p, drawPrimitive( PE_ArrowDown, p, ceData, elementFlags,
TQRect( r.x() + r.width() - 2 - 16 + 2, TQRect( r.x() + r.width() - 2 - 16 + 2,
r.y() + 2 + 2, 16 - 4, r.height() - 4 -4 ), r.y() + 2 + 2, 16 - 4, r.height() - 4 -4 ),
cg, cg,
@ -337,8 +357,8 @@ void MetalStyle::drawComplexControl( ComplexControl cc,
break; break;
} }
default: default:
TQWindowsStyle::drawComplexControl( cc, p, widget, r, cg, how, sub, subActive, TQWindowsStyle::drawComplexControl( cc, p, ceData, elementFlags, r, cg, how, sub, subActive,
opt ); opt, widget );
break; break;
} }
} }
@ -473,13 +493,13 @@ void MetalStyle::drawMetalGradient( TQPainter *p, int x, int y, int w, int h,
int MetalStyle::pixelMetric( PixelMetric metric, const TQWidget *w ) const int MetalStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *w ) const
{ {
switch ( metric ) { switch ( metric ) {
case PM_MenuBarFrameWidth: case PM_MenuBarFrameWidth:
return 2; return 2;
default: default:
return TQWindowsStyle::pixelMetric( metric, w ); return TQWindowsStyle::pixelMetric( metric, ceData, elementFlags, w );
} }
} }

@ -26,13 +26,15 @@ class MetalStyle : public TQWindowsStyle
{ {
public: public:
MetalStyle(); MetalStyle();
void polish( TQApplication*); void applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void unPolish( TQApplication*); void applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void polish( TQWidget* ); void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void unPolish( TQWidget* ); void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void drawPrimitive( PrimitiveElement pe, void 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 = Style_Default, SFlags flags = Style_Default,
@ -40,22 +42,26 @@ public:
void drawControl( ControlElement element, void 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 how = Style_Default, SFlags how = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControl( ComplexControl cc, void drawComplexControl( ComplexControl cc,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
SCFlags sub = SC_All, SCFlags sub = SC_All,
SCFlags subActive = SC_None, SCFlags subActive = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
int pixelMetric( PixelMetric, const TQWidget * ) const; const TQWidget *widget = 0 ) const;
int pixelMetric( PixelMetric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * = 0 ) const;
private: private:

@ -769,156 +769,171 @@ NorwegianWoodStyle::NorwegianWoodStyle() : TQWindowsStyle()
/*! /*!
Reimplementation from TQStyle Reimplementation from TQStyle
*/ */
void NorwegianWoodStyle::polish( TQApplication *app) void NorwegianWoodStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
{ {
if (ceData.widgetObjectTypes.contains("TQApplication")) {
TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
oldPalette = app->palette(); oldPalette = app->palette();
// we simply create a nice TQColorGroup with a couple of fancy wood // we simply create a nice TQColorGroup with a couple of fancy wood
// pixmaps here and apply to it all widgets // pixmaps here and apply to it all widgets
TQImage img(button_xpm); TQImage img(button_xpm);
TQImage orig = img; TQImage orig = img;
orig.detach(); orig.detach();
TQPixmap button; TQPixmap button;
button.convertFromImage(img); button.convertFromImage(img);
int i; int i;
for (i=0; i<img.numColors(); i++) { for (i=0; i<img.numColors(); i++) {
TQRgb rgb = img.color(i); TQRgb rgb = img.color(i);
TQColor c(rgb); TQColor c(rgb);
rgb = c.dark(120).rgb(); rgb = c.dark(120).rgb();
img.setColor(i,rgb); img.setColor(i,rgb);
} }
TQPixmap mid; TQPixmap mid;
mid.convertFromImage(img); mid.convertFromImage(img);
img = orig; img = orig;
img.detach(); img.detach();
for (i=0; i<img.numColors(); i++) { for (i=0; i<img.numColors(); i++) {
TQRgb rgb = img.color(i); TQRgb rgb = img.color(i);
TQColor c(rgb); TQColor c(rgb);
rgb = c.light().rgb(); rgb = c.light().rgb();
img.setColor(i,rgb); img.setColor(i,rgb);
} }
TQPixmap light; TQPixmap light;
light.convertFromImage(img); light.convertFromImage(img);
img = orig; img = orig;
img.detach(); img.detach();
for (i=0; i<img.numColors(); i++) { for (i=0; i<img.numColors(); i++) {
TQRgb rgb = img.color(i); TQRgb rgb = img.color(i);
TQColor c(rgb); TQColor c(rgb);
rgb = c.dark(180).rgb(); rgb = c.dark(180).rgb();
img.setColor(i,rgb); img.setColor(i,rgb);
} }
TQPixmap dark; TQPixmap dark;
dark.convertFromImage(img); dark.convertFromImage(img);
TQImage bgimage(polish_xpm);
TQPixmap background;
background.convertFromImage(bgimage);
img = bgimage; TQImage bgimage(polish_xpm);
img.detach(); TQPixmap background;
for (i=0; i<img.numColors(); i++) { background.convertFromImage(bgimage);
TQRgb rgb = img.color(i);
TQColor c(rgb);
rgb = c.dark(180).rgb();
img.setColor(i,rgb);
}
sunkenDark = new TQPixmap;
sunkenDark->convertFromImage(img);
img = bgimage;
img.detach();
for (i=0; i<img.numColors(); i++) {
TQRgb rgb = img.color(i);
TQColor c(rgb);
rgb = c.dark(180).rgb();
img.setColor(i,rgb);
}
sunkenDark = new TQPixmap;
sunkenDark->convertFromImage(img);
img = bgimage;
img.detach();
for (i=0; i<img.numColors(); i++) {
TQRgb rgb = img.color(i);
TQColor c(rgb);
rgb = c.light(130).rgb();
img.setColor(i,rgb);
}
sunkenLight= new TQPixmap;
sunkenLight->convertFromImage(img);
TQPalette op(TQColor(212,140,95));
// TQPalette op(white);
TQColorGroup active (op.active().foreground(),
TQBrush(op.active().button(),button),
TQBrush(op.active().light(), light),
TQBrush(op.active().dark(), dark),
TQBrush(op.active().mid(), mid),
op.active().text(),
TQt::white,
TQColor(236,182,120),
TQBrush(op.active().background(), background)
);
TQColorGroup disabled (op.disabled().foreground(),
TQBrush(op.disabled().button(),button),
TQBrush(op.disabled().light(), light),
op.disabled().dark(),
TQBrush(op.disabled().mid(), mid),
op.disabled().text(),
TQt::white,
TQColor(236,182,120),
TQBrush(op.disabled().background(), background)
);
app->setPalette(TQPalette(active, disabled, active), TRUE );
img = bgimage;
img.detach();
for (i=0; i<img.numColors(); i++) {
TQRgb rgb = img.color(i);
TQColor c(rgb);
rgb = c.light(130).rgb();
img.setColor(i,rgb);
}
sunkenLight= new TQPixmap;
sunkenLight->convertFromImage(img);
TQPalette op(TQColor(212,140,95));
// TQPalette op(white);
TQColorGroup active (op.active().foreground(),
TQBrush(op.active().button(),button),
TQBrush(op.active().light(), light),
TQBrush(op.active().dark(), dark),
TQBrush(op.active().mid(), mid),
op.active().text(),
TQt::white,
TQColor(236,182,120),
TQBrush(op.active().background(), background)
);
TQColorGroup disabled (op.disabled().foreground(),
TQBrush(op.disabled().button(),button),
TQBrush(op.disabled().light(), light),
op.disabled().dark(),
TQBrush(op.disabled().mid(), mid),
op.disabled().text(),
TQt::white,
TQColor(236,182,120),
TQBrush(op.disabled().background(), background)
);
app->setPalette(TQPalette(active, disabled, active), TRUE );
}
} }
void NorwegianWoodStyle::unPolish( TQApplication *app) void NorwegianWoodStyle::applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
{ {
app->setPalette(oldPalette, TRUE); if (ceData.widgetObjectTypes.contains("TQApplication")) {
TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
app->setPalette(oldPalette, TRUE);
}
} }
/*! /*!
Reimplementation from TQStyle Reimplementation from TQStyle
*/ */
void NorwegianWoodStyle::polish( TQWidget* w) void NorwegianWoodStyle::polish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
{ {
if (ceData.widgetObjectTypes.contains("TQWidget")) {
// the polish function sets some widgets to transparent mode and TQWidget *w = reinterpret_cast<TQWidget*>(ptr);
// some to translate background mode in order to get the full
// benefit from the nice pixmaps in the color group. // the polish function sets some widgets to transparent mode and
// some to translate background mode in order to get the full
if ( !w->isTopLevel() ) { // benefit from the nice pixmaps in the color group.
if ( w->inherits("TQPushButton")
|| w->inherits("TQToolButton") if ( !w->isTopLevel() ) {
|| w->inherits("TQComboBox") ) { if ( w->inherits("TQPushButton")
w->setAutoMask( TRUE ); || w->inherits("TQToolButton")
return; || w->inherits("TQComboBox") ) {
w->setAutoMask( TRUE );
return;
}
if ( w->backgroundPixmap() )
w->setBackgroundOrigin( TQWidget::WindowOrigin );
}
} }
if ( w->backgroundPixmap() )
w->setBackgroundOrigin( TQWidget::WindowOrigin );
}
} }
void NorwegianWoodStyle::unPolish( TQWidget* w) void NorwegianWoodStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
{ {
// the polish function sets some widgets to transparent mode and if (ceData.widgetObjectTypes.contains("TQWidget")) {
// some to translate background mode in order to get the full TQWidget *w = reinterpret_cast<TQWidget*>(ptr);
// benefit from the nice pixmaps in the color group.
if ( !w->isTopLevel() ) { // the polish function sets some widgets to transparent mode and
if ( w->inherits("TQPushButton") // some to translate background mode in order to get the full
|| w->inherits("TQToolButton") // benefit from the nice pixmaps in the color group.
|| w->inherits("TQComboBox") ) { if ( !w->isTopLevel() ) {
w->setAutoMask( FALSE ); if ( w->inherits("TQPushButton")
return; || w->inherits("TQToolButton")
|| w->inherits("TQComboBox") ) {
w->setAutoMask( FALSE );
return;
}
if ( w->backgroundPixmap() )
w->setBackgroundOrigin( TQWidget::WidgetOrigin );
}
} }
if ( w->backgroundPixmap() )
w->setBackgroundOrigin( TQWidget::WidgetOrigin );
}
} }
void NorwegianWoodStyle::drawPrimitive( PrimitiveElement pe, void NorwegianWoodStyle::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, const TQStyleOption& opt ) const SFlags flags, const TQStyleOption& opt ) const
@ -970,28 +985,30 @@ void NorwegianWoodStyle::drawPrimitive( PrimitiveElement pe,
} }
case PE_ScrollBarAddLine: case PE_ScrollBarAddLine:
if ( flags & Style_Horizontal ) if ( flags & Style_Horizontal )
drawSemicircleButton( p, r, PointRight, flags & Style_Down, cg ); drawSemicircleButton( p, ceData, elementFlags, r, PointRight, flags & Style_Down, cg );
else else
drawSemicircleButton( p, r, PointDown, flags & Style_Down, cg ); drawSemicircleButton( p, ceData, elementFlags, r, PointDown, flags & Style_Down, cg );
break; break;
case PE_ScrollBarSubLine: case PE_ScrollBarSubLine:
if ( flags & Style_Horizontal ) if ( flags & Style_Horizontal )
drawSemicircleButton( p, r, PointLeft, flags & Style_Down, cg ); drawSemicircleButton( p, ceData, elementFlags, r, PointLeft, flags & Style_Down, cg );
else else
drawSemicircleButton( p, r, PointUp, flags & Style_Down, cg ); drawSemicircleButton( p, ceData, elementFlags, r, PointUp, flags & Style_Down, cg );
break; break;
default: default:
TQWindowsStyle::drawPrimitive( pe, p, r, cg, flags, opt ); TQWindowsStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
break; break;
} }
} }
void NorwegianWoodStyle::drawControl( ControlElement element, void NorwegianWoodStyle::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 how, const TQStyleOption& opt ) const SFlags how, const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch( element ) { switch( element ) {
case CE_PushButton: case CE_PushButton:
@ -1033,7 +1050,7 @@ void NorwegianWoodStyle::drawControl( ControlElement element,
y2 -= 2; y2 -= 2;
} }
drawPrimitive( PE_ButtonCommand, p, drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags,
TQRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1), TQRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1),
myCg, flags, opt ); myCg, flags, opt );
@ -1052,7 +1069,7 @@ void NorwegianWoodStyle::drawControl( ControlElement element,
flags = Style_Default; flags = Style_Default;
if ( btn->isEnabled() ) if ( btn->isEnabled() )
flags |= Style_Enabled; flags |= Style_Enabled;
drawPrimitive( PE_ArrowDown, p, drawPrimitive( PE_ArrowDown, p, ceData, elementFlags,
TQRect( x2 - dx, dx, y1, y2 - y1), TQRect( x2 - dx, dx, y1, y2 - y1),
myCg, flags, opt ); myCg, flags, opt );
} }
@ -1092,16 +1109,18 @@ void NorwegianWoodStyle::drawControl( ControlElement element,
break; break;
} }
default: default:
TQWindowsStyle::drawControl( element, p, widget, r, cg, how, opt ); TQWindowsStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget );
break; break;
} }
} }
void NorwegianWoodStyle::drawControlMask( ControlElement element, void NorwegianWoodStyle::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 ) {
case CE_PushButton: case CE_PushButton:
@ -1113,20 +1132,22 @@ void NorwegianWoodStyle::drawControlMask( ControlElement element,
break; break;
} }
default: default:
TQWindowsStyle::drawControlMask( element, p, widget, r, opt ); TQWindowsStyle::drawControlMask( element, p, ceData, elementFlags, r, opt, widget );
break; break;
} }
} }
void NorwegianWoodStyle::drawComplexControl( ComplexControl cc, void NorwegianWoodStyle::drawComplexControl( ComplexControl cc,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how, SFlags how,
SCFlags sub, SCFlags sub,
SCFlags subActive, SCFlags subActive,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch( cc ) { switch( cc ) {
case CC_ComboBox: case CC_ComboBox:
@ -1135,15 +1156,15 @@ void NorwegianWoodStyle::drawComplexControl( ComplexControl cc,
cmb = (const TQComboBox*)widget; cmb = (const TQComboBox*)widget;
int awh, ax, ay, sh, sy, dh, ew; int awh, ax, ay, sh, sy, dh, ew;
get_combo_parameters( subRect(SR_PushButtonContents, widget), get_combo_parameters( subRect(SR_PushButtonContents, ceData, elementFlags, widget),
ew, awh, ax, ay, sh, dh, sy ); ew, awh, ax, ay, sh, dh, sy );
drawPrimitive( PE_ButtonCommand, p, r, cg, Style_Raised, opt ); drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, Style_Raised, opt );
TQStyle *mstyle = TQStyleFactory::create( "Motif" ); TQStyle *mstyle = TQStyleFactory::create( "Motif" );
if ( mstyle ) if ( mstyle )
mstyle->drawPrimitive( PE_ArrowDown, p, mstyle->drawPrimitive( PE_ArrowDown, p, ceData, elementFlags,
TQRect(ax, ay, awh, awh), cg, how, opt ); TQRect(ax, ay, awh, awh), cg, how, opt );
else else
drawPrimitive( PE_ArrowDown, p, drawPrimitive( PE_ArrowDown, p, ceData, elementFlags,
TQRect(ax, ay, awh, awh), cg, how, opt ); TQRect(ax, ay, awh, awh), cg, how, opt );
TQPen oldPen = p->pen(); TQPen oldPen = p->pen();
@ -1156,8 +1177,8 @@ void NorwegianWoodStyle::drawComplexControl( ComplexControl cc,
p->setPen( oldPen ); p->setPen( oldPen );
if ( cmb->editable() ) { if ( cmb->editable() ) {
TQRect r( querySubControlMetrics(CC_ComboBox, widget, TQRect r( querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
SC_ComboBoxEditField, opt) ); SC_ComboBoxEditField, opt, widget) );
qDrawShadePanel( p, r, cg, TRUE, 1, qDrawShadePanel( p, r, cg, TRUE, 1,
&cg.brush(TQColorGroup::Button) ); &cg.brush(TQColorGroup::Button) );
} }
@ -1165,17 +1186,19 @@ void NorwegianWoodStyle::drawComplexControl( ComplexControl cc,
break; break;
} }
default: default:
TQWindowsStyle::drawComplexControl( cc, p, widget, r, cg, how, TQWindowsStyle::drawComplexControl( cc, p, ceData, elementFlags, r, cg, how,
sub, subActive, opt ); sub, subActive, opt, widget );
break; break;
} }
} }
void NorwegianWoodStyle::drawComplexControlMask( ComplexControl control, void NorwegianWoodStyle::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 ) {
case CC_ComboBox: case CC_ComboBox:
@ -1187,15 +1210,17 @@ void NorwegianWoodStyle::drawComplexControlMask( ComplexControl control,
break; break;
} }
default: default:
TQWindowsStyle::drawComplexControlMask( control, p, widget, r, opt ); TQWindowsStyle::drawComplexControlMask( control, p, ceData, elementFlags, r, opt, widget );
break; break;
} }
} }
TQRect NorwegianWoodStyle::querySubControlMetrics( ComplexControl control, TQRect NorwegianWoodStyle::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
{ {
TQRect rect; TQRect rect;
switch ( control ) { switch ( control ) {
@ -1204,15 +1229,15 @@ TQRect NorwegianWoodStyle::querySubControlMetrics( ComplexControl control,
switch( sc ) { switch( sc ) {
case SC_ComboBoxEditField: case SC_ComboBoxEditField:
{ {
rect = subRect( SR_PushButtonContents, widget ); rect = subRect( SR_PushButtonContents, ceData, elementFlags, widget );
int ew = get_combo_extra_width( rect.height(), 0 ); int ew = get_combo_extra_width( rect.height(), 0 );
rect.setRect( rect.x() + 1, rect.y() + 1, rect.setRect( rect.x() + 1, rect.y() + 1,
rect.width() - 2 - ew, rect.height() - 2 ); rect.width() - 2 - ew, rect.height() - 2 );
break; break;
} }
default: default:
rect = TQWindowsStyle::querySubControlMetrics( control, widget, rect = TQWindowsStyle::querySubControlMetrics( control, ceData, elementFlags,
sc, opt ); sc, opt, widget );
break; break;
} }
break; break;
@ -1237,21 +1262,21 @@ TQRect NorwegianWoodStyle::querySubControlMetrics( ComplexControl control,
rect.setRect( b, b, w - 2 * b, w - 2 * b ); rect.setRect( b, b, w - 2 * b, w - 2 * b );
break; break;
default: default:
rect = TQWindowsStyle::querySubControlMetrics( control, widget, rect = TQWindowsStyle::querySubControlMetrics( control, ceData, elementFlags,
sc, opt ); sc, opt, widget );
break; break;
} }
break; break;
} }
default: default:
rect = TQWindowsStyle::querySubControlMetrics( control, widget, rect = TQWindowsStyle::querySubControlMetrics( control, ceData, elementFlags,
sc, opt ); sc, opt, widget );
break; break;
} }
return rect; return rect;
} }
TQRect NorwegianWoodStyle::subRect( SubRect sr, const TQWidget * widget ) const TQRect NorwegianWoodStyle::subRect( SubRect sr, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget * widget ) const
{ {
TQRect r; TQRect r;
switch ( sr ) { switch ( sr ) {
@ -1276,14 +1301,14 @@ TQRect NorwegianWoodStyle::subRect( SubRect sr, const TQWidget * widget ) const
} }
case SR_ComboBoxFocusRect: case SR_ComboBoxFocusRect:
{ {
r = subRect( SR_PushButtonContents, widget ); r = subRect( SR_PushButtonContents, ceData, elementFlags, widget );
int ew = get_combo_extra_width( r.height() ); int ew = get_combo_extra_width( r.height() );
r.setRect( r.x() + 1, r.y() + 1, r.width() - 2 - ew, r.setRect( r.x() + 1, r.y() + 1, r.width() - 2 - ew,
r.height() - 2 ); r.height() - 2 );
break; break;
} }
default: default:
r = TQWindowsStyle::subRect( sr, widget ); r = TQWindowsStyle::subRect( sr, ceData, elementFlags, widget );
break; break;
} }
return r; return r;
@ -1358,11 +1383,12 @@ static void get_combo_parameters( const TQRect &r,
static inline int buttonthickness( int d ) static inline int buttonthickness( int d )
{ return d > 20 ? 5 : ( d < 10 ? 2: 3 ); } { return d > 20 ? 5 : ( d < 10 ? 2: 3 ); }
void NorwegianWoodStyle::drawSemicircleButton( TQPainter *p, const TQRect &r, void NorwegianWoodStyle::drawSemicircleButton( TQPainter *p, TQStyleControlElementData ceData,
ControlElementFlags elementFlags, const TQRect &r,
int dir, bool sunken, int dir, bool sunken,
const TQColorGroup &g ) const const TQColorGroup &g ) const
{ {
int b = pixelMetric( PM_ScrollBarExtent ) > 20 ? 3 : 2; int b = pixelMetric( PM_ScrollBarExtent, ceData, elementFlags ) > 20 ? 3 : 2;
TQRegion extrn( r.x(), r.y(), r.width(), r.height(), TQRegion::Ellipse ); TQRegion extrn( r.x(), r.y(), r.width(), r.height(), TQRegion::Ellipse );
TQRegion intern( r.x()+b, r.y()+b, r.width()-2*b, r.height()-2*b, TQRegion::Ellipse ); TQRegion intern( r.x()+b, r.y()+b, r.width()-2*b, r.height()-2*b, TQRegion::Ellipse );

@ -26,13 +26,15 @@ class NorwegianWoodStyle : public TQWindowsStyle
{ {
public: public:
NorwegianWoodStyle(); NorwegianWoodStyle();
void polish( TQApplication*); void applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void polish( TQWidget* ); void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void unPolish( TQWidget* ); void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void unPolish( TQApplication*); void applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void drawPrimitive( PrimitiveElement pe, void 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 = Style_Default, SFlags flags = Style_Default,
@ -40,44 +42,54 @@ public:
void drawControl( ControlElement element, void 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 how = Style_Default, SFlags how = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawControlMask( ControlElement element, void drawControlMask( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControl( ComplexControl cc, void drawComplexControl( ComplexControl cc,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
SCFlags sub = SC_All, SCFlags sub = SC_All,
SCFlags subActive = SC_None, SCFlags subActive = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControlMask( ComplexControl control, void drawComplexControlMask( ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQRect querySubControlMetrics( ComplexControl control, TQRect querySubControlMetrics( ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc, SubControl sc,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQRect subRect( SubRect r, const TQWidget *widget ) const; TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const;
private: private:
void drawSemicircleButton(TQPainter *p, const TQRect &r, int dir, void drawSemicircleButton(TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, int dir,
bool sunken, const TQColorGroup &g ) const; bool sunken, const TQColorGroup &g ) const;
TQPalette oldPalette; TQPalette oldPalette;
TQPixmap *sunkenDark; TQPixmap *sunkenDark;

Loading…
Cancel
Save