ScummVM API documentation
cloudicon.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef BACKENDS_NETWORKING_CURL_CLOUDICON_H
23 #define BACKENDS_NETWORKING_CURL_CLOUDICON_H
24 
25 #include "graphics/surface.h"
26 
27 namespace Cloud {
28 
29 class CloudIcon {
30 public:
31  CloudIcon();
32  ~CloudIcon();
33 
37  enum Type {
38  kNone,
41  };
42 
49  void show(Type icon, int duration = 0);
50 
52  Type getShownType() const;
53 
55  bool needsUpdate() const;
56 
58  void update();
59 
60 private:
61  static const float ALPHA_SPEED, ALPHA_MAX, ALPHA_MIN;
62  static const int UPDATE_DELAY_MIN_MILLIS = 10;
63 
64  enum State {
65  kHidden,
66  kShown,
67  kGoingToHide
68  };
69 
70  State _state;
71  Type _type;
72 
73  Graphics::Surface _icon, _disabledIcon, _alphaIcon;
74  float _currentAlpha;
75  bool _alphaRising;
76 
77  uint32 _hideTime;
78  uint32 _lastUpdateTime;
79 
80  void initIcons();
81  void loadIcon(Graphics::Surface &icon, const byte *data, uint32 size);
82  void makeAlphaIcon(const Graphics::Surface &icon, float alpha);
83 
84  void hide();
85 };
86 
87 } // End of namespace Cloud
88 
89 #endif
Definition: surface.h:67
Definition: basestorage.h:28
Definition: cloudicon.h:29
Type
Definition: cloudicon.h:37
Definition: cloudicon.h:40
Definition: cloudicon.h:39
Type getShownType() const
void show(Type icon, int duration=0)
bool needsUpdate() const