diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2014-09-14 13:36:10 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2014-09-14 22:07:14 +0200 |
commit | d6a83d3f91336e23b51bfc3b3d58da799760829f (patch) | |
tree | 4873e64f7b8f44eb8c4c47138a9c186cc8dc6284 | |
parent | 96369e97a014a279db61b8e37bc54270f7beaccb (diff) |
convert UserDrawHdl to boost signals2
Note that ImplListBox::userDrawSignal is connected to
ImplListBoxWindow::userDrawSignal to forward the signal, just like
the Link was previously forwarded.
Change-Id: Ic8fc6f51e309bc34fb4e39c13745302649991d0a
-rw-r--r-- | include/vcl/combobox.hxx | 2 | ||||
-rw-r--r-- | include/vcl/lstbox.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/ilstbox.hxx | 15 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 5 | ||||
-rw-r--r-- | vcl/source/control/ilstbox.cxx | 6 | ||||
-rw-r--r-- | vcl/source/control/lstbox.cxx | 7 |
6 files changed, 17 insertions, 21 deletions
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index c82239ded360..95e35193030a 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -71,11 +71,11 @@ private: DECL_DLLPRIVATE_LINK( ImplDoubleClickHdl, void* ); DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, void* ); DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, void* ); - DECL_DLLPRIVATE_LINK( ImplUserDrawHdl, UserDrawEvent* ); DECL_DLLPRIVATE_LINK( ImplAutocompleteHdl, Edit* ); DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* ); SAL_DLLPRIVATE void ImplClickButtonHandler( ImplBtn* ); + SAL_DLLPRIVATE void ImplUserDrawHandler( UserDrawEvent* ); protected: using Window::ImplInit; diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx index 43078889733a..29bf86d0b784 100644 --- a/include/vcl/lstbox.hxx +++ b/include/vcl/lstbox.hxx @@ -61,11 +61,12 @@ private: DECL_DLLPRIVATE_LINK( ImplDoubleClickHdl, void* ); DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, void* ); DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, void* ); - DECL_DLLPRIVATE_LINK( ImplUserDrawHdl, UserDrawEvent* ); DECL_DLLPRIVATE_LINK( ImplFocusHdl, void* ); DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl, void* ); SAL_DLLPRIVATE void ImplClickButtonHandler( Control* ); + SAL_DLLPRIVATE void ImplUserDrawHandler( UserDrawEvent* ); + protected: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx index c8a49a4fa56e..2b049357ab7c 100644 --- a/vcl/inc/ilstbox.hxx +++ b/vcl/inc/ilstbox.hxx @@ -233,7 +233,6 @@ private: Link maSelectHdl; Link maCancelHdl; Link maDoubleClickHdl; - Link maUserDrawHdl; Link maMRUChangedHdl; Link maFocusHdl; Link maListItemSelectHdl; @@ -342,13 +341,13 @@ public: const Link& GetCancelHdl() const { return maCancelHdl; } void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; } const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; } - void SetUserDrawHdl( const Link& rLink ) { maUserDrawHdl = rLink; } - const Link& GetUserDrawHdl() const { return maUserDrawHdl; } void SetMRUChangedHdl( const Link& rLink ) { maMRUChangedHdl = rLink; } const Link& GetMRUChangedHdl() const { return maMRUChangedHdl; } void SetFocusHdl( const Link& rLink ) { maFocusHdl = rLink ; } const Link& GetFocusHdl() const { return maFocusHdl; } + boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal; + void SetListItemSelectHdl( const Link& rLink ) { maListItemSelectHdl = rLink ; } const Link& GetListItemSelectHdl() const { return maListItemSelectHdl; } bool IsSelectionChanged() const { return mbSelectionChanged; } @@ -478,8 +477,8 @@ public: const Link& GetCancelHdl() const { return maLBWindow.GetCancelHdl(); } void SetDoubleClickHdl( const Link& rLink ) { maLBWindow.SetDoubleClickHdl( rLink ); } const Link& GetDoubleClickHdl() const { return maLBWindow.GetDoubleClickHdl(); } - void SetUserDrawHdl( const Link& rLink ) { maLBWindow.SetUserDrawHdl( rLink ); } - const Link& GetUserDrawHdl() const { return maLBWindow.GetUserDrawHdl(); } + + boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal; void SetFocusHdl( const Link& rLink ) { maLBWindow.SetFocusHdl( rLink ); } const Link& GetFocusHdl() const { return maLBWindow.GetFocusHdl(); } @@ -555,8 +554,6 @@ private: Rectangle maFocusRect; Size maUserItemSize; - Link maUserDrawHdl; - /// bitfield bool mbUserDrawEnabled : 1; bool mbInUserDraw : 1; @@ -589,9 +586,7 @@ public: virtual void MBDown(); boost::signals2::signal< void ( ImplWin* ) > buttonDownSignal; - - void SetUserDrawHdl( const Link& rLink ) { maUserDrawHdl = rLink; } - const Link& GetUserDrawHdl() const { return maUserDrawHdl; } + boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal; void SetUserItemSize( const Size& rSz ) { maUserItemSize = rSz; } const Size& GetUserItemSize() const { return maUserItemSize; } diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 0ac87c7f203b..700fe04f5569 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -180,7 +180,7 @@ void ComboBox::ImplInit( Window* pParent, WinBits nStyle ) mpImplLB->SetSelectHdl( LINK( this, ComboBox, ImplSelectHdl ) ); mpImplLB->SetCancelHdl( LINK( this, ComboBox, ImplCancelHdl ) ); mpImplLB->SetDoubleClickHdl( LINK( this, ComboBox, ImplDoubleClickHdl ) ); - mpImplLB->SetUserDrawHdl( LINK( this, ComboBox, ImplUserDrawHdl ) ); + mpImplLB->userDrawSignal.connect( boost::bind( &ComboBox::ImplUserDrawHandler, this, _1 ) ); mpImplLB->SetSelectionChangedHdl( LINK( this, ComboBox, ImplSelectionChangedHdl ) ); mpImplLB->SetListItemSelectHdl( LINK( this, ComboBox, ImplListItemSelectHdl ) ); mpImplLB->Show(); @@ -1221,10 +1221,9 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, s } -IMPL_LINK( ComboBox, ImplUserDrawHdl, UserDrawEvent*, pEvent ) +void::ComboBox::ImplUserDrawHandler( UserDrawEvent* pEvent ) { UserDraw( *pEvent ); - return 1; } void ComboBox::UserDraw( const UserDrawEvent& ) diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index bbc1f2ad5e53..75c7d2cbe16e 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -1739,7 +1739,7 @@ void ImplListBoxWindow::ImplPaint( sal_Int32 nPos, bool bErase, bool bLayout ) nCurr = sal::static_int_cast<sal_Int32>( nCurr - GetEntryList()->GetMRUCount()); UserDrawEvent aUDEvt( this, aRect, nPos, nCurr ); - maUserDrawHdl.Call( &aUDEvt ); + userDrawSignal( &aUDEvt ); mbInUserDraw = false; } else @@ -2132,6 +2132,8 @@ ImplListBox::ImplListBox( Window* pParent, WinBits nWinStyle ) : Control( pParent, nWinStyle ), maLBWindow( this, nWinStyle&(~WB_BORDER) ) { + maLBWindow.userDrawSignal.connect( userDrawSignal ); + // for native widget rendering we must be able to detect this window type SetType( WINDOW_LISTBOXWINDOW ); @@ -2737,7 +2739,7 @@ void ImplWin::ImplDraw( bool bLayout ) { mbInUserDraw = true; UserDrawEvent aUDEvt( this, maFocusRect, mnItemPos, 0 ); - maUserDrawHdl.Call( &aUDEvt ); + userDrawSignal( &aUDEvt ); mbInUserDraw = false; } else diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index ef18971d37fa..02a54ba59ced 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -137,7 +137,7 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle ) mpImplWin = new ImplWin( this, (nStyle & (WB_LEFT|WB_RIGHT|WB_CENTER))|WB_NOBORDER ); mpImplWin->buttonDownSignal.connect( boost::bind( &ListBox::ImplClickButtonHandler, this, _1 )); - mpImplWin->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) ); + mpImplWin->userDrawSignal.connect( boost::bind( &ListBox::ImplUserDrawHandler, this, _1 ) ); mpImplWin->Show(); mpImplWin->GetDropTarget()->addDropTargetListener(xDrop); mpImplWin->SetEdgeBlending(GetEdgeBlending()); @@ -157,7 +157,7 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle ) mpImplLB->SetScrollHdl( LINK( this, ListBox, ImplScrollHdl ) ); mpImplLB->SetCancelHdl( LINK( this, ListBox, ImplCancelHdl ) ); mpImplLB->SetDoubleClickHdl( LINK( this, ListBox, ImplDoubleClickHdl ) ); - mpImplLB->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) ); + mpImplLB->userDrawSignal.connect( boost::bind( &ListBox::ImplUserDrawHandler, this, _1 ) ); mpImplLB->SetFocusHdl( LINK( this, ListBox, ImplFocusHdl ) ); mpImplLB->SetListItemSelectHdl( LINK( this, ListBox, ImplListItemSelectHdl ) ); mpImplLB->SetPosPixel( Point() ); @@ -1360,10 +1360,9 @@ void ListBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines } } -IMPL_LINK( ListBox, ImplUserDrawHdl, UserDrawEvent*, pEvent ) +void ListBox::ImplUserDrawHandler( UserDrawEvent* pEvent ) { UserDraw( *pEvent ); - return 1; } void ListBox::UserDraw( const UserDrawEvent& ) |