Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / toolkit / source / awt / xthrobber.cxx
blob91b35f9f9a246acbc48ba2f770ca5ce221fe312b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "toolkit/awt/xthrobber.hxx"
30 #include "toolkit/helper/property.hxx"
31 #include <toolkit/helper/tkresmgr.hxx>
33 #include "xthrobber.hrc"
34 #include <tools/debug.hxx>
35 #include <vcl/fixed.hxx>
36 #include <vcl/timer.hxx>
37 #include <vcl/svapp.hxx>
38 #include <vcl/throbber.hxx>
40 //........................................................................
41 namespace toolkit
43 //........................................................................
45 using namespace ::com::sun::star;
47 //====================================================================
48 //= XThrobber
49 //====================================================================
50 DBG_NAME( XThrobber )
52 //--------------------------------------------------------------------
53 XThrobber::XThrobber()
55 DBG_CTOR( XThrobber, NULL );
58 //--------------------------------------------------------------------
59 XThrobber::~XThrobber()
61 DBG_DTOR( XThrobber, NULL );
64 //--------------------------------------------------------------------
65 void SAL_CALL XThrobber::start() throw ( uno::RuntimeException )
67 SolarMutexGuard aGuard;
68 Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
69 if ( pThrobber != NULL)
70 pThrobber->start();
73 //--------------------------------------------------------------------
74 void SAL_CALL XThrobber::stop() throw ( uno::RuntimeException )
76 SolarMutexGuard aGuard;
77 Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
78 if ( pThrobber != NULL)
79 pThrobber->stop();
82 //--------------------------------------------------------------------
83 void XThrobber::SetWindow( Window* pWindow )
85 XThrobber_Base::SetWindow( pWindow );
86 InitImageList();
89 //--------------------------------------------------------------------
90 void SAL_CALL XThrobber::InitImageList()
91 throw( uno::RuntimeException )
93 SolarMutexGuard aGuard;
95 Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
96 if ( pThrobber == NULL)
97 return;
99 uno::Sequence< uno::Reference< graphic::XGraphic > > aImageList(12);
100 sal_uInt16 nIconIdStart = RID_TK_ICON_THROBBER_START;
102 for ( sal_uInt16 i=0; i<12; i++ )
104 Image aImage = TK_RES_IMAGE( nIconIdStart + i );
105 aImageList[i] = aImage.GetXGraphic();
108 pThrobber->setImageList( aImageList );
111 //........................................................................
112 } // namespace toolkit
113 //........................................................................
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */