20 #ifndef _STELGUIITEMS_HPP_
21 #define _STELGUIITEMS_HPP_
23 #include <QGraphicsPixmapItem>
24 #include <QGraphicsWidget>
27 class QGraphicsSceneMouseEvent;
30 class QGraphicsTextItem;
39 class QProgressBar* addProgressBar();
46 Q_INTERFACES(QGraphicsItem);
49 virtual void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
50 virtual QRectF boundingRect()
const;
51 void setOpacity(
double opacity);
53 mutable double lastOpacity;
57 class StelButton :
public QObject,
public QGraphicsPixmapItem
70 StelButton(QGraphicsItem* parent,
const QPixmap& pixOn,
const QPixmap& pixOff,
71 const QPixmap& pixHover=QPixmap(),
72 QAction* action=NULL,
bool noBackground=
false);
82 StelButton(QGraphicsItem* parent,
const QPixmap& pixOn,
const QPixmap& pixOff,
const QPixmap& pixNoChange,
83 const QPixmap& pixHover=QPixmap(),
84 QAction* action=NULL,
bool noBackground=
false,
bool isTristate=
true);
86 enum {ButtonStateOff = 0, ButtonStateOn = 1, ButtonStateNoChange = 2};
107 static QPixmap
makeRed(
const QPixmap& p);
124 virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
125 virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
126 virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
127 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
129 void animValueChanged(qreal value);
132 int toggleChecked(
int);
138 QPixmap pixBackground;
142 QPixmap pixNoChangeRed;
144 QPixmap pixBackgroundRed;
162 Q_INTERFACES(QGraphicsItem);
166 virtual void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
167 virtual QRectF boundingRect()
const;
169 QRectF boundingRectNoHelpLabel()
const;
176 void buttonHoverChanged(
bool b);
178 QTimeLine* hideTimeLine;
179 QGraphicsSimpleTextItem* helpLabel;
186 Q_INTERFACES(QGraphicsItem);
188 BottomStelBar(QGraphicsItem* parent,
const QPixmap& pixLeft=QPixmap(),
const QPixmap& pixRight=QPixmap(),
const QPixmap& pixMiddle=QPixmap(),
const QPixmap& pixSingle=QPixmap());
190 virtual void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
191 virtual QRectF boundingRect()
const;
192 QRectF boundingRectNoHelpLabel()
const;
198 void addButton(
StelButton* button,
const QString& groupName=
"defaultGroup",
const QString& beforeActionName=
"");
203 void setGroupMargin(
const QString& groupName,
int left,
int right);
207 const QPixmap& pixRight=QPixmap(),
const QPixmap& pixMiddle=QPixmap(),
208 const QPixmap& pixSingle=QPixmap());
224 void buttonHoverChanged(
bool b);
227 void updateText(
bool forceUpdatePos=
false);
228 void updateButtonsGroups();
229 QRectF getButtonsBoundingRect()
const;
230 QGraphicsSimpleTextItem* location;
231 QGraphicsSimpleTextItem* datetime;
232 QGraphicsSimpleTextItem* fov;
233 QGraphicsSimpleTextItem* fps;
237 ButtonGroup() : leftMargin(0), rightMargin(0),
238 pixBackgroundLeft(NULL), pixBackgroundRight(NULL),
239 pixBackgroundMiddle(NULL), pixBackgroundSingle(NULL) {;}
241 QList<StelButton*> elems;
247 QPixmap* pixBackgroundLeft;
248 QPixmap* pixBackgroundRight;
249 QPixmap* pixBackgroundMiddle;
250 QPixmap* pixBackgroundSingle;
253 QMap<QString, ButtonGroup> buttonGroups;
254 QPixmap pixBackgroundLeft;
255 QPixmap pixBackgroundRight;
256 QPixmap pixBackgroundMiddle;
257 QPixmap pixBackgroundSingle;
260 bool flagShowLocation;
262 QGraphicsSimpleTextItem* helpLabel;
271 double getRoundSize()
const {
return roundSize;}
272 void setBackgroundOpacity(
double opacity);
277 #endif // _STELGUIITEMS_HPP_