00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef KPASSIVEPOPUP_H
00012 #define KPASSIVEPOPUP_H
00013
00014 #include <tqframe.h>
00015
00016 #include <tdelibs_export.h>
00017
00018 class TQBoxLayout;
00019 class TQTimer;
00020 class TQLabel;
00021 class TQVBox;
00022
00068 class TDEUI_EXPORT KPassivePopup : public TQFrame
00069 {
00070 Q_OBJECT
00071 TQ_PROPERTY (bool autoDelete READ autoDelete WRITE setAutoDelete )
00072 TQ_PROPERTY (int timeout READ timeout WRITE setTimeout )
00073
00074 public:
00079 enum PopupStyle
00080 {
00081 Boxed,
00082 Balloon,
00083 CustomStyle=128
00084 };
00085
00089 KPassivePopup( TQWidget *parent=0, const char *name=0, WFlags f=0 );
00090
00094 KPassivePopup( WId parent, const char *name=0, WFlags f=0 );
00095
00100 KPassivePopup( int popupStyle, TQWidget *parent=0, const char *name=0, WFlags f=0 );
00101
00106 KPassivePopup( int popupStyle, WId parent, const char *name=0, WFlags f=0 );
00107
00111 virtual ~KPassivePopup();
00112
00116 void setView( TQWidget *child );
00117
00121 void setView( const TQString &caption, const TQString &text = TQString::null );
00122
00126 virtual void setView( const TQString &caption, const TQString &text, const TQPixmap &icon );
00127
00148 TQVBox * standardView( const TQString& caption, const TQString& text,
00149 const TQPixmap& icon, TQWidget *parent = 0L );
00150
00154 TQWidget *view() const { return msgView; }
00155
00159 int timeout() const { return hideDelay; }
00160
00167 virtual void setAutoDelete( bool autoDelete );
00168
00173 bool autoDelete() const { return m_autoDelete; }
00174
00180 void setAnchor( const TQPoint& anchor );
00181
00182
00183
00184
00191 static KPassivePopup *message( const TQString &text, TQWidget *parent, const char *name=0 );
00192
00199 static KPassivePopup *message( const TQString &caption, const TQString &text,
00200 TQWidget *parent, const char *name=0 );
00201
00208 static KPassivePopup *message( const TQString &caption, const TQString &text,
00209 const TQPixmap &icon,
00210 TQWidget *parent, const char *name=0, int timeout = -1 );
00211
00218 static KPassivePopup *message( const TQString &caption, const TQString &text,
00219 const TQPixmap &icon,
00220 WId parent, const char *name=0, int timeout = -1 );
00221
00228 static KPassivePopup *message( int popupStyle, const TQString &text, TQWidget *parent,
00229 const char *name=0 );
00230
00237 static KPassivePopup *message( int popupStyle, const TQString &caption, const TQString &text,
00238 TQWidget *parent, const char *name=0 );
00239
00246 static KPassivePopup *message( int popupStyle, const TQString &caption, const TQString &text,
00247 const TQPixmap &icon,
00248 TQWidget *parent, const char *name=0, int timeout = -1 );
00249
00256 static KPassivePopup *message( int popupStyle, const TQString &caption, const TQString &text,
00257 const TQPixmap &icon,
00258 WId parent, const char *name=0, int timeout = -1 );
00259
00260
00261 public slots:
00270 void setTimeout( int delay );
00271
00275 virtual void show();
00276
00281 void show(const TQPoint &p);
00282
00283 signals:
00287 void clicked();
00288
00292 void clicked( TQPoint pos );
00293
00297 void hidden(KPassivePopup*);
00298
00299 protected:
00303 virtual void positionSelf();
00304
00309 virtual void hideEvent( TQHideEvent * );
00310
00314 void moveNear( TQRect target );
00315
00319 virtual void mouseReleaseEvent( TQMouseEvent *e );
00320
00329 TQRect defaultArea() const;
00330
00335 void updateMask();
00336
00341 virtual void paintEvent( TQPaintEvent* pe );
00342
00343 private:
00344 void init( int popupStyle );
00345
00346 WId window;
00347 TQWidget *msgView;
00348 TQBoxLayout *topLayout;
00349 int hideDelay;
00350 TQTimer *hideTimer;
00351
00352 TQLabel *ttlIcon;
00353 TQLabel *ttl;
00354 TQLabel *msg;
00355
00356 bool m_autoDelete;
00357
00358
00359 class Private;
00360 Private *d;
00361 };
00362
00363 #endif // KPASSIVEPOPUP_H
00364
00365
00366
00367
00368