LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StatusBarIcon.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2010-2012 Hewlett-Packard Development Company, L.P.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * LICENSE@@@ */
18 
19 
20 
21 
22 #ifndef STATUSBARICON_H
23 #define STATUSBARICON_H
24 
25 #include <QPixmap>
26 #include <QObject>
27 #include <QPainter>
28 #include <QGraphicsObject>
29 #include <QPointer>
30 #include <QEasingCurve>
31 #include "VariantAnimation.h"
32 
33 class StatusBarIcon;
34 
35 #define ICON_SPACING 5
36 
37 
39 public:
40  virtual void updateBoundingRect(bool forceRepaint=false)=0;
41  virtual void iconRemoved(StatusBarIcon* icon) {}
42 };
43 
44 class StatusBarIcon : public QObject
45 {
46  Q_OBJECT
47 
48 public:
51 
52  QRect boundingRect() const;
53 
54  void show();
55  void hide();
56 
57  bool isVisible() const { return m_visible; }
58 
59  qreal visiblePortion() { return m_animWidth; }
60 
61  void paint(QPainter* painter, QPoint centerRight, int width=-1);
62 
63  void setImage(QPixmap* img);
64 
65 protected Q_SLOTS:
66  void slotAnimFinished();
67 
68 protected:
69 
70  virtual void setVisible(bool visible) { m_visible = visible; }
71 
72  void animValueChanged(const QVariant& value);
73  void updateBoundingRect(bool forceRepaint = false);
74 
78  };
79 
80  QPixmap* m_imgPtr;
81 
82  QRect m_bounds;
83  bool m_visible;
84 
86 
88 
90  QEasingCurve m_curve;
91  QPointer<tIconAnim> m_animPtr;
92  qreal m_animWidth;
94 };
95 
96 #endif /* STATUSBARICON_H */