summaryrefslogtreecommitdiffstats
path: root/src/styles/qsgistyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/styles/qsgistyle.cpp')
-rw-r--r--src/styles/qsgistyle.cpp98
1 files changed, 83 insertions, 15 deletions
diff --git a/src/styles/qsgistyle.cpp b/src/styles/qsgistyle.cpp
index 930a34d09..aa00c57f0 100644
--- a/src/styles/qsgistyle.cpp
+++ b/src/styles/qsgistyle.cpp
@@ -398,6 +398,14 @@ int TQSGIStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceDat
case PM_SplitterWidth:
return TQMAX( 10, TQApplication::globalStrut().width() );
+ case PM_MenuIndicatorFrameHBorder:
+ return (sgiItemFrame+2);
+ case PM_MenuIndicatorFrameVBorder:
+ return (sgiItemFrame+4);
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ return sgiItemFrame;
+
default:
break;
}
@@ -567,6 +575,9 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
const int defaultFrameWidth = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags );
bool hot = ( flags & Style_MouseOver ) && ( flags & Style_Enabled );
+ bool dis = ! (flags & Style_Enabled);
+ bool act = flags & Style_Active;
+
switch ( pe ) {
case PE_ButtonCommand:
{
@@ -878,6 +889,51 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
}
break;
+ case PE_MenuItemIndicatorFrame:
+ {
+ int x, y, w, h;
+ r.rect(&x, &y, &w, &h);
+
+ SFlags cflags = Style_Default;
+ if (! dis)
+ cflags |= Style_Enabled;
+ if (act)
+ cflags |= Style_On;
+
+ TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) );
+ er.addCoords( 1, 1, -1, -1 );
+ drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, cflags, opt );
+ }
+ break;
+
+ case PE_MenuItemIndicatorIconFrame:
+ {
+ int x, y, w, h;
+ r.rect(&x, &y, &w, &h);
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+
+ drawPanel( p, x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame, cg, TRUE, 1, &cg.brush( TQColorGroup::Light ) );
+ }
+ break;
+
+ case PE_MenuItemIndicatorCheck:
+ {
+ int x, y, w, h;
+ r.rect(&x, &y, &w, &h);
+
+ SFlags cflags = Style_Default;
+ if (! dis)
+ cflags |= Style_Enabled;
+ if (act)
+ cflags |= Style_On;
+
+ TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) );
+ er.addCoords( 1, 1, -1, -1 );
+ er.addCoords( 0, 1, 1, 1 );
+ drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, cflags | Style_On, opt );
+ }
+ break;
+
default:
TQMotifStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
break;
@@ -990,8 +1046,7 @@ void TQSGIStyle::drawControl( ControlElement element,
if ( mi->isChecked() ) {
if ( mi->iconSet() ) {
- drawPanel( p, x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame,
- cg, TRUE, 1, &cg.brush( TQColorGroup::Light ) );
+ drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
}
} else {
if ( !act )
@@ -1018,20 +1073,9 @@ void TQSGIStyle::drawControl( ControlElement element,
p->drawPixmap( pmr.topLeft(), pixmap );
} else {
if ( checkable ) {
- SFlags cflags = Style_Default;
- if (! dis)
- cflags |= Style_Enabled;
- if (act)
- cflags |= Style_On;
-
if ( mi->isChecked() ) {
- TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3,
- pixelMetric(PM_IndicatorWidth, ceData, elementFlags),
- pixelMetric(PM_IndicatorHeight, ceData, elementFlags) );
- er.addCoords( 1, 1, -1, -1 );
- drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, cflags, opt );
- er.addCoords( 0, 1, 1, 1 );
- drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, cflags | Style_On, opt );
+ drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt);
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt);
}
}
}
@@ -1467,4 +1511,28 @@ TQRect TQSGIStyle::querySubControlMetrics( ComplexControl control,
return TQMotifStyle::querySubControlMetrics( control, ceData, elementFlags, sub, opt, widget );
}
+/*! \reimp */
+int TQSGIStyle::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, sgiCheckMarkSpace );
+ ret = maxpmw;
+ }
+ break;
+ default:
+ ret = TQMotifStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w);
+ break;
+ }
+
+ return ret;
+}
+
#endif // QT_NO_STYLE_SGI