From 2b98abcb30a61058af54e2a6e17126398507fc14 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Tue, 1 Jan 2013 22:28:21 +0100 Subject: Personas: Make the Persona in the menubar working. Change-Id: I21a45159f6b27aa7beff5ec07530b14480675729 Signed-off-by: Cor Nouws Signed-off-by: Olivier Hallot Signed-off-by: Adolfo Jayme Barrientos Signed-off-by: Michael Meeks --- vcl/source/window/menu.cxx | 61 +++++++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 17 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 926438c17fc1..64fe254e929c 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -3856,7 +3856,16 @@ static void ImplInitMenuWindow( Window* pWin, sal_Bool bFont, sal_Bool bMenuBar pWin->SetPointFont( rStyleSettings.GetMenuFont() ); if( bMenuBar ) { - if( pWin->IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL ) ) + const BitmapEx* pPersonaBitmap = rStyleSettings.GetPersonaHeader(); + if ( pPersonaBitmap != NULL ) + { + Wallpaper aWallpaper( *pPersonaBitmap ); + aWallpaper.SetStyle( WALLPAPER_TOPRIGHT ); + pWin->SetBackground( aWallpaper ); + pWin->SetPaintTransparent( sal_False ); + pWin->SetParentClipMode( 0 ); + } + else if ( pWin->IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL ) ) { pWin->SetBackground(); // background will be drawn by NWF } @@ -5494,13 +5503,19 @@ void MenuBarWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight ) 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() ); + if ( GetSettings().GetStyleSettings().GetPersonaHeader() ) + Erase(); + else + { + 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 @@ -5524,12 +5539,18 @@ void MenuBarWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight ) MenubarValue aMenubarValue; aMenubarValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this ); - // use full window size to get proper gradient - // but clip accordingly - Point aPt; - Rectangle aCtrlRect( aPt, GetOutputSizePixel() ); + if ( GetSettings().GetStyleSettings().GetPersonaHeader() ) + Erase( aRect ); + else + { + // 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() ); + } - DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, aCtrlRect, CTRL_STATE_ENABLED, aMenubarValue, rtl::OUString() ); ImplAddNWFSeparator( this, aMenubarValue ); } else @@ -5751,13 +5772,19 @@ void MenuBarWindow::Paint( const Rectangle& ) if( IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL) ) { - Point aPt; - Rectangle aCtrlRegion( aPt, GetOutputSizePixel() ); - MenubarValue aMenubarValue; aMenubarValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this ); - DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, aCtrlRegion, CTRL_STATE_ENABLED, aMenubarValue, rtl::OUString() ); + if ( GetSettings().GetStyleSettings().GetPersonaHeader() ) + Erase(); + else + { + Point aPt; + Rectangle aCtrlRegion( aPt, GetOutputSizePixel() ); + + DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, aCtrlRegion, CTRL_STATE_ENABLED, aMenubarValue, rtl::OUString() ); + } + ImplAddNWFSeparator( this, aMenubarValue ); } SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); -- cgit v1.2.3