20 #ifndef _STELGUIITEMS_HPP_
21 #define _STELGUIITEMS_HPP_
23 #include <QGraphicsPixmapItem>
24 #include <QGraphicsWidget>
28 class QGraphicsSceneMouseEvent;
30 class QGraphicsTextItem;
47 QMap<const StelProgressController*, QProgressBar*> allBars;
54 Q_INTERFACES(QGraphicsItem)
57 virtual void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
58 virtual QRectF boundingRect()
const;
59 void setOpacity(
double opacity);
61 mutable double lastOpacity;
65 class StelButton :
public QObject,
public QGraphicsPixmapItem
78 StelButton(QGraphicsItem* parent,
const QPixmap& pixOn,
const QPixmap& pixOff,
79 const QPixmap& pixHover=QPixmap(),
80 class StelAction* action=NULL,
bool noBackground=
false);
82 StelButton(QGraphicsItem* parent,
const QPixmap& pixOn,
const QPixmap& pixOff,
83 const QPixmap& pixHover=QPixmap(),
84 const QString& actionId=QString(),
bool noBackground=
false);
94 StelButton(QGraphicsItem* parent,
const QPixmap& pixOn,
const QPixmap& pixOff,
const QPixmap& pixNoChange,
95 const QPixmap& pixHover=QPixmap(),
96 const QString& actionId=QString(),
bool noBackground=
false,
bool isTristate=
true);
99 enum {ButtonStateOff = 0, ButtonStateOn = 1, ButtonStateNoChange = 2};
129 virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
130 virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
131 virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
132 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
134 void animValueChanged(qreal value);
136 void initCtor(
const QPixmap& apixOn,
137 const QPixmap& apixOff,
138 const QPixmap& apixNoChange,
139 const QPixmap& apixHover,
144 int toggleChecked(
int);
150 QPixmap pixBackground;
166 Q_INTERFACES(QGraphicsItem)
170 virtual void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
171 virtual QRectF boundingRect()
const;
173 QRectF boundingRectNoHelpLabel()
const;
175 void setColor(
const QColor& c);
178 void buttonHoverChanged(
bool b);
180 QTimeLine* hideTimeLine;
181 QGraphicsSimpleTextItem* helpLabel;
188 Q_INTERFACES(QGraphicsItem)
190 BottomStelBar(QGraphicsItem* parent,
const QPixmap& pixLeft=QPixmap(),
const QPixmap& pixRight=QPixmap(),
const QPixmap& pixMiddle=QPixmap(),
const QPixmap& pixSingle=QPixmap());
192 virtual void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
193 virtual QRectF boundingRect()
const;
194 QRectF boundingRectNoHelpLabel()
const;
200 void addButton(
StelButton* button,
const QString& groupName=
"defaultGroup",
const QString& beforeActionName=
"");
202 StelButton* hideButton(
const QString& actionName);
205 void setGroupMargin(
const QString& groupName,
int left,
int right);
208 void setGroupBackground(
const QString& groupName,
const QPixmap& pixLeft=QPixmap(),
209 const QPixmap& pixRight=QPixmap(),
const QPixmap& pixMiddle=QPixmap(),
210 const QPixmap& pixSingle=QPixmap());
213 void setColor(
const QColor& c);
216 void setFlagShowTime(
bool b) {flagShowTime=b;}
217 bool getFlagShowTime() {
return flagShowTime; }
219 void setFlagShowLocation(
bool b) {flagShowLocation=b;}
220 bool getFlagShowLocation() {
return flagShowLocation; }
222 void setFlagShowFps(
bool b) {flagShowFps=b;}
223 bool getFlagShowFps() {
return flagShowFps; }
225 void setFlagShowFov(
bool b) {flagShowFov=b;}
226 bool getFlagShowFov() {
return flagShowFov; }
228 void setFlagFovDms(
bool b) {flagFovDms=b;}
229 bool getFlagFovDms() {
return flagFovDms; }
231 void setFlagTimeJd(
bool b) {flagTimeJd=b;}
232 bool getFlagTimeJd() {
return flagTimeJd; }
234 void setFlagShowTz(
bool b) { flagShowTZ=b; }
235 bool getFlagShowTz() {
return flagShowTZ; }
242 void buttonHoverChanged(
bool b);
245 void updateText(
bool forceUpdatePos=
false);
246 void updateButtonsGroups();
247 QRectF getButtonsBoundingRect()
const;
248 QGraphicsSimpleTextItem* location;
249 QGraphicsSimpleTextItem* datetime;
250 QGraphicsSimpleTextItem* fov;
251 QGraphicsSimpleTextItem* fps;
255 ButtonGroup() : leftMargin(0), rightMargin(0),
256 pixBackgroundLeft(NULL), pixBackgroundRight(NULL),
257 pixBackgroundMiddle(NULL), pixBackgroundSingle(NULL) {;}
259 QList<StelButton*> elems;
265 QPixmap* pixBackgroundLeft;
266 QPixmap* pixBackgroundRight;
267 QPixmap* pixBackgroundMiddle;
268 QPixmap* pixBackgroundSingle;
271 QMap<QString, ButtonGroup> buttonGroups;
272 QPixmap pixBackgroundLeft;
273 QPixmap pixBackgroundRight;
274 QPixmap pixBackgroundMiddle;
275 QPixmap pixBackgroundSingle;
278 bool flagShowLocation;
285 QGraphicsSimpleTextItem* helpLabel;
294 double getRoundSize()
const {
return roundSize;}
295 void setBackgroundOpacity(
double opacity);
300 #endif // _STELGUIITEMS_HPP_
Maintain the state of a progress bar.