summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2012-09-05 19:49:10 +0100
committerNoel Power <noel.power@suse.com>2012-09-11 16:04:10 +0100
commitbe045f69d1746a287c48389785a0eaa91785d452 (patch)
tree87ff2a39ff7120c862d90970470e1a77168410e6 /toolkit
parent7d69c50413884d5cba1498b5af3298820fb4621b (diff)
better scrolling, support for scroll width and scroll height
scroll top & scroll left not working that successfully Change-Id: I61e49c15798a1754822fb0802cbd17bab07327cd
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/inc/toolkit/awt/scrollabledialog.hxx3
-rw-r--r--toolkit/source/awt/scrollabledialog.cxx68
2 files changed, 19 insertions, 52 deletions
diff --git a/toolkit/inc/toolkit/awt/scrollabledialog.hxx b/toolkit/inc/toolkit/awt/scrollabledialog.hxx
index 968771b56e6c..41ae32f72c9f 100644
--- a/toolkit/inc/toolkit/awt/scrollabledialog.hxx
+++ b/toolkit/inc/toolkit/awt/scrollabledialog.hxx
@@ -63,10 +63,9 @@ namespace toolkit
Window* getContentWindow();
ScrollBarVisibility getScrollVisibility() { return maScrollVis; }
void setScrollVisibility( ScrollBarVisibility rState );
- virtual void Paint( const Rectangle& rRect );
- virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
DECL_LINK( ScrollBarHdl, ScrollBar* );
DECL_LINK( ContainerScrolled, void* );
+ virtual void ResetScrollBars();
// Window
virtual void Resize();
};
diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx
index dc3d3ab2dba2..2ffc793287c4 100644
--- a/toolkit/source/awt/scrollabledialog.cxx
+++ b/toolkit/source/awt/scrollabledialog.cxx
@@ -88,74 +88,44 @@ IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB )
void ScrollableDialog::SetScrollTop( long nTop )
{
printf("ScrollableDialog::SetScrollTop(%d)\n", nTop );
+ Point aOld = mnScrollPos;
+ lcl_Scroll( mnScrollPos.X() , nTop );
+ printf("about to set thumb\n");
+ maHScrollBar.SetThumbPos( 0 );
+ mnScrollPos = aOld;
}
void ScrollableDialog::SetScrollLeft( long nLeft )
{
printf("ScrollableDialog::SetScrollLeft(%d)\n", nLeft );
+ Point aOld = mnScrollPos;
+ lcl_Scroll( nLeft , mnScrollPos.Y() );
+ printf("about to set thumb\n");
+ maVScrollBar.SetThumbPos( 0 );
+ mnScrollPos = aOld;
}
void ScrollableDialog::SetScrollWidth( long nWidth )
{
printf("ScrollableDialog::SetScrollWidth(%d)\n", nWidth );
maScrollArea.Width() = nWidth;
+ ResetScrollBars();
}
void ScrollableDialog::SetScrollHeight( long nHeight )
{
printf("ScrollableDialog::SetScrollHeight(%d)\n", nHeight );
maScrollArea.Height() = nHeight;
+ ResetScrollBars();
}
-void ScrollableDialog::Paint( const Rectangle& rRect )
-{
-// printf("ScrollableDialog::Paint( %d, %d, %d, %d width %d height %d\n", rRect.Top(), rRect.Left(), rRect.Right(), rRect.Bottom(),GetSizePixel().Width(), GetSizePixel().Height() );
- Dialog::Paint( rRect );
-}
-
-void ScrollableDialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
+void ScrollableDialog::Resize()
{
-// printf("ScrollableDialog::Draw( ( %d, %d ) h %d, w %d \n", rPos.X(), rPos.Y(), rSize.Height(), rSize.Width() );
- Dialog::Draw( pDev, rPos, rSize, nFlags );
+ ResetScrollBars();
}
-void ScrollableDialog::Resize()
+void ScrollableDialog::ResetScrollBars()
{
Size aOutSz = GetOutputSizePixel();
- printf("ScrollableDialog::Resize() - size is width %d height %d\n", GetSizePixel().Width(), GetSizePixel().Height() );
- // find the output area for the window
- long nMaxX = GetSizePixel().Width();
- long nMaxY = GetSizePixel().Height();
- for ( int index = 0, count = GetChildCount(); index < count; ++index )
- {
- Window* pChild = GetChild( index );
- if ( pChild )
- {
- Point aPos = pChild->GetPosPixel();
- Size aSize = pChild->GetSizePixel();
- long nX = aPos.X() + aSize.Width();
- long nY = aPos.Y() + aSize.Height();
- if ( nX > nMaxX )
- nMaxX = nX;
- if ( nY > nMaxY )
- nMaxY = nY;
- printf("%s child[%d] pos (%d,%d) height %d, width %d\n", rtl::OUStringToOString( pChild->GetText(), RTL_TEXTENCODING_UTF8 ).getStr(), index, aPos.X(), aPos.Y(), aSize.Height(), aSize.Width() );
- }
- }
-
-#if 1
- // assume for the moment that we have both hori & vert scroll bars
- Size aContentsSize( aOutSz );
- if ( mbHasVertBar )
- {
- aContentsSize.Width() -= mnScrWidth;
- nMaxX += mnScrWidth;
- }
- if ( mbHasHoriBar )
- {
- aContentsSize.Height() -= mnScrWidth;
- nMaxY += mnScrWidth;
- }
- maScrollArea = aContentsSize;
-#endif
+ printf("ScrollableDialog::ResetScrollbars() - size is width %d height %d\n", GetSizePixel().Width(), GetSizePixel().Height() );
Point aVPos( aOutSz.Width() - mnScrWidth, 0 );
Point aHPos( 0, aOutSz.Height() - mnScrWidth );
@@ -163,13 +133,11 @@ void ScrollableDialog::Resize()
maVScrollBar.SetPosSizePixel( aVPos, Size( mnScrWidth, GetSizePixel().Height() - mnScrWidth ) );
maHScrollBar.SetPosSizePixel( aHPos, Size( GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
- printf("nMaxX is %d nMaxY is %d, scrollarea height %d, width %d\n", nMaxX, nMaxY, maScrollArea.Height(), maScrollArea.Width() );
- printf("Width %d Height %d outsize width %d height %d\n", GetSizePixel().Width(), GetSizePixel().Height(), aOutSz.Width(), aOutSz.Height() );
- maHScrollBar.SetRangeMax( nMaxX );
+ maHScrollBar.SetRangeMax( maScrollArea.Width() + mnScrWidth );
maHScrollBar.SetVisibleSize( GetSizePixel().Width() );
// maHScrollBar.SetPageSize( maScrollArea.Height() );
- maVScrollBar.SetRangeMax( nMaxY );
+ maVScrollBar.SetRangeMax( maScrollArea.Height() + mnScrWidth );
maVScrollBar.SetVisibleSize( GetSizePixel().Height() );
// maVScrollBar.SetPageSize( maScrollArea.Width() );
}