summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2018-03-19 15:18:50 +0100
committerKatarina Behrens <Katarina.Behrens@cib.de>2018-04-24 12:28:56 +0200
commit152faedebbfed3d0c3b5e465a25ef4dba030072c (patch)
tree39d0db55371259ffbf4c284e8649cb1890ce7578 /sfx2
parent0252a39a95a8ab457ded651956dee99f08e6ca69 (diff)
Prep mouse event handler to indicate dragging started
Change-Id: Icdb865e511047b166767ca9e87e808c308ad7643 Reviewed-on: https://gerrit.libreoffice.org/53324 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.cxx10
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx11
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.cxx12
3 files changed, 33 insertions, 0 deletions
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);
}