Darrell Anderson 12 years ago
commit 481457e585

@ -987,17 +987,16 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
if ( !w || !w->parentWidget() || !o.tab() ) if ( !w || !w->parentWidget() || !o.tab() )
break; break;
const TQTabBar * tb = (const TQTabBar *) w;
const TQTab * t = o.tab(); const TQTab * t = o.tab();
bool selected = sf & Style_Selected; 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; TRUE : FALSE;
TQRect r2( r ); TQRect r2( r );
if ( tb->shape() == TQTabBar::RoundedAbove ) { if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) {
p->setPen( cg.light() ); p->setPen( cg.light() );
p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 ); p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 );
if ( r2.left() == 0 ) if ( r2.left() == 0 )
p->drawPoint( tb->rect().bottomLeft() ); p->drawPoint( ceData.rect.bottomLeft() );
if ( selected ) { if ( selected ) {
p->fillRect( TQRect( r2.left()+1, r2.bottom()-1, r2.width()-3, 2), p->fillRect( TQRect( r2.left()+1, r2.bottom()-1, r2.width()-3, 2),
@ -1031,9 +1030,9 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
x2++; x2++;
p->drawLine( x2, r2.top() + 2, x2, r2.bottom() - p->drawLine( x2, r2.top() + 2, x2, r2.bottom() -
(selected ? (lastTab ? 0:1) :2)); (selected ? (lastTab ? 0:1) :2));
} else if ( tb->shape() == TQTabBar::RoundedBelow ) { } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) {
bool rightAligned = styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, tb ) == TQt::AlignRight; bool rightAligned = styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, w ) == TQt::AlignRight;
bool firstTab = tb->indexOf( t->identifier() ) == 0; bool firstTab = ceData.tabBarData.identIndexMap[t->identifier()] == 0;
if ( selected ) { if ( selected ) {
p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1), p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1),
cg.brush( TQColorGroup::Background )); cg.brush( TQColorGroup::Background ));
@ -1086,16 +1085,15 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
if ( o.isDefault() ) if ( o.isDefault() )
break; break;
const TQTabBar * tb = (const TQTabBar *) w;
TQTab * t = o.tab(); TQTab * t = o.tab();
const bool enabled = sf & Style_Enabled; const bool enabled = sf & Style_Enabled;
bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
TQRect tr = r; TQRect tr = r;
if ( t->identifier() == tb->currentTab() ) if ( t->identifier() == ceData.tabBarData.currentTabIndex )
tr.setBottom( tr.bottom() - tr.setBottom( tr.bottom() -
pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, tb ) ); pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, w ) );
int alignment = TQt::AlignCenter | TQt::ShowPrefix; 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()))) 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; return;
} }
const TQPopupMenu *pum = dynamic_cast<const TQPopupMenu *>(w);
static const int itemFrame = 2; static const int itemFrame = 2;
static const int itemHMargin = 3; static const int itemHMargin = 3;
static const int itemVMargin = 3; static const int itemVMargin = 3;
@ -1527,15 +1524,15 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
bool active = sf & Style_Active; bool active = sf & Style_Active;
bool disabled = !mi->isEnabled(); bool disabled = !mi->isEnabled();
bool checkable = pum->isCheckable(); bool checkable = (elementFlags & CEF_IsCheckable);
bool enabled = mi->isEnabled(); bool enabled = mi->isEnabled();
bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
int xpos = x; int xpos = x;
int xm = itemFrame + checkcol + itemHMargin; int xm = itemFrame + checkcol + itemHMargin;
if (pum->erasePixmap() && !pum->erasePixmap()->isNull()) { if (!ceData.bgPixmap.isNull()) {
p->drawPixmap(x, y, *pum->erasePixmap(), x, y, sw, sh); p->drawPixmap(x, y, ceData.bgPixmap, x, y, sw, sh);
} else { } else {
p->fillRect(x, y, sw, sh, cg.background()); p->fillRect(x, y, sw, sh, cg.background());
} }
@ -2615,16 +2612,12 @@ void AsteroidStyle::paletteChanged()
bool AsteroidStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ) bool AsteroidStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e )
{ {
if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
TQObject* o = reinterpret_cast<TQObject*>(source);
/* Win2K has this interesting behaviour where it sets the current /* Win2K has this interesting behaviour where it sets the current
default button to whatever pushbutton the user presses the mouse default button to whatever pushbutton the user presses the mouse
on. I _think_ this emulates that properly. -clee */ on. I _think_ this emulates that properly. -clee */
if (o->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING)) { if (ceData.widgetObjectTypes.contains(TQPUSHBUTTON_OBJECT_NAME_STRING)) {
if (e->type() == TQEvent::MouseButtonPress) { if (e->type() == TQEvent::MouseButtonPress) {
TQPushButton *pb = dynamic_cast<TQPushButton *>(o); widgetActionRequest(ceData, elementFlags, source, WAR_SetDefault);
pb->setDefault(TRUE);
}
} }
} }

@ -179,7 +179,6 @@ HighColorStyle::HighColorStyle( StyleType styleType )
type = styleType; type = styleType;
highcolor = (type == HighColor && TQPixmap::defaultDepth() > 8); highcolor = (type == HighColor && TQPixmap::defaultDepth() > 8);
gDict.setAutoDelete(true); gDict.setAutoDelete(true);
hoverWidget = 0L;
selectionBackground = false; selectionBackground = false;
} }
@ -1121,9 +1120,6 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
// PUSHBUTTON // PUSHBUTTON
// ------------------------------------------------------------------- // -------------------------------------------------------------------
case CE_PushButton: { case CE_PushButton: {
if ( widget == hoverWidget )
flags |= Style_MouseOver;
if ( type != HighColor ) { if ( type != HighColor ) {
TQPushButton *button = (TQPushButton*) widget; TQPushButton *button = (TQPushButton*) widget;
TQRect br = r; TQRect br = r;
@ -1293,8 +1289,6 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
// POPUPMENU ITEM // POPUPMENU ITEM
// ------------------------------------------------------------------- // -------------------------------------------------------------------
case CE_PopupMenuItem: { case CE_PopupMenuItem: {
const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget;
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
if ( !mi ) { if ( !mi ) {
// Don't leave blank holes if we set NoBackground for the TQPopupMenu. // Don't leave blank holes if we set NoBackground for the TQPopupMenu.
@ -1307,7 +1301,7 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
int tab = opt.tabWidth(); int tab = opt.tabWidth();
int checkcol = opt.maxIconWidth(); int checkcol = opt.maxIconWidth();
bool enabled = mi->isEnabled(); bool enabled = mi->isEnabled();
bool checkable = popupmenu->isCheckable(); bool checkable = (elementFlags & CEF_IsCheckable);
bool active = flags & Style_Active; bool active = flags & Style_Active;
bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
@ -1971,31 +1965,22 @@ bool HighColorStyle::objectEventHandler( TQStyleControlElementData ceData, Contr
if (KStyle::objectEventHandler( ceData, elementFlags, source, event )) if (KStyle::objectEventHandler( ceData, elementFlags, source, event ))
return true; return true;
if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
TQObject* object = reinterpret_cast<TQObject*>(source);
TQToolBar* toolbar; TQToolBar* toolbar;
// Handle push button hover effects. if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING))
TQPushButton* button = dynamic_cast<TQPushButton*>(object);
if ( button )
{ {
if ( (event->type() == TQEvent::Enter) && TQObject* object = reinterpret_cast<TQObject*>(source);
(button->isEnabled()) ) {
hoverWidget = button; if ( object->parent() && !qstrcmp( object->name(), kdeToolbarWidget ) )
button->repaint( false );
}
else if ( (event->type() == TQEvent::Leave) &&
(TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(hoverWidget)) ) {
hoverWidget = 0L;
button->repaint( false );
}
} else if ( object->parent() && !qstrcmp( object->name(), kdeToolbarWidget ) )
{ {
// Draw a gradient background for custom widgets in the toolbar // Draw a gradient background for custom widgets in the toolbar
// that have specified a "kde toolbar widget" name. // that have specified a "kde toolbar widget" name.
// FIXME
// This currently requires direct widget access
// Is there any way to do this without it?
if (event->type() == TQEvent::Paint ) { if (event->type() == TQEvent::Paint ) {
// Find the top-level toolbar of this widget, since it may be nested in other // Find the top-level toolbar of this widget, since it may be nested in other
// widgets that are on the toolbar. // widgets that are on the toolbar.
TQWidget *widget = TQT_TQWIDGET(object); TQWidget *widget = TQT_TQWIDGET(object);
@ -2027,7 +2012,12 @@ bool HighColorStyle::objectEventHandler( TQStyleControlElementData ceData, Contr
{ {
// We need to override the paint event to draw a // We need to override the paint event to draw a
// gradient on a QToolBarExtensionWidget. // gradient on a QToolBarExtensionWidget.
// FIXME
// This currently requires direct widget access
// Is there any way to do this without it?
if ( event->type() == TQEvent::Paint ) { if ( event->type() == TQEvent::Paint ) {
TQWidget *widget = TQT_TQWIDGET(object); TQWidget *widget = TQT_TQWIDGET(object);
TQRect wr = widget->rect(), tr = toolbar->rect(); TQRect wr = widget->rect(), tr = toolbar->rect();
TQPainter p( widget ); TQPainter p( widget );

@ -171,7 +171,6 @@ class HighColorStyle : public KStyle
int pwidth=-1, int pwidth=-1,
int pheight=-1 ) const; int pheight=-1 ) const;
TQWidget *hoverWidget;
StyleType type; StyleType type;
bool highcolor; bool highcolor;
mutable bool selectionBackground; mutable bool selectionBackground;

@ -118,7 +118,6 @@ HighContrastStyle::HighContrastStyle()
TQSettings settings; TQSettings settings;
settings.beginGroup("/highcontraststyle/Settings/"); settings.beginGroup("/highcontraststyle/Settings/");
bool useWideLines = settings.readBoolEntry("wideLines", false); bool useWideLines = settings.readBoolEntry("wideLines", false);
hoverWidget = 0L;
basicLineWidth = useWideLines ? 4 : 2; basicLineWidth = useWideLines ? 4 : 2;
} }
@ -665,9 +664,6 @@ void HighContrastStyle::drawKStylePrimitive (KStylePrimitive kpe,
const TQStyleOption &opt, const TQStyleOption &opt,
const TQWidget* widget ) const const TQWidget* widget ) const
{ {
if ( widget == hoverWidget )
flags |= Style_MouseOver;
switch ( kpe ) switch ( kpe )
{ {
// TOOLBAR HANDLE // TOOLBAR HANDLE
@ -760,9 +756,6 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
const TQStyleOption& opt, const TQStyleOption& opt,
const TQWidget *widget ) const const TQWidget *widget ) const
{ {
if ( widget == hoverWidget )
flags |= Style_MouseOver;
switch (element) switch (element)
{ {
// TABS // TABS
@ -777,8 +770,7 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
setColorsNormal (p, cg, flags, Style_Selected); setColorsNormal (p, cg, flags, Style_Selected);
drawRoundRect (p, r); drawRoundRect (p, r);
const TQTabBar *tb = static_cast< const TQTabBar * >(widget); TQTabBar::Shape shape = ceData.tabBarData.shape;
TQTabBar::Shape shape = tb->shape();
if (shape == TQTabBar::TriangularBelow || if (shape == TQTabBar::TriangularBelow ||
shape == TQTabBar::RoundedBelow) { shape == TQTabBar::RoundedBelow) {
p->fillRect (r.left(), r.top(), p->fillRect (r.left(), r.top(),
@ -1008,14 +1000,13 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
setColorsNormal (p, cg, flags, Style_Active|Style_MouseOver); setColorsNormal (p, cg, flags, Style_Active|Style_MouseOver);
p->fillRect (r, p->backgroundColor ()); p->fillRect (r, p->backgroundColor ());
const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget;
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
if (!mi) if (!mi)
break; break;
int tab = opt.tabWidth(); int tab = opt.tabWidth();
int checkcol = opt.maxIconWidth(); int checkcol = opt.maxIconWidth();
bool checkable = popupmenu->isCheckable(); bool checkable = (elementFlags & CEF_IsCheckable);
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
int x, y, w, h; int x, y, w, h;
r.rect( &x, &y, &w, &h ); r.rect( &x, &y, &w, &h );
@ -1213,9 +1204,6 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
const TQStyleOption& opt, const TQStyleOption& opt,
const TQWidget *widget ) const const TQWidget *widget ) const
{ {
if ( widget == hoverWidget )
flags |= Style_MouseOver;
switch(control) switch(control)
{ {
// COMBOBOX // COMBOBOX
@ -1830,49 +1818,6 @@ TQRect HighContrastStyle::subRect (SubRect subrect, const TQStyleControlElementD
bool HighContrastStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event ) bool HighContrastStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
{ {
if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
TQObject* object = reinterpret_cast<TQObject*>(source);
TQWidget* widget = dynamic_cast<TQWidget*>(object);
if (widget)
{
// Handle hover effects.
if (event->type() == TQEvent::Enter
&& (widget->inherits (TQBUTTON_OBJECT_NAME_STRING)
|| widget->inherits (TQCOMBOBOX_OBJECT_NAME_STRING)
|| widget->inherits (TQSPINWIDGET_OBJECT_NAME_STRING)))
{
hoverWidget = widget;
widget->repaint (false);
}
else if (event->type() == TQEvent::Leave
&& (widget->inherits (TQBUTTON_OBJECT_NAME_STRING)
|| widget->inherits (TQCOMBOBOX_OBJECT_NAME_STRING)
|| widget->inherits (TQSPINWIDGET_OBJECT_NAME_STRING)))
{
if (TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(hoverWidget))
hoverWidget = 0L;
widget->repaint (false);
}
// Make sure the focus rectangle is shown correctly.
else if (event->type() == TQEvent::FocusIn || event->type() == TQEvent::FocusOut)
{
TQWidget* widgetparent = dynamic_cast<TQWidget*>(widget->parent());
while (widgetparent
&& ! widgetparent->inherits (TQCOMBOBOX_OBJECT_NAME_STRING)
&& ! widgetparent->inherits (TQSPINWIDGET_OBJECT_NAME_STRING))
{
widgetparent = dynamic_cast<TQWidget*>(widgetparent->parent());
}
if (widgetparent)
widgetparent->repaint (false);
else
widget->repaint (false);
}
}
}
return KStyle::objectEventHandler (ceData, elementFlags, source, event); return KStyle::objectEventHandler (ceData, elementFlags, source, event);
} }

@ -152,8 +152,6 @@ class HighContrastStyle : public KStyle
protected: protected:
virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
TQWidget *hoverWidget;
private: private:
void setColorsNormal (TQPainter* p, const TQColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const; void setColorsNormal (TQPainter* p, const TQColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const;
void setColorsButton (TQPainter* p, const TQColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const; void setColorsButton (TQPainter* p, const TQColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const;

@ -284,7 +284,6 @@ KeramikStyle::KeramikStyle()
toolbarBlendWidget(0), titleBarMode(None), flatMode(false), customScrollMode(false), kickerMode(false) toolbarBlendWidget(0), titleBarMode(None), flatMode(false), customScrollMode(false), kickerMode(false)
{ {
forceSmallMode = false; forceSmallMode = false;
hoverWidget = 0;
TQSettings settings; TQSettings settings;
@ -1368,9 +1367,6 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
if (isFormWidget(btn)) if (isFormWidget(btn))
formMode = true; formMode = true;
if ( widget == hoverWidget )
flags |= Style_MouseOver;
if ( btn->isFlat( ) ) if ( btn->isFlat( ) )
flatMode = true; flatMode = true;
@ -1514,28 +1510,26 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
case CE_TabBarTab: case CE_TabBarTab:
{ {
const TQTabBar* tabBar = static_cast< const TQTabBar* >( widget ); bool bottom = ceData.tabBarData.shape == TQTabBar::RoundedBelow ||
ceData.tabBarData.shape == TQTabBar::TriangularBelow;
bool bottom = tabBar->shape() == TQTabBar::RoundedBelow ||
tabBar->shape() == TQTabBar::TriangularBelow;
if ( flags & Style_Selected ) if ( flags & Style_Selected )
{ {
TQRect tabRect = r; TQRect tabRect = r;
//If not the right-most tab, readjust the painting to be one pixel wider //If not the right-most tab, readjust the painting to be one pixel wider
//to avoid a doubled line //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); 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 else
{ {
Keramik::InactiveTabPainter::Mode mode; 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; 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; else mode = Keramik::InactiveTabPainter::Middle;
if ( bottom ) if ( bottom )
@ -1610,7 +1604,6 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
// POPUPMENU ITEM // POPUPMENU ITEM
// ------------------------------------------------------------------- // -------------------------------------------------------------------
case CE_PopupMenuItem: { case CE_PopupMenuItem: {
const TQPopupMenu *popupmenu = static_cast< const TQPopupMenu * >( widget );
TQRect main = r; TQRect main = r;
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
@ -1627,7 +1620,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
int tab = opt.tabWidth(); int tab = opt.tabWidth();
int checkcol = opt.maxIconWidth(); int checkcol = opt.maxIconWidth();
bool enabled = mi->isEnabled(); bool enabled = mi->isEnabled();
bool checkable = popupmenu->isCheckable(); bool checkable = (elementFlags & CEF_IsCheckable);
bool active = flags & Style_Active; bool active = flags & Style_Active;
bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
@ -2037,9 +2030,6 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
if (toolbarMode) if (toolbarMode)
toolbarBlendWidget = widget; toolbarBlendWidget = widget;
if ( widget == hoverWidget )
flags |= Style_MouseOver;
drawPrimitive( PE_ButtonCommand, p2, ceData, elementFlags, br, cg, flags ); drawPrimitive( PE_ButtonCommand, p2, ceData, elementFlags, br, cg, flags );
toolbarBlendWidget = 0; toolbarBlendWidget = 0;
@ -2259,10 +2249,6 @@ void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
if (active & SC_ToolButtonMenu) if (active & SC_ToolButtonMenu)
mflags |= Style_Down; mflags |= Style_Down;
if ( widget == hoverWidget )
bflags |= Style_MouseOver;
if (onToolbar && static_cast<TQToolBar*>(TQT_TQWIDGET(widget->parent()))->orientation() == Qt::Horizontal) if (onToolbar && static_cast<TQToolBar*>(TQT_TQWIDGET(widget->parent()))->orientation() == Qt::Horizontal)
bflags |= Style_Horizontal; bflags |= Style_Horizontal;
@ -2420,11 +2406,10 @@ int KeramikStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, C
case PM_TabBarTabShiftVertical: case PM_TabBarTabShiftVertical:
{ {
const TQTabBar* tb = ::tqqt_cast<const TQTabBar*>(widget); if (ceData.widgetObjectTypes.contains(TQTABBAR_OBJECT_NAME_STRING))
if (tb)
{ {
if (tb->shape() == TQTabBar::RoundedBelow || if (ceData.tabBarData.shape == TQTabBar::RoundedBelow ||
tb->shape() == TQTabBar::TriangularBelow) ceData.tabBarData.shape == TQTabBar::TriangularBelow)
return 0; return 0;
} }
@ -2781,26 +2766,6 @@ bool KeramikStyle::objectEventHandler( TQStyleControlElementData ceData, Control
if ( !object->isWidgetType() ) return false; if ( !object->isWidgetType() ) return false;
//Clear hover highlight when needed
if ( (event->type() == TQEvent::Leave) && (TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(hoverWidget)) )
{
TQWidget* button = TQT_TQWIDGET(object);
hoverWidget = 0;
button->repaint( false );
return false;
}
//Hover highlight on buttons, toolbuttons and combos
if ( ::tqqt_cast<TQPushButton*>(object) || ::tqqt_cast<TQComboBox*>(object) || ::tqqt_cast<TQToolButton*>(object) )
{
if (event->type() == TQEvent::Enter && TQT_TQWIDGET(object)->isEnabled() )
{
hoverWidget = TQT_TQWIDGET(object);
hoverWidget->repaint( false );
}
return false;
}
//Combo line edits get special frames //Combo line edits get special frames
if ( event->type() == TQEvent::Paint && ::tqqt_cast<TQLineEdit*>(object) ) if ( event->type() == TQEvent::Paint && ::tqqt_cast<TQLineEdit*>(object) )
{ {

@ -204,9 +204,6 @@ private:
return maskMode?Keramik::TilePainter::PaintMask : Keramik::TilePainter::PaintFullBlend; return maskMode?Keramik::TilePainter::PaintMask : Keramik::TilePainter::PaintFullBlend;
} }
TQWidget* hoverWidget;
bool kickerMode; bool kickerMode;
// For progress bar animation // For progress bar animation

@ -1261,11 +1261,10 @@ void KThemeStyle::drawControl( ControlElement element,
case CE_TabBarTab: case CE_TabBarTab:
{ {
const TQTabBar* tb = ( const TQTabBar* ) widget; TQTabBar::Shape tbs = ceData.tabBarData.shape;
TQTabBar::Shape tbs = tb->shape();
bool selected = how & Style_Selected; bool selected = how & Style_Selected;
WidgetType widget = selected ? ActiveTab : InactiveTab; WidgetType widget = selected ? ActiveTab : InactiveTab;
const TQColorGroup *cg = colorGroup( tb->colorGroup(), widget ); const TQColorGroup *cg = colorGroup( ceData.colorGroup, widget );
int i; int i;
int x2 = x + w - 1, y2 = y + h - 1; int x2 = x + w - 1, y2 = y + h - 1;
int bWidth = borderWidth( widget ); int bWidth = borderWidth( widget );
@ -1276,7 +1275,7 @@ void KThemeStyle::drawControl( ControlElement element,
if ( !selected ) if ( !selected )
{ {
p->fillRect( x, y, x2 - x + 1, 2, p->fillRect( x, y, x2 - x + 1, 2,
tb->palette().active().brush( TQColorGroup::Background ) ); ceData.palette.active().brush( TQColorGroup::Background ) );
y += 2; y += 2;
} }
p->setPen( cg->text() ); p->setPen( cg->text() );
@ -1338,8 +1337,8 @@ void KThemeStyle::drawControl( ControlElement element,
else else
p->fillRect( x, y, x2 - x + 1, y2 - y + 1, cg->background() ); p->fillRect( x, y, x2 - x + 1, y2 - y + 1, cg->background() );
} }
else if ( tb->shape() == TQTabBar::RoundedBelow || else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ||
tb->shape() == TQTabBar::TriangularBelow ) ceData.tabBarData.shape == TQTabBar::TriangularBelow )
{ {
if ( widget == ActiveTab ) if ( widget == ActiveTab )
widget = RotActiveTab; widget = RotActiveTab;
@ -1349,7 +1348,7 @@ void KThemeStyle::drawControl( ControlElement element,
if ( !selected ) if ( !selected )
{ {
p->fillRect( x, y2 - 2, x2 - x + 1, 2, p->fillRect( x, y2 - 2, x2 - x + 1, 2,
tb->palette().active().brush( TQColorGroup::Background ) ); ceData.palette.active().brush( TQColorGroup::Background ) );
y2 -= 2; y2 -= 2;
} }
p->setPen( cg->text() ); p->setPen( cg->text() );
@ -1451,7 +1450,6 @@ void KThemeStyle::drawControl( ControlElement element,
int x, y, w, h; int x, y, w, h;
r.rect( &x, &y, &w, &h ); r.rect( &x, &y, &w, &h );
const TQPopupMenu *popupmenu = ( const TQPopupMenu * ) widget;
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
if ( mi ) if ( mi )
{ {
@ -1461,7 +1459,7 @@ void KThemeStyle::drawControl( ControlElement element,
int tab = opt.tabWidth(); int tab = opt.tabWidth();
int checkcol = opt.maxIconWidth(); int checkcol = opt.maxIconWidth();
bool enabled = (mi? mi->isEnabled():true); bool enabled = (mi? mi->isEnabled():true);
bool checkable = popupmenu->isCheckable(); bool checkable = (elementFlags & CEF_IsCheckable);
bool active = how & Style_Active; bool active = how & Style_Active;
bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags, TQStyleOption::Default, 0, 0 ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags, TQStyleOption::Default, 0, 0 );
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();

@ -631,7 +631,6 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
switch (control) { switch (control) {
case CE_TabBarTab: case CE_TabBarTab:
{ {
const TQTabBar* tb = static_cast<const TQTabBar*>(widget);
bool below = false; bool below = false;
TQRect tr(r); TQRect tr(r);
TQRect fr(r); TQRect fr(r);
@ -639,7 +638,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
tr.addCoords(0, 0, 0, -1); tr.addCoords(0, 0, 0, -1);
fr.addCoords(2, 2, -2, -2); 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); tr = r; tr.addCoords(0, 1, 0, 0);
fr = r; fr.addCoords(2, 2,-2, -4); fr = r; fr.addCoords(2, 2,-2, -4);
below = true; below = true;
@ -784,7 +783,6 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
if (! widget || data.isDefault()) if (! widget || data.isDefault())
break; break;
const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget;
TQMenuItem *mi = data.menuItem(); TQMenuItem *mi = data.menuItem();
int tab = data.tabWidth(); int tab = data.tabWidth();
int maxpmw = data.maxIconWidth(); int maxpmw = data.maxIconWidth();
@ -847,7 +845,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
if ((flags & Style_Active) && (flags & Style_Enabled)) if ((flags & Style_Active) && (flags & Style_Enabled))
mode = TQIconSet::Active; mode = TQIconSet::Active;
TQPixmap pixmap; TQPixmap pixmap;
if (popupmenu->isCheckable() && mi->isChecked()) if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
pixmap = pixmap =
mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On );
else else
@ -857,7 +855,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
pmr.moveCenter(cr.center()); pmr.moveCenter(cr.center());
p->setPen(cg.text()); p->setPen(cg.text());
p->drawPixmap(pmr.topLeft(), pixmap); 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, drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg,
(flags & Style_Enabled) | Style_On); (flags & Style_Enabled) | Style_On);
@ -1538,7 +1536,6 @@ TQSize LightStyleV2::sizeFromContents( ContentsType contents,
break; break;
TQMenuItem *mi = data.menuItem(); TQMenuItem *mi = data.menuItem();
const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget;
int maxpmw = data.maxIconWidth(); int maxpmw = data.maxIconWidth();
int w = contentsSize.width(), h = contentsSize.height(); int w = contentsSize.width(), h = contentsSize.height();
@ -1558,7 +1555,7 @@ TQSize LightStyleV2::sizeFromContents( ContentsType contents,
if (mi->pixmap()) if (mi->pixmap())
h = QMAX(h, mi->pixmap()->height()); h = QMAX(h, mi->pixmap()->height());
else if (! mi->text().isNull()) else if (! mi->text().isNull())
h = QMAX(h, popupmenu->fontMetrics().height() + 2); h = QMAX(h, TQFontMetrics(ceData.font).height() + 2);
if (mi->iconSet() != 0) if (mi->iconSet() != 0)
h = QMAX(h, mi->iconSet()->pixmap(TQIconSet::Small, h = QMAX(h, mi->iconSet()->pixmap(TQIconSet::Small,
TQIconSet::Normal).height()); TQIconSet::Normal).height());

@ -819,10 +819,9 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
switch (control) { switch (control) {
case CE_TabBarTab: case CE_TabBarTab:
{ {
const TQTabBar *tb = (const TQTabBar *) widget;
TQRect br = r; TQRect br = r;
if ( tb->shape() == TQTabBar::RoundedAbove ) { if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) {
if ( ! ( flags & Style_Selected ) ) { if ( ! ( flags & Style_Selected ) ) {
p->setPen( cg.background() ); p->setPen( cg.background() );
p->drawLine( br.left(), br.bottom(), p->drawLine( br.left(), br.bottom(),
@ -857,7 +856,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
else else
br.addCoords( 1, 1, -1, 0 ); br.addCoords( 1, 1, -1, 0 );
p->fillRect( br, cg.background() ); p->fillRect( br, cg.background() );
} else if ( tb->shape() == TQTabBar::RoundedBelow ) { } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) {
if ( ! ( flags & Style_Selected ) ) { if ( ! ( flags & Style_Selected ) ) {
p->setPen( cg.background() ); p->setPen( cg.background() );
p->drawLine( br.left(), br.top(), p->drawLine( br.left(), br.top(),
@ -906,7 +905,6 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
if (! widget || data.isDefault()) if (! widget || data.isDefault())
break; break;
const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget;
TQMenuItem *mi = data.menuItem(); TQMenuItem *mi = data.menuItem();
int tab = data.tabWidth(); int tab = data.tabWidth();
int maxpmw = data.maxIconWidth(); int maxpmw = data.maxIconWidth();
@ -967,7 +965,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
if ((flags & Style_Active) && (flags & Style_Enabled)) if ((flags & Style_Active) && (flags & Style_Enabled))
mode = TQIconSet::Active; mode = TQIconSet::Active;
TQPixmap pixmap; TQPixmap pixmap;
if (popupmenu->isCheckable() && mi->isChecked()) if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
pixmap = pixmap =
mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On );
else else
@ -977,7 +975,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
pmr.moveCenter(cr.center()); pmr.moveCenter(cr.center());
p->setPen(cg.text()); p->setPen(cg.text());
p->drawPixmap(pmr.topLeft(), pixmap); 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, drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg,
(flags & Style_Enabled) | Style_On); (flags & Style_Enabled) | Style_On);
@ -1765,7 +1763,6 @@ TQSize LightStyleV3::sizeFromContents( ContentsType contents,
break; break;
TQMenuItem *mi = data.menuItem(); TQMenuItem *mi = data.menuItem();
const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget;
int maxpmw = data.maxIconWidth(); int maxpmw = data.maxIconWidth();
int w = contentsSize.width(), h = contentsSize.height(); int w = contentsSize.width(), h = contentsSize.height();
@ -1785,7 +1782,7 @@ TQSize LightStyleV3::sizeFromContents( ContentsType contents,
if (mi->pixmap()) if (mi->pixmap())
h = QMAX(h, mi->pixmap()->height()); h = QMAX(h, mi->pixmap()->height());
else if (! mi->text().isNull()) else if (! mi->text().isNull())
h = QMAX(h, popupmenu->fontMetrics().height() + 2); h = QMAX(h, TQFontMetrics(ceData.font).height() + 2);
if (mi->iconSet() != 0) if (mi->iconSet() != 0)
h = QMAX(h, mi->iconSet()->pixmap(TQIconSet::Small, h = QMAX(h, mi->iconSet()->pixmap(TQIconSet::Small,
TQIconSet::Normal).height()); TQIconSet::Normal).height());

@ -156,10 +156,6 @@ PlastikStyle::PlastikStyle() : KStyle( AllowMenuTransparency, ThreeButtonScrollB
kornMode(false), kornMode(false),
flatMode(false) flatMode(false)
{ {
hoverWidget = 0;
hoverTab = 0;
horizontalLine = 0; horizontalLine = 0;
verticalLine = 0; verticalLine = 0;
@ -1835,7 +1831,7 @@ void PlastikStyle::drawPrimitive(TQ_PrimitiveElement pe,
// -------------- // --------------
case PE_Splitter: { case PE_Splitter: {
// highlight on mouse over // highlight on mouse over
TQColor color = (static_cast<TQPaintDevice*>(static_cast<TQWidget*>(hoverWidget)) == static_cast<TQPaintDevice*>(p->device()))?TQColor(cg.background().light(100+_contrast)):cg.background(); TQColor color = (mouseOver)?TQColor(cg.background().light(100+_contrast)):cg.background();
p->fillRect(r, color); p->fillRect(r, color);
if (w > h) { if (w > h) {
if (h > 4) { if (h > 4) {
@ -2310,31 +2306,26 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
// TABS // TABS
// ---- // ----
case CE_TabBarTab: { case CE_TabBarTab: {
const TQTabBar * tb = (const TQTabBar *) widget;
bool cornerWidget = false; bool cornerWidget = false;
if( ::tqqt_cast<TQTabWidget*>(tb->parent()) ) { if (!ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes.isEmpty()) {
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; cornerWidget = true;
} }
TQTabBar::Shape tbs = tb->shape(); TQTabBar::Shape tbs = ceData.tabBarData.shape;
bool selected = false; bool selected = false;
if (flags & Style_Selected) selected = true; if (flags & Style_Selected) selected = true;
TabPosition pos; TabPosition pos;
if (tb->count() == 1) { if (ceData.tabBarData.tabCount == 1) {
pos = Single; pos = Single;
} else if ((tb->indexOf(opt.tab()->identifier()) == 0)) { } else if (ceData.tabBarData.identIndexMap[opt.tab()->identifier()] == 0) {
pos = First; 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; pos = Last;
} else { } else {
pos = Middle; pos = Middle;
} }
bool mouseOver = false; bool mouseOver = false;
if (opt.tab() == hoverTab) { if (opt.tab() == opt.hoverTab()) {
mouseOver = true; mouseOver = true;
flags |= Style_MouseOver; flags |= Style_MouseOver;
} }
@ -2369,9 +2360,6 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
if (button->isFlat() ) if (button->isFlat() )
flatMode = true; flatMode = true;
if (widget == hoverWidget)
flags |= Style_MouseOver;
TQColorGroup g2 = cg; TQColorGroup g2 = cg;
if (isDefault) if (isDefault)
g2.setColor(TQColorGroup::Background, cg.background().dark(120) ); g2.setColor(TQColorGroup::Background, cg.background().dark(120) );
@ -2491,7 +2479,6 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
// POPUPMENU ITEM (highlighted on mouseover) // POPUPMENU ITEM (highlighted on mouseover)
// ------------------------------------------ // ------------------------------------------
case CE_PopupMenuItem: { case CE_PopupMenuItem: {
const TQPopupMenu *popupmenu = static_cast< const TQPopupMenu * >( widget );
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
if ( !mi ) if ( !mi )
@ -2506,7 +2493,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
int tab = opt.tabWidth(); int tab = opt.tabWidth();
int checkcol = opt.maxIconWidth(); int checkcol = opt.maxIconWidth();
bool enabled = mi->isEnabled(); bool enabled = mi->isEnabled();
bool checkable = popupmenu->isCheckable(); bool checkable = (elementFlags & CEF_IsCheckable);
bool active = flags & Style_Active; bool active = flags & Style_Active;
bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
@ -2872,7 +2859,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
surfaceFlags |= Round_UpperRight|Round_BottomRight; surfaceFlags |= Round_UpperRight|Round_BottomRight;
} }
if ((widget == hoverWidget) || (flags & Style_MouseOver)) { if (flags & Style_MouseOver) {
surfaceFlags |= Is_Highlight; surfaceFlags |= Is_Highlight;
if(editable) surfaceFlags |= Highlight_Left|Highlight_Right; if(editable) surfaceFlags |= Highlight_Left|Highlight_Right;
surfaceFlags |= Highlight_Top|Highlight_Bottom; surfaceFlags |= Highlight_Top|Highlight_Bottom;
@ -2889,7 +2876,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
surfaceFlags |= Round_UpperLeft|Round_BottomLeft; surfaceFlags |= Round_UpperLeft|Round_BottomLeft;
} }
if ((widget == hoverWidget) || (flags & Style_MouseOver)) { if (flags & Style_MouseOver) {
surfaceFlags |= Is_Highlight; surfaceFlags |= Is_Highlight;
surfaceFlags |= Highlight_Top|Highlight_Bottom; surfaceFlags |= Highlight_Top|Highlight_Bottom;
} }
@ -2974,7 +2961,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
if (controls & SC_ToolButton) { if (controls & SC_ToolButton) {
// If we're pressed, on, or raised... // If we're pressed, on, or raised...
if (bflags & (Style_Down | Style_On | Style_Raised) || widget==hoverWidget ) { if (bflags & (Style_Down | Style_On | Style_Raised) || (flags & Style_MouseOver) ) {
drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt); drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
} else if (tb->parentWidget() && } else if (tb->parentWidget() &&
tb->parentWidget()->backgroundPixmap() && tb->parentWidget()->backgroundPixmap() &&
@ -3084,7 +3071,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
} else { } else {
surfaceFlags |= Round_UpperRight; surfaceFlags |= Round_UpperRight;
} }
if ((widget == hoverWidget) || (sflags & Style_MouseOver)) { if (sflags & Style_MouseOver) {
surfaceFlags |= Is_Highlight; surfaceFlags |= Is_Highlight;
surfaceFlags |= Highlight_Top|Highlight_Left|Highlight_Right; surfaceFlags |= Highlight_Top|Highlight_Left|Highlight_Right;
} }
@ -3098,7 +3085,7 @@ void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
} else { } else {
surfaceFlags |= Round_BottomRight; surfaceFlags |= Round_BottomRight;
} }
if ((widget == hoverWidget) || (sflags & Style_MouseOver)) { if (sflags & Style_MouseOver) {
surfaceFlags |= Is_Highlight; surfaceFlags |= Is_Highlight;
surfaceFlags |= Highlight_Bottom|Highlight_Left|Highlight_Right; surfaceFlags |= Highlight_Bottom|Highlight_Left|Highlight_Right;
} }
@ -3278,9 +3265,8 @@ int PlastikStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, C
// TABS // TABS
// ---- // ----
case PM_TabBarTabVSpace: { case PM_TabBarTabVSpace: {
const TQTabBar * tb = (const TQTabBar *) widget; if (ceData.tabBarData.shape == TQTabBar::RoundedAbove ||
if (tb->shape() == TQTabBar::RoundedAbove || ceData.tabBarData.shape == TQTabBar::RoundedBelow)
tb->shape() == TQTabBar::RoundedBelow)
return 12; return 12;
else else
return 4; return 4;
@ -3488,83 +3474,6 @@ bool PlastikStyle::objectEventHandler( TQStyleControlElementData ceData, Control
if (!obj->isWidgetType() ) return false; if (!obj->isWidgetType() ) return false;
// focus highlight
if ( ::tqqt_cast<TQLineEdit*>(obj) ) {
TQWidget* widget = TQT_TQWIDGET(obj);
if ( ::tqqt_cast<TQSpinWidget*>(widget->parentWidget()) )
{
TQWidget* spinbox = widget->parentWidget();
if ((ev->type() == TQEvent::FocusIn) || (ev->type() == TQEvent::FocusOut))
{
spinbox->repaint(false);
}
return false;
}
if ((ev->type() == TQEvent::FocusIn) || (ev->type() == TQEvent::FocusOut))
{
widget->repaint(false);
}
return false;
}
//Hover highlight... use tqqt_cast to check if the widget inheits one of the classes.
if ( ::tqqt_cast<TQPushButton*>(obj) || ::tqqt_cast<TQComboBox*>(obj) ||
::tqqt_cast<TQSpinWidget*>(obj) || ::tqqt_cast<TQCheckBox*>(obj) ||
::tqqt_cast<TQRadioButton*>(obj) || ::tqqt_cast<TQToolButton*>(obj) || obj->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) )
{
if ((ev->type() == TQEvent::Enter) && TQT_TQWIDGET(obj)->isEnabled())
{
TQWidget* button = TQT_TQWIDGET(obj);
hoverWidget = button;
button->repaint(false);
}
else if ((ev->type() == TQEvent::Leave) && (TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(hoverWidget)) )
{
TQWidget* button = TQT_TQWIDGET(obj);
hoverWidget = 0;
button->repaint(false);
}
return false;
}
if ( ::tqqt_cast<TQTabBar*>(obj) ) {
if ((ev->type() == TQEvent::Enter) && TQT_TQWIDGET(obj)->isEnabled())
{
TQWidget* tabbar = TQT_TQWIDGET(obj);
hoverWidget = tabbar;
hoverTab = 0;
tabbar->repaint(false);
}
else if (ev->type() == TQEvent::MouseMove)
{
TQTabBar *tabbar = dynamic_cast<TQTabBar*>(obj);
TQMouseEvent *me = dynamic_cast<TQMouseEvent*>(ev);
if (tabbar && me) {
// avoid unnecessary repaints (which otherwise would occour on every
// MouseMove event causing high cpu load).
bool repaint = true;
TQTab *tab = tabbar->selectTab(me->pos() );
if (hoverTab == tab)
repaint = false;
hoverTab = tab;
if (repaint)
tabbar->repaint(false);
}
}
else if (ev->type() == TQEvent::Leave)
{
TQWidget* tabbar = TQT_TQWIDGET(obj);
hoverWidget = 0;
hoverTab = 0;
tabbar->repaint(false);
}
return false;
}
// Track show events for progress bars // Track show events for progress bars
if ( _animateProgressBar && ::tqqt_cast<TQProgressBar*>(obj) ) if ( _animateProgressBar && ::tqqt_cast<TQProgressBar*>(obj) )
{ {

@ -268,7 +268,6 @@ protected:
virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
TQWidget* hoverWidget;
protected slots: protected slots:
void khtmlWidgetDestroyed(TQObject* w); void khtmlWidgetDestroyed(TQObject* w);
@ -301,8 +300,6 @@ private:
TQColor _focusHighlightColor; TQColor _focusHighlightColor;
TQColor _checkMarkColor; TQColor _checkMarkColor;
TQTab *hoverTab;
// track khtml widgets. // track khtml widgets.
TQMap<const TQWidget*,bool> khtmlWidgets; TQMap<const TQWidget*,bool> khtmlWidgets;

@ -701,8 +701,7 @@ void KStyle::drawControl( TQ_ControlElement element,
// TABS // TABS
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case CE_TabBarTab: { case CE_TabBarTab: {
const TQTabBar* tb = (const TQTabBar*) widget; TQTabBar::Shape tbs = ceData.tabBarData.shape;
TQTabBar::Shape tbs = tb->shape();
bool selected = flags & Style_Selected; bool selected = flags & Style_Selected;
int x = r.x(), y=r.y(), bottom=r.bottom(), right=r.right(); int x = r.x(), y=r.y(), bottom=r.bottom(), right=r.right();
@ -1043,17 +1042,15 @@ int KStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, Control
return 24; return 24;
case PM_TabBarTabVSpace: { case PM_TabBarTabVSpace: {
const TQTabBar * tb = (const TQTabBar *) widget; if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ||
if ( tb->shape() == TQTabBar::RoundedAbove || ceData.tabBarData.shape == TQTabBar::RoundedBelow )
tb->shape() == TQTabBar::RoundedBelow )
return 10; return 10;
else else
return 4; return 4;
} }
case PM_TabBarTabOverlap: { case PM_TabBarTabOverlap: {
const TQTabBar* tb = (const TQTabBar*)widget; TQTabBar::Shape tbs = ceData.tabBarData.shape;
TQTabBar::Shape tbs = tb->shape();
if ( (tbs == TQTabBar::RoundedAbove) || if ( (tbs == TQTabBar::RoundedAbove) ||
(tbs == TQTabBar::RoundedBelow) ) (tbs == TQTabBar::RoundedBelow) )

Loading…
Cancel
Save