Kaydet (Commit) a519c883 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

No need for IMenuBarWindow abstraction

Change-Id: I5be4cfb951100d36054e409043cb9becbe52338d
üst 8be00a3f
......@@ -48,7 +48,7 @@ class CommandEvent;
class MenuFloatingWindow;
namespace vcl { class Window; }
class SalMenu;
class IMenuBarWindow;
class MenuBarWindow;
struct SystemMenuData;
enum class FloatWinPopupFlags;
......@@ -434,8 +434,8 @@ class VCL_DLLPUBLIC MenuBar : public Menu
protected:
/// Return the IMenuBarWindow interface.
IMenuBarWindow* getMenuBarWindow();
/// Return the MenuBarWindow.
MenuBarWindow* getMenuBarWindow();
public:
MenuBar();
......
......@@ -2459,12 +2459,12 @@ void Menu::HighlightItem( sal_uInt16 nItemPos )
}
// - MenuBar -
IMenuBarWindow* MenuBar::getMenuBarWindow()
MenuBarWindow* MenuBar::getMenuBarWindow()
{
// so far just a dynamic_cast, hopefully to be turned into something saner
// at some stage
IMenuBarWindow *pWin = dynamic_cast<IMenuBarWindow*>(pWindow.get());
//either there is no window (fdo#87663) or it is an IMenuBarWindow
MenuBarWindow *pWin = dynamic_cast<MenuBarWindow*>(pWindow.get());
//either there is no window (fdo#87663) or it is a MenuBarWindow
assert(!pWindow || pWin);
return pWin;
}
......@@ -2497,7 +2497,7 @@ MenuBar::~MenuBar()
void MenuBar::ClosePopup(Menu *pMenu)
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
MenuBarWindow* pMenuWin = getMenuBarWindow();
if (!pMenuWin)
return;
pMenuWin->PopupClosed(pMenu);
......@@ -2505,7 +2505,7 @@ void MenuBar::ClosePopup(Menu *pMenu)
sal_uLong MenuBar::DeactivateMenuBar(sal_uLong nFocusId)
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
MenuBarWindow* pMenuWin = getMenuBarWindow();
nFocusId = pMenuWin ? pMenuWin->GetFocusId() : 0;
if (nFocusId)
{
......@@ -2535,7 +2535,7 @@ void MenuBar::ShowButtons( bool bClose, bool bFloat, bool bHide )
mbCloseBtnVisible = bClose;
mbFloatBtnVisible = bFloat;
mbHideBtnVisible = bHide;
IMenuBarWindow* pMenuWin = getMenuBarWindow();
MenuBarWindow* pMenuWin = getMenuBarWindow();
if (pMenuWin)
pMenuWin->ShowButtons(bClose, bFloat, bHide);
}
......@@ -2546,7 +2546,7 @@ void MenuBar::SetDisplayable( bool bDisplayable )
if( bDisplayable != mbDisplayable )
{
mbDisplayable = bDisplayable;
IMenuBarWindow* pMenuWin = getMenuBarWindow();
MenuBarWindow* pMenuWin = getMenuBarWindow();
if (pMenuWin)
pMenuWin->LayoutChanged();
}
......@@ -2581,7 +2581,7 @@ void MenuBar::ImplDestroy( MenuBar* pMenu, bool bDelete )
vcl::Window *pWindow = pMenu->ImplGetWindow();
if (pWindow && bDelete)
{
IMenuBarWindow* pMenuWin = pMenu->getMenuBarWindow();
MenuBarWindow* pMenuWin = pMenu->getMenuBarWindow();
if (pMenuWin)
pMenuWin->KillActivePopup();
pWindow->disposeOnce();
......@@ -2602,7 +2602,7 @@ bool MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu )
vcl::Window* pWin = ImplGetWindow();
if (pWin && pWin->IsEnabled() && pWin->IsInputEnabled() && !pWin->IsInModalMode())
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
MenuBarWindow* pMenuWin = getMenuBarWindow();
bDone = pMenuWin && pMenuWin->HandleKeyEvent(rKEvent, bFromMenu);
}
return bDone;
......@@ -2646,7 +2646,7 @@ void MenuBar::SelectItem(sal_uInt16 nId)
pWindow->GrabFocus();
nId = GetItemPos( nId );
IMenuBarWindow* pMenuWin = getMenuBarWindow();
MenuBarWindow* pMenuWin = getMenuBarWindow();
if (pMenuWin)
{
// #99705# popup the selected menu
......@@ -2736,13 +2736,13 @@ bool MenuBar::HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nCommandEventId )
sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link<>& i_rLink, const OUString& i_rToolTip )
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
MenuBarWindow* pMenuWin = getMenuBarWindow();
return pMenuWin ? pMenuWin->AddMenuBarButton(i_rImage, i_rLink, i_rToolTip) : 0;
}
void MenuBar::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<>& rLink )
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
MenuBarWindow* pMenuWin = getMenuBarWindow();
if (!pMenuWin)
return;
pMenuWin->SetMenuBarButtonHighlightHdl(nId, rLink);
......@@ -2750,13 +2750,13 @@ void MenuBar::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<>& rLink
Rectangle MenuBar::GetMenuBarButtonRectPixel( sal_uInt16 nId )
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
MenuBarWindow* pMenuWin = getMenuBarWindow();
return pMenuWin ? pMenuWin->GetMenuBarButtonRectPixel(nId) : Rectangle();
}
void MenuBar::RemoveMenuBarButton( sal_uInt16 nId )
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
MenuBarWindow* pMenuWin = getMenuBarWindow();
if (!pMenuWin)
return;
pMenuWin->RemoveMenuBarButton(nId);
......@@ -2764,7 +2764,7 @@ void MenuBar::RemoveMenuBarButton( sal_uInt16 nId )
bool MenuBar::HandleMenuButtonEvent( Menu *, sal_uInt16 i_nButtonId )
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
MenuBarWindow* pMenuWin = getMenuBarWindow();
return pMenuWin && pMenuWin->HandleMenuButtonEvent(i_nButtonId);
}
......
......@@ -59,7 +59,7 @@ public:
/** Class that implements the actual window of the menu bar.
*/
class MenuBarWindow : public vcl::Window, public IMenuBarWindow
class MenuBarWindow : public vcl::Window, public MenuWindow
{
friend class MenuBar;
friend class Menu;
......@@ -92,11 +92,11 @@ private:
std::map< sal_uInt16, AddButtonEntry > m_aAddButtons;
void HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight);
virtual void ChangeHighlightItem(sal_uInt16 n, bool bSelectPopupEntry, bool bAllowRestoreFocus = true, bool bDefaultToDocument = true) SAL_OVERRIDE;
void ChangeHighlightItem(sal_uInt16 n, bool bSelectPopupEntry, bool bAllowRestoreFocus = true, bool bDefaultToDocument = true);
sal_uInt16 ImplFindEntry( const Point& rMousePos ) const;
void ImplCreatePopup( bool bPreSelectFirst );
virtual bool HandleKeyEvent(const KeyEvent& rKEvent, bool bFromMenu = true) SAL_OVERRIDE;
bool HandleKeyEvent(const KeyEvent& rKEvent, bool bFromMenu = true);
Rectangle ImplGetItemRect( sal_uInt16 nPos );
void ImplInitStyleSettings();
......@@ -119,7 +119,7 @@ public:
virtual ~MenuBarWindow();
virtual void dispose() SAL_OVERRIDE;
virtual void ShowButtons(bool bClose, bool bFloat, bool bHide) SAL_OVERRIDE;
void ShowButtons(bool bClose, bool bFloat, bool bHide);
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
......@@ -129,26 +129,26 @@ public:
virtual void Resize() SAL_OVERRIDE;
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
virtual void SetFocusId(sal_uLong nId) SAL_OVERRIDE { nSaveFocusId = nId; }
virtual sal_uLong GetFocusId() const SAL_OVERRIDE { return nSaveFocusId; }
void SetFocusId(sal_uLong nId) { nSaveFocusId = nId; }
sal_uLong GetFocusId() const { return nSaveFocusId; }
virtual void SetMenu(MenuBar* pMenu) SAL_OVERRIDE;
virtual void SetHeight(long nHeight) SAL_OVERRIDE;
virtual void KillActivePopup() SAL_OVERRIDE;
virtual void PopupClosed(Menu* pMenu) SAL_OVERRIDE;
virtual sal_uInt16 GetHighlightedItem() const SAL_OVERRIDE { return nHighlightedItem; }
void SetMenu(MenuBar* pMenu);
void SetHeight(long nHeight);
void KillActivePopup();
void PopupClosed(Menu* pMenu);
sal_uInt16 GetHighlightedItem() const { return nHighlightedItem; }
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE;
virtual void SetAutoPopup(bool bAuto) SAL_OVERRIDE { mbAutoPopup = bAuto; }
virtual void LayoutChanged() SAL_OVERRIDE;
void SetAutoPopup(bool bAuto) { mbAutoPopup = bAuto; }
void LayoutChanged();
Size MinCloseButtonSize();
/// Add an arbitrary button to the menubar that will appear next to the close button.
virtual sal_uInt16 AddMenuBarButton(const Image&, const Link<>&, const OUString&) SAL_OVERRIDE;
virtual void SetMenuBarButtonHighlightHdl(sal_uInt16 nId, const Link<>&) SAL_OVERRIDE;
virtual Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId) SAL_OVERRIDE;
virtual void RemoveMenuBarButton(sal_uInt16 nId) SAL_OVERRIDE;
virtual bool HandleMenuButtonEvent(sal_uInt16 i_nButtonId) SAL_OVERRIDE;
sal_uInt16 AddMenuBarButton(const Image&, const Link<>&, const OUString&);
void SetMenuBarButtonHighlightHdl(sal_uInt16 nId, const Link<>&);
Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId);
void RemoveMenuBarButton(sal_uInt16 nId);
bool HandleMenuButtonEvent(sal_uInt16 i_nButtonId);
virtual void SetMBWHideAccel (bool val) { mbHideAccel = val; }
virtual bool GetMBWHideAccel (void) const { return mbHideAccel; }
virtual void SetMBWMenuKey (bool val) { mbMenuKey = val; }
......
......@@ -58,35 +58,5 @@ public:
const HelpEvent& rHEvt, const Rectangle &rHighlightRect);
};
/// Interface for the MenuBarWindow functionality.
class IMenuBarWindow : public MenuWindow
{
public:
virtual ~IMenuBarWindow() {}
virtual sal_uLong GetFocusId() const = 0;
virtual void SetFocusId(sal_uLong nId) = 0;
virtual bool HandleKeyEvent(const KeyEvent& rKEvent, bool bFromMenu = true) = 0;
virtual void LayoutChanged() = 0;
virtual void PopupClosed(Menu* pMenu) = 0;
virtual void ShowButtons(bool bClose, bool bFloat, bool bHide) = 0;
virtual void ChangeHighlightItem(sal_uInt16 n, bool bSelectPopupEntry, bool bAllowRestoreFocus = true, bool bDefaultToDocument = true ) = 0;
virtual sal_uInt16 GetHighlightedItem() const = 0;
virtual void SetAutoPopup(bool bAuto) = 0;
virtual void SetMenu(MenuBar* pMenu) = 0;
virtual void SetHeight(long nHeight) = 0;
virtual void KillActivePopup() = 0;
/// Add an arbitrary button to the menubar that will appear next to the close button.
virtual sal_uInt16 AddMenuBarButton(const Image&, const Link<>&, const OUString&) = 0;
virtual void SetMenuBarButtonHighlightHdl(sal_uInt16 nId, const Link<>&) = 0;
virtual Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId) = 0;
virtual void RemoveMenuBarButton(sal_uInt16 nId) = 0;
virtual bool HandleMenuButtonEvent(sal_uInt16 i_nButtonId) = 0;
};
#endif // INCLUDED_VCL_SOURCE_WINDOW_MENUWINDOW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment