diff options
Diffstat (limited to 'kstyles')
-rw-r--r-- | kstyles/asteroid/asteroid.cpp | 25 | ||||
-rw-r--r-- | kstyles/highcolor/highcolor.cpp | 4 | ||||
-rw-r--r-- | kstyles/highcontrast/highcontrast.cpp | 6 | ||||
-rw-r--r-- | kstyles/keramik/keramik.cpp | 26 | ||||
-rw-r--r-- | kstyles/kthemestyle/kthemestyle.cpp | 16 | ||||
-rw-r--r-- | kstyles/light/lightstyle-v2.cpp | 11 | ||||
-rw-r--r-- | kstyles/light/lightstyle-v3.cpp | 13 | ||||
-rw-r--r-- | kstyles/plastik/plastik.cpp | 26 |
8 files changed, 50 insertions, 77 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()); } diff --git a/kstyles/highcolor/highcolor.cpp b/kstyles/highcolor/highcolor.cpp index 06de67bd6..120f7d6e6 100644 --- a/kstyles/highcolor/highcolor.cpp +++ b/kstyles/highcolor/highcolor.cpp @@ -1289,8 +1289,6 @@ void HighColorStyle::drawControl( TQ_ControlElement element, // POPUPMENU ITEM // ------------------------------------------------------------------- case CE_PopupMenuItem: { - const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget; - TQMenuItem *mi = opt.menuItem(); if ( !mi ) { // Don't leave blank holes if we set NoBackground for the TQPopupMenu. @@ -1303,7 +1301,7 @@ void HighColorStyle::drawControl( TQ_ControlElement element, int tab = opt.tabWidth(); int checkcol = opt.maxIconWidth(); bool enabled = mi->isEnabled(); - bool checkable = popupmenu->isCheckable(); + bool checkable = (elementFlags & CEF_IsCheckable); bool active = flags & Style_Active; bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); bool reverse = TQApplication::reverseLayout(); diff --git a/kstyles/highcontrast/highcontrast.cpp b/kstyles/highcontrast/highcontrast.cpp index 7b6ed4a9e..9d28dfd05 100644 --- a/kstyles/highcontrast/highcontrast.cpp +++ b/kstyles/highcontrast/highcontrast.cpp @@ -770,8 +770,7 @@ void HighContrastStyle::drawControl (TQ_ControlElement element, setColorsNormal (p, cg, flags, Style_Selected); drawRoundRect (p, r); - const TQTabBar *tb = static_cast< const TQTabBar * >(widget); - TQTabBar::Shape shape = tb->shape(); + TQTabBar::Shape shape = ceData.tabBarData.shape; if (shape == TQTabBar::TriangularBelow || shape == TQTabBar::RoundedBelow) { p->fillRect (r.left(), r.top(), @@ -1001,14 +1000,13 @@ void HighContrastStyle::drawControl (TQ_ControlElement element, setColorsNormal (p, cg, flags, Style_Active|Style_MouseOver); p->fillRect (r, p->backgroundColor ()); - const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget; TQMenuItem *mi = opt.menuItem(); if (!mi) break; int tab = opt.tabWidth(); int checkcol = opt.maxIconWidth(); - bool checkable = popupmenu->isCheckable(); + bool checkable = (elementFlags & CEF_IsCheckable); bool reverse = TQApplication::reverseLayout(); int x, y, w, h; r.rect( &x, &y, &w, &h ); diff --git a/kstyles/keramik/keramik.cpp b/kstyles/keramik/keramik.cpp index 02f720636..6d46df973 100644 --- a/kstyles/keramik/keramik.cpp +++ b/kstyles/keramik/keramik.cpp @@ -1510,28 +1510,26 @@ void KeramikStyle::drawControl( TQ_ControlElement element, case CE_TabBarTab: { - const TQTabBar* tabBar = static_cast< const TQTabBar* >( widget ); - - bool bottom = tabBar->shape() == TQTabBar::RoundedBelow || - tabBar->shape() == TQTabBar::TriangularBelow; + bool bottom = ceData.tabBarData.shape == TQTabBar::RoundedBelow || + ceData.tabBarData.shape == TQTabBar::TriangularBelow; if ( flags & Style_Selected ) { TQRect tabRect = r; //If not the right-most tab, readjust the painting to be one pixel wider //to avoid a doubled line - int rightMost = TQApplication::reverseLayout() ? 0 : tabBar->count() - 1; + int rightMost = TQApplication::reverseLayout() ? 0 : ceData.tabBarData.tabCount - 1; - if (tabBar->indexOf( opt.tab()->identifier() ) != rightMost) + if (ceData.tabBarData.identIndexMap[opt.tab()->identifier()] != rightMost) tabRect.setWidth( tabRect.width() + 1); - Keramik::ActiveTabPainter( bottom ).draw( p, tabRect, cg.button().light(110), cg.background(), !tabBar->isEnabled(), pmode()); + Keramik::ActiveTabPainter( bottom ).draw( p, tabRect, cg.button().light(110), cg.background(), !(elementFlags & CEF_IsEnabled), pmode()); } else { Keramik::InactiveTabPainter::Mode mode; - int index = tabBar->indexOf( opt.tab()->identifier() ); + int index = ceData.tabBarData.identIndexMap[opt.tab()->identifier()]; if ( index == 0 ) mode = Keramik::InactiveTabPainter::First; - else if ( index == tabBar->count() - 1 ) mode = Keramik::InactiveTabPainter::Last; + else if ( index == ceData.tabBarData.tabCount - 1 ) mode = Keramik::InactiveTabPainter::Last; else mode = Keramik::InactiveTabPainter::Middle; if ( bottom ) @@ -1606,7 +1604,6 @@ void KeramikStyle::drawControl( TQ_ControlElement element, // POPUPMENU ITEM // ------------------------------------------------------------------- case CE_PopupMenuItem: { - const TQPopupMenu *popupmenu = static_cast< const TQPopupMenu * >( widget ); TQRect main = r; TQMenuItem *mi = opt.menuItem(); @@ -1623,7 +1620,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element, int tab = opt.tabWidth(); int checkcol = opt.maxIconWidth(); bool enabled = mi->isEnabled(); - bool checkable = popupmenu->isCheckable(); + bool checkable = (elementFlags & CEF_IsCheckable); bool active = flags & Style_Active; bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); bool reverse = TQApplication::reverseLayout(); @@ -2409,11 +2406,10 @@ int KeramikStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, C case PM_TabBarTabShiftVertical: { - const TQTabBar* tb = ::tqqt_cast<const TQTabBar*>(widget); - if (tb) + if (ceData.widgetObjectTypes.contains(TQTABBAR_OBJECT_NAME_STRING)) { - if (tb->shape() == TQTabBar::RoundedBelow || - tb->shape() == TQTabBar::TriangularBelow) + if (ceData.tabBarData.shape == TQTabBar::RoundedBelow || + ceData.tabBarData.shape == TQTabBar::TriangularBelow) return 0; } diff --git a/kstyles/kthemestyle/kthemestyle.cpp b/kstyles/kthemestyle/kthemestyle.cpp index 50f14b9e3..9a604014e 100644 --- a/kstyles/kthemestyle/kthemestyle.cpp +++ b/kstyles/kthemestyle/kthemestyle.cpp @@ -1261,11 +1261,10 @@ void KThemeStyle::drawControl( ControlElement element, case CE_TabBarTab: { - const TQTabBar* tb = ( const TQTabBar* ) widget; - TQTabBar::Shape tbs = tb->shape(); + TQTabBar::Shape tbs = ceData.tabBarData.shape; bool selected = how & Style_Selected; WidgetType widget = selected ? ActiveTab : InactiveTab; - const TQColorGroup *cg = colorGroup( tb->colorGroup(), widget ); + const TQColorGroup *cg = colorGroup( ceData.colorGroup, widget ); int i; int x2 = x + w - 1, y2 = y + h - 1; int bWidth = borderWidth( widget ); @@ -1276,7 +1275,7 @@ void KThemeStyle::drawControl( ControlElement element, if ( !selected ) { p->fillRect( x, y, x2 - x + 1, 2, - tb->palette().active().brush( TQColorGroup::Background ) ); + ceData.palette.active().brush( TQColorGroup::Background ) ); y += 2; } p->setPen( cg->text() ); @@ -1338,8 +1337,8 @@ void KThemeStyle::drawControl( ControlElement element, else p->fillRect( x, y, x2 - x + 1, y2 - y + 1, cg->background() ); } - else if ( tb->shape() == TQTabBar::RoundedBelow || - tb->shape() == TQTabBar::TriangularBelow ) + else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow || + ceData.tabBarData.shape == TQTabBar::TriangularBelow ) { if ( widget == ActiveTab ) widget = RotActiveTab; @@ -1349,7 +1348,7 @@ void KThemeStyle::drawControl( ControlElement element, if ( !selected ) { p->fillRect( x, y2 - 2, x2 - x + 1, 2, - tb->palette().active().brush( TQColorGroup::Background ) ); + ceData.palette.active().brush( TQColorGroup::Background ) ); y2 -= 2; } p->setPen( cg->text() ); @@ -1451,7 +1450,6 @@ void KThemeStyle::drawControl( ControlElement element, int x, y, w, h; r.rect( &x, &y, &w, &h ); - const TQPopupMenu *popupmenu = ( const TQPopupMenu * ) widget; TQMenuItem *mi = opt.menuItem(); if ( mi ) { @@ -1461,7 +1459,7 @@ void KThemeStyle::drawControl( ControlElement element, int tab = opt.tabWidth(); int checkcol = opt.maxIconWidth(); bool enabled = (mi? mi->isEnabled():true); - bool checkable = popupmenu->isCheckable(); + bool checkable = (elementFlags & CEF_IsCheckable); bool active = how & Style_Active; bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags, TQStyleOption::Default, 0, 0 ); bool reverse = TQApplication::reverseLayout(); diff --git a/kstyles/light/lightstyle-v2.cpp b/kstyles/light/lightstyle-v2.cpp index 8df9606ad..a77a5fe03 100644 --- a/kstyles/light/lightstyle-v2.cpp +++ b/kstyles/light/lightstyle-v2.cpp @@ -631,7 +631,6 @@ void LightStyleV2::drawControl( TQ_ControlElement control, switch (control) { case CE_TabBarTab: { - const TQTabBar* tb = static_cast<const TQTabBar*>(widget); bool below = false; TQRect tr(r); TQRect fr(r); @@ -639,7 +638,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control, tr.addCoords(0, 0, 0, -1); fr.addCoords(2, 2, -2, -2); - if ( tb->shape() == TQTabBar::RoundedBelow || tb->shape() == TQTabBar::TriangularBelow) { + if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow || ceData.tabBarData.shape == TQTabBar::TriangularBelow) { tr = r; tr.addCoords(0, 1, 0, 0); fr = r; fr.addCoords(2, 2,-2, -4); below = true; @@ -784,7 +783,6 @@ void LightStyleV2::drawControl( TQ_ControlElement control, if (! widget || data.isDefault()) break; - const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget; TQMenuItem *mi = data.menuItem(); int tab = data.tabWidth(); int maxpmw = data.maxIconWidth(); @@ -847,7 +845,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control, if ((flags & Style_Active) && (flags & Style_Enabled)) mode = TQIconSet::Active; TQPixmap pixmap; - if (popupmenu->isCheckable() && mi->isChecked()) + if ((elementFlags & CEF_IsCheckable) && mi->isChecked()) pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); else @@ -857,7 +855,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control, pmr.moveCenter(cr.center()); p->setPen(cg.text()); p->drawPixmap(pmr.topLeft(), pixmap); - } else if (popupmenu->isCheckable() && mi->isChecked()) + } else if ((elementFlags & CEF_IsCheckable) && mi->isChecked()) drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg, (flags & Style_Enabled) | Style_On); @@ -1538,7 +1536,6 @@ TQSize LightStyleV2::sizeFromContents( ContentsType contents, break; TQMenuItem *mi = data.menuItem(); - const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget; int maxpmw = data.maxIconWidth(); int w = contentsSize.width(), h = contentsSize.height(); @@ -1558,7 +1555,7 @@ TQSize LightStyleV2::sizeFromContents( ContentsType contents, if (mi->pixmap()) h = QMAX(h, mi->pixmap()->height()); else if (! mi->text().isNull()) - h = QMAX(h, popupmenu->fontMetrics().height() + 2); + h = QMAX(h, TQFontMetrics(ceData.font).height() + 2); if (mi->iconSet() != 0) h = QMAX(h, mi->iconSet()->pixmap(TQIconSet::Small, TQIconSet::Normal).height()); diff --git a/kstyles/light/lightstyle-v3.cpp b/kstyles/light/lightstyle-v3.cpp index 97c9d2e0b..565b8ac2c 100644 --- a/kstyles/light/lightstyle-v3.cpp +++ b/kstyles/light/lightstyle-v3.cpp @@ -819,10 +819,9 @@ void LightStyleV3::drawControl( TQ_ControlElement control, switch (control) { case CE_TabBarTab: { - const TQTabBar *tb = (const TQTabBar *) widget; TQRect br = r; - if ( tb->shape() == TQTabBar::RoundedAbove ) { + if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) { if ( ! ( flags & Style_Selected ) ) { p->setPen( cg.background() ); p->drawLine( br.left(), br.bottom(), @@ -857,7 +856,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control, else br.addCoords( 1, 1, -1, 0 ); p->fillRect( br, cg.background() ); - } else if ( tb->shape() == TQTabBar::RoundedBelow ) { + } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) { if ( ! ( flags & Style_Selected ) ) { p->setPen( cg.background() ); p->drawLine( br.left(), br.top(), @@ -906,7 +905,6 @@ void LightStyleV3::drawControl( TQ_ControlElement control, if (! widget || data.isDefault()) break; - const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget; TQMenuItem *mi = data.menuItem(); int tab = data.tabWidth(); int maxpmw = data.maxIconWidth(); @@ -967,7 +965,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control, if ((flags & Style_Active) && (flags & Style_Enabled)) mode = TQIconSet::Active; TQPixmap pixmap; - if (popupmenu->isCheckable() && mi->isChecked()) + if ((elementFlags & CEF_IsCheckable) && mi->isChecked()) pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); else @@ -977,7 +975,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control, pmr.moveCenter(cr.center()); p->setPen(cg.text()); p->drawPixmap(pmr.topLeft(), pixmap); - } else if (popupmenu->isCheckable() && mi->isChecked()) + } else if ((elementFlags & CEF_IsCheckable) && mi->isChecked()) drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg, (flags & Style_Enabled) | Style_On); @@ -1765,7 +1763,6 @@ TQSize LightStyleV3::sizeFromContents( ContentsType contents, break; TQMenuItem *mi = data.menuItem(); - const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget; int maxpmw = data.maxIconWidth(); int w = contentsSize.width(), h = contentsSize.height(); @@ -1785,7 +1782,7 @@ TQSize LightStyleV3::sizeFromContents( ContentsType contents, if (mi->pixmap()) h = QMAX(h, mi->pixmap()->height()); else if (! mi->text().isNull()) - h = QMAX(h, popupmenu->fontMetrics().height() + 2); + h = QMAX(h, TQFontMetrics(ceData.font).height() + 2); if (mi->iconSet() != 0) h = QMAX(h, mi->iconSet()->pixmap(TQIconSet::Small, TQIconSet::Normal).height()); diff --git a/kstyles/plastik/plastik.cpp b/kstyles/plastik/plastik.cpp index f827ca024..f8e775cc5 100644 --- a/kstyles/plastik/plastik.cpp +++ b/kstyles/plastik/plastik.cpp @@ -2306,25 +2306,19 @@ void PlastikStyle::drawControl(TQ_ControlElement element, // TABS // ---- case CE_TabBarTab: { - const TQTabBar * tb = (const TQTabBar *) widget; bool cornerWidget = false; - if( ::tqqt_cast<TQTabWidget*>(tb->parent()) ) { - const TQTabWidget *tw = (const TQTabWidget*)tb->parent(); - // is there a corner widget in the (top) left edge? - TQWidget *cw = tw->cornerWidget(TQt::TopLeft); - if(cw) { - cornerWidget = true; - } + if (!ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes.isEmpty()) { + cornerWidget = true; } - TQTabBar::Shape tbs = tb->shape(); + TQTabBar::Shape tbs = ceData.tabBarData.shape; bool selected = false; if (flags & Style_Selected) selected = true; TabPosition pos; - if (tb->count() == 1) { + if (ceData.tabBarData.tabCount == 1) { pos = Single; - } else if ((tb->indexOf(opt.tab()->identifier()) == 0)) { + } else if (ceData.tabBarData.identIndexMap[opt.tab()->identifier()] == 0) { pos = First; - } else if (tb->indexOf(opt.tab()->identifier()) == tb->count() - 1) { + } else if (ceData.tabBarData.identIndexMap[opt.tab()->identifier()] == (ceData.tabBarData.tabCount - 1)) { pos = Last; } else { pos = Middle; @@ -2485,7 +2479,6 @@ void PlastikStyle::drawControl(TQ_ControlElement element, // POPUPMENU ITEM (highlighted on mouseover) // ------------------------------------------ case CE_PopupMenuItem: { - const TQPopupMenu *popupmenu = static_cast< const TQPopupMenu * >( widget ); TQMenuItem *mi = opt.menuItem(); if ( !mi ) @@ -2500,7 +2493,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element, int tab = opt.tabWidth(); int checkcol = opt.maxIconWidth(); bool enabled = mi->isEnabled(); - bool checkable = popupmenu->isCheckable(); + bool checkable = (elementFlags & CEF_IsCheckable); bool active = flags & Style_Active; bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); bool reverse = TQApplication::reverseLayout(); @@ -3272,9 +3265,8 @@ int PlastikStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, C // TABS // ---- case PM_TabBarTabVSpace: { - const TQTabBar * tb = (const TQTabBar *) widget; - if (tb->shape() == TQTabBar::RoundedAbove || - tb->shape() == TQTabBar::RoundedBelow) + if (ceData.tabBarData.shape == TQTabBar::RoundedAbove || + ceData.tabBarData.shape == TQTabBar::RoundedBelow) return 12; else return 4; |