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 <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2021-11-27 20:51:10 +00:00
parent bc4e3a1ef4
commit b98ff21fa7
6 changed files with 25 additions and 23 deletions

View file

@ -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

View file

@ -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();

View file

@ -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();

View file

@ -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)

View file

@ -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 );

View file

@ -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);