summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2012-05-14 14:58:32 +0200
committerJan Holesovsky <kendy@suse.cz>2012-05-15 08:39:32 +0200
commit83208da599e46dbba39c9e9a5b503bc4e93d4eea (patch)
treeef61b1fc1794c4947bbb4b7ca453dd3341bf1e69 /vcl
parentedec6d134a4265fe6c69f3e51a173a5cd395c615 (diff)
Reduce copy'n'paste by different nesting of if's.
Change-Id: I9a68d585217550c1d229a2bc66d04e506253d747
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/menu.cxx64
1 files changed, 26 insertions, 38 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 39536d7dfd15..965778c1cd7f 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1,4 +1,3 @@
-
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
@@ -5521,56 +5520,45 @@ 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 ( bHighlight )
+
+ if( IsNativeControlSupported( CTRL_MENUBAR, PART_MENU_ITEM ) &&
+ IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL ) )
{
- 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 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 )
+ {
// draw selected item
DrawNativeControl( CTRL_MENUBAR, PART_MENU_ITEM,
- aRect,
- CTRL_STATE_ENABLED | CTRL_STATE_SELECTED,
- aControlValue,
- OUString() );
- }
- else
- {
- SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() );
- SetLineColor();
- DrawRect( aRect );
+ aRect,
+ CTRL_STATE_ENABLED | CTRL_STATE_SELECTED,
+ aControlValue,
+ OUString() );
}
}
else
{
- if( IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL) )
+ if ( bHighlight )
{
- 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 );
+ SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() );
+ SetLineColor();
+ DrawRect( aRect );
}
else
Erase( aRect );
}
+
Pop();
pMenu->ImplPaint( this, 0, 0, pData, bHighlight );
}