summaryrefslogtreecommitdiffstats
path: root/kstyles/asteroid/asteroid.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-17 15:05:01 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-17 15:05:01 -0500
commitfb2b1442644d0b35d004f3896efc0afa5a5b81a5 (patch)
tree438e47c523108f72d81fda90df29238da32b05f0 /kstyles/asteroid/asteroid.cpp
parent2ed8f9ade70bd38a541d7e62e02962a1311aabb5 (diff)
downloadtdelibs-fb2b1442644d0b35d004f3896efc0afa5a5b81a5.tar.gz
tdelibs-fb2b1442644d0b35d004f3896efc0afa5a5b81a5.zip
Do not use direct widget access when drawing tabs and popup menus
Diffstat (limited to 'kstyles/asteroid/asteroid.cpp')
-rw-r--r--kstyles/asteroid/asteroid.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/kstyles/asteroid/asteroid.cpp b/kstyles/asteroid/asteroid.cpp
index 7f06b2ee8..a618ef0e8 100644
--- a/kstyles/asteroid/asteroid.cpp
+++ b/kstyles/asteroid/asteroid.cpp
@@ -987,17 +987,16 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
if ( !w || !w->parentWidget() || !o.tab() )
break;
- const TQTabBar * tb = (const TQTabBar *) w;
const TQTab * t = o.tab();
bool selected = sf & Style_Selected;
- bool lastTab = (tb->indexOf( t->identifier() ) == tb->count()-1) ?
+ bool lastTab = (ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1) ?
TRUE : FALSE;
TQRect r2( r );
- if ( tb->shape() == TQTabBar::RoundedAbove ) {
+ if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) {
p->setPen( cg.light() );
p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 );
if ( r2.left() == 0 )
- p->drawPoint( tb->rect().bottomLeft() );
+ p->drawPoint( ceData.rect.bottomLeft() );
if ( selected ) {
p->fillRect( TQRect( r2.left()+1, r2.bottom()-1, r2.width()-3, 2),
@@ -1031,9 +1030,9 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
x2++;
p->drawLine( x2, r2.top() + 2, x2, r2.bottom() -
(selected ? (lastTab ? 0:1) :2));
- } else if ( tb->shape() == TQTabBar::RoundedBelow ) {
- bool rightAligned = styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, tb ) == TQt::AlignRight;
- bool firstTab = tb->indexOf( t->identifier() ) == 0;
+ } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) {
+ bool rightAligned = styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, w ) == TQt::AlignRight;
+ bool firstTab = ceData.tabBarData.identIndexMap[t->identifier()] == 0;
if ( selected ) {
p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1),
cg.brush( TQColorGroup::Background ));
@@ -1086,16 +1085,15 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
if ( o.isDefault() )
break;
- const TQTabBar * tb = (const TQTabBar *) w;
TQTab * t = o.tab();
const bool enabled = sf & Style_Enabled;
bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
TQRect tr = r;
- if ( t->identifier() == tb->currentTab() )
+ if ( t->identifier() == ceData.tabBarData.currentTabIndex )
tr.setBottom( tr.bottom() -
- pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, tb ) );
+ pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, w ) );
int alignment = TQt::AlignCenter | TQt::ShowPrefix;
if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, w)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, w)) && (!acceleratorsShown())))
@@ -1515,7 +1513,6 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
return;
}
- const TQPopupMenu *pum = dynamic_cast<const TQPopupMenu *>(w);
static const int itemFrame = 2;
static const int itemHMargin = 3;
static const int itemVMargin = 3;
@@ -1527,15 +1524,15 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
bool active = sf & Style_Active;
bool disabled = !mi->isEnabled();
- bool checkable = pum->isCheckable();
+ bool checkable = (elementFlags & CEF_IsCheckable);
bool enabled = mi->isEnabled();
bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
int xpos = x;
int xm = itemFrame + checkcol + itemHMargin;
- if (pum->erasePixmap() && !pum->erasePixmap()->isNull()) {
- p->drawPixmap(x, y, *pum->erasePixmap(), x, y, sw, sh);
+ if (!ceData.bgPixmap.isNull()) {
+ p->drawPixmap(x, y, ceData.bgPixmap, x, y, sw, sh);
} else {
p->fillRect(x, y, sw, sh, cg.background());
}