Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / toolkit / source / awt / xthrobber.cxx
blobb62f680e30836779ae742c5ff4c1d57e5dadf7da
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "toolkit/awt/xthrobber.hxx"
21 #include "toolkit/helper/property.hxx"
22 #include <toolkit/helper/tkresmgr.hxx>
24 #include "xthrobber.hrc"
25 #include <tools/debug.hxx>
26 #include <vcl/fixed.hxx>
27 #include <vcl/timer.hxx>
28 #include <vcl/svapp.hxx>
29 #include <vcl/throbber.hxx>
31 //........................................................................
32 namespace toolkit
34 //........................................................................
36 using namespace ::com::sun::star;
38 //====================================================================
39 //= XThrobber
40 //====================================================================
41 DBG_NAME( XThrobber )
43 //--------------------------------------------------------------------
44 XThrobber::XThrobber()
46 DBG_CTOR( XThrobber, NULL );
49 //--------------------------------------------------------------------
50 XThrobber::~XThrobber()
52 DBG_DTOR( XThrobber, NULL );
55 //--------------------------------------------------------------------
56 void SAL_CALL XThrobber::start() throw ( uno::RuntimeException )
58 SolarMutexGuard aGuard;
59 Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
60 if ( pThrobber != NULL)
61 pThrobber->start();
64 //--------------------------------------------------------------------
65 void SAL_CALL XThrobber::stop() throw ( uno::RuntimeException )
67 SolarMutexGuard aGuard;
68 Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
69 if ( pThrobber != NULL)
70 pThrobber->stop();
73 //--------------------------------------------------------------------
74 void XThrobber::SetWindow( Window* pWindow )
76 XThrobber_Base::SetWindow( pWindow );
77 InitImageList();
80 //--------------------------------------------------------------------
81 void SAL_CALL XThrobber::InitImageList()
82 throw( uno::RuntimeException )
84 SolarMutexGuard aGuard;
86 Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
87 if ( pThrobber == NULL)
88 return;
90 uno::Sequence< uno::Reference< graphic::XGraphic > > aImageList(12);
91 sal_uInt16 nIconIdStart = RID_TK_ICON_THROBBER_START;
93 for ( sal_uInt16 i=0; i<12; i++ )
95 Image aImage = TK_RES_IMAGE( nIconIdStart + i );
96 aImageList[i] = aImage.GetXGraphic();
99 pThrobber->setImageList( aImageList );
102 //........................................................................
103 } // namespace toolkit
104 //........................................................................
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */