1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xthrobber.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_toolkit.hxx"
33 #include "toolkit/awt/xthrobber.hxx"
34 #include "toolkit/helper/property.hxx"
35 #include <toolkit/helper/tkresmgr.hxx>
36 #include <toolkit/helper/throbberimpl.hxx>
38 #ifndef _TOOLKIT_AWT_XTHROBBER_HRC_
39 #include "xthrobber.hrc"
41 #include <tools/debug.hxx>
42 #include <vcl/fixed.hxx>
43 #include <vcl/timer.hxx>
45 //........................................................................
48 //........................................................................
50 using namespace ::com::sun::star
;
52 //====================================================================
54 //====================================================================
57 //--------------------------------------------------------------------
58 XThrobber::XThrobber()
60 DBG_CTOR( XThrobber
, NULL
);
62 mpThrobber
= new Throbber_Impl( this, 100, sal_True
);
67 //--------------------------------------------------------------------
68 XThrobber::~XThrobber()
70 DBG_DTOR( XThrobber
, NULL
);
74 //--------------------------------------------------------------------
75 IMPLEMENT_FORWARD_XINTERFACE2( XThrobber
, VCLXWindow
, XThrobber_Base
)
77 //--------------------------------------------------------------------
78 IMPLEMENT_FORWARD_XTYPEPROVIDER2( XThrobber
, VCLXWindow
, XThrobber_Base
)
80 //--------------------------------------------------------------------
81 void SAL_CALL
XThrobber::start() throw ( uno::RuntimeException
)
86 //--------------------------------------------------------------------
87 void SAL_CALL
XThrobber::stop() throw ( uno::RuntimeException
)
92 //--------------------------------------------------------------------
93 void XThrobber::ProcessWindowEvent( const VclWindowEvent
& _rVclWindowEvent
)
95 static bool bInit
= false;
98 // Images won't be shown if set too early
99 mpThrobber
->initImage();
102 // TODO: XSimpleAnimation::ProcessWindowEvent
103 //::vos::OClearableGuard aGuard( GetMutex() );
104 //Reference< XSimpleAnimation > xKeepAlive( this );
105 //SpinButton* pSpinButton = static_cast< SpinButton* >( GetWindow() );
106 //if ( !pSpinButton )
109 VCLXWindow::ProcessWindowEvent( _rVclWindowEvent
);
112 //--------------------------------------------------------------------
113 void SAL_CALL
XThrobber::setProperty( const ::rtl::OUString
& PropertyName
, const uno::Any
& Value
)
114 throw( uno::RuntimeException
)
116 ::vos::OGuard
aGuard( GetMutex() );
120 VCLXWindow::setProperty( PropertyName
, Value
);
124 //--------------------------------------------------------------------
125 uno::Any SAL_CALL
XThrobber::getProperty( const ::rtl::OUString
& PropertyName
)
126 throw( uno::RuntimeException
)
128 ::vos::OGuard
aGuard( GetMutex() );
134 aReturn
= VCLXWindow::getProperty( PropertyName
);
139 //--------------------------------------------------------------------
140 void SAL_CALL
XThrobber::InitImageList()
141 throw( uno::RuntimeException
)
143 ::vos::OGuard
aGuard( GetMutex() );
144 uno::Sequence
< uno::Reference
< graphic::XGraphic
> > aImageList(12);
145 sal_uInt16 nIconIdStart
= RID_TK_ICON_THROBBER_START
;
147 if ( mpThrobber
->isHCMode() )
148 nIconIdStart
= RID_TK_HC_ICON_THROBBER_START
;
150 for ( sal_uInt16 i
=0; i
<12; i
++ )
152 Image aImage
= TK_RES_IMAGE( nIconIdStart
+ i
);
153 aImageList
[i
] = aImage
.GetXGraphic();
156 mpThrobber
->setImageList( aImageList
);
159 //........................................................................
160 } // namespace toolkit
161 //........................................................................