Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "toolkit/awt/xthrobber.hxx"
21 : #include "toolkit/helper/property.hxx"
22 : #include <toolkit/helper/tkresmgr.hxx>
23 :
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>
30 :
31 : //........................................................................
32 : namespace toolkit
33 : {
34 : //........................................................................
35 :
36 : using namespace ::com::sun::star;
37 :
38 : //====================================================================
39 : //= XThrobber
40 : //====================================================================
41 : DBG_NAME( XThrobber )
42 :
43 : //--------------------------------------------------------------------
44 0 : XThrobber::XThrobber()
45 : {
46 : DBG_CTOR( XThrobber, NULL );
47 0 : }
48 :
49 : //--------------------------------------------------------------------
50 0 : XThrobber::~XThrobber()
51 : {
52 : DBG_DTOR( XThrobber, NULL );
53 0 : }
54 :
55 : //--------------------------------------------------------------------
56 0 : void SAL_CALL XThrobber::start() throw ( uno::RuntimeException )
57 : {
58 0 : SolarMutexGuard aGuard;
59 0 : Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
60 0 : if ( pThrobber != NULL)
61 0 : pThrobber->start();
62 0 : }
63 :
64 : //--------------------------------------------------------------------
65 0 : void SAL_CALL XThrobber::stop() throw ( uno::RuntimeException )
66 : {
67 0 : SolarMutexGuard aGuard;
68 0 : Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
69 0 : if ( pThrobber != NULL)
70 0 : pThrobber->stop();
71 0 : }
72 :
73 : //--------------------------------------------------------------------
74 0 : void XThrobber::SetWindow( Window* pWindow )
75 : {
76 0 : XThrobber_Base::SetWindow( pWindow );
77 0 : InitImageList();
78 0 : }
79 :
80 : //--------------------------------------------------------------------
81 0 : void SAL_CALL XThrobber::InitImageList()
82 : throw( uno::RuntimeException )
83 : {
84 0 : SolarMutexGuard aGuard;
85 :
86 0 : Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
87 0 : if ( pThrobber == NULL)
88 0 : return;
89 :
90 0 : uno::Sequence< uno::Reference< graphic::XGraphic > > aImageList(12);
91 0 : sal_uInt16 nIconIdStart = RID_TK_ICON_THROBBER_START;
92 :
93 0 : for ( sal_uInt16 i=0; i<12; i++ )
94 : {
95 0 : Image aImage = TK_RES_IMAGE( nIconIdStart + i );
96 0 : aImageList[i] = aImage.GetXGraphic();
97 0 : }
98 :
99 0 : pThrobber->setImageList( aImageList );
100 : }
101 :
102 : //........................................................................
103 : } // namespace toolkit
104 : //........................................................................
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|