00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef KPASSIVEPOPUP_H
00026 #define KPASSIVEPOPUP_H
00027
00028 #include <kdeui_export.h>
00029
00030 #include <QtGui/QFrame>
00031
00032 class KVBox;
00033 class QSystemTrayIcon;
00034
00082 class KDEUI_EXPORT KPassivePopup : public QFrame
00083 {
00084 Q_OBJECT
00085 Q_PROPERTY (bool autoDelete READ autoDelete WRITE setAutoDelete )
00086 Q_PROPERTY (int timeout READ timeout WRITE setTimeout )
00087 Q_PROPERTY (QRect defaultArea READ defaultArea )
00088
00089 public:
00093 enum PopupStyle
00094 {
00095 Boxed,
00096 Balloon,
00097 CustomStyle=128
00098 };
00099
00103 explicit KPassivePopup( QWidget *parent=0, Qt::WFlags f = 0 );
00104
00108 explicit KPassivePopup( WId parent );
00109
00110 #if 0 // These break macos and win32 where the definition of WId makes them ambiguous
00111
00115 explicit KPassivePopup( int popupStyle, QWidget *parent=0, Qt::WFlags f=0 ) KDE_DEPRECATED;
00116
00121 KPassivePopup( int popupStyle, WId parent, Qt::WFlags f=0 ) KDE_DEPRECATED;
00122 #endif
00123
00127 virtual ~KPassivePopup();
00128
00132 void setView( QWidget *child );
00133
00137 void setView( const QString &caption, const QString &text = QString() );
00138
00142 virtual void setView( const QString &caption, const QString &text, const QPixmap &icon );
00143
00164 KVBox * standardView( const QString& caption, const QString& text,
00165 const QPixmap& icon, QWidget *parent = 0L );
00166
00170 QWidget *view() const;
00171
00175 int timeout() const;
00176
00183 virtual void setAutoDelete( bool autoDelete );
00184
00189 bool autoDelete() const;
00190
00199 QRect defaultArea() const;
00200
00204 QPoint anchor() const;
00205
00210 void setAnchor( const QPoint& anchor );
00211
00212
00213
00214
00221 static KPassivePopup *message( const QString &text, QWidget *parent );
00222
00229 static KPassivePopup *message( const QString &text, QSystemTrayIcon *parent );
00230
00237 static KPassivePopup *message( const QString &caption, const QString &text,
00238 QWidget *parent );
00239
00246 static KPassivePopup *message( const QString &caption, const QString &text,
00247 QSystemTrayIcon *parent );
00248
00255 static KPassivePopup *message( const QString &caption, const QString &text,
00256 const QPixmap &icon,
00257 QWidget *parent, int timeout = -1 );
00258
00265 static KPassivePopup *message( const QString &caption, const QString &text,
00266 const QPixmap &icon,
00267 QSystemTrayIcon *parent, int timeout = -1 );
00268
00275 static KPassivePopup *message( const QString &caption, const QString &text,
00276 const QPixmap &icon,
00277 WId parent, int timeout = -1 );
00278
00285 static KPassivePopup *message( int popupStyle, const QString &text, QWidget *parent );
00286
00293 static KPassivePopup *message( int popupStyle, const QString &text, QSystemTrayIcon *parent );
00294
00301 static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
00302 QSystemTrayIcon *parent );
00303
00310 static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
00311 QWidget *parent );
00312
00319 static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
00320 const QPixmap &icon,
00321 QWidget *parent, int timeout = -1 );
00322
00329 static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
00330 const QPixmap &icon,
00331 QSystemTrayIcon *parent, int timeout = -1 );
00332
00339 static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
00340 const QPixmap &icon,
00341 WId parent, int timeout = -1 );
00342
00343
00344 public Q_SLOTS:
00353 void setTimeout( int delay );
00354
00359 void setPopupStyle( int popupstyle );
00360
00364 void show();
00365
00369 void show(const QPoint &p);
00370
00371 virtual void setVisible(bool visible);
00372
00373 Q_SIGNALS:
00377 void clicked();
00378
00382 void clicked( const QPoint &pos );
00383
00384 protected:
00388 virtual void positionSelf();
00389
00394 virtual void hideEvent( QHideEvent * );
00395
00399 void moveNear( const QRect &target );
00400
00404 QPoint calculateNearbyPoint( const QRect &target);
00405
00409 virtual void mouseReleaseEvent( QMouseEvent *e );
00410
00414 void updateMask();
00415
00420 virtual void paintEvent( QPaintEvent* pe );
00421
00422 private:
00423 void init( WId window );
00424
00425
00426 class Private;
00427 Private *const d;
00428 };
00429
00430 #endif // KPASSIVEPOPUP_H
00431
00432
00433
00434
00435