diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-06-16 20:01:32 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-07-28 11:58:04 +0200 |
commit | 10926dd227d366b25bf79cffcbf8628355be250c (patch) | |
tree | c9950714255f4e9e1722da439c87e8e454155db5 /vcl | |
parent | 6eb9fde88af245a00247fca8a592ed08ee4b8bbe (diff) |
Move SalInstancePopover decl to header file
Change-Id: I58d021d3e4a3f5d4b8b805380526c1d32b782674
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117345
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119563
Tested-by: Jenkins
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/salvtables.hxx | 17 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 79 |
2 files changed, 51 insertions, 45 deletions
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 74d8179ea356..3d5dc97a3a31 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -1884,4 +1884,21 @@ public: virtual ~SalInstanceMenuButton() override; }; +class SalInstancePopover : public SalInstanceContainer, public virtual weld::Popover +{ +private: + VclPtr<DockingWindow> m_xPopover; + + DECL_LINK(PopupModeEndHdl, FloatingWindow*, void); + +public: + SalInstancePopover(DockingWindow* pPopover, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + ~SalInstancePopover(); + + virtual void popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) override; + + virtual void popdown() override; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 2dd874c97843..3abcd7ad5ecb 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -6638,54 +6638,43 @@ IMPL_LINK(SalInstanceEntryTreeView, AutocompleteHdl, Edit&, rEdit, void) } } -namespace -{ -class SalInstancePopover : public SalInstanceContainer, public virtual weld::Popover +SalInstancePopover::SalInstancePopover(DockingWindow* pPopover, SalInstanceBuilder* pBuilder, + bool bTakeOwnership) + : SalInstanceContainer(pPopover, pBuilder, bTakeOwnership) + , m_xPopover(pPopover) { -private: - VclPtr<DockingWindow> m_xPopover; - - DECL_LINK(PopupModeEndHdl, FloatingWindow*, void); - -public: - SalInstancePopover(DockingWindow* pPopover, SalInstanceBuilder* pBuilder, bool bTakeOwnership) - : SalInstanceContainer(pPopover, pBuilder, bTakeOwnership) - , m_xPopover(pPopover) - { - } - - ~SalInstancePopover() { signal_closed(); } - - virtual void popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) override - { - SalInstanceWidget* pVclWidget = dynamic_cast<SalInstanceWidget*>(pParent); - assert(pVclWidget); - vcl::Window* pWidget = pVclWidget->getWidget(); - - tools::Rectangle aRect; - Point aPt = pWidget->OutputToScreenPixel(rRect.TopLeft()); - aRect.SetLeft(aPt.X()); - aRect.SetTop(aPt.Y()); - aPt = pWidget->OutputToScreenPixel(rRect.BottomRight()); - aRect.SetRight(aPt.X()); - aRect.SetBottom(aPt.Y()); +} - FloatWinPopupFlags nFlags = FloatWinPopupFlags::Down | FloatWinPopupFlags::GrabFocus - | FloatWinPopupFlags::NoMouseUpClose; - m_xPopover->EnableDocking(); - DockingManager* pDockingManager = vcl::Window::GetDockingManager(); - pDockingManager->SetPopupModeEndHdl(m_xPopover, - LINK(this, SalInstancePopover, PopupModeEndHdl)); - pDockingManager->StartPopupMode(m_xPopover, aRect, nFlags); - } +SalInstancePopover::~SalInstancePopover() { signal_closed(); } - virtual void popdown() override - { - vcl::Window::GetDockingManager()->EndPopupMode(m_xPopover); - m_xPopover->EnableDocking(false); - signal_closed(); - } -}; +void SalInstancePopover::popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) +{ + SalInstanceWidget* pVclWidget = dynamic_cast<SalInstanceWidget*>(pParent); + assert(pVclWidget); + vcl::Window* pWidget = pVclWidget->getWidget(); + + tools::Rectangle aRect; + Point aPt = pWidget->OutputToScreenPixel(rRect.TopLeft()); + aRect.SetLeft(aPt.X()); + aRect.SetTop(aPt.Y()); + aPt = pWidget->OutputToScreenPixel(rRect.BottomRight()); + aRect.SetRight(aPt.X()); + aRect.SetBottom(aPt.Y()); + + FloatWinPopupFlags nFlags = FloatWinPopupFlags::Down | FloatWinPopupFlags::GrabFocus + | FloatWinPopupFlags::NoMouseUpClose; + m_xPopover->EnableDocking(); + DockingManager* pDockingManager = vcl::Window::GetDockingManager(); + pDockingManager->SetPopupModeEndHdl(m_xPopover, + LINK(this, SalInstancePopover, PopupModeEndHdl)); + pDockingManager->StartPopupMode(m_xPopover, aRect, nFlags); +} + +void SalInstancePopover::popdown() +{ + vcl::Window::GetDockingManager()->EndPopupMode(m_xPopover); + m_xPopover->EnableDocking(false); + signal_closed(); } IMPL_LINK_NOARG(SalInstancePopover, PopupModeEndHdl, FloatingWindow*, void) { signal_closed(); } |