summaryrefslogtreecommitdiffstats
path: root/style/qtcurve.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-04 16:20:28 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-04 16:20:28 -0600
commit1079dc4b331da45fb98e8b814932421a46c0b13c (patch)
tree7282e2b46a52c89af0e71e4ce09317f010eb3518 /style/qtcurve.cpp
parent4465ba29ed04d8c7b16456b36717794a39e4a343 (diff)
downloadtde-style-qtcurve-1079dc4b331da45fb98e8b814932421a46c0b13c.tar.gz
tde-style-qtcurve-1079dc4b331da45fb98e8b814932421a46c0b13c.zip
Fix crashes when used with third-party toolkits
Diffstat (limited to 'style/qtcurve.cpp')
-rw-r--r--style/qtcurve.cpp618
1 files changed, 332 insertions, 286 deletions
diff --git a/style/qtcurve.cpp b/style/qtcurve.cpp
index 0bd1b09..873bcae 100644
--- a/style/qtcurve.cpp
+++ b/style/qtcurve.cpp
@@ -379,7 +379,7 @@ TQ_EXPORT_PLUGIN(QtCurveStylePlugin)
#define SKIP_TASKBAR (APP_SKIP_TASKBAR==itsThemedApp || APP_KPRINTER==itsThemedApp || APP_KDIALOG==itsThemedApp)
-#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+#if defined TQTC_TQT_ONLY || !defined TDE_VERSION
#include <tqfile.h>
#endif
@@ -397,7 +397,7 @@ TQ_EXPORT_PLUGIN(QtCurveStylePlugin)
#define DW_BGND 105
-#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+#if defined TQTC_TQT_ONLY || !defined TDE_VERSION
// Try to read $TDEHOME/share/config/kickerrc to find out if kicker is transparent...
static bool kickerIsTrans()
@@ -827,7 +827,7 @@ QtCurveStyle::QtCurveStyle()
itsMdiColors(0L),
itsThemedApp(APP_OTHER),
itsPixmapCache(150000, 499),
-#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+#if defined TQTC_TQT_ONLY || !defined TDE_VERSION
itsIsTransKicker(false),
#endif
itsHover(HOVER_NONE),
@@ -1120,7 +1120,7 @@ QtCurveStyle::~QtCurveStyle()
if(itsSidebarButtonsCols!=itsSliderCols &&
itsSidebarButtonsCols!=itsDefBtnCols)
delete [] itsSidebarButtonsCols;
- if(itsActiveMdiColors && itsActiveMdiColors!=itsHighlightCols)
+ if(itsActiveMdiColors && itsActiveMdiColors!=itsHighlightCols && itsActiveMdiColors!=itsBackgroundCols)
delete [] itsActiveMdiColors;
if(itsMdiColors && itsMdiColors!=itsBackgroundCols)
delete [] itsMdiColors;
@@ -1171,7 +1171,7 @@ void QtCurveStyle::applicationPolish(TQStyleControlElementData ceData, ControlEl
if ("kicker"==appName || "appletproxy"==appName)
{
itsThemedApp=APP_KICKER;
- #if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+ #if defined TQTC_TQT_ONLY || !defined TDE_VERSION
itsIsTransKicker=kickerIsTrans();
#endif
}
@@ -1206,7 +1206,7 @@ void QtCurveStyle::applicationPolish(TQStyleControlElementData ceData, ControlEl
else if ("korn"==appName)
{
itsThemedApp=APP_KORN;
- #if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+ #if defined TQTC_TQT_ONLY || !defined TDE_VERSION
itsIsTransKicker=kickerIsTrans();
#endif
}
@@ -1490,7 +1490,7 @@ void QtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags
if(widget->parentWidget() && ::tqqt_cast<TQScrollView *>(widget) && ::tqqt_cast<TQComboBox *>(widget->parentWidget()))
{
- TQPalette pal(widget->palette());
+ TQPalette pal(ceData.palette);
#if 0
TQPalette orig(pal);
#endif
@@ -1524,7 +1524,7 @@ void QtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags
#endif
}
- if (APP_MACTOR==itsThemedApp && itsMactorPal && !widget->inherits("TQTipLabel"))
+ if (APP_MACTOR==itsThemedApp && itsMactorPal && !ceData.widgetObjectTypes.contains("TQTipLabel"))
widget->setPalette(*itsMactorPal);
// Get rid of Kontact's frame...
@@ -1567,7 +1567,7 @@ void QtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags
#endif
if(framelessGroupBoxCheckBox)
{
- TQFont fnt(widget->font());
+ TQFont fnt(ceData.font);
fnt.setBold(true);
widget->setFont(fnt);
@@ -1596,7 +1596,7 @@ void QtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags
#endif
}
}
- else if (::tqqt_cast<TQButton *>(widget) || widget->inherits("TQToolBarExtensionWidget"))
+ else if (::tqqt_cast<TQButton *>(widget) || ceData.widgetObjectTypes.contains("TQToolBarExtensionWidget"))
{
/*if(onToolBar(widget))
widget->setBackgroundMode(NoBackground);
@@ -1629,10 +1629,10 @@ void QtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags
if(SHADE_NONE!=opts.shadeMenubars)
installObjectEventHandler(ceData, elementFlags, ptr, this);
if(BLEND_TITLEBAR || opts.windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR)
- emitMenuSize(widget, widget->rect().height());
+ emitMenuSize(widget, ceData.rect.height());
if(SHADE_WINDOW_BORDER==opts.shadeMenubars)
{
- TQPalette pal(widget->palette());
+ TQPalette pal(ceData.palette);
TQColorGroup act(pal.active());
TQColorGroup inact(pal.inactive());
@@ -1646,7 +1646,7 @@ void QtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags
else if(opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars ||
(SHADE_CUSTOM==opts.shadeMenubars && TOO_DARK(itsMenubarCols[ORIGINAL_SHADE])))
{
- TQPalette pal(widget->palette());
+ TQPalette pal(ceData.palette);
TQColorGroup act(pal.active());
act.setColor(TQColorGroup::Foreground, opts.customMenuTextColor
@@ -1671,8 +1671,8 @@ void QtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags
}
else if(::tqqt_cast<TQPopupMenu *>(widget))
widget->setBackgroundMode(NoBackground); // PaletteBackground);
- else if (widget->inherits("KToolBarSeparator") ||
- (widget->inherits("KListViewSearchLineWidget") &&
+ else if (ceData.widgetObjectTypes.contains("KToolBarSeparator") ||
+ (ceData.widgetObjectTypes.contains("KListViewSearchLineWidget") &&
widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent())))
{
widget->setName(kdeToolbarWidget);
@@ -1711,16 +1711,16 @@ void QtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags
if(onToolBar(widget))
widget->setName(kdeToolbarWidget);
if(widget && widget->parentWidget() &&
- widget->inherits("KLineEdit") && widget->parentWidget()->inherits("KIO::DefaultProgress") &&
+ ceData.widgetObjectTypes.contains("KLineEdit") && widget->parentWidget()->inherits("KIO::DefaultProgress") &&
::tqqt_cast<TQFrame *>(widget))
((TQFrame *)widget)->setLineWidth(0);
}
- else if (widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || widget->inherits("TQDockWindowResizeHandle"))
+ else if (ceData.widgetObjectTypes.contains(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || ceData.widgetObjectTypes.contains(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || ceData.widgetObjectTypes.contains("TQDockWindowResizeHandle"))
{
if(enableFilter)
installObjectEventHandler(ceData, elementFlags, ptr, this);
}
- else if (0==qstrcmp(widget->name(), kdeToolbarWidget))
+ else if (0==qstrcmp(ceData.name.ascii(), kdeToolbarWidget))
{
if(!widget->parent() ||
0!=qstrcmp(TQT_TQWIDGET(widget->parent())->className(),
@@ -1750,10 +1750,10 @@ void QtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags
}
else if(::tqqt_cast<TQProgressBar *>(widget))
{
- if(widget->palette().inactive().highlightedText()!=widget->palette().active().highlightedText())
+ if(ceData.palette.inactive().highlightedText()!=ceData.palette.active().highlightedText())
{
- TQPalette pal(widget->palette());
- pal.setInactive(widget->palette().active());
+ TQPalette pal(ceData.palette);
+ pal.setInactive(ceData.palette.active());
widget->setPalette(pal);
}
@@ -1781,7 +1781,7 @@ void QtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags
pal.setColor(TQColorGroup::Midlight, pal.active().background());
TQApplication::setPalette(pal);
}
- else if(widget->inherits("KTabCtl"))
+ else if(ceData.widgetObjectTypes.contains("KTabCtl"))
installObjectEventHandler(ceData, elementFlags, ptr, this);
else if(NO_FRAME(opts.groupBox) && ::tqqt_cast<TQGroupBox *>(widget))
{
@@ -1829,15 +1829,15 @@ void QtCurveStyle::polish(TQStyleControlElementData ceData, ControlElementFlags
if(widget->parentWidget() && widget->parentWidget()->parentWidget() &&
::tqqt_cast<TQScrollView *>(widget->parentWidget()->parentWidget()) &&
- widget->inherits("KCMultiWidget") && widget->parentWidget()->inherits("TQViewportWidget"))
+ ceData.widgetObjectTypes.contains("KCMultiWidget") && widget->parentWidget()->inherits("TQViewportWidget"))
((TQScrollView *)(widget->parentWidget()->parentWidget()))->setLineWidth(0);
}
if(opts.tabBgnd && widget && widget->parentWidget() && ::tqqt_cast<TQWidgetStack *>(widget) &&
::tqqt_cast<TQTabWidget *>(widget->parentWidget()) &&
- 0==qstrcmp(widget->name(), "tab pages"))
+ 0==qstrcmp(ceData.name.ascii(), "tab pages"))
{
- TQPalette pal(widget->palette());
+ TQPalette pal(ceData.palette);
pal.setColor(TQColorGroup::Background, shade(pal.active().background(), TO_FACTOR(opts.tabBgnd)));
widget->setBackgroundMode(PaletteBackground);
@@ -1883,7 +1883,7 @@ void QtCurveStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlag
widget->setMouseTracking(false);
removeObjectEventHandler(ceData, elementFlags, ptr, this);
}
- else if (::tqqt_cast<TQButton *>(widget) || widget->inherits("TQToolBarExtensionWidget"))
+ else if (::tqqt_cast<TQButton *>(widget) || ceData.widgetObjectTypes.contains("TQToolBarExtensionWidget"))
{
if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
widget->setBackgroundMode(PaletteButton);
@@ -1924,7 +1924,7 @@ void QtCurveStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlag
SHADE_SELECTED==opts.shadeMenubars || (SHADE_CUSTOM==opts.shadeMenubars &&TOO_DARK(itsMenubarCols[ORIGINAL_SHADE])))
widget->setPalette(TQApplication::palette());
}
- else if (widget->inherits("KToolBarSeparator"))
+ else if (ceData.widgetObjectTypes.contains("KToolBarSeparator"))
{
widget->setBackgroundMode(PaletteBackground);
removeObjectEventHandler(ceData, elementFlags, ptr, this);
@@ -1943,7 +1943,7 @@ void QtCurveStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlag
}
else if (::tqqt_cast<TQLineEdit*>(widget) || ::tqqt_cast<TQTextEdit*>(widget))
removeObjectEventHandler(ceData, elementFlags, ptr, this);
- else if (widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || widget->inherits("TQDockWindowResizeHandle"))
+ else if (ceData.widgetObjectTypes.contains(TQSPLITTERHANDLE_OBJECT_NAME_STRING) || ceData.widgetObjectTypes.contains(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) || ceData.widgetObjectTypes.contains("TQDockWindowResizeHandle"))
removeObjectEventHandler(ceData, elementFlags, ptr, this);
else if (::tqqt_cast<TQProgressBar*>(widget))
{
@@ -1952,7 +1952,7 @@ void QtCurveStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlag
}
else if(opts.highlightScrollViews && ::tqqt_cast<TQScrollView*>(widget))
removeObjectEventHandler(ceData, elementFlags, ptr, this);
- else if(0==qstrcmp(widget->name(), kdeToolbarWidget))
+ else if(0==qstrcmp(ceData.name.ascii(), kdeToolbarWidget))
{
removeObjectEventHandler(ceData, elementFlags, ptr, this);
widget->setBackgroundMode(PaletteBackground);
@@ -1962,7 +1962,7 @@ void QtCurveStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlag
removeObjectEventHandler(ceData, elementFlags, ptr, this);
widget->setBackgroundMode(PaletteBackground); // We paint whole background.
}
- else if(widget->inherits("KTabCtl"))
+ else if(ceData.widgetObjectTypes.contains("KTabCtl"))
removeObjectEventHandler(ceData, elementFlags, ptr, this);
#ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
else if(opts.fixParentlessDialogs && ::tqqt_cast<TQDialog *>(widget))
@@ -2042,10 +2042,10 @@ bool QtCurveStyle::objectEventHandler( TQStyleControlElementData ceData, Control
*parent(TQT_TQWIDGET(object->parent()));
if(IS_FLAT(opts.toolbarAppearance))
- TQPainter(widget).fillRect(widget->rect(), parent->colorGroup().background());
+ TQPainter(widget).fillRect(ceData.rect, parent->colorGroup().background());
else
{
- int y_offset(widget->y());
+ int y_offset(ceData.rect.y());
while(parent && parent->parent() && 0==qstrcmp(parent->name(), kdeToolbarWidget))
{
@@ -2053,7 +2053,7 @@ bool QtCurveStyle::objectEventHandler( TQStyleControlElementData ceData, Control
parent = TQT_TQWIDGET(parent->parent());
}
- TQRect r(widget->rect()),
+ TQRect r(ceData.rect),
pr(parent->rect());
bool horiz=pr.width() > pr.height();
TQPainter p(widget);
@@ -2061,7 +2061,7 @@ bool QtCurveStyle::objectEventHandler( TQStyleControlElementData ceData, Control
// If parent is a TQToolbar use its orientation, else just base on width>height.
if (tb)
- horiz = Qt::Horizontal==tb->orientation();
+ horiz = TQt::Horizontal==ceData.orientation;
TQRect bgndRect(r.x(), r.y()-y_offset, r.width(), pr.height());
@@ -2102,12 +2102,12 @@ bool QtCurveStyle::objectEventHandler( TQStyleControlElementData ceData, Control
{
TQWidget *widget=(TQWidget*)object;
TQPainter painter(widget);
- TQColor col(USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : widget->palette().active().background());
+ TQColor col(USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : ceData.palette.active().background());
if(APPEARANCE_STRIPED==opts.menuBgndAppearance)
- painter.drawTiledPixmap(widget->rect(), *createStripePixmap(col, false));
+ painter.drawTiledPixmap(ceData.rect, *createStripePixmap(col, false));
else
- drawBevelGradientReal(col, &painter, widget->rect(), GT_HORIZ==opts.menuBgndGrad, false,
+ drawBevelGradientReal(col, &painter, ceData.rect, GT_HORIZ==opts.menuBgndGrad, false,
opts.menuBgndAppearance, WIDGET_OTHER);
return false;
}
@@ -2135,7 +2135,7 @@ bool QtCurveStyle::objectEventHandler( TQStyleControlElementData ceData, Control
TQObject *child(object->child("_tabbar"));
TQTabBar *tb(child ? ::tqqt_cast<TQTabBar *>(child) : 0L);
TQPainter painter(widget);
- TQRect r(widget->rect());
+ TQRect r(ceData.rect);
int tbHeight(tb ? tb->height()-1 : 28);
if(tb && (TQTabBar::RoundedBelow == tb->shape() ||
@@ -2143,7 +2143,7 @@ bool QtCurveStyle::objectEventHandler( TQStyleControlElementData ceData, Control
r.addCoords(0, 0, 0, -tbHeight);
else
r.addCoords(0, tbHeight, 0, 0);
- drawPrimitive(PE_PanelTabWidget, &painter, TQStyleControlElementData(), CEF_None, r, widget->colorGroup(),
+ drawPrimitive(PE_PanelTabWidget, &painter, TQStyleControlElementData(), CEF_None, r, ceData.colorGroup,
Style_Horizontal|Style_Enabled);
return true;
}
@@ -2176,9 +2176,9 @@ bool QtCurveStyle::objectEventHandler( TQStyleControlElementData ceData, Control
TQWidget *widget(TQT_TQWIDGET(object)),
*parent(TQT_TQWIDGET(object->parent()));
- TQRect r(widget->rect());
+ TQRect r(ceData.rect);
TQPainter p(widget);
- int y_offset(widget->y()+parent->y());
+ int y_offset(ceData.rect.y()+parent->y());
r.setY(r.y()-y_offset);
r.setHeight(parent->rect().height());
@@ -3202,7 +3202,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, TQStyleCo
if(flags&Style_Down)
flags=((flags|Style_Down)^Style_Down)| Style_Sunken;
flags|=Style_Enabled;
-#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+#if defined TQTC_TQT_ONLY || !defined TDE_VERSION
#if defined TDE_VERSION && TDE_VERSION >= 0x30400 && TDE_VERSION < 0x30500
if(HOVER_KICKER==itsHover && itsHoverWidget) // && itsHoverWidget==p->device())
flags|=Style_MouseOver;
@@ -3211,7 +3211,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, TQStyleCo
#endif
drawLightBevel(p, r, cg, flags|Style_Horizontal, ROUNDED_ALL,
getFill(flags, use), use, true, false);
-#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+#if defined TQTC_TQT_ONLY || !defined TDE_VERSION
itsFormMode=false;
#endif
}
@@ -3240,7 +3240,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, TQStyleCo
}
else if(0==flags) // Header on popup menu?
{ TQWidget *widget(p && p->device() ? dynamic_cast<TQWidget*>(p->device()) : 0L);
- bool menuTitle(widget && 0==qstrcmp(widget->className(), "KPopupTitle"));
+ bool menuTitle(widget && 0==qstrcmp(ceData.widgetObjectTypes[ceData.widgetObjectTypes.count()-1].ascii(), "KPopupTitle"));
const TQColor *use(buttonColors(cg));
TQRect r2(r);
@@ -3362,7 +3362,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, TQStyleCo
? cg.background().dark(DW_BGND)
: */cg.background(),
p, r, cg, glassMod ? flags : flags|Style_Horizontal,
-#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+#if defined TQTC_TQT_ONLY || !defined TDE_VERSION
(APP_KORN==itsThemedApp && itsIsTransKicker && PE_ButtonTool==pe) ||
#endif
operaMdi || mdi
@@ -3394,7 +3394,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, TQStyleCo
drawLightBevel(p, r, cg, glassMod ? flags : flags|Style_Horizontal,
flags&CHECK_BUTTON
-#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+#if defined TQTC_TQT_ONLY || !defined TDE_VERSION
|| (APP_KORN==itsThemedApp && itsIsTransKicker && PE_ButtonTool==pe)
#endif
? ROUNDED_NONE : ROUNDED_ALL,
@@ -4041,6 +4041,87 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, TQStyleCo
}
break;
}
+ case PE_ScrollBarTrough:
+ {
+ bool useThreeButtonScrollBar(SCROLLBAR_KDE==opts.scrollbarType),
+ horiz(TQt::Horizontal==ceData.orientation),
+ maxed(ceData.minSteps == ceData.maxSteps);
+ SFlags sflags((horiz ? Style_Horizontal : Style_Default) |
+ (maxed || !(elementFlags & CEF_IsEnabled) ? Style_Default : Style_Enabled));
+
+ TQRect subline(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSubLine,
+ data, dynamic_cast<const TQWidget *>(p->device()))),
+ addline(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, SC_ScrollBarAddLine,
+ data, dynamic_cast<const TQWidget *>(p->device()))),
+ subpage(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSubPage,
+ data, dynamic_cast<const TQWidget *>(p->device()))),
+ addpage(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, SC_ScrollBarAddPage,
+ data, dynamic_cast<const TQWidget *>(p->device()))),
+ slider(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSlider,
+ data, dynamic_cast<const TQWidget *>(p->device()))),
+ first(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, SC_ScrollBarFirst,
+ data, dynamic_cast<const TQWidget *>(p->device()))),
+ last(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, SC_ScrollBarLast,
+ data, dynamic_cast<const TQWidget *>(p->device()))),
+ subline2(addline),
+ sbRect(ceData.rect);
+
+ adjustScrollbarRects(itsFormMode, horiz, useThreeButtonScrollBar, subline, addline, subpage, addpage, slider, first, last, subline2, sbRect, opts, dynamic_cast<const TQWidget *>(p->device()));
+
+ // Draw trough...
+ const TQColor *trough(itsBackgroundCols); // backgroundColors(cg));
+ bool noButtons((SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons) && ROUNDED);
+ TQRect s2(subpage), a2(addpage);
+
+#ifndef SIMPLE_SCROLLBARS
+ if(noButtons)
+ {
+ // Increase clipping to allow trough to "bleed" into slider corners...
+ a2.addCoords(-2, -2, 2, 2);
+ s2.addCoords(-2, -2, 2, 2);
+ }
+#endif
+ p->save();
+ if(opts.flatSbarButtons)
+ p->setClipRegion(TQRegion(s2)+TQRegion(addpage)+TQRegion(addline)+TQRegion(subline)+TQRegion(subline2));
+ else
+ p->setClipRegion(TQRegion(s2)+TQRegion(addpage));
+
+ if(opts.flatSbarButtons && SCROLLBAR_NONE!=opts.scrollbarType && ROUNDED && !IS_FLAT(opts.sbarBgndAppearance))
+ drawBevelGradient(itsBackgroundCols[ORIGINAL_SHADE], p, r, flags&Style_Horizontal, false,
+ opts.sbarBgndAppearance, WIDGET_SB_BGND);
+ else if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons) && IS_FLAT(opts.sbarBgndAppearance))
+ {
+ TQColor color(cg.background());
+
+ if(0!=opts.tabBgnd && inStackWidget(dynamic_cast<const TQWidget *>(p->device())))
+ color=shade(color, TO_FACTOR(opts.tabBgnd));
+ p->fillRect(sbRect, cg.background());
+ }
+
+ sflags&=~(Style_Down|Style_On|Style_Sunken);
+
+ if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)) {
+ if(horiz) {
+ sbRect.addCoords(0, THIN_SBAR_MOD, 0, -THIN_SBAR_MOD);
+ }
+ else {
+ sbRect.addCoords(THIN_SBAR_MOD, 0, -THIN_SBAR_MOD, 0);
+ }
+ }
+
+ drawLightBevel(p, sbRect, cg, sflags/*|Style_Down*/,
+#ifndef SIMPLE_SCROLLBARS
+ !(opts.square&SQUARE_SB_SLIDER) && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)
+ ? ROUNDED_ALL :
+#endif
+ ROUNDED_NONE,
+ trough[2], trough, true, true,
+ opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)
+ ? WIDGET_SLIDER_TROUGH : WIDGET_TROUGH);
+ p->restore();
+ break;
+ }
case PE_ScrollBarAddLine:
case PE_ScrollBarSubLine:
{
@@ -4125,7 +4206,7 @@ void QtCurveStyle::drawPrimitive(TQ_PrimitiveElement pe, TQPainter *p, TQStyleCo
{
TQWidget *widget(dynamic_cast<TQWidget*>(p->device()));
- if(widget && 0==qstrcmp(widget->className(), "TQViewportWidget") &&
+ if(widget && 0==qstrcmp(ceData.widgetObjectTypes[ceData.widgetObjectTypes.count()-1], "TQViewportWidget") &&
widget->parentWidget() && ::tqqt_cast<TQListBox *>(widget->parentWidget()) &&
widget->parentWidget()->parentWidget() && ::tqqt_cast<TQComboBox *>(widget->parentWidget()->parentWidget()))
{
@@ -4490,7 +4571,7 @@ void QtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, TQPainter *p, TQStyl
drawHandleMarkers(p, r, flags, false, handles);
break;
case KPE_SliderGroove:
- drawSliderGroove(p, r, cg, flags, widget);
+ drawSliderGroove(p, r, cg, flags, ceData, elementFlags, widget);
break;
case KPE_SliderHandle:
drawSliderHandle(p, r, cg, flags, widget ? ::tqqt_cast<TQSlider *>(widget) : 0L);
@@ -4573,7 +4654,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleCont
firstTab(0==tabIndex),
lastTab((ceData.tabBarData.tabCount-1)==tabIndex),
// isFirstKTabCtlTab(firstTab && widget->parent()
-// ? 0==qstrcmp("KTabCtl", widget->parent()->className())
+// ? 0==qstrcmp("KTabCtl", ceData.parentWidgetData.objectTypes[ceData.widgetObjectTypes.count()-1])
// : false),
active(flags & Style_Selected),
itsHover(itsHoverTab && itsHoverTab->isEnabled() && data.tab()==itsHoverTab &&
@@ -4922,7 +5003,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleCont
else
{
iw=button->pixmap() ? button->pixmap()->width()
- : widget->fontMetrics().size(TQt::ShowPrefix,
+ : TQFontMetrics(ceData.font).size(TQt::ShowPrefix,
button->text()).width();
int cw(iw+pw+constSpace);
@@ -4973,7 +5054,7 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleCont
}
case CE_PopupMenuItem:
{
- if(!widget || data.isDefault())
+ if(data.isDefault())
break;
TQMenuItem *mi(data.menuItem());
@@ -4985,8 +5066,8 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleCont
maxpmw=TQMAX(maxpmw, constMenuPixmapWidth);
r.rect(&x, &y, &w, &h);
- if(widget->erasePixmap() && !widget->erasePixmap()->isNull())
- p->drawPixmap(x, y, *widget->erasePixmap(), x, y, w, h);
+ if(!ceData.bgPixmap.isNull())
+ p->drawPixmap(x, y, ceData.bgPixmap, x, y, w, h);
else
{
if(IS_FLAT_BGND(opts.menuBgndAppearance))
@@ -5158,11 +5239,9 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleCont
drawMenuOrToolBarBackground(p, r, cg);
break;
case CE_DockWindowEmptyArea:
- if(widget && widget->inherits(TQTOOLBAR_OBJECT_NAME_STRING))
+ if(widget && ceData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING))
{
- TQDockWindow *wind((TQDockWindow*)widget);
-
- drawMenuOrToolBarBackground(p, r, cg, false, Qt::Horizontal==wind->orientation());
+ drawMenuOrToolBarBackground(p, r, cg, false, TQt::Horizontal==ceData.orientation);
}
else
BASE_STYLE::drawControl(control, p, ceData, elementFlags, r, cg, flags, data, widget);
@@ -5212,14 +5291,13 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleCont
}
case CE_ProgressBarContents:
{
- const TQProgressBar *pb((const TQProgressBar*)widget);
- int steps(pb->totalSteps());
+ int steps(ceData.totalSteps);
if(0==steps)//Busy indicator
{
static const int barWidth(PROGRESS_CHUNK_WIDTH*3.4);
- int progress(pb->progress() % (2*(r.width()-barWidth)));
+ int progress(ceData.currentStep % (2*(r.width()-barWidth)));
if(progress < 0)
progress = 0;
@@ -5233,9 +5311,9 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleCont
{
TQRect cr(subRect(SR_ProgressBarContents, ceData, elementFlags, widget));
- if(cr.isValid() && pb->progress()>0)
+ if(cr.isValid() && ceData.currentStep>0)
{
- double pg(((double)pb->progress()) / steps);
+ double pg(((double)ceData.currentStep) / steps);
int width(TQMIN(cr.width(), (int)(pg * cr.width())));
if(TQApplication::reverseLayout())
@@ -5251,11 +5329,10 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleCont
}
case CE_ProgressBarLabel:
{
- const TQProgressBar* pb = (const TQProgressBar*)widget;
TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget);
- double progress = pb->progress();
+ double progress = ceData.currentStep;
bool reverse = TQApplication::reverseLayout();
- int steps = pb->totalSteps();
+ int steps = ceData.totalSteps;
if (!cr.isValid())
return;
@@ -5279,17 +5356,17 @@ void QtCurveStyle::drawControl(ControlElement control, TQPainter *p, TQStyleCont
crect.setRect(cr.x()+width, cr.y(), cr.width(), cr.height());
p->save();
- p->setPen(pb->isEnabled() ? (reverse ? cg.text() : cg.highlightedText()) : cg.text());
- p->drawText(r, AlignCenter, pb->progressString());
+ p->setPen((elementFlags & CEF_IsEnabled) ? (reverse ? cg.text() : cg.highlightedText()) : cg.text());
+ p->drawText(r, AlignCenter, ceData.progressText);
p->setClipRect(crect);
p->setPen(reverse ? cg.highlightedText() : cg.text());
- p->drawText(r, AlignCenter, pb->progressString());
+ p->drawText(r, AlignCenter, ceData.progressText);
p->restore();
}
else
{
p->setPen(cg.text());
- p->drawText(r, AlignCenter, pb->progressString());
+ p->drawText(r, AlignCenter, ceData.progressText);
}
break;
}
@@ -5507,7 +5584,7 @@ void QtCurveStyle::drawComplexControlMask(ComplexControl control, TQPainter *p,
TQRect QtCurveStyle::subRect(SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget)const
{
TQRect rect,
- wrect(widget->rect());
+ wrect(ceData.rect);
switch(subrect)
{
@@ -5624,7 +5701,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
bflags|=NO_ETCH_BUTTON;
// If we're pressed, on, or raised...
-#if defined TQTC_TQT_ONLY || !defined TDE_VERSION || TDE_VERSION >= 0x30200
+#if defined TQTC_TQT_ONLY || !defined TDE_VERSION
if(bflags &(Style_Down | Style_On | Style_Raised) || onControlButtons)
#else
if(bflags &(Style_Down | Style_On | Style_Raised | Style_MouseOver) ||
@@ -5672,7 +5749,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
if(tb)
{
TQRect tbr(tb->rect());
- bool horiz(Qt::Horizontal==tb->orientation());
+ bool horiz(TQt::Horizontal==ceData.orientation);
if(!IS_FLAT(opts.toolbarAppearance)) {
if(horiz) {
@@ -5717,7 +5794,6 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
itsFormMode = isFormWidget(widget);
- const TQComboBox *combobox((const TQComboBox *)widget);
TQRect frame(TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
SC_ComboBoxFrame,
data, widget), ceData, elementFlags)),
@@ -5728,8 +5804,8 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
SC_ComboBoxEditField,
data, widget), ceData, elementFlags));
const TQColor *use(buttonColors(cg));
- bool editable(combobox->editable()),
- sunken(combobox->listBox() ? combobox->listBox()->isShown() : false),
+ bool editable((elementFlags & CEF_IsEditable)),
+ sunken(ceData.comboBoxListBoxFlags & CEF_IsShown),
reverse(TQApplication::reverseLayout());
SFlags fillFlags(flags),
doEtch(!itsFormMode && DO_EFFECT && (!editable || opts.etchEntry));
@@ -5747,7 +5823,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
fillFlags-=Style_MouseOver;
}
- if(editable ||(!itsFormMode && DO_EFFECT && qstrcmp(widget->name(), kdeToolbarWidget)))
+ if(editable ||(!itsFormMode && DO_EFFECT && qstrcmp(ceData.name.ascii(), kdeToolbarWidget)))
{
p->setPen(cg.background());
p->drawRect(r);
@@ -5897,9 +5973,9 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
if(!sunken && !editable &&
((MO_GLOW==opts.coloredMouseOver && flags&Style_MouseOver)/* ||
(FOCUS_FULL==opts.focus && flags&Style_HasFocus)*/ || glowFocus))
- drawGlow(p, widget ? TQT_TQRECT_OBJECT(widget->rect()) : r, cg, WIDGET_COMBO, glowFocus ? itsFocusCols : NULL);
+ drawGlow(p, widget ? TQT_TQRECT_OBJECT(ceData.rect) : r, cg, WIDGET_COMBO, glowFocus ? itsFocusCols : NULL);
else
- drawEtch(p, widget ? TQT_TQRECT_OBJECT(widget->rect()) : r, cg,
+ drawEtch(p, widget ? TQT_TQRECT_OBJECT(ceData.rect) : r, cg,
!editable && EFFECT_SHADOW==opts.buttonEffect && !sunken, editable && (opts.square&SQUARE_ENTRY));
}
@@ -5911,13 +5987,12 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
{
itsFormMode = isFormWidget(widget);
- const TQSpinWidget *spinwidget((const TQSpinWidget *)widget);
TQRect frame(querySubControlMetrics(CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetFrame,
data, widget)),
- up(spinwidget->upRect()),
- down(spinwidget->downRect()),
+ up(ceData.spinWidgetData.upRect),
+ down(ceData.spinWidgetData.downRect),
all(frame.unite(up).unite(down));
- bool hw(itsHoverWidget && itsHoverWidget==spinwidget),
+ bool hw(itsHoverWidget && itsHoverWidget==widget),
reverse(TQApplication::reverseLayout()),
doFrame((controls&SC_SpinWidgetFrame) && frame.isValid()),
doEtch(!itsFormMode && DO_EFFECT && opts.etchEntry);
@@ -5933,10 +6008,10 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
flags-=Style_MouseOver;
if(opts.unifySpin)
- drawEntryField(p, all, cg, flags, spinwidget && flags&Style_Enabled
+ drawEntryField(p, all, cg, flags, ceData.widgetObjectTypes.contains(TQSPINWIDGET_OBJECT_NAME_STRING) && flags&Style_Enabled
? flags&Style_MouseOver || hw
? ENTRY_MOUSE_OVER
- : flags&Style_HasFocus || spinwidget->hasFocus()
+ : flags&Style_HasFocus || (elementFlags & CEF_HasFocus)
? ENTRY_FOCUS
: ENTRY_NONE
: ENTRY_NONE,
@@ -5948,10 +6023,10 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
frame.setWidth(frame.width()+1);
drawEntryField(p, frame, cg, flags,
- spinwidget && flags&Style_Enabled
+ ceData.widgetObjectTypes.contains(TQSPINWIDGET_OBJECT_NAME_STRING) && flags&Style_Enabled
? flags&Style_MouseOver || hw
? ENTRY_MOUSE_OVER
- : flags&Style_HasFocus || spinwidget->hasFocus()
+ : flags&Style_HasFocus || (elementFlags & CEF_HasFocus)
? ENTRY_FOCUS
: ENTRY_NONE
: ENTRY_NONE,
@@ -5991,11 +6066,11 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
if(hw && HOVER_SW_UP==itsHover)
upflags|=Style_MouseOver;
up.setHeight(up.height()+1);
- if(spinwidget->buttonSymbols()==TQSpinWidget::PlusMinus)
+ if(ceData.spinWidgetData.buttonSymbols==TQSpinWidget::PlusMinus)
pe=PE_SpinWidgetPlus;
- if(!spinwidget->isUpEnabled())
+ if(!ceData.spinWidgetData.upEnabled)
upflags&=~Style_Enabled;
- drawPrimitive(pe, p, ceData, elementFlags, up, !(upflags&Style_Enabled) && spinwidget ? spinwidget->palette().disabled() : cg,
+ drawPrimitive(pe, p, ceData, elementFlags, up, !(upflags&Style_Enabled) && ceData.widgetObjectTypes.contains(TQSPINWIDGET_OBJECT_NAME_STRING) ? ceData.palette.disabled() : cg,
upflags |((active==SC_SpinWidgetUp)
? Style_On | Style_Sunken : Style_Raised));
}
@@ -6007,11 +6082,11 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
if(hw && HOVER_SW_DOWN==itsHover)
downflags|=Style_MouseOver;
- if(spinwidget->buttonSymbols()==TQSpinWidget::PlusMinus)
+ if(ceData.spinWidgetData.buttonSymbols==TQSpinWidget::PlusMinus)
pe=PE_SpinWidgetMinus;
- if(!spinwidget->isDownEnabled())
+ if(!ceData.spinWidgetData.downEnabled)
downflags&=~Style_Enabled;
- drawPrimitive(pe, p, ceData, elementFlags, down, !(downflags&Style_Enabled) && spinwidget ? spinwidget->palette().disabled() : cg,
+ drawPrimitive(pe, p, ceData, elementFlags, down, !(downflags&Style_Enabled) && ceData.widgetObjectTypes.contains(TQSPINWIDGET_OBJECT_NAME_STRING) ? ceData.palette.disabled() : cg,
downflags |((active==SC_SpinWidgetDown)
? Style_On | Style_Sunken : Style_Raised));
}
@@ -6022,10 +6097,10 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
{
frame.setWidth(frame.width()+1);
drawEntryField(p, frame, cg, flags,
- spinwidget && flags&Style_Enabled
+ ceData.widgetObjectTypes.contains(TQSPINWIDGET_OBJECT_NAME_STRING) && flags&Style_Enabled
? flags&Style_MouseOver || hw
? ENTRY_MOUSE_OVER
- : flags&Style_HasFocus || spinwidget->hasFocus()
+ : flags&Style_HasFocus || (elementFlags & CEF_HasFocus)
? ENTRY_FOCUS
: ENTRY_NONE
: ENTRY_NONE,
@@ -6033,7 +6108,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
}
if(doEtch)
- drawEtch(p, spinwidget ? TQT_TQRECT_OBJECT(spinwidget->rect()) : r, cg, false, (opts.square&SQUARE_ENTRY));
+ drawEtch(p, ceData.widgetObjectTypes.contains(TQSPINWIDGET_OBJECT_NAME_STRING) ? TQT_TQRECT_OBJECT(ceData.rect) : r, cg, false, (opts.square&SQUARE_ENTRY));
}
itsFormMode=false;
break;
@@ -6041,14 +6116,14 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
case CC_ScrollBar:
{
const TQScrollBar *sb((const TQScrollBar *)widget);
- bool hw(itsHoverWidget && itsHoverWidget==sb),
+ bool hw(itsHoverWidget && itsHoverWidget==widget),
useThreeButtonScrollBar(SCROLLBAR_KDE==opts.scrollbarType),
- horiz(Qt::Horizontal==sb->orientation()),
- maxed(sb->minValue() == sb->maxValue()),
- atMin(maxed || sb->value()==sb->minValue()),
- atMax(maxed || sb->value()==sb->maxValue());
+ horiz(TQt::Horizontal==ceData.orientation),
+ maxed(ceData.minSteps == ceData.maxSteps),
+ atMin(maxed || ceData.currentStep==ceData.minSteps),
+ atMax(maxed || ceData.currentStep==ceData.maxSteps);
SFlags sflags((horiz ? Style_Horizontal : Style_Default) |
- (maxed || !widget->isEnabled() ? Style_Default : Style_Enabled));
+ (maxed || !(elementFlags & CEF_IsEnabled) ? Style_Default : Style_Enabled));
TQRect subline(querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine,
data, widget)),
addline(querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine,
@@ -6064,148 +6139,22 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
last(querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast,
data, widget)),
subline2(addline),
- sbRect(sb->rect());
-
- itsFormMode=isFormWidget(widget);
-
- if(itsFormMode)
- {
- // See KHTML note at top of file
- if(horiz)
- {
- subline.addCoords(0, 0, 0, -1);
- addline.addCoords(0, 0, 0, -1);
- subpage.addCoords(0, 0, 0, -1);
- addpage.addCoords(0, 0, 0, -1);
- slider.addCoords(0, 0, 0, -1);
- first.addCoords(0, 0, 0, -1);
- last.addCoords(0, 0, 0, -1);
- subline2.addCoords(0, 0, 0, -1);
- sbRect.addCoords(0, 0, 0, -1);
- }
- else
- {
- subline.addCoords(0, 0, -1, 0);
- addline.addCoords(0, 0, -1, 0);
- subpage.addCoords(0, 0, -1, 0);
- addpage.addCoords(0, 0, -1, 0);
- slider.addCoords(0, 0, -1, 0);
- first.addCoords(0, 0, -1, 0);
- last.addCoords(0, 0, -1, 0);
- subline2.addCoords(0, 0, -1, 0);
- sbRect.addCoords(0, 0, -1, 0);
- }
+ sbRect(ceData.rect);
-#ifndef SIMPLE_SCROLLBARS
- if(sbRect.isValid() && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)) {
- if(horiz) {
- sbRect.addCoords(0, 0, -1, 0);
- }
- else {
- sbRect.addCoords(0, 0, 0, -1);
- }
- }
-#endif
- }
- else if (useThreeButtonScrollBar) {
- if (horiz) {
- subline2.moveBy(-addline.width(), 0);
- }
- else {
- subline2.moveBy(0, -addline.height());
- }
- }
+ adjustScrollbarRects(itsFormMode, horiz, useThreeButtonScrollBar, subline, addline, subpage, addpage, slider, first, last, subline2, sbRect, opts, widget);
- if(opts.flatSbarButtons) {
- switch(opts.scrollbarType)
- {
- case SCROLLBAR_KDE:
- if(horiz)
- sbRect.addCoords(subline.width(), 0, -(addline.width()+subline2.width()), 0);
- else
- sbRect.addCoords(0, subline.height(), 0, -(addline.height()+subline2.height()));
- break;
- case SCROLLBAR_WINDOWS:
- if(horiz)
- sbRect.addCoords(subline.width(), 0, -(addline.width()), 0);
- else
- sbRect.addCoords(0, subline.height(), 0, -(addline.height()));
- break;
- case SCROLLBAR_NEXT:
- if(horiz)
- sbRect.addCoords(subline.width()+subline2.width(), 0, 0, 0);
- else
- sbRect.addCoords(0, subline.height()+subline2.height(), 0, 0);
- break;
- case SCROLLBAR_PLATINUM:
- if(horiz)
- sbRect.addCoords(0, 0, -(addline.width()+subline2.width()), 0);
- else
- sbRect.addCoords(0, 0, 0, -(addline.height()+subline2.height()));
- default:
- break;
- }
- }
-
- // Draw trough...
- const TQColor *trough(itsBackgroundCols); // backgroundColors(cg));
bool noButtons((SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons) && ROUNDED);
TQRect s2(subpage), a2(addpage);
-#ifndef SIMPLE_SCROLLBARS
- if(noButtons)
- {
- // Increase clipping to allow trough to "bleed" into slider corners...
- a2.addCoords(-2, -2, 2, 2);
- s2.addCoords(-2, -2, 2, 2);
- }
-#endif
- p->save();
- if(opts.flatSbarButtons)
- p->setClipRegion(TQRegion(s2)+TQRegion(addpage)+TQRegion(addline)+TQRegion(subline)+TQRegion(subline2));
- else
- p->setClipRegion(TQRegion(s2)+TQRegion(addpage));
-
- if(opts.flatSbarButtons && SCROLLBAR_NONE!=opts.scrollbarType && ROUNDED && !IS_FLAT(opts.sbarBgndAppearance))
- drawBevelGradient(itsBackgroundCols[ORIGINAL_SHADE], p, r, flags&Style_Horizontal, false,
- opts.sbarBgndAppearance, WIDGET_SB_BGND);
- else if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons) && IS_FLAT(opts.sbarBgndAppearance))
- {
- TQColor color(cg.background());
-
- if(0!=opts.tabBgnd && inStackWidget(widget))
- color=shade(color, TO_FACTOR(opts.tabBgnd));
- p->fillRect(sbRect, cg.background());
- }
-
- sflags&=~(Style_Down|Style_On|Style_Sunken);
-
- if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)) {
- if(horiz) {
- sbRect.addCoords(0, THIN_SBAR_MOD, 0, -THIN_SBAR_MOD);
- }
- else {
- sbRect.addCoords(THIN_SBAR_MOD, 0, -THIN_SBAR_MOD, 0);
- }
- }
-
- drawLightBevel(p, sbRect, cg, sflags/*|Style_Down*/,
-#ifndef SIMPLE_SCROLLBARS
- !(opts.square&SQUARE_SB_SLIDER) && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)
- ? ROUNDED_ALL :
-#endif
- ROUNDED_NONE,
- trough[2], trough, true, true,
- opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)
- ? WIDGET_SLIDER_TROUGH : WIDGET_TROUGH);
- p->restore();
+ // Draw trough...
+ drawPrimitive(PE_ScrollBarTrough, p, ceData, elementFlags, r, cg, sflags, data);
if(/*(controls&SC_ScrollBarSubLine) && */subline.isValid())
{
bool enable=!atMin;
- drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, !enable && sb ? sb->palette().disabled() : cg,
+ drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, !enable && sb ? ceData.palette.disabled() : cg,
sflags |
//(enable ? Style_Enabled : Style_Default) |
(enable && hw && HOVER_SB_SUB==itsHover
@@ -6217,7 +6166,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
{
if(IS_FLAT(opts.sbarBgndAppearance))
p->fillRect(subline2, cg.background());
- drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, !enable && sb ? sb->palette().disabled() : cg,
+ drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, !enable && sb ? ceData.palette.disabled() : cg,
sflags |
//(enable ? Style_Enabled : Style_Default) |
(enable && hw && HOVER_SB_SUB2==itsHover
@@ -6240,7 +6189,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
}
}
- drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, !enable && sb ? sb->palette().disabled() : cg,
+ drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, !enable && sb ? ceData.palette.disabled() : cg,
sflags |
//(enable ? Style_Enabled : Style_Default) |
(enable && hw && HOVER_SB_ADD==itsHover
@@ -6317,7 +6266,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
? Style_Down : Style_Default));
// ### perhaps this should not be able to accept focus if maxedOut?
- if(sb->hasFocus()) {
+ if(elementFlags & CEF_HasFocus) {
drawPrimitive(PE_FocusRect, p, ceData, elementFlags, TQRect(slider.x()+2, slider.y()+2,
slider.width()-5, slider.height()-5), cg, Style_Default);
}
@@ -6379,26 +6328,25 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
// slider, focus. We also ony double-buffer if not on a toolbar, as we dont know
// the background, etc, if on a toolbar - and that is handled in eventFilter
{
- bool tb(!IS_FLAT(opts.toolbarAppearance) && widget &&
- 0==qstrcmp(widget->name(), kdeToolbarWidget));
+ bool tb(!IS_FLAT(opts.toolbarAppearance) &&
+ 0==qstrcmp(ceData.name.ascii(), kdeToolbarWidget));
TQRect groove=querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, data, widget),
handle=querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, data, widget);
- TQPixmap pix(widget->size());
+ TQPixmap pix(ceData.rect.size());
TQPainter p2,
*paint(tb ? p : &p2);
if(!tb)
{
paint->begin(&pix);
- if (widget->parentWidget() && widget->parentWidget()->backgroundPixmap() &&
- !widget->parentWidget()->backgroundPixmap()->isNull())
- paint->drawTiledPixmap(r, *(widget->parentWidget()->backgroundPixmap()), widget->pos());
+ if (!ceData.parentWidgetData.bgPixmap.isNull())
+ paint->drawTiledPixmap(r, ceData.parentWidgetData.bgPixmap, ceData.pos);
else
pix.fill(cg.background());
}
if((controls & SC_SliderGroove)&& groove.isValid())
- drawSliderGroove(paint, groove, cg, flags, widget);
+ drawSliderGroove(paint, groove, cg, flags, ceData, elementFlags, widget);
if((controls & SC_SliderHandle)&& handle.isValid())
drawSliderHandle(paint, handle, cg, flags, widget ? ::tqqt_cast<TQSlider *>(widget) : 0L, tb);
if(controls & SC_SliderTickmarks)
@@ -6419,11 +6367,11 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
{
const int buttonMargin(3);
const TQTitleBar *tb((const TQTitleBar *)widget);
- bool isActive((tb->isActive() && widget->isActiveWindow()) ||
- (!tb->window() && widget->topLevelWidget()->isActiveWindow()));
+ bool isActive(((elementFlags & CEF_IsActive) && (elementFlags & CEF_IsActiveWindow)) ||
+ (!tb->window() && (ceData.topLevelWidgetFlags & CEF_IsActiveWindow)));
TQColorGroup cgroup(isActive
- ? widget->palette().active()
- : widget->palette().inactive());
+ ? ceData.palette.active()
+ : ceData.palette.inactive());
const TQColor *cols(getMdiColors(cg, isActive));
TQColor textCol(isActive ? itsActiveMdiTextColor : itsMdiTextColor),
shdCol(shadowColor(textCol)),
@@ -6458,8 +6406,8 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, TQPainter *p, TQSt
drawBevelGradient(cols[ORIGINAL_SHADE], p, r, true, false, app, WIDGET_MDI_WINDOW);
ir.addCoords(2, 0, -4, 0);
- TQFontMetrics fm(TQFontMetrics(widget->font()));
- TQString titleString(elliditide(widget->caption(), fm, textRect.width()));
+ TQFontMetrics fm(TQFontMetrics(ceData.font));
+ TQString titleString(elliditide(ceData.caption, fm, textRect.width()));
if(full)
{
@@ -6566,14 +6514,14 @@ TQRect QtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, TQStyleCo
int fw(pixelMetric(PM_SpinBoxFrameWidth, ceData, elementFlags, 0));
TQSize bs;
- bs.setHeight(widget->height()>>1);
+ bs.setHeight(ceData.rect.height()>>1);
if(bs.height()< 8)
bs.setHeight(8);
bs.setWidth(DO_EFFECT ? 16 : 15);
bs=bs.expandedTo(TQApplication::globalStrut());
- int extra(bs.height()*2==widget->height()? 0 : 1),
- y(0), x(widget->width()-bs.width()),
+ int extra(bs.height()*2==ceData.rect.height()? 0 : 1),
+ y(0), x(ceData.rect.width()-bs.width()),
rx(x-fw*2);
switch(sc)
@@ -6583,15 +6531,15 @@ TQRect QtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, TQStyleCo
case SC_SpinWidgetDown:
return TQRect(x, y+bs.height(), bs.width(), bs.height()+extra);
case SC_SpinWidgetButtonField:
- return TQRect(x, y, bs.width(), widget->height()-2*fw);
+ return TQRect(x, y, bs.width(), ceData.rect.height()-2*fw);
case SC_SpinWidgetEditField:
- return TQRect(fw, fw, rx, widget->height()-2*fw);
+ return TQRect(fw, fw, rx, ceData.rect.height()-2*fw);
case SC_SpinWidgetFrame:
return reverse
- ? TQRect(widget->x()+bs.width(), widget->y(),
- widget->width()-bs.width()-1, widget->height())
- : TQRect(widget->x(), widget->y(),
- widget->width()-bs.width(),widget->height());
+ ? TQRect(ceData.rect.x()+bs.width(), ceData.rect.y(),
+ ceData.rect.width()-bs.width()-1, ceData.rect.height())
+ : TQRect(ceData.rect.x(), ceData.rect.y(),
+ ceData.rect.width()-bs.width(),ceData.rect.height());
default:
break; // Remove compiler warnings...
}
@@ -6619,19 +6567,18 @@ TQRect QtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, TQStyleCo
nextScrollBar(SCROLLBAR_NEXT==opts.scrollbarType),
noButtons(SCROLLBAR_NONE==opts.scrollbarType);
TQRect ret;
- const TQScrollBar *sb((const TQScrollBar*)widget);
- bool horizontal(sb->orientation() == Qt::Horizontal);
- int sliderstart(sb->sliderStart()),
+ bool horizontal(ceData.orientation == TQt::Horizontal);
+ int sliderstart(ceData.startStep),
sbextent(pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget)),
- maxlen((horizontal ? sb->width() : sb->height())
+ maxlen((horizontal ? ceData.rect.width() : ceData.rect.height())
- (noButtons ? 0 : (sbextent * (threeButtonScrollBar ? 3 : 2)))),
sliderlen;
// calculate slider length
- if (sb->maxValue() != sb->minValue())
+ if (ceData.maxSteps != ceData.minSteps)
{
- uint range = sb->maxValue() - sb->minValue();
- sliderlen = (sb->pageStep() * maxlen) / (range + sb->pageStep());
+ uint range = ceData.maxSteps - ceData.minSteps;
+ sliderlen = (ceData.pageStep * maxlen) / (range + ceData.pageStep);
int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget );
if ( sliderlen < slidermin || range > INT_MAX / 2 )
@@ -6652,9 +6599,9 @@ TQRect QtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, TQStyleCo
// top/left button
if (platinumScrollBar)
if (horizontal)
- ret.setRect(sb->width() - 2 * sbextent, 0, sbextent, sbextent);
+ ret.setRect(ceData.rect.width() - 2 * sbextent, 0, sbextent, sbextent);
else
- ret.setRect(0, sb->height() - 2 * sbextent, sbextent, sbextent);
+ ret.setRect(0, ceData.rect.height() - 2 * sbextent, sbextent, sbextent);
else
ret.setRect(0, 0, sbextent, sbextent);
break;
@@ -6670,9 +6617,9 @@ TQRect QtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, TQStyleCo
ret.setRect(0, sbextent, sbextent, sbextent);
else
if (horizontal)
- ret.setRect(sb->width() - sbextent, 0, sbextent, sbextent);
+ ret.setRect(ceData.rect.width() - sbextent, 0, sbextent, sbextent);
else
- ret.setRect(0, sb->height() - sbextent, sbextent, sbextent);
+ ret.setRect(0, ceData.rect.height() - sbextent, sbextent, sbextent);
break;
case SC_ScrollBarSubPage:
// between top/left button and slider
@@ -6721,9 +6668,9 @@ TQRect QtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, TQStyleCo
if(noButtons)
{
if (horizontal)
- ret.setRect(0, 0, sb->width(), sb->height());
+ ret.setRect(0, 0, ceData.rect.width(), ceData.rect.height());
else
- ret.setRect(0, 0, sb->width(), sb->height());
+ ret.setRect(0, 0, ceData.rect.width(), ceData.rect.height());
}
else
{
@@ -6738,9 +6685,9 @@ TQRect QtCurveStyle::querySubControlMetrics(TQ_ComplexControl control, TQStyleCo
fudge = sbextent;
if (horizontal)
- ret.setRect(fudge, 0, sb->width() - sbextent * multi, sb->height());
+ ret.setRect(fudge, 0, ceData.rect.width() - sbextent * multi, ceData.rect.height());
else
- ret.setRect(0, fudge, sb->width(), sb->height() - sbextent * multi);
+ ret.setRect(0, fudge, ceData.rect.width(), ceData.rect.height() - sbextent * multi);
}
break;
case SC_ScrollBarSlider:
@@ -6906,7 +6853,7 @@ int QtCurveStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceDa
case PM_DockWindowHandleExtent:
return 10;
case PM_SplitterWidth:
- return widget && widget->inherits("TQDockWindowResizeHandle")
+ return widget && ceData.widgetObjectTypes.contains("TQDockWindowResizeHandle")
? 9
: LINE_1DOT==opts.splitters
? 7
@@ -7052,7 +6999,7 @@ TQSize QtCurveStyle::sizeFromContents(ContentsType contents, TQStyleControlEleme
return size;
}
case CT_ToolButton:
- if(widget->parent() && ::tqqt_cast<TQToolBar *>(widget->parent()))
+ if(ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING))
return TQSize(contentsSize.width()+8, contentsSize.height()+8);
default:
break; // Remove compiler warnings...
@@ -7086,7 +7033,7 @@ int QtCurveStyle::styleHint(StyleHint stylehint, TQStyleControlElementData ceDat
if(opts.passwordChar)
{
int chars[4]={opts.passwordChar, 0x25CF, 0x2022, 0};
- const TQFontMetrics &fm(widget ? widget->fontMetrics() : TQFontMetrics(TQFont()));
+ const TQFontMetrics &fm(TQFontMetrics(ceData.font));
for(int i=0; chars[i]; ++i)
if (fm.inFont(TQChar(chars[i])))
@@ -7791,11 +7738,10 @@ void QtCurveStyle::drawSliderHandle(TQPainter *p, const TQRect &r, const TQColor
}
void QtCurveStyle::drawSliderGroove(TQPainter *p, const TQRect &r, const TQColorGroup &cg,
- SFlags flags, const TQWidget *widget) const
+ SFlags flags, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
{
- const TQSlider *sliderWidget((const TQSlider *)widget);
TQRect groove(r);
- bool horiz(Qt::Horizontal==sliderWidget->orientation()),
+ bool horiz(TQt::Horizontal==ceData.orientation),
reverse(TQApplication::reverseLayout());
flags&=~Style_MouseOver;
@@ -7821,13 +7767,13 @@ void QtCurveStyle::drawSliderGroove(TQPainter *p, const TQRect &r, const TQColor
itsBackgroundCols[flags&Style_Enabled ? 2 : ORIGINAL_SHADE],
itsBackgroundCols, true, true, WIDGET_SLIDER_TROUGH);
- if(opts.fillSlider && (horiz ? sliderWidget->value()>0 : sliderWidget->value()<sliderWidget->maxValue()) &&
- sliderWidget->maxValue()!=sliderWidget->minValue() && flags&Style_Enabled)
+ if(opts.fillSlider && (horiz ? ceData.currentStep>0 : ceData.currentStep<ceData.maxSteps) &&
+ ceData.maxSteps!=ceData.minSteps && flags&Style_Enabled)
{
TQRect used(groove);
int pos((int)(((double)(horiz ? groove.width() : groove.height()) /
- (sliderWidget->maxValue()-sliderWidget->minValue())) *
- (sliderWidget->value() - sliderWidget->minValue())));
+ (ceData.maxSteps-ceData.minSteps)) *
+ (ceData.currentStep - ceData.minSteps)));
if(pos>0)
{
const TQColor *usedCols=itsSliderCols ? itsSliderCols : itsHighlightCols;
@@ -8092,7 +8038,7 @@ const TQColor * QtCurveStyle::getMdiColors(const TQColorGroup &cg, bool active)
if(col!=itsBackgroundCols[ORIGINAL_SHADE])
{
- itsActiveMdiColors=new TQColor [TOTAL_SHADES+1];
+ itsActiveMdiColors=new TQColor [TOTAL_SHADES+1];
shadeColors(col, itsActiveMdiColors);
}
}
@@ -8176,10 +8122,12 @@ const TQColor * QtCurveStyle::getMdiColors(const TQColorGroup &cg, bool active)
itsActiveMdiColors[ORIGINAL_SHADE]==itsMdiColors[ORIGINAL_SHADE])
opts.shadeMenubarOnlyWhenActive=false;
- if(!itsActiveMdiColors)
+ if(!itsActiveMdiColors) {
itsActiveMdiColors=(TQColor *)itsBackgroundCols;
- if(!itsMdiColors)
+ }
+ if(!itsMdiColors) {
itsMdiColors=(TQColor *)itsBackgroundCols;
+ }
}
return active ? itsActiveMdiColors : itsMdiColors;
@@ -8315,7 +8263,7 @@ bool QtCurveStyle::redrawHoverWidget(const TQPoint &pos)
subline2(addline);
if (useThreeButtonScrollBar) {
- if (Qt::Horizontal==sb->orientation()) {
+ if (TQt::Horizontal==ceData.orientation) {
subline2.moveBy(-addline.width(), 0);
}
}
@@ -8815,4 +8763,102 @@ void QtCurveStyle::hoverWidgetDestroyed(TQObject *o)
resetHover();
}
+void QtCurveStyle::adjustScrollbarRects(bool &itsFormMode,
+ bool &horiz,
+ bool &useThreeButtonScrollBar,
+ TQRect &subline,
+ TQRect &addline,
+ TQRect &subpage,
+ TQRect &addpage,
+ TQRect &slider,
+ TQRect &first,
+ TQRect &last,
+ TQRect &subline2,
+ TQRect &sbRect,
+ Options& opts,
+ const TQWidget* widget) const {
+
+ itsFormMode=isFormWidget(widget);
+
+ if(itsFormMode)
+ {
+ // See KHTML note at top of file
+ if(horiz)
+ {
+ subline.addCoords(0, 0, 0, -1);
+ addline.addCoords(0, 0, 0, -1);
+ subpage.addCoords(0, 0, 0, -1);
+ addpage.addCoords(0, 0, 0, -1);
+ slider.addCoords(0, 0, 0, -1);
+ first.addCoords(0, 0, 0, -1);
+ last.addCoords(0, 0, 0, -1);
+ subline2.addCoords(0, 0, 0, -1);
+ sbRect.addCoords(0, 0, 0, -1);
+ }
+ else
+ {
+ subline.addCoords(0, 0, -1, 0);
+ addline.addCoords(0, 0, -1, 0);
+ subpage.addCoords(0, 0, -1, 0);
+ addpage.addCoords(0, 0, -1, 0);
+ slider.addCoords(0, 0, -1, 0);
+ first.addCoords(0, 0, -1, 0);
+ last.addCoords(0, 0, -1, 0);
+ subline2.addCoords(0, 0, -1, 0);
+ sbRect.addCoords(0, 0, -1, 0);
+ }
+
+#ifndef SIMPLE_SCROLLBARS
+ if(sbRect.isValid() && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)) {
+ if(horiz) {
+ sbRect.addCoords(0, 0, -1, 0);
+ }
+ else {
+ sbRect.addCoords(0, 0, 0, -1);
+ }
+ }
+#endif
+ }
+
+ else if (useThreeButtonScrollBar) {
+ if (horiz) {
+ subline2.moveBy(-addline.width(), 0);
+ }
+ else {
+ subline2.moveBy(0, -addline.height());
+ }
+ }
+
+ if(opts.flatSbarButtons) {
+ switch(opts.scrollbarType)
+ {
+ case SCROLLBAR_KDE:
+ if(horiz)
+ sbRect.addCoords(subline.width(), 0, -(addline.width()+subline2.width()), 0);
+ else
+ sbRect.addCoords(0, subline.height(), 0, -(addline.height()+subline2.height()));
+ break;
+ case SCROLLBAR_WINDOWS:
+ if(horiz)
+ sbRect.addCoords(subline.width(), 0, -(addline.width()), 0);
+ else
+ sbRect.addCoords(0, subline.height(), 0, -(addline.height()));
+ break;
+ case SCROLLBAR_NEXT:
+ if(horiz)
+ sbRect.addCoords(subline.width()+subline2.width(), 0, 0, 0);
+ else
+ sbRect.addCoords(0, subline.height()+subline2.height(), 0, 0);
+ break;
+ case SCROLLBAR_PLATINUM:
+ if(horiz)
+ sbRect.addCoords(0, 0, -(addline.width()+subline2.width()), 0);
+ else
+ sbRect.addCoords(0, 0, 0, -(addline.height()+subline2.height()));
+ default:
+ break;
+ }
+ }
+}
+
#include "qtcurve.moc"