From 4f7f0b0539fd66f4ab01432cb062acb447269a23 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Mon, 25 Jun 2012 13:09:36 +0200 Subject: Revert "Reduce copy'n'paste by different nesting of if's." This reverts commit 83208da599e46dbba39c9e9a5b503bc4e93d4eea. --- vcl/source/window/menu.cxx | 64 +++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 26 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index a23f69aea0d1..5f543c9c0f31 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1,3 +1,4 @@ + /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * @@ -5498,45 +5499,56 @@ void MenuBarWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight ) Rectangle aRect = Rectangle( Point( nX, 1 ), Size( pData->aSz.Width(), GetOutputSizePixel().Height()-2 ) ); Push( PUSH_CLIPREGION ); IntersectClipRegion( aRect ); - - if( IsNativeControlSupported( CTRL_MENUBAR, PART_MENU_ITEM ) && - IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL ) ) + if ( bHighlight ) { - // draw background (transparency) - MenubarValue aControlValue; - aControlValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this ); - - Point tmp(0,0); - Rectangle aBgRegion( tmp, GetOutputSizePixel() ); - DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, - aBgRegion, - CTRL_STATE_ENABLED, - aControlValue, - OUString() ); - ImplAddNWFSeparator( this, aControlValue ); - - if ( bHighlight ) + if( IsNativeControlSupported( CTRL_MENUBAR, PART_MENU_ITEM ) && + IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL ) ) { + // draw background (transparency) + MenubarValue aControlValue; + aControlValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this ); + + Point tmp(0,0); + Rectangle aBgRegion( tmp, GetOutputSizePixel() ); + DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, + aBgRegion, + CTRL_STATE_ENABLED, + aControlValue, + OUString() ); + ImplAddNWFSeparator( this, aControlValue ); + // draw selected item DrawNativeControl( CTRL_MENUBAR, PART_MENU_ITEM, - aRect, - CTRL_STATE_ENABLED | CTRL_STATE_SELECTED, - aControlValue, - OUString() ); + aRect, + CTRL_STATE_ENABLED | CTRL_STATE_SELECTED, + aControlValue, + OUString() ); } - } - else - { - if ( bHighlight ) + else { SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() ); SetLineColor(); DrawRect( aRect ); } + } + else + { + if( IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL) ) + { + MenubarValue aMenubarValue; + aMenubarValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this ); + + // use full window size to get proper gradient + // but clip accordingly + Point aPt; + Rectangle aCtrlRect( aPt, GetOutputSizePixel() ); + + DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, aCtrlRect, CTRL_STATE_ENABLED, aMenubarValue, rtl::OUString() ); + ImplAddNWFSeparator( this, aMenubarValue ); + } else Erase( aRect ); } - Pop(); pMenu->ImplPaint( this, 0, 0, pData, bHighlight ); } -- cgit