summaryrefslogtreecommitdiffstats
path: root/src/styles/qcompactstyle.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-31 12:39:49 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-31 12:39:49 -0500
commit2fce73142f9e5c46c909934b03bca5a30512a3d0 (patch)
tree3b467ac5f1f85ff95e36c8f9de08f1954b1017d6 /src/styles/qcompactstyle.cpp
parent0836d4649ca26cc4e6e867ca5a4a3eafd995f807 (diff)
downloadtqt3-2fce73142f9e5c46c909934b03bca5a30512a3d0.tar.gz
tqt3-2fce73142f9e5c46c909934b03bca5a30512a3d0.zip
Automated update from Qt3
Diffstat (limited to 'src/styles/qcompactstyle.cpp')
-rw-r--r--src/styles/qcompactstyle.cpp51
1 files changed, 44 insertions, 7 deletions
diff --git a/src/styles/qcompactstyle.cpp b/src/styles/qcompactstyle.cpp
index 54b120851..f2038a38c 100644
--- a/src/styles/qcompactstyle.cpp
+++ b/src/styles/qcompactstyle.cpp
@@ -67,6 +67,12 @@ int TQCompactStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData c
case PM_MaximumDragDistance:
ret = -1;
break;
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ ret = 0;
+ break;
default:
ret = TQWindowsStyle::pixelMetric( metric, ceData, elementFlags, widget );
break;
@@ -189,7 +195,7 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, TQStyleC
return;
if ( mi->isChecked() ) {
- drawPrimitive( PE_MenuItemIndicatorFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), itemg, flags, opt );
+ drawPrimitive( PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, itemg, flags, opt );
} else if ( !act ) {
p->fillRect(x, y, checkcol , h,
g.brush( TQColorGroup::Button ));
@@ -208,7 +214,7 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, TQStyleC
int pixh = pixmap.height();
if ( act && !dis ) {
if ( !mi->isChecked() )
- drawPrimitive( PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), itemg, flags, opt );
+ drawPrimitive( PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, itemg, flags, opt );
}
TQRect cr( x, y, checkcol, h );
TQRect pmr( 0, 0, pixw, pixh );
@@ -221,7 +227,7 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, TQStyleC
p->fillRect( x+checkcol + 1, y, w - checkcol - 1, h, fill);
} else if ( checkable ) { // just "checking"...
if ( mi->isChecked() ) {
- drawPrimitive( PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, h), itemg, flags, opt );
+ drawPrimitive( PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, itemg, flags, opt );
}
}
@@ -322,21 +328,27 @@ void TQCompactStyle::drawPrimitive( PrimitiveElement pe,
switch (pe) {
case PE_MenuItemIndicatorFrame:
{
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+
if ( act && !dis ) {
- qDrawShadePanel( p, x, y, w, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) );
+ qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) );
} else {
- qDrawShadePanel( p, x, y, w, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) );
+ qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) );
}
}
break;
case PE_MenuItemIndicatorIconFrame:
{
- qDrawShadePanel( p, x, y, w, h, cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+
+ qDrawShadePanel( p, x, y, checkcol, h, cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) );
}
break;
case PE_MenuItemIndicatorCheck:
{
- int mw = w + motifItemFrame;
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+
+ int mw = checkcol + motifItemFrame;
int mh = h - 2*motifItemFrame;
SFlags cflags = Style_Default;
@@ -355,4 +367,29 @@ void TQCompactStyle::drawPrimitive( PrimitiveElement pe,
}
}
+/*! \reimp */
+int TQCompactStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const
+{
+ int ret;
+
+ switch (sh) {
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int maxpmw = opt.maxIconWidth();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+
+ if ( checkable )
+ maxpmw = TQMAX( maxpmw, 8 ); // space for the checkmarks
+
+ ret = maxpmw;
+ }
+ break;
+ default:
+ ret = TQWindowsStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w);
+ break;
+ }
+
+ return ret;
+}
+
#endif