diff options
author | Noel Grandin <noel@peralex.com> | 2015-10-15 08:13:49 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-10-16 09:11:29 +0000 |
commit | 6f1313b3d44ea54e9a331e0fc00871081fa662fe (patch) | |
tree | fa6d9b6da04daedcb63ea2a0bc8c414288ed8bc6 /extensions/source/propctrlr/commoncontrol.hxx | |
parent | 14bf708ef586b15dffed66ffaf524baf4d8fcbfa (diff) |
convert Link<> to typed
Change-Id: Icbba339dac0be31e30dff021bba06a219f8aecd6
Reviewed-on: https://gerrit.libreoffice.org/19405
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'extensions/source/propctrlr/commoncontrol.hxx')
-rw-r--r-- | extensions/source/propctrlr/commoncontrol.hxx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/extensions/source/propctrlr/commoncontrol.hxx b/extensions/source/propctrlr/commoncontrol.hxx index 481ef86f3eb8..fc39aec21412 100644 --- a/extensions/source/propctrlr/commoncontrol.hxx +++ b/extensions/source/propctrlr/commoncontrol.hxx @@ -27,10 +27,12 @@ #include <tools/link.hxx> #include <vcl/window.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <type_traits> class NotifyEvent; class Control; class ListBox; +class Edit; namespace pcr { @@ -88,6 +90,7 @@ namespace pcr /// may be used by derived classes, they forward the event to the PropCtrListener DECL_LINK( ModifiedHdl, void* ); + DECL_LINK_TYPED( EditModifiedHdl, Edit&, void ); DECL_LINK_TYPED( SelectHdl, ListBox&, void ); DECL_LINK_TYPED( GetFocusHdl, Control&, void ); DECL_LINK_TYPED( LoseFocusHdl, Control&, void ); @@ -148,27 +151,39 @@ namespace pcr inline void impl_checkDisposed_throw(); private: VclPtr<TControlWindow> m_pControlWindow; + void implSetModifyHandler(std::true_type); + void implSetModifyHandler(std::false_type); }; //= CommonBehaviourControl - implementation - template< class TControlInterface, class TControlWindow > - inline CommonBehaviourControl< TControlInterface, TControlWindow >::CommonBehaviourControl ( sal_Int16 _nControlType, vcl::Window* _pParentWindow, WinBits _nWindowStyle, bool _bDoSetHandlers ) + inline CommonBehaviourControl< TControlInterface, TControlWindow >::CommonBehaviourControl ( sal_Int16 _nControlType, vcl::Window* _pParentWindow, WinBits _nWindowStyle, bool _bDoSetHandlers) :ComponentBaseClass( m_aMutex ) ,CommonBehaviourControlHelper( _nControlType, *this ) ,m_pControlWindow( new TControlWindow( _pParentWindow, _nWindowStyle ) ) { if ( _bDoSetHandlers ) { - m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, ModifiedHdl ) ); + implSetModifyHandler(std::is_base_of<::Edit,TControlWindow>()); m_pControlWindow->SetGetFocusHdl( LINK( this, CommonBehaviourControlHelper, GetFocusHdl ) ); m_pControlWindow->SetLoseFocusHdl( LINK( this, CommonBehaviourControlHelper, LoseFocusHdl ) ); } autoSizeWindow(); } + template< class TControlInterface, class TControlWindow > + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(std::true_type) + { + m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, EditModifiedHdl ) ); + } + + template< class TControlInterface, class TControlWindow > + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(std::false_type) + { + m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, ModifiedHdl ) ); + } template< class TControlInterface, class TControlWindow > inline void CommonBehaviourControl< TControlInterface, TControlWindow >::impl_checkDisposed_throw() |