diff options
Diffstat (limited to 'kstyles/highcolor/highcolor.cpp')
-rw-r--r-- | kstyles/highcolor/highcolor.cpp | 61 |
1 files changed, 43 insertions, 18 deletions
diff --git a/kstyles/highcolor/highcolor.cpp b/kstyles/highcolor/highcolor.cpp index 120f7d6e6..c659f7451 100644 --- a/kstyles/highcolor/highcolor.cpp +++ b/kstyles/highcolor/highcolor.cpp @@ -260,8 +260,10 @@ void HighColorStyle::drawPrimitive( TQ_PrimitiveElement pe, SFlags flags, const TQStyleOption& opt ) const { - bool down = flags & Style_Down; - bool on = flags & Style_On; + bool down = flags & Style_Down; + bool on = flags & Style_On; + bool active = flags & Style_Active; + bool reverse = TQApplication::reverseLayout(); switch(pe) { @@ -851,6 +853,42 @@ void HighColorStyle::drawPrimitive( TQ_PrimitiveElement pe, break; } + case PE_MenuItemIndicatorFrame: { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + TQRect cr = visualRect( TQRect(x, y, w, h), r ); + + int cx = reverse ? x+w - w : x; + + // We only have to draw the background if the menu item is inactive - + // if it's active the "pressed" background is already drawn + if ( ! active ) + qDrawShadePanel( p, cx, y, w, h, cg, true, 1, &cg.brush(TQColorGroup::Midlight) ); + } + break; + + case PE_MenuItemIndicatorIconFrame: { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + TQRect cr = visualRect( TQRect(x, y, w, h), r ); + qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) ); + } + break; + + case PE_MenuItemIndicatorCheck: { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + TQRect cr = visualRect( TQRect(x, y, w, h), r ); + + int cx = reverse ? x+w - w : x; + + // Draw the checkmark + SFlags cflags = Style_Default; + cflags |= active ? Style_Enabled : Style_On; + + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame, w - itemFrame*2, h - itemFrame*2), cg, cflags ); + } + break; default: { @@ -1345,8 +1383,7 @@ void HighColorStyle::drawControl( TQ_ControlElement element, // Do we have an icon and are checked at the same time? // Then draw a "pressed" background behind the icon if ( checkable && !active && mi->isChecked() ) - qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), - cg, true, 1, &cg.brush(TQColorGroup::Midlight) ); + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags); // Draw the icon TQPixmap pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); TQRect pmr( 0, 0, pixmap.width(), pixmap.height() ); @@ -1356,20 +1393,8 @@ void HighColorStyle::drawControl( TQ_ControlElement element, // Are we checked? (This time without an icon) else if ( checkable && mi->isChecked() ) { - int cx = reverse ? x+w - checkcol : x; - - // We only have to draw the background if the menu item is inactive - - // if it's active the "pressed" background is already drawn - if ( ! active ) - qDrawShadePanel( p, cx, y, checkcol, h, cg, true, 1, - &cg.brush(TQColorGroup::Midlight) ); - - // Draw the checkmark - SFlags cflags = Style_Default; - cflags |= active ? Style_Enabled : Style_On; - - drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame, - checkcol - itemFrame*2, h - itemFrame*2), cg, cflags ); + drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags); } // Time to draw the menu item label... |