kstars
infobox.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 INFOBOX_H
00019 #define INFOBOX_H
00020
00021 #include <qobject.h>
00022 #include <qpoint.h>
00023 #include <qrect.h>
00024 #include <qsize.h>
00025 #include <qstring.h>
00026
00036 class QPainter;
00037
00038 class InfoBox : public QObject {
00039 Q_OBJECT
00040 public:
00044 InfoBox();
00045
00054 InfoBox( int x, int y, bool shade, QString t1="", QString t2="", QString t3="" );
00055
00065 InfoBox( QPoint p, bool shade, QString t1="", QString t2="", QString t3="" );
00066
00068 ~InfoBox();
00069
00078 void draw( QPainter &p, QColor BGColor, unsigned int BGMode );
00079
00082 bool toggleShade();
00083
00088 void move( int x, int y );
00089
00095 void move( QPoint p );
00096
00101 void resize( int w, int h ) { Size.setWidth( w ); Size.setHeight( h ); }
00102
00107 void resize( QSize s ) { Size.setWidth( s.width() ); Size.setHeight( s.height() ); }
00108
00110 void updateSize();
00111
00118 bool constrain( QRect r, bool inside=true );
00119
00123 void setText1( QString newt ) { Text1 = newt; }
00124
00128 void setText2( QString newt ) { Text2 = newt; }
00129
00133 void setText3( QString newt ) { Text3 = newt; }
00134
00135
00136 int padx() const { return 6; }
00137 int pady() const { return 6; }
00138
00140 void setVisible( bool t ) { Visible = t; }
00141
00143 int x() const { return Pos.x(); }
00144
00146 int y() const { return Pos.y(); }
00147
00149 QPoint pos() const { return Pos; }
00150
00152 int width() const { return Size.width(); }
00153
00155 int height() const { return Size.height(); }
00156
00158 QSize size() const { return Size; }
00159
00161 bool isVisible() const { return Visible; }
00162
00164 QString text1() const { return Text1; }
00165
00167 QString text2() const { return Text2; }
00168
00170 QString text3() const { return Text3; }
00171
00173 QRect rect() const;
00174
00176 bool anchorRight() const { return ( AnchorFlag & AnchorRight ); }
00177
00179 bool anchorBottom() const { return ( AnchorFlag & AnchorBottom ); }
00180
00182 void setAnchorRight( const bool ar );
00183
00185 void setAnchorBottom( const bool ab );
00186
00188 int anchorFlag() const { return AnchorFlag; }
00189
00191 void setAnchorFlag( const int af ) { AnchorFlag = af; }
00192
00193 enum AnchorType {
00194 AnchorNone = 0x0000,
00195 AnchorRight = 0x0001,
00196 AnchorBottom = 0x0002,
00197 AnchorBoth = AnchorRight | AnchorBottom
00198 };
00199
00200 signals:
00205 void moved( QPoint p );
00206
00211 void shaded( bool s );
00212
00213 private:
00214 bool Shaded, Visible;
00215
00216
00217 int FullTextWidth, FullTextHeight;
00218 int ShadedTextWidth, ShadedTextHeight;
00219 int AnchorFlag;
00220 QPoint Pos;
00221 QSize Size;
00222 QString Text1, Text2, Text3;
00223 };
00224
00225 #endif