diff options
author | Jan Holesovsky <kendy@suse.cz> | 2012-06-25 13:09:17 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2012-06-25 18:09:12 +0200 |
commit | ece807345296d4ab77aa7178e29efa8ac26836a0 (patch) | |
tree | 22fc2adaa86517b941c2a84836665bf104d988d7 /vcl | |
parent | f2eef8314c97c068b2b0cdbf565997836528f85d (diff) |
Revert "aero: Implement a glass menubar on Windows."
This reverts commit 64c696fc92a860fdbbe490ca503391b964dd646f.
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/salframe.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/svdata.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/win/salframe.h | 6 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 51 | ||||
-rw-r--r-- | vcl/win/source/gdi/salnativewidgets-luna.cxx | 132 |
5 files changed, 37 insertions, 159 deletions
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index 6af1a2841961..cd3f3b977575 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -279,12 +279,6 @@ public: // (e.g. input methods, printer update handlers). long CallCallback( sal_uInt16 nEvent, const void* pEvent ) const { return m_pProc ? m_pProc( m_pWindow, const_cast<SalFrame*>(this), nEvent, pEvent ) : 0; } - - /// Update the region that is supposed to be handled by the window manager - /// - /// This is primarily for Windows Aero theme in order to be able to draw - /// to the Glass area. - virtual void extendWindowManagerFrameNative( int /*nLeft*/, int /*nRight*/, int /*nTop*/, int /*nBottom*/ ) {} }; diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index e96979a07900..4f74c97e6899 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -305,7 +305,6 @@ struct ImplSVNWFData bool mbToolboxDropDownSeparate:1; // two adjacent buttons for // toolbox dropdown buttons bool mbFlatMenu:1; // no popup 3D border - bool mbTransparentMenubar:1; //< keep the background of the menubar transparent; needed for the Aero theme bool mbOpenMenuOnF10:1; // on gnome the first menu opens on F10 bool mbNoFocusRects:1; // on Aqua focus rects are not used bool mbCenteredTabs:1; // on Aqua, tabs are centered diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h index b8056696b7f8..0d4e206e8507 100644 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h @@ -144,12 +144,6 @@ public: virtual void BeginSetClipRegion( sal_uIntPtr nRects ); virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); virtual void EndSetClipRegion(); - - /// Update the region that is supposed to be handled by the window manager - /// - /// This is primarily for Windows Aero theme in order to be able to draw - /// to the Glass area. - virtual void extendWindowManagerFrameNative( int nLeft, int nRight, int nTop, int nBottom ); }; void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 935d5a9ec9ac..a23f69aea0d1 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -52,7 +52,6 @@ #include "vcl/toolbox.hxx" #include "vcl/dockingarea.hxx" -#include "salframe.hxx" #include "salinst.hxx" #include "svdata.hxx" #include "svids.hrc" @@ -2656,29 +2655,6 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa nImageStyle |= IMAGE_DRAW_DISABLE; } - // Menubar highlights - if ( bIsMenuBar && pWin->IsNativeControlSupported( CTRL_MENUBAR, PART_MENU_ITEM ) ) - { - bool bHighlight = pThisItemOnly && bHighlighted; - if ( bHighlight || ImplGetSVData()->maNWFData.mbTransparentMenubar ) - { - Rectangle aRect = Rectangle( Point( aTopLeft.X(), 1 ), Size( pData->aSz.Width(), pWin->GetOutputSizePixel().Height()-2 ) ); - pWin->Push( PUSH_CLIPREGION ); - pWin->IntersectClipRegion( aRect ); - - // draw selected item - MenubarValue aControlValue; - aControlValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( pWin ); - pWin->DrawNativeControl( CTRL_MENUBAR, PART_MENU_ITEM, - aRect, - CTRL_STATE_ENABLED | ( bHighlight? CTRL_STATE_SELECTED: 0 ), - aControlValue, - OUString() ); - - pWin->Pop(); - } - } - // Separator if ( !bLayout && !bIsMenuBar && ( pData->eType == MENUITEM_SEPARATOR ) ) { @@ -3334,9 +3310,6 @@ Window* MenuBar::ImplCreate( Window* pParent, Window* pWindow, MenuBar* pMenu ) ( pMenu->ImplGetSalMenu() && pMenu->ImplGetSalMenu()->VisibleMenuBar() ) ) nHeight = 0; - if ( pParent ) - pParent->ImplGetFrame()->extendWindowManagerFrameNative( 0, 0, nHeight, 0 ); - pWindow->SetPosSizePixel( 0, 0, 0, nHeight, WINDOW_POSSIZE_HEIGHT ); return pWindow; } @@ -3920,18 +3893,6 @@ static void ImplInitMenuWindow( Window* pWin, sal_Bool bFont, sal_Bool bMenuBar pWin->SetTextColor( rStyleSettings.GetMenuTextColor() ); pWin->SetTextFillColor(); pWin->SetLineColor(); - - // update the window manager frame here too in order to be able to switch - // themes - if ( bMenuBar ) - { - const Window *pParent = pWin->GetParent(); - if ( pParent ) - { - Size aSize = pWin->GetSizePixel(); - pParent->ImplGetFrame()->extendWindowManagerFrameNative( 0, 0, aSize.Height(), 0 ); - } - } } MenuFloatingWindow::MenuFloatingWindow( Menu* pMen, Window* pParent, WinBits nStyle ) : @@ -5554,9 +5515,15 @@ void MenuBarWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight ) OUString() ); ImplAddNWFSeparator( this, aControlValue ); - // NWF item highlight is drawn in ImplPaint() instead of - // here, so that we can NWF-paint even the non-higlighted - // items there + if ( bHighlight ) + { + // draw selected item + DrawNativeControl( CTRL_MENUBAR, PART_MENU_ITEM, + aRect, + CTRL_STATE_ENABLED | CTRL_STATE_SELECTED, + aControlValue, + OUString() ); + } } else { diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 40a522b55a76..ed39620c6f61 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -35,10 +35,7 @@ // (found at http://stackoverflow.com/questions/4009701/windows-visual-themes-gallery-of-parts-and-states/4009712#4009712) // // Theme subclasses: -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb773218%28v=vs.85%29.aspx -// -// Drawing in non-client area (general DWM-related info): -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb688195%28v=vs.85%29.aspx +// http://msdn.microsoft.com/en-us/library/windows/desktop/bb773218%28v=vs.85%29.aspx #define _SV_SALNATIVEWIDGETS_CXX @@ -51,7 +48,6 @@ #include "win/svsys.h" #include "win/salgdi.h" #include "win/saldata.hxx" -#include "win/salframe.h" #include "uxtheme.h" #include "vssym32.h" @@ -75,7 +71,6 @@ static ThemeMap aThemeMap; class VisualStylesAPI { private: - // uxtheme.dll functions typedef HTHEME (WINAPI * OpenThemeData_Proc_T) ( HWND hwnd, LPCWSTR pszClassList ); typedef HRESULT (WINAPI * CloseThemeData_Proc_T) ( HTHEME hTheme ); typedef HRESULT (WINAPI * GetThemeBackgroundContentRect_Proc_T) ( HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect ); @@ -92,18 +87,12 @@ private: GetThemePartSize_Proc_T lpfnGetThemePartSize; IsThemeActive_Proc_T lpfnIsThemeActive; - // dwmapi.dll functions - typedef HRESULT (WINAPI * DwmExtendFrameIntoClientArea_Proc_T) ( HWND hWnd, const MARGINS *pMarInset ); - - DwmExtendFrameIntoClientArea_Proc_T lpfnDwmExtendFrameIntoClientArea; - - // module handles of the appropriate dll's - oslModule mhUxthemeModule; - oslModule mhDwmapiModule; + oslModule mhModule; public: VisualStylesAPI(); ~VisualStylesAPI(); + sal_Bool IsAvailable() { return (mhModule != NULL); } HTHEME OpenThemeData( HWND hwnd, LPCWSTR pszClassList ); HRESULT CloseThemeData( HTHEME hTheme ); @@ -112,52 +101,40 @@ public: HRESULT DrawThemeText( HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect ); HRESULT GetThemePartSize( HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *prc, THEMESIZE eSize, SIZE *psz ); BOOL IsThemeActive( void ); - - HRESULT DwmExtendFrameIntoClientArea( HWND hWnd, const MARGINS *pMarInset ); }; static VisualStylesAPI vsAPI; VisualStylesAPI::VisualStylesAPI() - : lpfnOpenThemeData( NULL ), - lpfnCloseThemeData( NULL ), - lpfnGetThemeBackgroundContentRect( NULL ), - lpfnDrawThemeBackground( NULL ), - lpfnDrawThemeText( NULL ), - lpfnGetThemePartSize( NULL ), - lpfnIsThemeActive( NULL ), - lpfnDwmExtendFrameIntoClientArea( NULL ) { - OUString aLibraryName( "uxtheme.dll" ); - mhUxthemeModule = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); + OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM( "uxtheme.dll" ) ); + mhModule = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); - if ( mhUxthemeModule ) + if ( mhModule ) { - lpfnOpenThemeData = (OpenThemeData_Proc_T)osl_getAsciiFunctionSymbol( mhUxthemeModule, "OpenThemeData" ); - lpfnCloseThemeData = (CloseThemeData_Proc_T)osl_getAsciiFunctionSymbol( mhUxthemeModule, "CloseThemeData" ); - lpfnGetThemeBackgroundContentRect = (GetThemeBackgroundContentRect_Proc_T)osl_getAsciiFunctionSymbol( mhUxthemeModule, "GetThemeBackgroundContentRect" ); - lpfnDrawThemeBackground = (DrawThemeBackground_Proc_T)osl_getAsciiFunctionSymbol( mhUxthemeModule, "DrawThemeBackground" ); - lpfnDrawThemeText = (DrawThemeText_Proc_T)osl_getAsciiFunctionSymbol( mhUxthemeModule, "DrawThemeText" ); - lpfnGetThemePartSize = (GetThemePartSize_Proc_T)osl_getAsciiFunctionSymbol( mhUxthemeModule, "GetThemePartSize" ); - lpfnIsThemeActive = (IsThemeActive_Proc_T)osl_getAsciiFunctionSymbol( mhUxthemeModule, "IsThemeActive" ); + lpfnOpenThemeData = (OpenThemeData_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "OpenThemeData" ); + lpfnCloseThemeData = (CloseThemeData_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "CloseThemeData" ); + lpfnGetThemeBackgroundContentRect = (GetThemeBackgroundContentRect_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "GetThemeBackgroundContentRect" ); + lpfnDrawThemeBackground = (DrawThemeBackground_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "DrawThemeBackground" ); + lpfnDrawThemeText = (DrawThemeText_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "DrawThemeText" ); + lpfnGetThemePartSize = (GetThemePartSize_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "GetThemePartSize" ); + lpfnIsThemeActive = (IsThemeActive_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "IsThemeActive" ); } - - aLibraryName = "dwmapi.dll"; - mhDwmapiModule = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); - - if ( mhDwmapiModule ) + else { - lpfnDwmExtendFrameIntoClientArea = (DwmExtendFrameIntoClientArea_Proc_T)osl_getAsciiFunctionSymbol( mhDwmapiModule, "DwmExtendFrameIntoClientArea" ); + lpfnOpenThemeData = NULL; + lpfnCloseThemeData = NULL; + lpfnGetThemeBackgroundContentRect = NULL; + lpfnDrawThemeBackground = NULL; + lpfnDrawThemeText = NULL; + lpfnGetThemePartSize = NULL; } } VisualStylesAPI::~VisualStylesAPI() { - if( mhUxthemeModule ) - osl_unloadModule( mhUxthemeModule ); - - if( mhDwmapiModule ) - osl_unloadModule( mhDwmapiModule ); + if( mhModule ) + osl_unloadModule( mhModule ); } HTHEME VisualStylesAPI::OpenThemeData( HWND hwnd, LPCWSTR pszClassList ) @@ -216,14 +193,6 @@ BOOL VisualStylesAPI::IsThemeActive( void ) return FALSE; } -HRESULT VisualStylesAPI::DwmExtendFrameIntoClientArea( HWND hWnd, const MARGINS *pMarInset ) -{ - if (lpfnDwmExtendFrameIntoClientArea) - return (*lpfnDwmExtendFrameIntoClientArea) ( hWnd, pMarInset ); - else - return S_FALSE; -} - /********************************************************* * Initialize XP theming and local stuff *********************************************************/ @@ -492,7 +461,7 @@ void ImplConvertSpinbuttonValues( int nControlPart, const ControlState& rState, // ---- -sal_Bool ImplDrawNativeControl( HWND hWnd, HDC hDC, HTHEME hTheme, RECT rc, +sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, ControlType nType, ControlPart nPart, ControlState nState, @@ -974,22 +943,12 @@ sal_Bool ImplDrawNativeControl( HWND hWnd, HDC hDC, HTHEME hTheme, RECT rc, { if( nPart == PART_ENTIRE_CONTROL ) { - if( ImplGetSVData()->maNWFData.mbTransparentMenubar ) + if( aValue.getType() == CTRL_MENUBAR ) { - // When the frame is correctly extended to the client area, - // Aero just needs us to repaint the affected rectangle in black - FillRect( hDC, &rc, static_cast< HBRUSH >( GetStockObject( BLACK_BRUSH ) ) ); - return sal_True; - } - else - { - if( aValue.getType() == CTRL_MENUBAR ) - { - const MenubarValue *pValue = static_cast<const MenubarValue*>(&aValue); - rc.bottom += pValue->maTopDockingAreaHeight; // extend potential gradient to cover docking area as well - } - return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); + const MenubarValue *pValue = static_cast<const MenubarValue*>(&aValue); + rc.bottom += pValue->maTopDockingAreaHeight; // extend potential gradient to cover docking area as well } + return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); } else if( nPart == PART_MENU_ITEM ) { @@ -997,25 +956,6 @@ sal_Bool ImplDrawNativeControl( HWND hWnd, HDC hDC, HTHEME hTheme, RECT rc, iState = (nState & CTRL_STATE_SELECTED) ? MBI_HOT : MBI_NORMAL; else iState = (nState & CTRL_STATE_SELECTED) ? MBI_DISABLEDHOT : MBI_DISABLED; - - // draw the text glow so that the text is better visible - if ( ImplGetSVData()->maNWFData.mbTransparentMenubar ) - { - HTHEME hGlowTheme = getThemeHandle( hWnd, L"TextGlow"); - if ( !hTheme ) - return sal_False; - - // I have no idea what is the correct name of the contstant - // that is represented by '1' below - but that draws the glow - // effect - // I've found the "TextGlow" theme handle here: - // http://fc01.deviantart.net/fs26/f/2008/154/0/6/Vista_Visual_Style_Classes_by_UkIntel.html - // and its rendering here: - // http://deskmodder.de/wiki/index.php/Vista_msstyleImage_900-938 - // No better documentation on the topic, unfortunately :-( - ImplDrawTheme( hGlowTheme, hDC, 1, MBI_NORMAL, rc, aCaption ); - } - return ImplDrawTheme( hTheme, hDC, MENU_BARITEM, iState, rc, aCaption ); } } @@ -1296,7 +1236,7 @@ sal_Bool WinSalGraphics::drawNativeControl( ControlType nType, int ta = SetTextAlign( mhDC, TA_LEFT|TA_TOP|TA_NOUPDATECP ); OUString aCaptionStr( aCaption.replace('~', '&') ); // translate mnemonics - bOk = ImplDrawNativeControl(mhWnd, mhDC, hTheme, rc, + bOk = ImplDrawNativeControl(mhDC, hTheme, rc, nType, nPart, nState, aValue, aCaptionStr ); @@ -1554,20 +1494,4 @@ void WinSalGraphics::updateSettingsNative( AllSettings& rSettings ) rSettings.SetStyleSettings( aStyleSettings ); } -void WinSalFrame::extendWindowManagerFrameNative( int nLeft, int nRight, int nTop, int nBottom ) -{ - // nothing to do for Windows before Vista - if( aSalShlData.maVersionInfo.dwMajorVersion < 6 || !vsAPI.IsThemeActive() ) - return; - - MARGINS aMargins = { nLeft, nRight, nTop, nBottom }; - HRESULT nRet = vsAPI.DwmExtendFrameIntoClientArea( mhWnd, &aMargins ); - - ImplSVData* pSVData = ImplGetSVData(); - if( nRet == S_OK ) - pSVData->maNWFData.mbTransparentMenubar = true; - else - pSVData->maNWFData.mbTransparentMenubar = false; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |