include/vcl/menu.hxx | 15 ++++++++------- include/vcl/menubarupdateicon.hxx | 7 ++++--- vcl/source/window/bubblewindow.cxx | 4 ++-- vcl/source/window/menu.cxx | 4 ++-- vcl/source/window/menubarwindow.cxx | 10 +++++----- vcl/source/window/menubarwindow.hxx | 8 ++++---- 6 files changed, 25 insertions(+), 23 deletions(-)
New commits: commit b98ff21fa7132a3eb606a6441f5ebd0162453baa Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Nov 27 20:51:10 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Nov 28 11:14:09 2021 +0100 don't need to include vcl/menu.hxx from vcl/menubarupdateicon.hxx Change-Id: Iefb4e08ebf0c2c15b11cfc1d807ae9dc50326923 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125954 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 7834fe22519e..b0d7245cf72c 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -399,6 +399,12 @@ public: const OUString& get_id() const { return maID; } }; +struct MenuBarButtonCallbackArg +{ + sal_uInt16 nId; // Id of the button + bool bHighlight; // highlight on/off +}; + class VCL_DLLPUBLIC MenuBar final : public Menu { Link<void*,void> maCloseHdl; @@ -456,19 +462,14 @@ public: void SetDisplayable( bool bDisplayable ); bool IsDisplayable() const { return mbDisplayable; } - struct MenuBarButtonCallbackArg - { - sal_uInt16 nId; // Id of the button - bool bHighlight; // highlight on/off - }; // add an arbitrary button to the menubar (will appear next to closer) // passed link will be call with a MenuBarButtonCallbackArg on press // passed string will be set as tooltip - sal_uInt16 AddMenuBarButton( const Image&, const Link<MenuBar::MenuBarButtonCallbackArg&,bool>&, const OUString& ); + sal_uInt16 AddMenuBarButton( const Image&, const Link<MenuBarButtonCallbackArg&,bool>&, const OUString& ); // set the highlight link for additional button with ID nId // highlight link will be called with a MenuBarButtonHighlightArg // the bHighlight member of that struct shall contain the new state - void SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<MenuBar::MenuBarButtonCallbackArg&,bool>& ); + void SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<MenuBarButtonCallbackArg&,bool>& ); // returns the rectangle occupied by the additional button named nId // coordinates are relative to the systemwindow the menubar is attached to // if the menubar is unattached an empty rectangle is returned diff --git a/include/vcl/menubarupdateicon.hxx b/include/vcl/menubarupdateicon.hxx index 9cb3b397dfa1..f9b2932aa55c 100644 --- a/include/vcl/menubarupdateicon.hxx +++ b/include/vcl/menubarupdateicon.hxx @@ -22,12 +22,13 @@ #include <tools/link.hxx> #include <vcl/idle.hxx> #include <vcl/image.hxx> -#include <vcl/menu.hxx> class BubbleWindow; +class MenuBar; class SystemWindow; class VclSimpleEvent; class VclWindowEvent; +struct MenuBarButtonCallbackArg; class VCL_DLLPUBLIC MenuBarUpdateIconManager { @@ -57,8 +58,8 @@ private: DECL_DLLPRIVATE_LINK(WindowEventHdl, VclWindowEvent&, void); DECL_DLLPRIVATE_LINK(ApplicationEventHdl, VclSimpleEvent&, void); DECL_DLLPRIVATE_LINK(WaitTimeOutHdl, Timer*, void); - DECL_DLLPRIVATE_LINK(ClickHdl, MenuBar::MenuBarButtonCallbackArg&, bool); - DECL_DLLPRIVATE_LINK(HighlightHdl, MenuBar::MenuBarButtonCallbackArg&, bool); + DECL_DLLPRIVATE_LINK(ClickHdl, MenuBarButtonCallbackArg&, bool); + DECL_DLLPRIVATE_LINK(HighlightHdl, MenuBarButtonCallbackArg&, bool); VclPtr<BubbleWindow> GetBubbleWindow(); void SetBubbleChanged(); diff --git a/vcl/source/window/bubblewindow.cxx b/vcl/source/window/bubblewindow.cxx index 76fcf308d7a6..1a4a46a3fea2 100644 --- a/vcl/source/window/bubblewindow.cxx +++ b/vcl/source/window/bubblewindow.cxx @@ -365,7 +365,7 @@ IMPL_LINK_NOARG(MenuBarUpdateIconManager, UserEventHdl, void*, void) AddMenuBarIcon( pActiveSysWin, true ); } -IMPL_LINK_NOARG(MenuBarUpdateIconManager, ClickHdl, MenuBar::MenuBarButtonCallbackArg&, bool) +IMPL_LINK_NOARG(MenuBarUpdateIconManager, ClickHdl, MenuBarButtonCallbackArg&, bool) { maWaitIdle.Stop(); if ( mpBubbleWin ) @@ -376,7 +376,7 @@ IMPL_LINK_NOARG(MenuBarUpdateIconManager, ClickHdl, MenuBar::MenuBarButtonCallba return false; } -IMPL_LINK(MenuBarUpdateIconManager, HighlightHdl, MenuBar::MenuBarButtonCallbackArg&, rData, bool) +IMPL_LINK(MenuBarUpdateIconManager, HighlightHdl, MenuBarButtonCallbackArg&, rData, bool) { if ( rData.bHighlight ) maWaitIdle.Start(); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 96797979558c..591a429108b0 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2635,13 +2635,13 @@ bool Menu::HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nCommandEventId ) con return false; } -sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link<MenuBar::MenuBarButtonCallbackArg&,bool>& i_rLink, const OUString& i_rToolTip ) +sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link<MenuBarButtonCallbackArg&,bool>& i_rLink, const OUString& i_rToolTip ) { MenuBarWindow* pMenuWin = getMenuBarWindow(); return pMenuWin ? pMenuWin->AddMenuBarButton(i_rImage, i_rLink, i_rToolTip) : 0; } -void MenuBar::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<MenuBar::MenuBarButtonCallbackArg&,bool>& rLink ) +void MenuBar::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<MenuBarButtonCallbackArg&,bool>& rLink ) { MenuBarWindow* pMenuWin = getMenuBarWindow(); if (!pMenuWin) diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index f63c0b4127f4..2588b387fa85 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -229,7 +229,7 @@ IMPL_LINK_NOARG(MenuBarWindow, CloseHdl, ToolBox *, void) std::map<sal_uInt16,AddButtonEntry>::iterator it = m_aAddButtons.find(sal_uInt16(m_aCloseBtn->GetCurItemId())); if( it != m_aAddButtons.end() ) { - MenuBar::MenuBarButtonCallbackArg aArg; + MenuBarButtonCallbackArg aArg; aArg.nId = it->first; aArg.bHighlight = (sal_uInt16(m_aCloseBtn->GetHighlightItemId()) == it->first); it->second.m_aSelectLink.Call( aArg ); @@ -242,7 +242,7 @@ IMPL_LINK( MenuBarWindow, ToolboxEventHdl, VclWindowEvent&, rEvent, void ) if( ! m_pMenu ) return; - MenuBar::MenuBarButtonCallbackArg aArg; + MenuBarButtonCallbackArg aArg; aArg.nId = 0xffff; aArg.bHighlight = (rEvent.GetId() == VclEventId::ToolboxHighlight); if( rEvent.GetId() == VclEventId::ToolboxHighlight ) @@ -1125,7 +1125,7 @@ css::uno::Reference<css::accessibility::XAccessible> MenuBarWindow::CreateAccess return xAcc; } -sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link<MenuBar::MenuBarButtonCallbackArg&,bool>& i_rLink, const OUString& i_rToolTip ) +sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link<MenuBarButtonCallbackArg&,bool>& i_rLink, const OUString& i_rToolTip ) { // find first free button id sal_uInt16 nId = IID_DOCUMENTCLOSE; @@ -1149,7 +1149,7 @@ sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link<Me return nId; } -void MenuBarWindow::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<MenuBar::MenuBarButtonCallbackArg&,bool>& rLink ) +void MenuBarWindow::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<MenuBarButtonCallbackArg&,bool>& rLink ) { std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( nId ); if( it != m_aAddButtons.end() ) @@ -1198,7 +1198,7 @@ bool MenuBarWindow::HandleMenuButtonEvent( sal_uInt16 i_nButtonId ) std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( i_nButtonId ); if( it != m_aAddButtons.end() ) { - MenuBar::MenuBarButtonCallbackArg aArg; + MenuBarButtonCallbackArg aArg; aArg.nId = it->first; aArg.bHighlight = true; return it->second.m_aSelectLink.Call( aArg ); diff --git a/vcl/source/window/menubarwindow.hxx b/vcl/source/window/menubarwindow.hxx index 144607cce2d6..cc7963a1bed0 100644 --- a/vcl/source/window/menubarwindow.hxx +++ b/vcl/source/window/menubarwindow.hxx @@ -64,8 +64,8 @@ class MenuBarWindow : public vcl::Window, public MenuWindow private: struct AddButtonEntry { - Link<MenuBar::MenuBarButtonCallbackArg&,bool> m_aSelectLink; - Link<MenuBar::MenuBarButtonCallbackArg&,bool> m_aHighlightLink; + Link<MenuBarButtonCallbackArg&,bool> m_aSelectLink; + Link<MenuBarButtonCallbackArg&,bool> m_aHighlightLink; }; VclPtr<Menu> m_pMenu; @@ -131,8 +131,8 @@ public: Size const & MinCloseButtonSize() const; /// Add an arbitrary button to the menubar that will appear next to the close button. - sal_uInt16 AddMenuBarButton(const Image&, const Link<MenuBar::MenuBarButtonCallbackArg&,bool>&, const OUString&); - void SetMenuBarButtonHighlightHdl(sal_uInt16 nId, const Link<MenuBar::MenuBarButtonCallbackArg&,bool>&); + sal_uInt16 AddMenuBarButton(const Image&, const Link<MenuBarButtonCallbackArg&,bool>&, const OUString&); + void SetMenuBarButtonHighlightHdl(sal_uInt16 nId, const Link<MenuBarButtonCallbackArg&,bool>&); tools::Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId); void RemoveMenuBarButton(sal_uInt16 nId); bool HandleMenuButtonEvent(sal_uInt16 i_nButtonId);