LibreOffice Module vcl (master)  1
throbber.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_VCL_THROBBER_HXX
21 #define INCLUDED_VCL_THROBBER_HXX
22 
23 #if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
24 #error "don't use this in new code"
25 #endif
26 
27 #include <config_options.h>
28 #include <vcl/dllapi.h>
29 #include <vcl/toolkit/imgctrl.hxx>
30 #include <vcl/timer.hxx>
31 
32 #include <vector>
33 
34 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) Throbber final : public ImageControl
35 {
36 public:
37  enum class ImageSet
38  {
40  N16px,
42  N32px,
44  N64px,
45  };
46 
47 public:
48  Throbber(vcl::Window* i_parentWindow, WinBits i_style);
49  virtual ~Throbber() override;
50  virtual void dispose() override;
51 
52  // Properties
53  void setStepTime( sal_Int32 nStepTime ) { mnStepTime = nStepTime; }
54  sal_Int32 getStepTime() const { return mnStepTime; }
55 
56  void setRepeat( bool bRepeat ) { mbRepeat = bRepeat; }
57  bool getRepeat() const { return mbRepeat; }
58 
59  // animation control
60  void start();
61  void stop();
62  bool isRunning() const;
63 
64  void setImageList( ::std::vector< Image > const& i_images );
65 
66  // default images
67  static ::std::vector< OUString >
68  getDefaultImageURLs( const ImageSet i_imageSet );
69 
70 private:
71  // Window overridables
72  virtual void Resize() override;
73 
74  SAL_DLLPRIVATE void initImages();
75 
76  ::std::vector< Image > maImageList;
77 
78  bool mbRepeat;
79  sal_Int32 mnStepTime;
80  sal_Int32 mnCurStep;
81  AutoTimer maWaitTimer;
82 
83  DECL_LINK( TimeOutHdl, Timer*, void );
84 };
85 
86 #endif // INCLUDED_VCL_THROBBER_HXX
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int64 WinBits
An auto-timer is a multi-shot timer re-emitting itself at interval until destroyed or stopped...
Definition: timer.hxx:72
def stop
Definition: timer.hxx:26
void dispose()