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 #include <kdebug.h>
00026
00027 #include "infobox.h"
00028
00039 class QPainter;
00040 class GeoLocation;
00041 class SkyPoint;
00042 class dms;
00043 class InfoBox;
00044 class KStarsDateTime;
00045
00046 class InfoBoxes : public QObject {
00047 Q_OBJECT
00048 public:
00072 InfoBoxes( int w, int h,
00073 int tx=0, int ty=0, bool tshade=false,
00074 int gx=0, int gy=600, bool gshade=false,
00075 int fx=600, int fy=0, bool fshade=false,
00076 QColor colorText=QColor("white"),
00077 QColor colorGrab=QColor("red"),
00078 QColor colorBG=QColor("black") );
00079
00097 InfoBoxes( int w, int h,
00098 QPoint tp, bool tshade,
00099 QPoint gp, bool gshade,
00100 QPoint fp, bool fshade,
00101 QColor colorText=QColor("white"),
00102 QColor colorGrab=QColor("red"),
00103 QColor colorBG=QColor("black") );
00104
00106 ~InfoBoxes();
00107
00109 InfoBox *timeBox() { return TimeBox; }
00111 InfoBox *geoBox() { return GeoBox; }
00113 InfoBox *focusBox() { return FocusBox; }
00114
00122 void resize( int w, int h );
00123
00127 int width() const { return Width; }
00128
00132 int height() const { return Height; }
00133
00141 void drawBoxes( QPainter &p, QColor FGColor=QColor("white"),
00142 QColor grabColor=QColor("red"), QColor BGColor=QColor("black"),
00143 unsigned int BGMode=0 );
00144
00152 bool grabBox( QMouseEvent *e );
00153
00159 bool unGrabBox();
00160
00168 bool dragBox( QMouseEvent *e );
00169
00177 bool shadeBox( QMouseEvent *e );
00178
00187 bool fixCollisions( InfoBox *target );
00188
00191 bool isVisible() { return Visible; }
00192
00193 public slots:
00200 void setVisible( bool t ) { Visible = t; }
00201
00205 void showTimeBox( bool t ) { TimeBox->setVisible( t ); }
00206
00210 void showGeoBox( bool t ) { GeoBox->setVisible( t ); }
00211
00215 void showFocusBox( bool t ) { FocusBox->setVisible( t ); }
00216
00225 bool timeChanged( const KStarsDateTime &ut, const KStarsDateTime <, dms *lst );
00226
00231 bool geoChanged(const GeoLocation *geo);
00232
00237 bool focusCoordChanged(const SkyPoint *p);
00238
00243 bool focusObjChanged(const QString &n);
00244
00248 void checkBorders(bool resetToDefault=true);
00249
00250 private:
00251 int Width, Height;
00252 int GrabbedBox;
00253 bool Visible;
00254 const QColor boxColor, grabColor, bgColor;
00255 QPoint GrabPos;
00256 InfoBox *GeoBox, *FocusBox, *TimeBox;
00257 };
00258
00259 #endif