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>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -164,6 +164,8 @@ public:
|
||||
void FadeIn();
|
||||
void FadeOut();
|
||||
|
||||
tools::Rectangle GetDeckDragArea() const;
|
||||
|
||||
private:
|
||||
SidebarController(
|
||||
SidebarDockingWindow* pParentWindow,
|
||||
|
@@ -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();
|
||||
};
|
||||
|
@@ -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));
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user