diff options
-rw-r--r-- | include/sfx2/sidebar/DeckTitleBar.hxx | 1 | ||||
-rw-r--r-- | include/sfx2/sidebar/SidebarController.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/sidebar/SidebarDockingWindow.hxx | 4 | ||||
-rw-r--r-- | sfx2/source/sidebar/DeckTitleBar.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarDockingWindow.cxx | 12 |
6 files changed, 40 insertions, 0 deletions
diff --git a/include/sfx2/sidebar/DeckTitleBar.hxx b/include/sfx2/sidebar/DeckTitleBar.hxx index 3542cd45e0fb..59f15bf1ef93 100644 --- a/include/sfx2/sidebar/DeckTitleBar.hxx +++ b/include/sfx2/sidebar/DeckTitleBar.hxx @@ -31,6 +31,7 @@ public: const std::function<void()>& rCloserAction); void SetCloserVisible(const bool bIsCloserVisible); + tools::Rectangle GetDragArea() const; virtual void DataChanged(const DataChangedEvent& rEvent) override; diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index 50e91097ca67..33cdfc395200 100644 --- a/include/sfx2/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -164,6 +164,8 @@ public: void FadeIn(); void FadeOut(); + tools::Rectangle GetDeckDragArea() const; + private: SidebarController( SidebarDockingWindow* pParentWindow, diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx b/include/sfx2/sidebar/SidebarDockingWindow.hxx index 2bff73a3eb77..2df114e1c585 100644 --- a/include/sfx2/sidebar/SidebarDockingWindow.hxx +++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx @@ -39,6 +39,9 @@ public: virtual bool EventNotify(NotifyEvent& rEvent) override; virtual bool Close() override; + void SetReadyToDrag( bool bStartDrag ) { mbIsReadyToDrag = bStartDrag; } + bool IsReadyToDrag() const { return mbIsReadyToDrag; } + using SfxDockingWindow::Close; protected: @@ -51,6 +54,7 @@ protected: private: ::rtl::Reference<sfx2::sidebar::SidebarController> mpSidebarController; + bool mbIsReadyToDrag; void DoDispose(); }; diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx index e241b76b079d..891efe8b031c 100644 --- a/sfx2/source/sidebar/DeckTitleBar.cxx +++ b/sfx2/source/sidebar/DeckTitleBar.cxx @@ -18,6 +18,7 @@ */ #include <sfx2/sidebar/DeckTitleBar.hxx> +#include <sfx2/sidebar/SidebarDockingWindow.hxx> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sfxresid.hxx> #include <sfx2/strings.hrc> @@ -81,6 +82,15 @@ tools::Rectangle DeckTitleBar::GetTitleArea (const tools::Rectangle& rTitleBarBo rTitleBarBox.Bottom()); } +tools::Rectangle DeckTitleBar::GetDragArea() const +{ + Image aGripImage (Theme::GetImage(Theme::Image_Grip)); + return tools::Rectangle(0,0, + aGripImage.GetSizePixel().Width() + gaLeftGripPadding + gaRightGripPadding, + aGripImage.GetSizePixel().Height() + ); +} + void DeckTitleBar::PaintDecoration(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rTitleBarBox*/) { Image aImage (Theme::GetImage(Theme::Image_Grip)); diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index b205559c6326..5763fe49db02 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -1340,6 +1340,17 @@ void SidebarController::FadeIn() mpSplitWindow->FadeIn(); } +tools::Rectangle SidebarController::GetDeckDragArea() const +{ + tools::Rectangle aRect; + + VclPtr<DeckTitleBar> pTitleBar = mpCurrentDeck->GetTitleBar(); + if ( pTitleBar) + aRect = pTitleBar->GetDragArea(); + + return aRect; +} + void SidebarController::frameAction(const css::frame::FrameActionEvent& rEvent) { if (rEvent.Frame == mxFrame) diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 15a3e3340ff1..11ebe7614e0a 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -23,6 +23,7 @@ #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <tools/link.hxx> +#include <tools/gen.hxx> using namespace css; using namespace css::uno; @@ -116,6 +117,17 @@ bool SidebarDockingWindow::EventNotify(NotifyEvent& rEvent) if (MouseNotifyEvent::KEYINPUT == nType) return true; + if ( MouseNotifyEvent::MOUSEBUTTONDOWN == nType) + { + const MouseEvent *mEvt = rEvent.GetMouseEvent(); + if (mEvt->IsLeft()) + { + tools::Rectangle aGrip = mpSidebarController->GetDeckDragArea(); + if ( aGrip.IsInside( mEvt->GetPosPixel() ) ) + SetReadyToDrag( true ); + } + } + return SfxDockingWindow::EventNotify(rEvent); } |