kpassivepopup.h
// -*- c++ -*-
/*
* Copyright : (C) 2001-2002 by Richard Moore
* Copyright : (C) 2004-2005 by Sascha Cunz
* License : This file is released under the terms of the LGPL, version 2.
* Email : rich@kde.org
* Email : sascha.cunz@tiscali.de
*/
#ifndef KPASSIVEPOPUP_H
#define KPASSIVEPOPUP_H
#include <qframe.h>
#include <kdelibs_export.h>
class QBoxLayout;
class QTimer;
class QLabel;
class QVBox;
class KDEUI_EXPORT KPassivePopup : public QFrame
{
Q_OBJECT
Q_PROPERTY (bool autoDelete READ autoDelete WRITE setAutoDelete )
Q_PROPERTY (int timeout READ timeout WRITE setTimeout )
public:
enum PopupStyle
{
Boxed,
Balloon,
CustomStyle=128
};
KPassivePopup( QWidget *parent=0, const char *name=0, WFlags f=0 );
KPassivePopup( WId parent, const char *name=0, WFlags f=0 );
KPassivePopup( int popupStyle, QWidget *parent=0, const char *name=0, WFlags f=0 );
KPassivePopup( int popupStyle, WId parent, const char *name=0, WFlags f=0 );
virtual ~KPassivePopup();
void setView( QWidget *child );
void setView( const QString &caption, const QString &text = QString::null );
virtual void setView( const QString &caption, const QString &text, const QPixmap &icon );
QVBox * standardView( const QString& caption, const QString& text,
const QPixmap& icon, QWidget *parent = 0L );
QWidget *view() const { return msgView; }
int timeout() const { return hideDelay; }
virtual void setAutoDelete( bool autoDelete );
bool autoDelete() const { return m_autoDelete; }
void setAnchor( const QPoint& anchor );
// TODO KDE4: give all the statics method a const QPoint p = QPoint() that in
// case the point is not null calls the show(cosnt QPoint &p) method instead
// the show() one.
static KPassivePopup *message( const QString &text, QWidget *parent, const char *name=0 );
static KPassivePopup *message( const QString &caption, const QString &text,
QWidget *parent, const char *name=0 );
static KPassivePopup *message( const QString &caption, const QString &text,
const QPixmap &icon,
QWidget *parent, const char *name=0, int timeout = -1 );
static KPassivePopup *message( const QString &caption, const QString &text,
const QPixmap &icon,
WId parent, const char *name=0, int timeout = -1 );
static KPassivePopup *message( int popupStyle, const QString &text, QWidget *parent,
const char *name=0 );
static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
QWidget *parent, const char *name=0 );
static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
const QPixmap &icon,
QWidget *parent, const char *name=0, int timeout = -1 );
static KPassivePopup *message( int popupStyle, const QString &caption, const QString &text,
const QPixmap &icon,
WId parent, const char *name=0, int timeout = -1 );
public slots:
void setTimeout( int delay );
virtual void show();
void show(const QPoint &p);
signals:
void clicked();
void clicked( QPoint pos );
protected:
virtual void positionSelf();
virtual void hideEvent( QHideEvent * );
void moveNear( QRect target );
virtual void mouseReleaseEvent( QMouseEvent *e );
QRect defaultArea() const;
void updateMask();
virtual void paintEvent( QPaintEvent* pe );
private:
void init( int popupStyle );
WId window;
QWidget *msgView;
QBoxLayout *topLayout;
int hideDelay;
QTimer *hideTimer;
QLabel *ttlIcon;
QLabel *ttl;
QLabel *msg;
bool m_autoDelete;
/* @internal */
class Private;
Private *d;
};
#endif // KPASSIVEPOPUP_H
// Local Variables:
// c-basic-offset: 4
// End:
KPassivePopup::PopupStyle
PopupStyle
Styles that a KPassivePopup can have.
Definition: kpassivepopup.h:79
KPassivePopup::Balloon
Information will appear in a comic-alike balloon.
Definition: kpassivepopup.h:82
KPassivePopup::autoDelete
bool autoDelete() const
Definition: kpassivepopup.h:173
KPassivePopup::view
QWidget * view() const
Returns the main view.
Definition: kpassivepopup.h:154
KPassivePopup::timeout
int timeout() const
Returns the delay before the popup is removed automatically.
Definition: kpassivepopup.h:159
KPassivePopup
A dialog-like popup that displays messages without interupting the user.
Definition: kpassivepopup.h:68
KPassivePopup::Boxed
Information will appear in a framed box (default)
Definition: kpassivepopup.h:81

KDE Home | KDE Accessibility Home | Description of Access Keys