summaryrefslogtreecommitdiff
path: root/vcl/source/control
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-08-17 11:33:14 +0200
committerNoel Grandin <noel@peralex.com>2015-08-17 12:41:38 +0200
commita50cd18768289c65debeed5ec507cf37095365b8 (patch)
tree1a057021e9a49791e8e2b6b03fc7f4a47dc43281 /vcl/source/control
parent81908b38536be0764955fe73f200417b7955a91b (diff)
make Control::ImplCallEventListenersAndHandler take a lambda
so that we make the Link<> calls type-safe, without having to make this a template method Change-Id: I2e36bd6aa7c63440f72d266b593e101965b5ebce
Diffstat (limited to 'vcl/source/control')
-rw-r--r--vcl/source/control/button.cxx8
-rw-r--r--vcl/source/control/combobox.cxx4
-rw-r--r--vcl/source/control/ctrl.cxx8
-rw-r--r--vcl/source/control/edit.cxx2
-rw-r--r--vcl/source/control/fixedhyper.cxx2
-rw-r--r--vcl/source/control/lstbox.cxx4
-rw-r--r--vcl/source/control/scrbar.cxx4
-rw-r--r--vcl/source/control/spinbtn.cxx4
-rw-r--r--vcl/source/control/spinfld.cxx8
9 files changed, 22 insertions, 22 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 0157b7ddd589..a1c0dea3ccae 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -114,7 +114,7 @@ void Button::SetCommandHandler(const OUString& aCommand)
void Button::Click()
{
- ImplCallEventListenersAndHandler( VCLEVENT_BUTTON_CLICK, maClickHdl, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_BUTTON_CLICK, [this] () { maClickHdl.Call(this); } );
}
OUString Button::GetStandardText( StandardButtonType eButton )
@@ -1548,7 +1548,7 @@ bool PushButton::PreNotify( NotifyEvent& rNEvt )
void PushButton::Toggle()
{
- ImplCallEventListenersAndHandler( VCLEVENT_PUSHBUTTON_TOGGLE, maToggleHdl, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_PUSHBUTTON_TOGGLE, [this] () { maToggleHdl.Call(this); } );
}
void PushButton::SetSymbol( SymbolType eSymbol )
@@ -2640,7 +2640,7 @@ bool RadioButton::PreNotify( NotifyEvent& rNEvt )
void RadioButton::Toggle()
{
- ImplCallEventListenersAndHandler( VCLEVENT_RADIOBUTTON_TOGGLE, maToggleHdl, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_RADIOBUTTON_TOGGLE, [this] () { maToggleHdl.Call(this); } );
}
bool RadioButton::SetModeRadioImage( const Image& rImage )
@@ -3595,7 +3595,7 @@ bool CheckBox::PreNotify( NotifyEvent& rNEvt )
void CheckBox::Toggle()
{
- ImplCallEventListenersAndHandler( VCLEVENT_CHECKBOX_TOGGLE, maToggleHdl, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_CHECKBOX_TOGGLE, [this] () { maToggleHdl.Call(this); } );
}
void CheckBox::SetState( TriState eState )
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 7703b30676a1..f7409eb1799b 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -556,12 +556,12 @@ void ComboBox::ToggleDropDown()
void ComboBox::Select()
{
- ImplCallEventListenersAndHandler( VCLEVENT_COMBOBOX_SELECT, m_pImpl->m_SelectHdl, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_COMBOBOX_SELECT, [this] () { m_pImpl->m_SelectHdl.Call(this); } );
}
void ComboBox::DoubleClick()
{
- ImplCallEventListenersAndHandler( VCLEVENT_COMBOBOX_DOUBLECLICK, m_pImpl->m_DoubleClickHdl, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_COMBOBOX_DOUBLECLICK, [this] () { m_pImpl->m_DoubleClickHdl.Call(this); } );
}
bool ComboBox::IsAutoSizeEnabled() const { return m_pImpl->m_isDDAutoSize; }
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 6062d1a49d4d..7eafeb3393e2 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, maGetFocusHdl, 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, maLoseFocusHdl, this ) )
+ if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_LOSEFOCUS, [this] () { maLoseFocusHdl.Call(this); } ) )
// been destroyed within the handler
return true;
}
@@ -320,7 +320,7 @@ void Control::AppendLayoutData( const Control& rSubControl ) const
}
}
-bool Control::ImplCallEventListenersAndHandler( sal_uLong nEvent, const Link<>& rHandler, void* pCaller )
+bool Control::ImplCallEventListenersAndHandler( sal_uLong nEvent, std::function<void()> callHandler )
{
VclPtr<Control> xThis(this);
@@ -328,7 +328,7 @@ bool Control::ImplCallEventListenersAndHandler( sal_uLong nEvent, const Link<>&
if ( !xThis->IsDisposed() )
{
- rHandler.Call( pCaller );
+ callHandler();
if ( !xThis->IsDisposed() )
return false;
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index b4e56f47fa86..8461583c1413 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2416,7 +2416,7 @@ void Edit::Modify()
if ( mpUpdateDataTimer )
mpUpdateDataTimer->Start();
- if ( ImplCallEventListenersAndHandler( VCLEVENT_EDIT_MODIFY, maModifyHdl, this ) )
+ if ( ImplCallEventListenersAndHandler( VCLEVENT_EDIT_MODIFY, [this] () { maModifyHdl.Call(this); } ) )
// have been destroyed while calling into the handlers
return;
diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx
index 4fb5af42c491..b7a27592ea16 100644
--- a/vcl/source/control/fixedhyper.cxx
+++ b/vcl/source/control/fixedhyper.cxx
@@ -77,7 +77,7 @@ void FixedHyperlink::MouseButtonUp( const MouseEvent& )
{
// calls the link if the control is enabled and the mouse is over the text.
if ( IsEnabled() && ImplIsOverText(GetPointerPosPixel()) )
- ImplCallEventListenersAndHandler( VCLEVENT_BUTTON_CLICK, m_aClickHdl, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_BUTTON_CLICK, [this] () { m_aClickHdl.Call(this); } );
}
void FixedHyperlink::RequestHelp( const HelpEvent& rHEvt )
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index ba085d718425..b89f7f3a524d 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -972,12 +972,12 @@ bool ListBox::PreNotify( NotifyEvent& rNEvt )
void ListBox::Select()
{
- ImplCallEventListenersAndHandler( VCLEVENT_LISTBOX_SELECT, maSelectHdl, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_LISTBOX_SELECT, [this] () { maSelectHdl.Call(this); } );
}
void ListBox::DoubleClick()
{
- ImplCallEventListenersAndHandler( VCLEVENT_LISTBOX_DOUBLECLICK, maDoubleClickHdl, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_LISTBOX_DOUBLECLICK, [this] () { maDoubleClickHdl.Call(this); } );
}
void ListBox::Clear()
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 8a4345fe399f..0246276470fe 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -1323,12 +1323,12 @@ bool ScrollBar::PreNotify( NotifyEvent& rNEvt )
void ScrollBar::Scroll()
{
- ImplCallEventListenersAndHandler( VCLEVENT_SCROLLBAR_SCROLL, maScrollHdl, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_SCROLLBAR_SCROLL, [this] () { maScrollHdl.Call(this); } );
}
void ScrollBar::EndScroll()
{
- ImplCallEventListenersAndHandler( VCLEVENT_SCROLLBAR_ENDSCROLL, maEndScrollHdl, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_SCROLLBAR_ENDSCROLL, [this] () { maEndScrollHdl.Call(this); } );
}
long ScrollBar::DoScroll( long nNewPos )
diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx
index ad47e9fc4bcb..4651f9b13bb0 100644
--- a/vcl/source/control/spinbtn.cxx
+++ b/vcl/source/control/spinbtn.cxx
@@ -81,7 +81,7 @@ void SpinButton::Up()
ImplMoveFocus(true);
}
- ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_UP, maUpHdlLink, this);
+ ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_UP, [this] () { maUpHdlLink.Call(this); } );
}
void SpinButton::Down()
@@ -94,7 +94,7 @@ void SpinButton::Down()
ImplMoveFocus(false);
}
- ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_DOWN, maDownHdlLink, this);
+ ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_DOWN, [this] () { maDownHdlLink.Call(this); } );
}
void SpinButton::Resize()
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 7541eef3e16a..e7058f88970e 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -383,22 +383,22 @@ void SpinField::dispose()
void SpinField::Up()
{
- ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_UP, maUpHdlLink, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_UP, [this] () { maUpHdlLink.Call(this); } );
}
void SpinField::Down()
{
- ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_DOWN, maDownHdlLink, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_DOWN, [this] () { maDownHdlLink.Call(this); } );
}
void SpinField::First()
{
- ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_FIRST, maFirstHdlLink, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_FIRST, [this] () { maFirstHdlLink.Call(this); } );
}
void SpinField::Last()
{
- ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_LAST, maLastHdlLink, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_LAST, [this] () { maLastHdlLink.Call(this); } );
}
void SpinField::MouseButtonDown( const MouseEvent& rMEvt )