diff options
author | Malte Timmermann <mt@openoffice.org> | 2001-10-12 11:28:12 +0000 |
---|---|---|
committer | Malte Timmermann <mt@openoffice.org> | 2001-10-12 11:28:12 +0000 |
commit | b7d30aaf73d5e617c72c619fe6e38095ec1f59d3 (patch) | |
tree | bd6a1b8d89c5e4fa648ed44790da290e5ebc7fb1 /vcl/source/control/imgctrl.cxx | |
parent | 425010e35fc538f525b86173d8d956d3d3e8c82a (diff) |
#89914# ScaleImage
Diffstat (limited to 'vcl/source/control/imgctrl.cxx')
-rw-r--r-- | vcl/source/control/imgctrl.cxx | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx index 89390da2b304..ce7d091eaf1d 100644 --- a/vcl/source/control/imgctrl.cxx +++ b/vcl/source/control/imgctrl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: imgctrl.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: th $ $Date: 2001-07-06 16:12:28 $ + * last change: $Author: mt $ $Date: 2001-10-12 12:28:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,10 +71,31 @@ ImageControl::ImageControl( Window* pParent, WinBits nStyle ) : FixedImage( pParent, nStyle ) { + mnDummy1_mbScaleImage = TRUE; } // ----------------------------------------------------------------------- +void ImageControl::SetScaleImage( BOOL bScale ) +{ + if ( bScale != mnDummy1_mbScaleImage ) + { + mnDummy1_mbScaleImage = bScale; + Invalidate(); + } +} + +// ----------------------------------------------------------------------- + +BOOL ImageControl::IsScaleImage() const +{ + // Make inline when changing member from dummy... + return (BOOL)mnDummy1_mbScaleImage; +} + + +// ----------------------------------------------------------------------- + void ImageControl::Resize() { Invalidate(); @@ -84,9 +105,20 @@ void ImageControl::Resize() void ImageControl::UserDraw( const UserDrawEvent& rUDEvt ) { - maBmp.Draw( rUDEvt.GetDevice(), - rUDEvt.GetRect().TopLeft(), - rUDEvt.GetRect().GetSize() ); + if ( mnDummy1_mbScaleImage ) + { + maBmp.Draw( rUDEvt.GetDevice(), + rUDEvt.GetRect().TopLeft(), + rUDEvt.GetRect().GetSize() ); + } + else + { + // Center... + Point aPos( rUDEvt.GetRect().TopLeft() ); + aPos.X() += ( rUDEvt.GetRect().GetWidth() - maBmp.GetSizePixel().Width() ) / 2; + aPos.Y() += ( rUDEvt.GetRect().GetHeight() - maBmp.GetSizePixel().Height() ) / 2; + maBmp.Draw( rUDEvt.GetDevice(), aPos ); + } } // ----------------------------------------------------------------------- |