kstars
infoboxes.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef INFOBOXES_H_
00019 #define INFOBOXES_H_
00020
00021 #include <qobject.h>
00022 #include <qcolor.h>
00023 #include <qevent.h>
00024 #include <qpoint.h>
00025
00026 #include <QMouseEvent>
00027 #include <kdebug.h>
00028
00029 #include "infobox.h"
00030
00041 class QPainter;
00042 class GeoLocation;
00043 class SkyPoint;
00044 class dms;
00045 class InfoBox;
00046 class KStarsDateTime;
00047
00048 class InfoBoxes : public QObject {
00049 Q_OBJECT
00050 public:
00074 InfoBoxes( int w, int h,
00075 int tx=0, int ty=0, bool tshade=false,
00076 int gx=0, int gy=600, bool gshade=false,
00077 int fx=600, int fy=0, bool fshade=false,
00078 const QColor &colorText=QColor("white"),
00079 const QColor &colorGrab=QColor("red"),
00080 const QColor &colorBG=QColor("black") );
00081
00099 InfoBoxes( int w, int h,
00100 const QPoint &tp, bool tshade,
00101 const QPoint &gp, bool gshade,
00102 const QPoint &fp, bool fshade,
00103 const QColor &colorText=QColor("white"),
00104 const QColor &colorGrab=QColor("red"),
00105 const QColor &colorBG=QColor("black") );
00106
00108 ~InfoBoxes();
00109
00111 InfoBox *timeBox() { return TimeBox; }
00113 InfoBox *geoBox() { return GeoBox; }
00115 InfoBox *focusBox() { return FocusBox; }
00116
00124 void resize( int w, int h );
00125
00129 int width() const { return Width; }
00130
00134 int height() const { return Height; }
00135
00143 void drawBoxes( QPainter &p, const QColor &FGColor=QColor("white"),
00144 const QColor &grabColor=QColor("red"), const QColor &BGColor=QColor("black"),
00145 unsigned int BGMode=0 );
00146
00147
00148
00149
00150 void reserveBoxes( QPainter& psky );
00151
00159 bool grabBox( QMouseEvent *e );
00160
00166 bool unGrabBox();
00167
00175 bool dragBox( QMouseEvent *e );
00176
00184 bool shadeBox( QMouseEvent *e );
00185
00194 bool fixCollisions( InfoBox *target );
00195
00198 bool isVisible() { return Visible; }
00199
00200 public slots:
00207 void setVisible( bool t ) { Visible = t; }
00208
00212 void showTimeBox( bool t ) { TimeBox->setVisible( t ); }
00213
00217 void showGeoBox( bool t ) { GeoBox->setVisible( t ); }
00218
00222 void showFocusBox( bool t ) { FocusBox->setVisible( t ); }
00223
00232 bool timeChanged( const KStarsDateTime &ut, const KStarsDateTime <, dms *lst );
00233
00238 bool geoChanged(const GeoLocation *geo);
00239
00244 bool focusCoordChanged(const SkyPoint *p);
00245
00250 bool focusObjChanged(const QString &n);
00251
00255 void checkBorders(bool resetToDefault=true);
00256
00257 private:
00258 int Width, Height;
00259 int GrabbedBox;
00260 bool Visible;
00261 const QColor boxColor, grabColor, bgColor;
00262 QPoint GrabPos;
00263 InfoBox *GeoBox, *FocusBox, *TimeBox;
00264 InfoBox* m_box[3];
00265
00266 int m_saveFocus[3][2];
00267 };
00268
00269 #endif