summaryrefslogtreecommitdiffstats
path: root/kstyles/light
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/light
parentd26d6ac23685063d532f0195499e617b2442350b (diff)
downloadtdelibs-884e5fa2022260e446ed13b9ed082023311442d2.tar.gz
tdelibs-884e5fa2022260e446ed13b9ed082023311442d2.zip
Update to new style API
Diffstat (limited to 'kstyles/light')
-rw-r--r--kstyles/light/lightstyle-v2.cpp36
-rw-r--r--kstyles/light/lightstyle-v3.cpp36
2 files changed, 64 insertions, 8 deletions
diff --git a/kstyles/light/lightstyle-v2.cpp b/kstyles/light/lightstyle-v2.cpp
index e39c7c9b1..c96f636de 100644
--- a/kstyles/light/lightstyle-v2.cpp
+++ b/kstyles/light/lightstyle-v2.cpp
@@ -562,12 +562,24 @@ void LightStyleV2::drawPrimitive( TQ_PrimitiveElement pe,
case PE_MenuItemIndicatorFrame:
case PE_MenuItemIndicatorIconFrame:
{
- qDrawShadePanel(p, r, cg, true, 1, &cg.brush(TQColorGroup::Midlight));
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, data, NULL, NULL);
+ TQRect cr(r.left(), r.top(), checkcol, r.height());
+ bool reverse = TQApplication::reverseLayout();
+ if ( reverse ) {
+ cr = visualRect( cr, r );
+ }
+ qDrawShadePanel(p, cr, cg, true, 1, &cg.brush(TQColorGroup::Midlight));
}
break;
case PE_MenuItemIndicatorCheck:
{
- drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | Style_On);
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, data, NULL, NULL);
+ TQRect cr(r.left(), r.top(), checkcol, r.height());
+ bool reverse = TQApplication::reverseLayout();
+ if ( reverse ) {
+ cr = visualRect( cr, r );
+ }
+ drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg, (flags & Style_Enabled) | Style_On);
}
break;
@@ -849,7 +861,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
if (mi->isChecked() &&
! (flags & Style_Active) &
(flags & Style_Enabled))
- drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, cr, cg, flags);
+ drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, data);
if (mi->iconSet()) {
TQIconSet::Mode mode =
@@ -868,7 +880,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
p->setPen(cg.text());
p->drawPixmap(pmr.topLeft(), pixmap);
} else if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
- drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, cr, cg, flags);
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, data);
TQColor textcolor;
TQColor embosscolor;
@@ -1496,6 +1508,13 @@ int LightStyleV2::pixelMetric( PixelMetric metric, TQStyleControlElementData ceD
ret = -1;
break;
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ ret = 0;
+ break;
+
default:
ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget);
break;
@@ -1638,6 +1657,15 @@ int LightStyleV2::styleHint( TQ_StyleHint stylehint,
ret = 0;
break;
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int maxpmw = option.maxIconWidth();
+ maxpmw = QMAX(maxpmw, 16);
+
+ ret = maxpmw;
+ }
+ break;
+
default:
ret = TQCommonStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
break;
diff --git a/kstyles/light/lightstyle-v3.cpp b/kstyles/light/lightstyle-v3.cpp
index b76c7bda3..d14035c17 100644
--- a/kstyles/light/lightstyle-v3.cpp
+++ b/kstyles/light/lightstyle-v3.cpp
@@ -751,12 +751,24 @@ void LightStyleV3::drawPrimitive( TQ_PrimitiveElement pe,
case PE_MenuItemIndicatorFrame:
case PE_MenuItemIndicatorIconFrame:
{
- qDrawShadePanel(p, r, cg, true, 1, &cg.brush(TQColorGroup::Midlight));
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, data, NULL, NULL);
+ TQRect cr(r.left(), r.top(), checkcol, r.height());
+ bool reverse = TQApplication::reverseLayout();
+ if ( reverse ) {
+ cr = visualRect( cr, r );
+ }
+ qDrawShadePanel(p, cr, cg, true, 1, &cg.brush(TQColorGroup::Midlight));
}
break;
case PE_MenuItemIndicatorCheck:
{
- drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | Style_On);
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, data, NULL, NULL);
+ TQRect cr(r.left(), r.top(), checkcol, r.height());
+ bool reverse = TQApplication::reverseLayout();
+ if ( reverse ) {
+ cr = visualRect( cr, r );
+ }
+ drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg, (flags & Style_Enabled) | Style_On);
}
break;
@@ -969,7 +981,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
if (mi->isChecked() &&
! (flags & Style_Active) &
(flags & Style_Enabled))
- drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, cr, cg, flags);
+ drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, data);
if (mi->iconSet()) {
TQIconSet::Mode mode =
@@ -988,7 +1000,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
p->setPen(cg.text());
p->drawPixmap(pmr.topLeft(), pixmap);
} else if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
- drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, cr, cg, flags);
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, data);
TQColor textcolor;
TQColor embosscolor;
@@ -1711,6 +1723,13 @@ int LightStyleV3::pixelMetric( PixelMetric metric, TQStyleControlElementData ceD
ret = -1;
break;
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ ret = 0;
+ break;
+
default:
ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget);
break;
@@ -1870,6 +1889,15 @@ int LightStyleV3::styleHint( TQ_StyleHint stylehint,
ret = NoBackground;
break;
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int maxpmw = option.maxIconWidth();
+ maxpmw = QMAX(maxpmw, 16);
+
+ ret = maxpmw;
+ }
+ break;
+
default:
ret = TQCommonStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
break;