diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2006-12-20 12:54:41 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2006-12-20 12:54:41 +0000 |
commit | 4ff34b86bef8a798d742961b74b973305efddcd9 (patch) | |
tree | 3e3cf9838f832f3013826cce784eafe8859e36aa /toolkit | |
parent | d373719951c18938993c1d72f71fbc27f00ed3b0 (diff) |
INTEGRATION: CWS jl49 (1.1.4); FILE ADDED
2006/12/19 09:48:17 jl 1.1.4.1: #i70481# adding copy of file which will be introduced in cws updchk02. In case of a conflict when updchk02 is integrated then the file from updchk02 shall be used
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/helper/throbberimpl.cxx | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/toolkit/source/helper/throbberimpl.cxx b/toolkit/source/helper/throbberimpl.cxx new file mode 100644 index 000000000000..60e00f552c05 --- /dev/null +++ b/toolkit/source/helper/throbberimpl.cxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: throbberimpl.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: ihi $ $Date: 2006-12-20 13:54:41 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _TOOLKIT_HELPER_THROBBERIMPL_HXX_ +#include <toolkit/helper/throbberimpl.hxx> +#endif + +#include <vcl/svapp.hxx> +#include <vcl/fixed.hxx> + +//........................................................................ +namespace toolkit +//........................................................................ +{ + using namespace ::com::sun::star; + using namespace ::com::sun::star::graphic; + using namespace ::com::sun::star::uno; + + //-------------------------------------------------------------------- + Throbber_Impl::Throbber_Impl( Reference< VCLXWindow > xParent, + sal_Int32 nStepTime, + sal_Bool bRepeat ) + :mrMutex( Application::GetSolarMutex() ) + { + mxParent = xParent; + mbRepeat = bRepeat; + mnStepTime = nStepTime; + maWaitTimer.SetTimeout( mnStepTime ); + maWaitTimer.SetTimeoutHdl( LINK( this, Throbber_Impl, TimeOutHdl ) ); + } + + //-------------------------------------------------------------------- + Throbber_Impl::~Throbber_Impl() + { + maWaitTimer.Stop(); + mxParent = NULL; + } + + //-------------------------------------------------------------------- + void Throbber_Impl::start() throw (RuntimeException) + { + ::vos::OGuard aGuard( GetMutex() ); + + mnCurStep = 0; + maWaitTimer.Start(); + } + + //-------------------------------------------------------------------- + void Throbber_Impl::stop() throw (RuntimeException) + { + ::vos::OGuard aGuard( GetMutex() ); + + maWaitTimer.Stop(); + } + + //-------------------------------------------------------------------- + void Throbber_Impl::setImageList( const Sequence< Reference< XGraphic > >& rImageList ) + throw (RuntimeException) + { + ::vos::OGuard aGuard( GetMutex() ); + + maImageList = rImageList; + + mnStepCount = maImageList.getLength(); + FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() ); + if ( pImage ) + if ( mnStepCount ) + pImage->SetImage( maImageList[ 0 ] ); + else + pImage->SetImage( Image() ); + } + + //-------------------------------------------------------------------- + void Throbber_Impl::initImage() + throw (RuntimeException) + { + FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() ); + if ( pImage ) + pImage->SetImage( maImageList[ 0 ] ); + } + + // ----------------------------------------------------------------------- + IMPL_LINK( Throbber_Impl, TimeOutHdl, Throbber_Impl*, EMPTYARG ) + { + ::vos::OGuard aGuard( GetMutex() ); + + FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() ); + + if ( !pImage ) + return 0; + + if ( mnCurStep < 11 ) + mnCurStep += 1; + else + mnCurStep = 0; + + pImage->SetImage( maImageList[ mnCurStep ] ); + + return 0; + } + +//........................................................................ +} // namespacetoolkit +//........................................................................ + |