summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-12-15 12:55:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-12-19 06:04:33 +0000
commitf9fd6390cd88b87ca81538385da028ff5b1783c0 (patch)
tree02adaf2d5e1913fec12df2326115c125cad8dda1 /toolkit
parent2a79ec7fe5abab9c3ba5f4f07a016dbc4287c1b8 (diff)
ScrollableWrapper -> ScrollableDialog
no point in having a template and a virtual base class when it's only used for one type Change-Id: Idb1a1a551064cc10896eff33652038eb5be0297e Reviewed-on: https://gerrit.libreoffice.org/32041 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/scrollabledialog.cxx76
-rw-r--r--toolkit/source/awt/vclxcontainer.cxx2
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx4
3 files changed, 30 insertions, 52 deletions
diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx
index a74aab53201d..af8c9283d504 100644
--- a/toolkit/source/awt/scrollabledialog.cxx
+++ b/toolkit/source/awt/scrollabledialog.cxx
@@ -30,16 +30,15 @@ namespace toolkit
// as css::awt::WindowAttribute::NODECORATION and they are used
// in the same bitmap :-( WB_VSCROLL & WB_HSCROLL apparently are only for
// child classes ( whole thing is a mess if you ask me )
-template< class T>
-ScrollableWrapper<T>::ScrollableWrapper( vcl::Window* pParent, WinBits nStyle, Dialog::InitFlag eFlag )
- : T( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ), eFlag ),
+ScrollableDialog::ScrollableDialog( vcl::Window* pParent, WinBits nStyle, Dialog::InitFlag eFlag )
+ : Dialog( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ), eFlag ),
maHScrollBar( VclPtr<ScrollBar>::Create(this, WB_HSCROLL | WB_DRAG) ),
maVScrollBar( VclPtr<ScrollBar>::Create(this, WB_VSCROLL | WB_DRAG) ),
mbHasHoriBar( false ),
mbHasVertBar( false ),
maScrollVis( None )
{
- Link<ScrollBar*,void> aLink( LINK( this, ScrollableWrapper, ScrollBarHdl ) );
+ Link<ScrollBar*,void> aLink( LINK( this, ScrollableDialog, ScrollBarHdl ) );
maVScrollBar->SetScrollHdl( aLink );
maHScrollBar->SetScrollHdl( aLink );
@@ -58,11 +57,10 @@ ScrollableWrapper<T>::ScrollableWrapper( vcl::Window* pParent, WinBits nStyle, D
}
}
setScrollVisibility( aVis );
- mnScrWidth = T::GetSettings().GetStyleSettings().GetScrollBarSize();
+ mnScrWidth = Dialog::GetSettings().GetStyleSettings().GetScrollBarSize();
}
-template< class T>
-void ScrollableWrapper<T>::setScrollVisibility( ScrollBarVisibility rVisState )
+void ScrollableDialog::setScrollVisibility( ScrollBarVisibility rVisState )
{
maScrollVis = rVisState;
if ( maScrollVis == Hori || maScrollVis == Both )
@@ -76,36 +74,33 @@ void ScrollableWrapper<T>::setScrollVisibility( ScrollBarVisibility rVisState )
maVScrollBar->Show();
}
if ( mbHasHoriBar || mbHasVertBar )
- this->SetStyle( T::GetStyle() | WB_CLIPCHILDREN | WB_AUTOSIZE );
+ this->SetStyle( Dialog::GetStyle() | WB_CLIPCHILDREN | WB_AUTOSIZE );
}
-template< class T>
-ScrollableWrapper<T>::~ScrollableWrapper()
+ScrollableDialog::~ScrollableDialog()
{
- T::disposeOnce();
+ disposeOnce();
}
-template< class T>
-void ScrollableWrapper<T>::dispose()
+void ScrollableDialog::dispose()
{
maHScrollBar.disposeAndClear();
maVScrollBar.disposeAndClear();
- T::dispose();
+ Dialog::dispose();
}
-template< class T>
-void ScrollableWrapper<T>::lcl_Scroll( long nX, long nY )
+void ScrollableDialog::lcl_Scroll( long nX, long nY )
{
long nXScroll = mnScrollPos.X() - nX;
long nYScroll = mnScrollPos.Y() - nY;
mnScrollPos = Point( nX, nY );
Rectangle aScrollableArea( 0, 0, maScrollArea.Width(), maScrollArea.Height() );
- T::Scroll(nXScroll, nYScroll, aScrollableArea );
+ Scroll(nXScroll, nYScroll, aScrollableArea );
// Manually scroll all children ( except the scrollbars )
- for ( int index = 0; index < T::GetChildCount(); ++index )
+ for ( int index = 0; index < GetChildCount(); ++index )
{
- vcl::Window* pChild = T::GetChild( index );
+ vcl::Window* pChild = GetChild( index );
if ( pChild && pChild != maVScrollBar.get() && pChild != maHScrollBar.get() )
{
Point aPos = pChild->GetPosPixel();
@@ -115,17 +110,7 @@ void ScrollableWrapper<T>::lcl_Scroll( long nX, long nY )
}
}
-//Can't use IMPL_LINK with the template
-//IMPL_LINK( ScrollableWrapper, ScrollBarHdl, ScrollBar*, pSB, void )
-
-template< class T>
-void ScrollableWrapper<T>::LinkStubScrollBarHdl( void* pThis, ScrollBar* pCaller)
-{
- static_cast<ScrollableWrapper<T>*>(pThis)->ScrollBarHdl( pCaller );
-}
-
-template< class T>
-void ScrollableWrapper<T>::ScrollBarHdl( ScrollBar* pSB )
+IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB, void )
{
sal_uInt16 nPos = (sal_uInt16) pSB->GetThumbPos();
if( pSB == maVScrollBar.get() )
@@ -134,8 +119,7 @@ void ScrollableWrapper<T>::ScrollBarHdl( ScrollBar* pSB )
lcl_Scroll(nPos, mnScrollPos.Y() );
}
-template< class T>
-void ScrollableWrapper<T>::SetScrollTop( long nTop )
+void ScrollableDialog::SetScrollTop( long nTop )
{
Point aOld = mnScrollPos;
lcl_Scroll( mnScrollPos.X() , mnScrollPos.Y() - nTop );
@@ -143,8 +127,7 @@ void ScrollableWrapper<T>::SetScrollTop( long nTop )
// new pos is 0,0
mnScrollPos = aOld;
}
-template< class T>
-void ScrollableWrapper<T>::SetScrollLeft( long nLeft )
+void ScrollableDialog::SetScrollLeft( long nLeft )
{
Point aOld = mnScrollPos;
lcl_Scroll( mnScrollPos.X() - nLeft , mnScrollPos.Y() );
@@ -152,45 +135,40 @@ void ScrollableWrapper<T>::SetScrollLeft( long nLeft )
// new pos is 0,0
mnScrollPos = aOld;
}
-template< class T>
-void ScrollableWrapper<T>::SetScrollWidth( long nWidth )
+
+void ScrollableDialog::SetScrollWidth( long nWidth )
{
maScrollArea.Width() = nWidth;
ResetScrollBars();
}
-template< class T>
-void ScrollableWrapper<T>::SetScrollHeight( long nHeight )
+void ScrollableDialog::SetScrollHeight( long nHeight )
{
maScrollArea.Height() = nHeight;
ResetScrollBars();
}
-template< class T>
-void ScrollableWrapper<T>::Resize()
+void ScrollableDialog::Resize()
{
ResetScrollBars();
}
-template< class T>
-void ScrollableWrapper<T>::ResetScrollBars()
+void ScrollableDialog::ResetScrollBars()
{
- Size aOutSz = T::GetOutputSizePixel();
+ Size aOutSz = GetOutputSizePixel();
Point aVPos( aOutSz.Width() - mnScrWidth, 0 );
Point aHPos( 0, aOutSz.Height() - mnScrWidth );
- maVScrollBar->SetPosSizePixel( aVPos, Size( mnScrWidth, T::GetSizePixel().Height() - mnScrWidth ) );
- maHScrollBar->SetPosSizePixel( aHPos, Size( T::GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
+ maVScrollBar->SetPosSizePixel( aVPos, Size( mnScrWidth, GetSizePixel().Height() - mnScrWidth ) );
+ maHScrollBar->SetPosSizePixel( aHPos, Size( GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
maHScrollBar->SetRangeMax( maScrollArea.Width() + mnScrWidth );
- maHScrollBar->SetVisibleSize( T::GetSizePixel().Width() );
+ maHScrollBar->SetVisibleSize( GetSizePixel().Width() );
maVScrollBar->SetRangeMax( maScrollArea.Height() + mnScrWidth );
- maVScrollBar->SetVisibleSize( T::GetSizePixel().Height() );
+ maVScrollBar->SetVisibleSize( GetSizePixel().Height() );
}
-template class ScrollableWrapper< Dialog >;
-
} // toolkit
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/awt/vclxcontainer.cxx b/toolkit/source/awt/vclxcontainer.cxx
index 0bd1ecdcdf43..275ae9b06c2a 100644
--- a/toolkit/source/awt/vclxcontainer.cxx
+++ b/toolkit/source/awt/vclxcontainer.cxx
@@ -245,7 +245,7 @@ throw(css::uno::RuntimeException, std::exception)
Size aSize( nVal, nVal );
VclPtr<vcl::Window> pWindow = GetWindow();
MapMode aMode( MapUnit::MapAppFont );
- toolkit::ScrollableInterface* pScrollable = dynamic_cast< toolkit::ScrollableInterface* >( pWindow.get() );
+ toolkit::ScrollableDialog* pScrollable = dynamic_cast< toolkit::ScrollableDialog* >( pWindow.get() );
if ( pWindow && pScrollable )
{
OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 28338f151110..51e3321d92cc 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -984,9 +984,9 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
{
// Modal/Modeless nur durch Show/Execute
if ( (pParent == nullptr ) && ( rDescriptor.ParentIndex == -1 ) )
- pNewWindow = VclPtr<toolkit::ScrollableWrapper<Dialog>>::Create( nullptr, nWinBits, Dialog::InitFlag::NoParent );
+ pNewWindow = VclPtr<toolkit::ScrollableDialog>::Create( nullptr, nWinBits, Dialog::InitFlag::NoParent );
else
- pNewWindow = VclPtr<toolkit::ScrollableWrapper<Dialog>>::Create( pParent, nWinBits );
+ pNewWindow = VclPtr<toolkit::ScrollableDialog>::Create( pParent, nWinBits );
// #i70217# Don't always create a new component object. It's possible that VCL has called
// GetComponentInterface( sal_True ) in the Dialog ctor itself (see Window::IsTopWindow() )
// which creates a component object.