// -*- c++ -*-
#ifndef KWINDOWINFO_H
#define KWINDOWINFO_H
#include
#include
#include
/**
* Displays messages in the window icon and title. The simplest use
* displays a text message in the window title:
*
* KWindowInfo::showMessage( this, "Message Body" );
*
* This more complex example changes the window icon, as well as
* displaying the text. In addition, this example overrides the
* default timeout to ensure the message is only displayed for 1
* second.
*
* QPixmap px;
* px.load( "lo16-app-logtracker.png" );
* KWindowInfo::showMessage( this, "Message Body", px, 1000 );
*
*
* @author Richard Moore, rich@kde.org
* @version $Id$
*/
class KWindowInfo : public QObject
{
Q_OBJECT
public:
/**
* Creates a KWindowInfo with the specified parent.
*/
KWindowInfo( QWidget *parent, const char *name=0 );
/**
* Cleans up.
*/
virtual ~KWindowInfo();
/**
* Returns true iff the object should delete itself when it resets.
*/
bool autoDelete() const { return autoDel; }
/**
* Set to true if you want the object to delete itself when the message
* timeout occurs.
*/
void setAutoDelete( bool enable ) { autoDel = enable; }
/**
* Utility method to display a title bar message for the specified
* window.
*/
static void showMessage( QWidget *window, const QString &text, int timeout = -1 );
/**
* Utility method to display a title bar message and icon for the
* specified window.
*/
static void showMessage( QWidget *window, const QString &text,
const QPixmap &pix, int timeout = -1 );
public slots:
/**
* Shows the specified text in the window title.
*/
void message( const QString &text );
/**
* Shows the specified text in the window title, and sets the window icon.
*/
void message( const QString &text, const QPixmap &pix );
/**
* Shows the specified text in the window title for the specified time.
* The time is specified in milliseconds.
*/
void message( const QString &text, int timeout );
/**
* Shows the specified icon and text in the window title and WM icon, for
* the specified time. The time is specified in milliseconds.
*/
void message( const QString &text, const QPixmap &pix, int timeout );
/**
* Saves the window title and icon
*/
void save();
/**
* Resets the window title and icon to the saved values. If
* auto-delete is enabled then the object is deleted.
*/
void restore();
public:
private:
QWidget *win;
QPixmap oldIcon;
QString oldText;
bool autoDel;
/* @internal */
class Private *d;
};
#endif // KWINDOWINFO_H
Generated by: rich on pegasus on Tue Feb 26 01:28:15 2002, using kdoc 2.0a53. |