diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-10-30 22:41:50 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-10-30 22:41:50 -0500 |
commit | 69429dcfc35d449c78b346bdce536f17d926c755 (patch) | |
tree | 6c1d1015837f0e77a8e950e38a3a24ee616e598c /src/styles/qsgistyle.cpp | |
parent | 22d1ab9eccc005b0497cff131593e6b9ff96e7c2 (diff) | |
download | qt3-69429dcfc35d449c78b346bdce536f17d926c755.tar.gz qt3-69429dcfc35d449c78b346bdce536f17d926c755.zip |
Add new style primatives for enhanced third party style compatibility
Diffstat (limited to 'src/styles/qsgistyle.cpp')
-rw-r--r-- | src/styles/qsgistyle.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/styles/qsgistyle.cpp b/src/styles/qsgistyle.cpp index a66fcda..b65100c 100644 --- a/src/styles/qsgistyle.cpp +++ b/src/styles/qsgistyle.cpp @@ -567,6 +567,9 @@ void QSGIStyle::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 +881,25 @@ void QSGIStyle::drawPrimitive( PrimitiveElement pe, } 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; + + QRect 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 ); + } + break; + default: QMotifStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); break; @@ -1018,20 +1040,8 @@ void QSGIStyle::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() ) { - QRect 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_MenuItemIndicatorCheck, p, ceData, elementFlags, QRect(x, y, w, h), cg, flags); } } } |