Automated update from Qt3

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

@ -41,121 +41,104 @@ MetalStyle::MetalStyle() : TQWindowsStyle() { }
/*!
Reimplementation from TQStyle
*/
void MetalStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
void MetalStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{
if (ceData.widgetObjectTypes.contains("TQApplication")) {
TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
oldPalette = app->palette();
// we simply create a nice TQColorGroup with a couple of fancy
// pixmaps here and apply to it all widgets
TQFont f("times", app->font().pointSize() );
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 background(marble_xpm);
TQPixmap dark( 1, 1 ); dark.fill( red.dark() );
TQPixmap mid( stone1_xpm );
TQPixmap light( stone1_xpm );//1, 1 ); light.fill( green );
TQPalette op = app->palette();
TQColor backCol( 227,227,227 );
// 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,
op.active().base(),// TQColor(236,182,120),
TQBrush(backCol, background)
);
active.setColor( TQColorGroup::ButtonText, TQt::white );
active.setColor( TQColorGroup::Shadow, TQt::black );
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,
op.disabled().base(),// TQColor(236,182,120),
TQBrush(backCol, background)
);
TQPalette newPalette( active, disabled, active );
app->setPalette( newPalette, TRUE );
}
oldPalette = ceData.palette;
// we simply create a nice TQColorGroup with a couple of fancy
// pixmaps here and apply to it all widgets
TQFont f("times", ceData.font.pointSize() );
f.setBold( TRUE );
f.setItalic( TRUE );
applicationActionRequest(ceData, elementFlags, ptr, AAR_SetFont, TQStyleApplicationActionRequestData(f, TRUE, "TQMenuBar"));
applicationActionRequest(ceData, elementFlags, ptr, AAR_SetFont, TQStyleApplicationActionRequestData(f, TRUE, "TQPopupMenu"));
// TQPixmap button( stonedark_xpm );
TQColor gold("#B9B9A5A54040"); //same as topgrad below
TQPixmap button( 1, 1 ); button.fill( gold );
TQPixmap background(marble_xpm);
TQPixmap dark( 1, 1 ); dark.fill( red.dark() );
TQPixmap mid( stone1_xpm );
TQPixmap light( stone1_xpm );//1, 1 ); light.fill( green );
TQPalette op = ceData.palette;
TQColor backCol( 227,227,227 );
// 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,
op.active().base(),// TQColor(236,182,120),
TQBrush(backCol, background)
);
active.setColor( TQColorGroup::ButtonText, TQt::white );
active.setColor( TQColorGroup::Shadow, TQt::black );
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,
op.disabled().base(),// TQColor(236,182,120),
TQBrush(backCol, background)
);
TQPalette newPalette( active, disabled, active );
applicationActionRequest(ceData, elementFlags, ptr, AAR_SetPalette, TQStyleApplicationActionRequestData(newPalette, TRUE));
}
/*!
Reimplementation from TQStyle
*/
void MetalStyle::applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
void MetalStyle::applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{
if (ceData.widgetObjectTypes.contains("TQApplication")) {
TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
app->setPalette(oldPalette, TRUE);
app->setFont( app->font(), TRUE );
}
applicationActionRequest(ceData, elementFlags, ptr, AAR_SetPalette, TQStyleApplicationActionRequestData(oldPalette, TRUE));
applicationActionRequest(ceData, elementFlags, ptr, AAR_SetFont, TQStyleApplicationActionRequestData(ceData.font, TRUE));
}
/*!
Reimplementation from TQStyle
*/
void MetalStyle::polish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
void MetalStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{
if (ceData.widgetObjectTypes.contains("TQWidget")) {
TQWidget *w = reinterpret_cast<TQWidget*>(ptr);
// the polish function sets some widgets to transparent mode and
// 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
// benefit from the nice pixmaps in the color group.
if (w->inherits("TQPushButton")){
w->setBackgroundMode( TQWidget::NoBackground );
return;
}
if (ceData.widgetObjectTypes.contains("TQPushButton")) {
widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::NoBackground));
return;
}
if ( !w->isTopLevel() ) {
if ( w->backgroundPixmap() ) {
w->setBackgroundOrigin( TQWidget::WindowOrigin );
}
if ( !(elementFlags & CEF_IsTopLevel) ) {
if ( !ceData.bgPixmap.isNull() ) {
widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundOrigin, TQStyleWidgetActionRequestData(TQWidget::WindowOrigin));
}
}
}
void MetalStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
void MetalStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{
if (ceData.widgetObjectTypes.contains("TQWidget")) {
TQWidget *w = reinterpret_cast<TQWidget*>(ptr);
// the polish function sets some widgets to transparent mode and
// 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
// benefit from the nice pixmaps in the color group.
if (w->inherits("TQPushButton")){
w->setBackgroundMode( TQWidget::PaletteButton );
return;
}
if ( !w->isTopLevel() ) {
if ( w->backgroundPixmap() )
w->setBackgroundOrigin( TQWidget::WidgetOrigin );
if (ceData.widgetObjectTypes.contains("TQPushButton")) {
widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::PaletteButton));
return;
}
if ( !(elementFlags & CEF_IsTopLevel) ) {
if ( !ceData.bgPixmap.isNull() ) {
widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundOrigin, TQStyleWidgetActionRequestData(TQWidget::WidgetOrigin));
}
}
}
@ -219,8 +202,6 @@ void MetalStyle::drawControl( ControlElement element,
switch( element ) {
case CE_PushButton:
{
const TQPushButton *btn;
btn = (const TQPushButton*)widget;
int x1, y1, x2, y2;
r.coords( &x1, &y1, &x2, &y2 );
@ -230,14 +211,14 @@ void MetalStyle::drawControl( ControlElement element,
TQBrush fill;
if ( btn->isDown() )
if ( elementFlags & CEF_IsDown )
fill = cg.brush( TQColorGroup::Mid );
else if ( btn->isOn() )
else if ( elementFlags & CEF_IsOn )
fill = TQBrush( cg.mid(), Dense4Pattern );
else
fill = cg.brush( TQColorGroup::Button );
if ( btn->isDefault() ) {
if ( elementFlags & CEF_IsDefault ) {
TQPointArray a;
a.setPoints( 9,
x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1,
@ -250,19 +231,19 @@ void MetalStyle::drawControl( ControlElement element,
y2 -= 2;
}
SFlags flags = Style_Default;
if ( btn->isOn() )
if ( elementFlags & CEF_IsOn )
flags |= Style_On;
if ( btn->isDown() )
if ( elementFlags & CEF_IsDown )
flags |= Style_Down;
if ( !btn->isFlat() && !btn->isDown() )
if ( !(elementFlags & CEF_IsFlat) && !(elementFlags & CEF_IsDown) )
flags |= Style_Raised;
drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags,
TQRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1),
cg, flags, opt );
if ( btn->isMenuButton() ) {
if ( (elementFlags & CEF_IsMenuWidget) ) {
flags = Style_Default;
if ( btn->isEnabled() )
if ( elementFlags & CEF_IsEnabled )
flags |= Style_Enabled;
int dx = ( y1 - y2 - 4 ) / 3;
@ -276,8 +257,6 @@ void MetalStyle::drawControl( ControlElement element,
}
case CE_PushButtonLabel:
{
const TQPushButton *btn;
btn = (const TQPushButton*)widget;
int x, y, w, h;
r.rect( &x, &y, &w, &h );
@ -285,9 +264,9 @@ void MetalStyle::drawControl( ControlElement element,
r.coords( &x1, &y1, &x2, &y2 );
int dx = 0;
int dy = 0;
if ( btn->isMenuButton() )
if ( (elementFlags & CEF_IsMenuWidget) )
dx = ( y2 - y1 ) / 3;
if ( btn->isOn() || btn->isDown() ) {
if ( (elementFlags & CEF_IsOn) || (elementFlags & CEF_IsDown) ) {
dx--;
dy--;
}
@ -299,9 +278,9 @@ void MetalStyle::drawControl( ControlElement element,
h -= 4;
drawItem( p, TQRect( x, y, w, h ),
AlignCenter|ShowPrefix,
cg, btn->isEnabled(),
btn->pixmap(), btn->text(), -1,
(btn->isDown() || btn->isOn())? &cg.brightText() : &cg.buttonText() );
cg, (elementFlags & CEF_IsEnabled),
(ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text, -1,
((elementFlags & CEF_IsDown) || (elementFlags & CEF_IsOn))? &cg.brightText() : &cg.buttonText() );
if ( dx || dy )
p->translate( -dx, -dy );
break;
@ -326,7 +305,6 @@ void MetalStyle::drawComplexControl( ComplexControl cc,
switch ( cc ) {
case CC_Slider:
{
const TQSlider *slider = ( const TQSlider* ) widget;
TQRect handle = querySubControlMetrics( CC_Slider, ceData, elementFlags,
SC_SliderHandle, opt, widget);
if ( sub & SC_SliderGroove )
@ -335,16 +313,13 @@ void MetalStyle::drawComplexControl( ComplexControl cc,
if ( (sub & SC_SliderHandle) && handle.isValid() )
drawMetalButton( p, handle.x(), handle.y(), handle.width(),
handle.height(), FALSE,
slider->orientation() == TQSlider::Horizontal);
ceData.orientation == TQSlider::Horizontal);
break;
}
case CC_ComboBox:
{
// not exactly correct...
const TQComboBox *cmb = ( const TQComboBox* ) widget;
qDrawWinPanel( p, r.x(), r.y(), r.width(), r.height(), cg, TRUE,
cmb->isEnabled() ? &cg.brush( TQColorGroup::Base ) :
(elementFlags & CEF_IsEnabled) ? &cg.brush( TQColorGroup::Base ) :
&cg.brush( TQColorGroup::Background ) );
drawMetalButton( p, r.x() + r.width() - 2 - 16, r.y() + 2, 16, r.height() - 4,
how & Style_Sunken, TRUE );
@ -352,7 +327,7 @@ void MetalStyle::drawComplexControl( ComplexControl cc,
TQRect( r.x() + r.width() - 2 - 16 + 2,
r.y() + 2 + 2, 16 - 4, r.height() - 4 -4 ),
cg,
cmb->isEnabled() ? Style_Enabled : Style_Default,
(elementFlags & CEF_IsEnabled) ? Style_Enabled : Style_Default,
opt );
break;
}

@ -769,163 +769,146 @@ NorwegianWoodStyle::NorwegianWoodStyle() : TQWindowsStyle()
/*!
Reimplementation from TQStyle
*/
void NorwegianWoodStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
void NorwegianWoodStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{
if (ceData.widgetObjectTypes.contains("TQApplication")) {
TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
oldPalette = ceData.palette;
oldPalette = app->palette();
// we simply create a nice TQColorGroup with a couple of fancy wood
// pixmaps here and apply to it all widgets
// we simply create a nice TQColorGroup with a couple of fancy wood
// pixmaps here and apply to it all widgets
TQImage img(button_xpm);
TQImage orig = img;
orig.detach();
TQPixmap button;
button.convertFromImage(img);
TQImage img(button_xpm);
TQImage orig = img;
orig.detach();
TQPixmap button;
button.convertFromImage(img);
int i;
for (i=0; i<img.numColors(); i++) {
TQRgb rgb = img.color(i);
TQColor c(rgb);
rgb = c.dark(120).rgb();
img.setColor(i,rgb);
}
TQPixmap mid;
mid.convertFromImage(img);
img = orig;
img.detach();
for (i=0; i<img.numColors(); i++) {
TQRgb rgb = img.color(i);
TQColor c(rgb);
rgb = c.light().rgb();
img.setColor(i,rgb);
}
TQPixmap light;
light.convertFromImage(img);
img = orig;
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);
}
TQPixmap dark;
dark.convertFromImage(img);
int i;
for (i=0; i<img.numColors(); i++) {
TQRgb rgb = img.color(i);
TQColor c(rgb);
rgb = c.dark(120).rgb();
img.setColor(i,rgb);
}
TQPixmap mid;
mid.convertFromImage(img);
img = orig;
img.detach();
for (i=0; i<img.numColors(); i++) {
TQRgb rgb = img.color(i);
TQColor c(rgb);
rgb = c.light().rgb();
img.setColor(i,rgb);
}
TQPixmap light;
light.convertFromImage(img);
img = orig;
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);
}
TQPixmap dark;
dark.convertFromImage(img);
TQImage bgimage(polish_xpm);
TQPixmap background;
background.convertFromImage(bgimage);
TQImage bgimage(polish_xpm);
TQPixmap background;
background.convertFromImage(bgimage);
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.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)
);
applicationActionRequest(ceData, elementFlags, ptr, AAR_SetPalette, TQStyleApplicationActionRequestData(TQPalette(active, disabled, active), TRUE));
}
void NorwegianWoodStyle::applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
void NorwegianWoodStyle::applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{
if (ceData.widgetObjectTypes.contains("TQApplication")) {
TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
app->setPalette(oldPalette, TRUE);
}
applicationActionRequest(ceData, elementFlags, ptr, AAR_SetPalette, TQStyleApplicationActionRequestData(oldPalette, TRUE));
}
/*!
Reimplementation from TQStyle
*/
void NorwegianWoodStyle::polish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
void NorwegianWoodStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{
if (ceData.widgetObjectTypes.contains("TQWidget")) {
TQWidget *w = reinterpret_cast<TQWidget*>(ptr);
// the polish function sets some widgets to transparent mode and
// some to translate background mode in order to get the full
// benefit from the nice pixmaps in the color group.
if ( !w->isTopLevel() ) {
if ( w->inherits("TQPushButton")
|| w->inherits("TQToolButton")
|| w->inherits("TQComboBox") ) {
w->setAutoMask( TRUE );
// the polish function sets some widgets to transparent mode and
// some to translate background mode in order to get the full
// benefit from the nice pixmaps in the color group.
if ( !(elementFlags & CEF_IsTopLevel) ) {
if ( (ceData.widgetObjectTypes.contains("TQPushButton")) || (ceData.widgetObjectTypes.contains("TQToolButton")) || (ceData.widgetObjectTypes.contains("TQComboBox")) ) {
widgetActionRequest(ceData, elementFlags, ptr, WAR_SetAutoMask);
return;
}
if ( w->backgroundPixmap() )
w->setBackgroundOrigin( TQWidget::WindowOrigin );
}
if (!ceData.bgPixmap.isNull()) {
widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundOrigin, TQStyleWidgetActionRequestData(TQWidget::WindowOrigin));
}
}
}
void NorwegianWoodStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr )
void NorwegianWoodStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{
if (ceData.widgetObjectTypes.contains("TQWidget")) {
TQWidget *w = reinterpret_cast<TQWidget*>(ptr);
// the polish function sets some widgets to transparent mode and
// some to translate background mode in order to get the full
// benefit from the nice pixmaps in the color group.
if ( !w->isTopLevel() ) {
if ( w->inherits("TQPushButton")
|| w->inherits("TQToolButton")
|| w->inherits("TQComboBox") ) {
w->setAutoMask( FALSE );
// the polish function sets some widgets to transparent mode and
// some to translate background mode in order to get the full
// benefit from the nice pixmaps in the color group.
if ( !(elementFlags & CEF_IsTopLevel) ) {
if ( (ceData.widgetObjectTypes.contains("TQPushButton")) || (ceData.widgetObjectTypes.contains("TQToolButton")) || (ceData.widgetObjectTypes.contains("TQComboBox")) ) {
widgetActionRequest(ceData, elementFlags, ptr, WAR_UnSetAutoMask);
return;
}
if ( w->backgroundPixmap() )
w->setBackgroundOrigin( TQWidget::WidgetOrigin );
}
if (!ceData.bgPixmap.isNull()) {
widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundOrigin, TQStyleWidgetActionRequestData(TQWidget::WidgetOrigin));
}
}
}
@ -1013,19 +996,17 @@ void NorwegianWoodStyle::drawControl( ControlElement element,
switch( element ) {
case CE_PushButton:
{
const TQPushButton *btn;
btn = ( const TQPushButton * )widget;
TQColorGroup myCg( cg );
SFlags flags = Style_Default;
if ( btn->isOn() )
if ( elementFlags & CEF_IsOn )
flags |= Style_On;
if ( btn->isDown() )
if ( elementFlags & CEF_IsDown )
flags |= Style_Down;
if ( btn->isOn() || btn->isDown() )
if ( (elementFlags & CEF_IsOn) || (elementFlags & CEF_IsDown) )
flags |= Style_Sunken;
if ( btn->isDefault() )
if ( elementFlags & CEF_IsDefault )
flags |= Style_Default;
if ( ! btn->isFlat() && !(flags & Style_Down) )
if ( ! (elementFlags & CEF_IsFlat) && !(flags & Style_Down) )
flags |= Style_Raised;
int x1, y1, x2, y2;
@ -1035,15 +1016,15 @@ void NorwegianWoodStyle::drawControl( ControlElement element,
p->setBrush( TQBrush( cg.button(), NoBrush ) );
TQBrush fill;
if ( btn->isDown() )
if ( elementFlags & CEF_IsDown )
fill = cg.brush( TQColorGroup::Mid );
else if ( btn->isOn() )
else if ( elementFlags & CEF_IsOn )
fill = TQBrush( cg.mid(), Dense4Pattern );
else
fill = cg.brush( TQColorGroup::Button );
myCg.setBrush( TQColorGroup::Mid, fill );
if ( btn->isDefault() ) {
if ( elementFlags & CEF_IsDefault ) {
x1 += 2;
y1 += 2;
x2 -= 2;
@ -1054,7 +1035,7 @@ void NorwegianWoodStyle::drawControl( ControlElement element,
TQRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1),
myCg, flags, opt );
if ( btn->isDefault() ) {
if ( elementFlags & CEF_IsDefault ) {
TQPen pen( TQt::black, 4 );
pen.setCapStyle( TQt::RoundCap );
pen.setJoinStyle( TQt::RoundJoin );
@ -1062,12 +1043,12 @@ void NorwegianWoodStyle::drawControl( ControlElement element,
drawroundrect( p, x1 - 1, y1 - 1, x2 - x1 + 3, y2 - y1 + 3, 8 );
}
if ( btn->isMenuButton() ) {
if ( elementFlags & CEF_IsMenuWidget ) {
int dx = ( y1 - y2 - 4 ) / 3;
// reset the flags
flags = Style_Default;
if ( btn->isEnabled() )
if ( elementFlags & CEF_IsEnabled )
flags |= Style_Enabled;
drawPrimitive( PE_ArrowDown, p, ceData, elementFlags,
TQRect( x2 - dx, dx, y1, y2 - y1),
@ -1080,8 +1061,6 @@ void NorwegianWoodStyle::drawControl( ControlElement element,
}
case CE_PushButtonLabel:
{
const TQPushButton *btn;
btn = (const TQPushButton*)widget;
int x, y, w, h;
r.rect( &x, &y, &w, &h );
@ -1089,7 +1068,7 @@ void NorwegianWoodStyle::drawControl( ControlElement element,
r.coords( &x1, &y1, &x2, &y2 );
int dx = 0;
int dy = 0;
if ( btn->isMenuButton() )
if ( elementFlags & CEF_IsMenuWidget )
dx = ( y2 - y1 ) / 3;
if ( dx || dy )
p->translate( dx, dy );
@ -1100,9 +1079,9 @@ void NorwegianWoodStyle::drawControl( ControlElement element,
h -= 4;
drawItem( p, TQRect( x, y, w, h ),
AlignCenter | ShowPrefix,
cg, btn->isEnabled(),
btn->pixmap(), btn->text(), -1,
(btn->isDown() || btn->isOn()) ? &cg.brightText()
cg, (elementFlags & CEF_IsEnabled),
(ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text, -1,
((elementFlags & CEF_IsDown) || (elementFlags & CEF_IsOn)) ? &cg.brightText()
: &cg.buttonText() );
if ( dx || dy )
p->translate( -dx, -dy );
@ -1152,9 +1131,6 @@ void NorwegianWoodStyle::drawComplexControl( ComplexControl cc,
switch( cc ) {
case CC_ComboBox:
{
const TQComboBox *cmb;
cmb = (const TQComboBox*)widget;
int awh, ax, ay, sh, sy, dh, ew;
get_combo_parameters( subRect(SR_PushButtonContents, ceData, elementFlags, widget),
ew, awh, ax, ay, sh, dh, sy );
@ -1176,7 +1152,7 @@ void NorwegianWoodStyle::drawComplexControl( ComplexControl cc,
p->drawLine( ax + awh - 1, sy + 1, ax + awh - 1, sy + sh - 1 );
p->setPen( oldPen );
if ( cmb->editable() ) {
if ( elementFlags & CEF_IsEditable ) {
TQRect r( querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
SC_ComboBoxEditField, opt, widget) );
qDrawShadePanel( p, r, cg, TRUE, 1,
@ -1244,19 +1220,17 @@ TQRect NorwegianWoodStyle::querySubControlMetrics( ComplexControl control,
}
case CC_ScrollBar:
{
const TQScrollBar* sb;
sb = (const TQScrollBar*)widget;
bool horz = sb->orientation() == TQScrollBar::Horizontal;
bool horz = ceData.orientation == TQScrollBar::Horizontal;
int b = 2;
int w = horz ? sb->height() : sb->width();
int w = horz ? ceData.rect.height() : ceData.rect.width();
switch ( sc ) {
case SC_ScrollBarAddLine:
rect.setRect( b, b, w - 2 * b, w - 2 * b );
if ( horz )
rect.moveBy( sb->width() - w, 0 );
rect.moveBy( ceData.rect.width() - w, 0 );
else
rect.moveBy( 0, sb->height() - w );
rect.moveBy( 0, ceData.rect.height() - w );
break;
case SC_ScrollBarSubLine:
rect.setRect( b, b, w - 2 * b, w - 2 * b );
@ -1282,9 +1256,7 @@ TQRect NorwegianWoodStyle::subRect( SubRect sr, const TQStyleControlElementData
switch ( sr ) {
case SR_PushButtonContents:
{
const TQPushButton *btn;
btn = (const TQPushButton*)widget;
r = btn->rect();
r = ceData.rect;
int d = TQMIN( r.width(), r.height() ) / 2;
int b = buttonthickness( d );

@ -257,18 +257,24 @@ class Q_EXPORT TQStyleWidgetActionRequestData {
public:
TQStyleWidgetActionRequestData();
TQStyleWidgetActionRequestData(int metric1, int metric2=0);
TQStyleWidgetActionRequestData(TQPalette palette);
TQStyleWidgetActionRequestData(TQFont font);
TQStyleWidgetActionRequestData(TQPalette palette, bool informWidgets = FALSE, const char* className = 0);
TQStyleWidgetActionRequestData(TQFont font, bool informWidgets = FALSE, const char* className = 0);
TQStyleWidgetActionRequestData(TQRect rect);
~TQStyleWidgetActionRequestData();
public:
bool bool1;
bool bool2;
int metric1;
int metric2;
TQPalette palette;
TQFont font;
TQRect rect;
const char * cstr;
TQString string;
};
typedef TQStyleWidgetActionRequestData TQStyleApplicationActionRequestData;
class Q_EXPORT TQStyle: public TQObject
{
TQ_OBJECT
@ -1077,6 +1083,8 @@ public:
WAR_RepaintRect,
WAR_EnableMouseTracking,
WAR_DisableMouseTracking,
WAR_SetAutoMask,
WAR_UnSetAutoMask,
WAR_SetCheckable,
WAR_UnSetCheckable,
WAR_FrameSetStyle,
@ -1084,6 +1092,7 @@ public:
WAR_SetLayoutMargin,
WAR_SetPalette,
WAR_SetBackgroundMode,
WAR_SetBackgroundOrigin,
WAR_SetFont,
WAR_RepaintAllAccelerators
};
@ -1092,6 +1101,15 @@ public:
void setWidgetActionRequestHook( WidgetActionRequestHook );
virtual bool widgetActionRequest( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, TQStyleWidgetActionRequestData requestData = TQStyleWidgetActionRequestData() );
enum ApplicationActionRequest {
AAR_SetPalette,
AAR_SetFont
};
typedef bool (*ApplicationActionRequestHook)(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, TQStyleApplicationActionRequestData requestData);
void setApplicationActionRequestHook( ApplicationActionRequestHook );
virtual bool applicationActionRequest( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, TQStyleApplicationActionRequestData requestData = TQStyleApplicationActionRequestData() );
// Old 2.x TQStyle API
#ifndef QT_NO_COMPAT
@ -1131,6 +1149,7 @@ private:
EventHandlerInstallationHook m_eventHandlerInstallationHook;
EventHandlerRemovalHook m_eventHandlerRemovalHook;
WidgetActionRequestHook m_widgetActionRequestHook;
ApplicationActionRequestHook m_applicationActionRequestHook;
ObjectEventSourceToHandlerMap m_objectEventSourceToHandlerMap;
ObjectEventSourceDataToHandlerMap m_objectEventSourceDataToHandlerMap;
ObjectEventSourceFlagsToHandlerMap m_objectEventSourceFlagsToHandlerMap;
@ -1141,6 +1160,7 @@ inline TQStyle::ControlElementFlags operator|(const TQStyle::ControlElementFlags
// inline TQStyle::ControlElementFlags operator|=(TQStyle::ControlElementFlags &a, const TQStyle::ControlElementFlags b) { a = static_cast<TQStyle::ControlElementFlags>(static_cast<int>(a) | static_cast<int>(b)); return a; }
Q_EXPORT TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields=true);
Q_EXPORT TQStyleControlElementData populateControlElementDataFromApplication(const TQApplication* app, const TQStyleOption& opt, bool populateReliantFields=true);
Q_EXPORT TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* object, TQStringList objectTypeList, const TQStyleOption& opt, bool populateReliantFields=true);
Q_EXPORT TQStringList getObjectTypeListForObject(const TQObject* object);

@ -403,6 +403,7 @@ TQStyle::TQStyle()
m_eventHandlerInstallationHook = NULL;
m_eventHandlerRemovalHook = NULL;
m_widgetActionRequestHook = NULL;
m_applicationActionRequestHook = NULL;
conditionalAcceleratorsEnabled = false;
d = new TQStylePrivate;
}
@ -526,8 +527,7 @@ void TQStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags, v
\sa unPolish()
*/
void TQStyle::polish( TQApplication *app ) {
TQStyleControlElementData ceData;
ceData.widgetObjectTypes = getObjectTypeListForObject(app);
TQStyleControlElementData ceData = populateControlElementDataFromApplication(app, TQStyleOption());
applicationPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, TQStyleOption()), app);
}
@ -539,8 +539,7 @@ void TQStyle::polish( TQApplication *app ) {
\sa polish()
*/
void TQStyle::unPolish( TQApplication *app ) {
TQStyleControlElementData ceData;
ceData.widgetObjectTypes = getObjectTypeListForObject(app);
TQStyleControlElementData ceData = populateControlElementDataFromApplication(app, TQStyleOption());
applicationUnPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, TQStyleOption()), app);
}
@ -2217,6 +2216,12 @@ bool TQStyle::widgetActionRequest( TQStyleControlElementData ceData, ControlElem
else if (request == WAR_DisableMouseTracking) {
widget->setMouseTracking(FALSE);
}
else if (request == WAR_SetAutoMask) {
widget->setAutoMask(TRUE);
}
else if (request == WAR_UnSetAutoMask) {
widget->setAutoMask(FALSE);
}
else if (request == WAR_SetCheckable) {
TQPopupMenu *pm = dynamic_cast<TQPopupMenu*>(widget);
if (pm) {
@ -2253,6 +2258,9 @@ bool TQStyle::widgetActionRequest( TQStyleControlElementData ceData, ControlElem
else if (request == WAR_SetBackgroundMode) {
widget->setBackgroundMode((TQt::BackgroundMode)requestData.metric1);
}
else if (request == WAR_SetBackgroundOrigin) {
widget->setBackgroundOrigin((TQWidget::BackgroundOrigin)requestData.metric1);
}
else if (request == WAR_SetFont) {
widget->setFont(requestData.font);
}
@ -2289,11 +2297,45 @@ bool TQStyle::widgetActionRequest( TQStyleControlElementData ceData, ControlElem
return true;
}
void TQStyle::acceleratorKeypressEventMonitor( TQObject *o, TQEvent *e ) {
// RAJA FIXME
// Also, SH_HideUnderlineAcceleratorWhenAltUp should probably be set to 1 in the TQWindowsStyle::styleHint overridden method
// Additionally, the common styleHint code in TDE (that controls popupmenu settings and such via configuration files) needs to be modified to add a config option for this new style hint
/*!
\fn void TQStyle::setApplicationActionRequestHook( ApplicationActionRequestHook hook );
Sets a callback function \a hook which will be called whenever a new application action request
is made via the TQStyle::installObjectEventHandler method. The callback function must
use this definition: bool callbackFunction( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler ).
\sa void TQStyle::installObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler )
*/
void TQStyle::setApplicationActionRequestHook( ApplicationActionRequestHook hook ) {
m_applicationActionRequestHook = hook;
}
/*!
\fn bool applicationActionRequestHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request );
Handles application action requests. Return FALSE to continue processing in base classes, TRUE to eat the request and halt processing.
*/
bool TQStyle::applicationActionRequest( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, TQStyleApplicationActionRequestData requestData ) {
bool cbret = false;
if (m_applicationActionRequestHook) {
cbret = (*m_applicationActionRequestHook)(ceData, elementFlags, source, request, requestData);
}
if (!cbret) {
if (ceData.widgetObjectTypes.contains("TQApplication")) {
TQApplication* application = reinterpret_cast<TQApplication*>(source);
if (request == AAR_SetPalette) {
application->setPalette(requestData.palette, requestData.bool1, requestData.cstr);
}
else if (request == AAR_SetFont) {
application->setFont(requestData.font, requestData.bool1, requestData.cstr);
}
return true;
}
}
return true;
}
void TQStyle::acceleratorKeypressEventMonitor( TQObject *o, TQEvent *e ) {
if (styleHint(SH_HideUnderlineAcceleratorWhenAltUp, TQStyleControlElementData(), CEF_None, TQStyleOption::Default, NULL, NULL) != 0) {
TQWidget *widget = dynamic_cast<TQWidget*>(o);
if (widget) {
@ -2337,12 +2379,16 @@ TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(int param1, int p
metric2 = param2;
}
TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQPalette param) {
TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQPalette param, bool informWidgets, const char* className) {
palette = param;
bool1 = informWidgets;
cstr = className;
}
TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQFont param) {
TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQFont param, bool informWidgets, const char* className) {
font = param;
bool1 = informWidgets;
cstr = className;
}
TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQRect param) {

@ -556,6 +556,18 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
return ceData;
}
TQStyleControlElementData populateControlElementDataFromApplication(const TQApplication* app, const TQStyleOption&, bool) {
TQStyleControlElementData ceData;
if (app) {
ceData.widgetObjectTypes = getObjectTypeListForObject(app);
ceData.palette = app->palette();
ceData.font = app->font();
}
return ceData;
}
/*! \reimp */
void TQCommonStyle::drawPrimitive( PrimitiveElement pe,
TQPainter *p,

Loading…
Cancel
Save