diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-10-31 14:53:25 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-10-31 14:53:25 -0500 |
commit | f16f8eb6bf27ae9dcebbcac7db0a5dbe673a27c5 (patch) | |
tree | 33493803b3ee7ed21af80bd3997e49d0beb604f1 /styles/phase/phasestyle.cpp | |
parent | c8898cf01f664fc323aa0bb46317bfb8b9dd22f5 (diff) | |
download | tdeartwork-f16f8eb6bf27ae9dcebbcac7db0a5dbe673a27c5.tar.gz tdeartwork-f16f8eb6bf27ae9dcebbcac7db0a5dbe673a27c5.zip |
Update styles for new API
Diffstat (limited to 'styles/phase/phasestyle.cpp')
-rw-r--r-- | styles/phase/phasestyle.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/styles/phase/phasestyle.cpp b/styles/phase/phasestyle.cpp index f163ef46..067fe804 100644 --- a/styles/phase/phasestyle.cpp +++ b/styles/phase/phasestyle.cpp @@ -1015,9 +1015,11 @@ void PhaseStyle::drawPrimitive(TQ_PrimitiveElement element, break; } case PE_MenuItemIndicatorCheck: { + int checkwidth = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, option, NULL, NULL); + int cx = reverse_ ? x+w - checkwidth : x; drawPrimitive(PE_CheckMark, painter, ceData, elementFlags, - TQRect(x + ITEMFRAME, y + ITEMFRAME, - w - ITEMFRAME*2, h - ITEMFRAME*2), + TQRect(cx + ITEMFRAME, y + ITEMFRAME, + checkwidth - ITEMFRAME*2, h - ITEMFRAME*2), group, Style_Default | (active ? Style_Enabled : Style_On)); break; @@ -1415,8 +1417,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element, // draw check if (mi->isChecked()) { - int cx = reverse_ ? x+w - checkwidth : x; - drawPrimitive(PE_MenuItemIndicatorCheck, painter, ceData, elementFlags, TQRect(cx, y, checkwidth, h), group, flags); + drawPrimitive(PE_MenuItemIndicatorCheck, painter, ceData, elementFlags, TQRect(x, y, checkwidth, h), group, flags, option); } // draw text @@ -2024,6 +2025,12 @@ int PhaseStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceData case PM_SliderControlThickness: return em; + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + return ITEMFRAME; + default: return KStyle::pixelMetric(metric, ceData, elementFlags, widget); } @@ -2257,6 +2264,29 @@ bool PhaseStyle::flatToolbar(const TQToolBar *toolbar) const return false; } +int PhaseStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const +{ + int ret; + + switch (sh) { + case SH_MenuIndicatorColumnWidth: + { + int checkwidth = opt.maxIconWidth(); + bool checkable = (elementFlags & CEF_IsCheckable); + + if (checkable) checkwidth = TQMAX(checkwidth, 20); + + ret = checkwidth; + } + break; + default: + ret = TQCommonStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w); + break; + } + + return ret; +} + ////////////////////////////////////////////////////////////////////////////// // eventFilter() // ------------- |