summaryrefslogtreecommitdiffstats
path: root/kstyles/highcontrast
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-31 14:12:48 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-31 14:12:48 -0500
commit884e5fa2022260e446ed13b9ed082023311442d2 (patch)
tree7893b2f5ae5b6181537877066d679d7cb2d18d9c /kstyles/highcontrast
parentd26d6ac23685063d532f0195499e617b2442350b (diff)
downloadtdelibs-884e5fa2022260e446ed13b9ed082023311442d2.tar.gz
tdelibs-884e5fa2022260e446ed13b9ed082023311442d2.zip
Update to new style API
Diffstat (limited to 'kstyles/highcontrast')
-rw-r--r--kstyles/highcontrast/highcontrast.cpp47
-rw-r--r--kstyles/highcontrast/highcontrast.h4
2 files changed, 44 insertions, 7 deletions
diff --git a/kstyles/highcontrast/highcontrast.cpp b/kstyles/highcontrast/highcontrast.cpp
index d54caf69b..82734b7b3 100644
--- a/kstyles/highcontrast/highcontrast.cpp
+++ b/kstyles/highcontrast/highcontrast.cpp
@@ -642,7 +642,8 @@ void HighContrastStyle::drawPrimitive (TQ_PrimitiveElement pe,
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
- TQRect cr = visualRect( TQRect(x, y, w, h), r );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ TQRect cr = visualRect( TQRect(x, y, checkcol, h), r );
drawRect (p, cr, 0, false);
break;
}
@@ -650,9 +651,12 @@ void HighContrastStyle::drawPrimitive (TQ_PrimitiveElement pe,
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
- TQRect cr = visualRect( TQRect(x, y, w, h), r );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
- TQRect rc (x, y, w, h);
+ TQRect cr = visualRect( TQRect(x, y, checkcol, h), r );
+ bool reverse = TQApplication::reverseLayout();
+ int cx = reverse ? x+w - checkcol : x;
+ TQRect rc (cx, y, checkcol, h);
addOffset (&rc, 2*basicLineWidth);
TQPoint center = rc.center();
if (rc.width() > rc.height())
@@ -1078,15 +1082,13 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
// Then draw a square border around the icon
if ( checkable && mi->isChecked() )
{
- drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags);
+ drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
}
}
// Are we checked? (This time without an icon)
else if ( checkable && mi->isChecked() ) {
- int cx = reverse ? x+w - checkcol : x;
-
- drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(cx, y, checkcol, h), cg, flags);
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt);
}
// Time to draw the menu item label...
@@ -1686,6 +1688,12 @@ int HighContrastStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceDa
return 5*basicLineWidth;
}
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ return 0;
+
default:
return KStyle::pixelMetric(m, ceData, elementFlags, widget);
}
@@ -1846,5 +1854,30 @@ bool HighContrastStyle::objectEventHandler( TQStyleControlElementData ceData, Co
return KStyle::objectEventHandler (ceData, elementFlags, source, event);
}
+/*! \reimp */
+int HighContrastStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const
+{
+ int ret;
+
+ switch (sh) {
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int checkcol = opt.maxIconWidth();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+
+ if ( checkable )
+ checkcol = QMAX( checkcol, 20 );
+
+ ret = checkcol;
+ }
+ break;
+ default:
+ ret = TQCommonStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w);
+ break;
+ }
+
+ return ret;
+}
+
// vim: set noet ts=4 sw=4:
// kate: indent-width 4; replace-tabs off; smart-indent on; tab-width 4;
diff --git a/kstyles/highcontrast/highcontrast.h b/kstyles/highcontrast/highcontrast.h
index 0831163fe..a01f733d7 100644
--- a/kstyles/highcontrast/highcontrast.h
+++ b/kstyles/highcontrast/highcontrast.h
@@ -149,6 +149,10 @@ class HighContrastStyle : public KStyle
TQRect subRect (SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget * widget) const;
+ int styleHint(TQ_StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
+ const TQStyleOption & = TQStyleOption::Default,
+ TQStyleHintReturn * = 0, const TQWidget * = 0 ) const;
+
protected:
virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );