diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-10-31 22:01:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-02 09:55:20 +0100 |
commit | a0eab90bd1f7fc31978da3f7be0ec86781baf8bc (patch) | |
tree | db82393a579042e4463f65dc47b5f30688d4df70 /vcl | |
parent | 22c88a039a557343ab11fbf7abc8f2a087e1a3c2 (diff) |
toolbox always has flat style
ever since
commit c1cd6af623e86b5b1b45f9d09dc17d6fbb907f02
Author: Jens-Heiner Rechtien <hr@openoffice.org>
Date: Mon May 10 14:51:02 2004 +0000
INTEGRATION: CWS nwf (1.64.66); FILE MERGED
2004/03/31 09:28:33 ssa 1.64.66.1: #i25130# force flat toolbox buttons
except for a completely and utterly undocumented hack of a registry key,
introduced in
commit 736dc0956a50315ec72ad126406556657a750d37
Author: Rüdiger Timm <rt@openoffice.org>
Date: Thu Apr 17 14:19:46 2003 +0000
INTEGRATION: CWS vcl08 (1.57.2.4.18); FILE MERGED
2003/04/14 17:46:27 ssa 1.57.2.4.18.1: #108699# disabled flat toolbox buttons not exported anymore
which only seems to apply to Windows.
So just remove this.
Change-Id: Idf315b8c89c3119883a5e6880d003d379fe6faec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105155
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/menubarwindow.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 101 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 21 |
3 files changed, 20 insertions, 104 deletions
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 863f4c9dbb09..84e9ec332966 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -72,7 +72,6 @@ void DecoToolBox::calcMinSize() aTbx->InsertItem( nId, GetItemImage( nId ) ); } } - aTbx->SetOutStyle( TOOLBOX_STYLE_FLAT ); maMinSize = aTbx->CalcWindowSizePixel(); aTbx.disposeAndClear(); @@ -129,7 +128,6 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) : m_aCloseBtn->maImage = Image(StockImage::Yes, SV_RESID_BITMAP_CLOSEDOC); - m_aCloseBtn->SetOutStyle(TOOLBOX_STYLE_FLAT); m_aCloseBtn->SetBackground(); m_aCloseBtn->SetPaintTransparent(true); m_aCloseBtn->SetParentClipMode(ParentClipMode::NoClip); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index ae9afe30250f..289f9e522954 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -1109,7 +1109,6 @@ void ToolBox::ImplInitToolBoxData() mnRightBorder = 0; mnBottomBorder = 0; mnLastResizeDY = 0; - mnOutStyle = TOOLBOX_STYLE_FLAT; // force flat buttons since NWF mnHighItemId = 0; mnCurItemId = 0; mnDownItemId = 0; @@ -1358,8 +1357,6 @@ bool ToolBox::ImplCalcItem() if ( !mbCalc ) return false; - ImplDisableFlatButtons(); - OutputDevice *pDefault = Application::GetDefaultDevice(); float fScaleFactor = pDefault ? pDefault->GetDPIScaleFactor() : 1.0; @@ -2560,8 +2557,6 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si // execute pending paint requests ImplCheckUpdate(); - ImplDisableFlatButtons(); - rRenderContext.SetFillColor(); ImplToolItem* pItem = &mpData->m_aItems[nPos]; @@ -2596,11 +2591,8 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si tools::Long nImageOffY = 0; DrawButtonFlags nStyle = DrawButtonFlags::NONE; - // draw separators in flat style only - if ( (mnOutStyle & TOOLBOX_STYLE_FLAT) && - (pItem->meType == ToolBoxItemType::SEPARATOR) && - nPos > 0 - ) + // draw separators + if ( (pItem->meType == ToolBoxItemType::SEPARATOR) && nPos > 0 ) { ImplDrawSeparator(rRenderContext, nPos, aButtonRect); } @@ -2622,15 +2614,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si nStyle |= DrawButtonFlags::Pressed; } - if ( mnOutStyle & TOOLBOX_STYLE_FLAT ) - { - ImplErase(rRenderContext, pItem->maRect, nHighlight != 0, bHasOpenPopup ); - } - else - { - DecorationView aDecoView(&rRenderContext); - aDecoView.DrawButton(aButtonRect, nStyle); - } + ImplErase(rRenderContext, pItem->maRect, nHighlight != 0, bHasOpenPopup ); nOffX += pItem->maRect.Left(); nOffY += pItem->maRect.Top(); @@ -2944,8 +2928,6 @@ bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat ) bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel ) { - ImplDisableFlatButtons(); - if ( !mpData ) return false; @@ -3054,8 +3036,6 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) if ( ImplHandleMouseMove( rMEvt ) ) return; - ImplDisableFlatButtons(); - Point aMousePos = rMEvt.GetPosPixel(); // only highlight when the focus is not inside a child window of a toolbox @@ -3118,7 +3098,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) } } - if ( bDrawHotSpot && ( (mnOutStyle & TOOLBOX_STYLE_FLAT) || !mnOutStyle ) ) + if ( bDrawHotSpot ) { bool bClearHigh = true; if ( !rMEvt.IsLeaveWindow() && (mnCurPos == ITEM_NOTFOUND) ) @@ -3130,28 +3110,25 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) { if ( (item.meType == ToolBoxItemType::BUTTON) && item.mbEnabled ) { - if ( !mnOutStyle || (mnOutStyle & TOOLBOX_STYLE_FLAT) ) + bClearHigh = false; + if ( mnHighItemId != item.mnId ) { - bClearHigh = false; - if ( mnHighItemId != item.mnId ) + if ( mnHighItemId ) + { + ImplHideFocus(); + ImplToolItems::size_type nPos = GetItemPos( mnHighItemId ); + InvalidateItem(nPos); + CallEventListeners( VclEventId::ToolboxHighlightOff, reinterpret_cast< void* >( nPos ) ); + } + if ( mpData->mbMenubuttonSelected ) { - if ( mnHighItemId ) - { - ImplHideFocus(); - ImplToolItems::size_type nPos = GetItemPos( mnHighItemId ); - InvalidateItem(nPos); - CallEventListeners( VclEventId::ToolboxHighlightOff, reinterpret_cast< void* >( nPos ) ); - } - if ( mpData->mbMenubuttonSelected ) - { - // remove highlight from menubutton - InvalidateMenuButton(); - } - mnHighItemId = item.mnId; - InvalidateItem(nTempPos); - ImplShowFocus(); - CallEventListeners( VclEventId::ToolboxHighlight ); + // remove highlight from menubutton + InvalidateMenuButton(); } + mnHighItemId = item.mnId; + InvalidateItem(nTempPos); + ImplShowFocus(); + CallEventListeners( VclEventId::ToolboxHighlight ); } } break; @@ -4850,44 +4827,6 @@ void ToolBox::ImplHideFocus() } } -void ToolBox::ImplDisableFlatButtons() -{ -#ifdef _WIN32 // Check in the Windows registry if an AT tool wants no flat toolboxes - static bool bInit = false, bValue = false; - if( ! bInit ) - { - bInit = true; - HKEY hkey; - - if( ERROR_SUCCESS == RegOpenKeyW(HKEY_CURRENT_USER, L"Software\\LibreOffice\\Accessibility\\AtToolSupport", &hkey) ) - { - DWORD dwType = 0; - wchar_t Data[6]; // possible values: "true", "false", "1", "0", DWORD - DWORD cbData = sizeof(Data); - - if( ERROR_SUCCESS == RegQueryValueExW(hkey, L"DisableFlatToolboxButtons", - nullptr, &dwType, reinterpret_cast<LPBYTE>(Data), &cbData) ) - { - switch (dwType) - { - case REG_SZ: - bValue = ((0 == wcsicmp(Data, L"1")) || (0 == wcsicmp(Data, L"true"))); - break; - case REG_DWORD: - bValue = static_cast<bool>(reinterpret_cast<DWORD *>(Data)[0]); - break; - } - } - RegCloseKey(hkey); - } - } - if( bValue ) - mnOutStyle &= ~TOOLBOX_STYLE_FLAT; -#else - (void) this; // loplugin:staticmethods -#endif -} - void ToolBox::SetToolbarLayoutMode( ToolBoxLayoutMode eLayout ) { if ( meLayoutMode != eLayout ) diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 56abd3cea7ae..047ca8c37621 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1376,27 +1376,6 @@ void ToolBox::SetHelpId( sal_uInt16 nItemId, const OString& rHelpId ) pItem->maHelpId = rHelpId; } -void ToolBox::SetOutStyle( sal_uInt16 nNewStyle ) -{ - // always force flat looking toolbars since NWF - nNewStyle |= TOOLBOX_STYLE_FLAT; - - if ( mnOutStyle == nNewStyle ) - return; - - mnOutStyle = nNewStyle; - ImplDisableFlatButtons(); - - // so as to redo the ButtonDevice - if ( !(mnOutStyle & TOOLBOX_STYLE_FLAT) ) - { - mnMaxItemWidth = 1; - mnMaxItemHeight = 1; - } - - ImplInvalidate( true, true ); -} - // disable key input if all items are disabled void ToolBox::ImplUpdateInputEnable() { |