summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2015-09-24 13:53:17 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-09-24 16:19:37 +0000
commite85b2333bce7b1dcae73861df6d90b48b9f4efe5 (patch)
tree21d066cecfbfda9ace96b26953ddcc3ae1764001 /vcl
parentff6462e6307e6924dc6c8178043ae9032f4b4152 (diff)
convert Link<> to typed
Change-Id: I59d325c3b051690303a5841907317122fa1ec98b Reviewed-on: https://gerrit.libreoffice.org/18825 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/ctrl.cxx4
-rw-r--r--vcl/source/control/slider.cxx52
2 files changed, 32 insertions, 24 deletions
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 4793fdb2cf38..db1af03e1862 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -258,7 +258,7 @@ bool Control::Notify( NotifyEvent& rNEvt )
{
mbHasControlFocus = true;
CompatStateChanged( StateChangedType::ControlFocus );
- if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_GETFOCUS, [this] () { maGetFocusHdl.Call(this); } ) )
+ if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_GETFOCUS, [this] () { maGetFocusHdl.Call(*this); } ) )
// been destroyed within the handler
return true;
}
@@ -272,7 +272,7 @@ bool Control::Notify( NotifyEvent& rNEvt )
{
mbHasControlFocus = false;
CompatStateChanged( StateChangedType::ControlFocus );
- if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_LOSEFOCUS, [this] () { maLoseFocusHdl.Call(this); } ) )
+ if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_LOSEFOCUS, [this] () { maLoseFocusHdl.Call(*this); } ) )
// been destroyed within the handler
return true;
}
diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx
index f09b493469a0..62a331c73adf 100644
--- a/vcl/source/control/slider.cxx
+++ b/vcl/source/control/slider.cxx
@@ -216,34 +216,12 @@ void Slider::ImplUpdateRects( bool bUpdate )
}
}
-void Slider::ImplSetFieldLink(const Link<>& rLink)
-{
- if (mpLinkedField != nullptr)
- {
- mpLinkedField->SetModifyHdl(rLink);
- mpLinkedField->SetUpHdl(rLink);
- mpLinkedField->SetDownHdl(rLink);
- mpLinkedField->SetFirstHdl(rLink);
- mpLinkedField->SetLastHdl(rLink);
- mpLinkedField->SetLoseFocusHdl(rLink);
- }
-}
-
void Slider::ImplUpdateLinkedField()
{
if (mpLinkedField)
mpLinkedField->SetValue(mnThumbPos);
}
-IMPL_LINK(Slider, LinkedFieldModifyHdl, NumericField*, pField)
-{
- if (pField)
- {
- SetThumbPos(pField->GetValue());
- }
- return 0;
-}
-
long Slider::ImplCalcThumbPos( long nPixPos )
{
// calculate position
@@ -851,8 +829,38 @@ void Slider::Resize()
void Slider::SetLinkedField(VclPtr<NumericField> pField)
{
ImplSetFieldLink(Link<>());
+ if (mpLinkedField)
+ mpLinkedField->SetLoseFocusHdl(Link<Control&,void>());
mpLinkedField = pField;
ImplSetFieldLink(LINK(this, Slider, LinkedFieldModifyHdl));
+ if (mpLinkedField)
+ mpLinkedField->SetLoseFocusHdl(LINK(this, Slider, LinkedFieldLoseFocusHdl));
+}
+
+void Slider::ImplSetFieldLink(const Link<>& rLink)
+{
+ if (mpLinkedField != nullptr)
+ {
+ mpLinkedField->SetModifyHdl(rLink);
+ mpLinkedField->SetUpHdl(rLink);
+ mpLinkedField->SetDownHdl(rLink);
+ mpLinkedField->SetFirstHdl(rLink);
+ mpLinkedField->SetLastHdl(rLink);
+ }
+}
+
+IMPL_LINK_NOARG_TYPED(Slider, LinkedFieldLoseFocusHdl, Control&, void)
+{
+ if (mpLinkedField)
+ SetThumbPos(mpLinkedField->GetValue());
+}
+
+IMPL_LINK(Slider, LinkedFieldModifyHdl, NumericField*, /*pField*/)
+{
+ if (mpLinkedField)
+ SetThumbPos(mpLinkedField->GetValue());
+
+ return 0;
}
void Slider::RequestHelp( const HelpEvent& rHEvt )