summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/svtools/editbrowsebox.hxx21
-rw-r--r--svtools/source/brwbox/ebbcontrols.cxx33
-rw-r--r--svx/source/fmcomp/gridcell.cxx68
-rw-r--r--svx/source/inc/gridcell.hxx4
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx7
5 files changed, 103 insertions, 30 deletions
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
index 052fe1d26092..c012414ded51 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -184,13 +184,34 @@ namespace svt
m_aFocusOutHdl = rHdl;
}
+ void SetMousePressHdl(const Link<const MouseEvent&,void>& rHdl)
+ {
+ m_aMousePressHdl = rHdl;
+ }
+
+ void SetMouseReleaseHdl(const Link<const MouseEvent&,void>& rHdl)
+ {
+ m_aMouseReleaseHdl = rHdl;
+ }
+
+ void SetMouseMoveHdl(const Link<const MouseEvent&,void>& rHdl)
+ {
+ m_aMouseMoveHdl = rHdl;
+ }
+
protected:
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
DECL_LINK(FocusInHdl, weld::Widget&, void);
DECL_LINK(FocusOutHdl, weld::Widget&, void);
+ DECL_LINK(MousePressHdl, const MouseEvent&, bool);
+ DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool);
+ DECL_LINK(MouseMoveHdl, const MouseEvent&, bool);
private:
Link<LinkParamNone*,void> m_aFocusInHdl;
Link<LinkParamNone*,void> m_aFocusOutHdl;
+ Link<const MouseEvent&,void> m_aMousePressHdl;
+ Link<const MouseEvent&,void> m_aMouseReleaseHdl;
+ Link<const MouseEvent&,void> m_aMouseMoveHdl;
};
class SVT_DLLPUBLIC EditControlBase : public ControlBase
diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index 32ad1e52c748..04ba4b489f08 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -32,6 +32,9 @@ namespace svt
m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
m_xWidget->connect_focus_out(LINK(this, ControlBase, FocusOutHdl));
+ m_xWidget->connect_mouse_press(LINK(this, ControlBase, MousePressHdl));
+ m_xWidget->connect_mouse_release(LINK(this, ControlBase, MouseReleaseHdl));
+ m_xWidget->connect_mouse_move(LINK(this, ControlBase, MouseMoveHdl));
}
void ComboBoxControl::dispose()
@@ -119,6 +122,9 @@ namespace svt
m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
m_xWidget->connect_focus_out(LINK(this, ControlBase, FocusOutHdl));
+ m_xWidget->connect_mouse_press(LINK(this, ControlBase, MousePressHdl));
+ m_xWidget->connect_mouse_release(LINK(this, ControlBase, MouseReleaseHdl));
+ m_xWidget->connect_mouse_move(LINK(this, ControlBase, MouseMoveHdl));
}
void ListBoxControl::dispose()
@@ -189,6 +195,9 @@ namespace svt
m_xBox->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
m_xBox->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
m_xBox->connect_focus_out(LINK(this, ControlBase, FocusOutHdl));
+ m_xBox->connect_mouse_press(LINK(this, ControlBase, MousePressHdl));
+ m_xBox->connect_mouse_release(LINK(this, ControlBase, MouseReleaseHdl));
+ m_xBox->connect_mouse_move(LINK(this, ControlBase, MouseMoveHdl));
m_xBox->connect_toggled(LINK(this, CheckBoxControl, OnToggle));
}
@@ -342,6 +351,9 @@ namespace svt
m_pEntry->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
m_pEntry->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
connect_focus_out(LINK(this, ControlBase, FocusOutHdl));
+ m_pEntry->connect_mouse_press(LINK(this, ControlBase, MousePressHdl));
+ m_pEntry->connect_mouse_release(LINK(this, ControlBase, MouseReleaseHdl));
+ m_pEntry->connect_mouse_move(LINK(this, ControlBase, MouseMoveHdl));
}
bool ControlBase::ProcessKey(const KeyEvent& rKEvt)
@@ -366,6 +378,24 @@ namespace svt
static_cast<BrowserDataWin*>(GetParent())->GetParent()->ChildFocusOut();
}
+ IMPL_LINK(ControlBase, MousePressHdl, const MouseEvent&, rEvent, bool)
+ {
+ m_aMousePressHdl.Call(rEvent);
+ return false;
+ }
+
+ IMPL_LINK(ControlBase, MouseReleaseHdl, const MouseEvent&, rEvent, bool)
+ {
+ m_aMouseReleaseHdl.Call(rEvent);
+ return false;
+ }
+
+ IMPL_LINK(ControlBase, MouseMoveHdl, const MouseEvent&, rEvent, bool)
+ {
+ m_aMouseMoveHdl.Call(rEvent);
+ return false;
+ }
+
void EditControlBase::dispose()
{
m_pEntry = nullptr;
@@ -640,6 +670,9 @@ namespace svt
m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
m_xWidget->connect_focus_out(LINK(this, ControlBase, FocusOutHdl));
+ m_xWidget->connect_mouse_press(LINK(this, ControlBase, MousePressHdl));
+ m_xWidget->connect_mouse_release(LINK(this, ControlBase, MouseReleaseHdl));
+ m_xWidget->connect_mouse_move(LINK(this, ControlBase, MouseMoveHdl));
// so any the natural size doesn't have an effect
m_xWidget->set_size_request(1, 1);
}
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index f768d4cb134b..9339a7cba09b 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -3103,6 +3103,9 @@ void FmXGridCell::init()
pEventWindow->AddEventListener( LINK( this, FmXGridCell, OnWindowEvent ) );
pEventWindow->SetFocusInHdl(LINK( this, FmXGridCell, OnFocusGained));
pEventWindow->SetFocusOutHdl(LINK( this, FmXGridCell, OnFocusLost));
+ pEventWindow->SetMousePressHdl(LINK( this, FmXGridCell, OnMousePress));
+ pEventWindow->SetMouseReleaseHdl(LINK( this, FmXGridCell, OnMouseRelease));
+ pEventWindow->SetMouseMoveHdl(LINK( this, FmXGridCell, OnMouseMove));
}
}
@@ -3376,45 +3379,50 @@ IMPL_LINK_NOARG(FmXGridCell, OnFocusLost, LinkParamNone*, void)
onFocusLost(aEvent);
}
-void FmXGridCell::onWindowEvent(const VclEventId _nEventId, const void* _pEventData)
+IMPL_LINK(FmXGridCell, OnMousePress, const MouseEvent&, rEventData, void)
{
- switch ( _nEventId )
- {
- case VclEventId::WindowMouseButtonDown:
- case VclEventId::WindowMouseButtonUp:
- {
- if ( !m_aMouseListeners.getLength() )
- break;
+ if (!m_aMouseListeners.getLength())
+ return;
+
+ awt::MouseEvent aEvent(VCLUnoHelper::createMouseEvent(rEventData, *this));
+ m_aMouseListeners.notifyEach(&awt::XMouseListener::mousePressed, aEvent);
+}
- const bool bButtonDown = ( _nEventId == VclEventId::WindowMouseButtonDown );
+IMPL_LINK(FmXGridCell, OnMouseRelease, const MouseEvent&, rEventData, void)
+{
+ if (!m_aMouseListeners.getLength())
+ return;
- awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *static_cast< const ::MouseEvent* >( _pEventData ), *this ) );
- m_aMouseListeners.notifyEach( bButtonDown ? &awt::XMouseListener::mousePressed : &awt::XMouseListener::mouseReleased, aEvent );
- }
- break;
- case VclEventId::WindowMouseMove:
+ awt::MouseEvent aEvent(VCLUnoHelper::createMouseEvent(rEventData, *this));
+ m_aMouseListeners.notifyEach(&awt::XMouseListener::mouseReleased, aEvent);
+}
+
+IMPL_LINK(FmXGridCell, OnMouseMove, const MouseEvent&, rMouseEvent, void)
+{
+ if ( rMouseEvent.IsEnterWindow() || rMouseEvent.IsLeaveWindow() )
{
- const MouseEvent& rMouseEvent = *static_cast< const ::MouseEvent* >( _pEventData );
- if ( rMouseEvent.IsEnterWindow() || rMouseEvent.IsLeaveWindow() )
+ if ( m_aMouseListeners.getLength() != 0 )
{
- if ( m_aMouseListeners.getLength() != 0 )
- {
- awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) );
- m_aMouseListeners.notifyEach( rMouseEvent.IsEnterWindow() ? &awt::XMouseListener::mouseEntered: &awt::XMouseListener::mouseExited, aEvent );
- }
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) );
+ m_aMouseListeners.notifyEach( rMouseEvent.IsEnterWindow() ? &awt::XMouseListener::mouseEntered: &awt::XMouseListener::mouseExited, aEvent );
}
- else if ( !rMouseEvent.IsEnterWindow() && !rMouseEvent.IsLeaveWindow() )
+ }
+ else if ( !rMouseEvent.IsEnterWindow() && !rMouseEvent.IsLeaveWindow() )
+ {
+ if ( m_aMouseMotionListeners.getLength() != 0 )
{
- if ( m_aMouseMotionListeners.getLength() != 0 )
- {
- awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) );
- aEvent.ClickCount = 0;
- const bool bSimpleMove = bool( rMouseEvent.GetMode() & MouseEventModifiers::SIMPLEMOVE );
- m_aMouseMotionListeners.notifyEach( bSimpleMove ? &awt::XMouseMotionListener::mouseMoved: &awt::XMouseMotionListener::mouseDragged, aEvent );
- }
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) );
+ aEvent.ClickCount = 0;
+ const bool bSimpleMove = bool( rMouseEvent.GetMode() & MouseEventModifiers::SIMPLEMOVE );
+ m_aMouseMotionListeners.notifyEach( bSimpleMove ? &awt::XMouseMotionListener::mouseMoved: &awt::XMouseMotionListener::mouseDragged, aEvent );
}
}
- break;
+}
+
+void FmXGridCell::onWindowEvent(const VclEventId _nEventId, const void* _pEventData)
+{
+ switch ( _nEventId )
+ {
case VclEventId::WindowKeyInput:
case VclEventId::WindowKeyUp:
{
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
index 45a92c0011c3..413928e600c9 100644
--- a/svx/source/inc/gridcell.hxx
+++ b/svx/source/inc/gridcell.hxx
@@ -785,6 +785,10 @@ private:
svt::ControlBase* getEventWindow() const;
DECL_LINK(OnFocusGained, LinkParamNone*, void);
DECL_LINK(OnFocusLost, LinkParamNone*, void);
+ DECL_LINK(OnMousePress, const MouseEvent&, void);
+ DECL_LINK(OnMouseRelease, const MouseEvent&, void);
+ DECL_LINK(OnMouseMove, const MouseEvent&, void);
+
DECL_LINK( OnWindowEvent, VclWindowEvent&, void );
};
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 9fccb99779b6..7034386c35f3 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -11758,6 +11758,13 @@ private:
pThis->signal_activate();
}
+ virtual void ensureMouseEventWidget() override
+ {
+ // The GtkEntry is sufficient to get mouse events without an intermediate GtkEventBox
+ if (!m_pMouseEventBox)
+ m_pMouseEventBox = m_pDelegate;
+ }
+
protected:
virtual void signal_activate()