kdeui Library API Documentation

KWindowInfo Class Reference

Displays messages in the window icon and title. More...

#include <kwindowinfo.h>

Inheritance diagram for KWindowInfo:

QObject List of all members.

Public Slots

void message (const QString &text)
 Shows the specified text in the window title.

void message (const QString &text, const QPixmap &pix)
 Shows the specified text in the window title, and sets the window icon.

void message (const QString &text, int timeout)
 Shows the specified text in the window title for the specified time.

void message (const QString &text, const QPixmap &pix, int timeout)
 Shows the specified icon and text in the window title and WM icon, for the specified time.

void permanent (const QString &text)
 Shows the specified text in the window title with no timeout.

void permanent (const QString &text, const QPixmap &pix)
 Shows the specified text and icon in the window title with no timeout.


Public Methods

 KWindowInfo (QWidget *parent, const char *name=0)
 Creates a KWindowInfo with the specified parent.

virtual ~KWindowInfo ()
 Cleans up.

bool autoDelete () const
 Returns true iff the object should delete itself when it resets.

void setAutoDelete (bool enable)
 Set to true if you want the object to delete itself when the message timeout occurs.


Static Public Methods

void showMessage (QWidget *window, const QString &text, int timeout=-1)
 Utility method to display a title bar message for the specified window.

void showMessage (QWidget *window, const QString &text, const QPixmap &pix, int timeout=-1)
 Utility method to display a title bar message and icon for the specified window.


Protected Slots

virtual void save ()
 Saves the window title and icon.

virtual void restore ()
 Resets the window title and icon to the saved values.


Protected Methods

virtual void display (const QString &text, const QPixmap &pix)
 Displays the message in the titlebar/icon.


Detailed Description

Displays messages in the window icon and title.

The message is usually transient with the original title and icon being restored automatically after a specified time. 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 );
 
If the parent window inherits KSystemTray then KWindowInfo changes the pixmap and tooltip of the system window to display the message.

Author:
Richard Moore, rich@kde.org
Version:
Id:
kwindowinfo.h,v 1.5 2002/09/28 15:16:22 tjansen Exp
Since:
3.1

Definition at line 40 of file kwindowinfo.h.


Constructor & Destructor Documentation

KWindowInfo::KWindowInfo QWidget   parent,
const char *    name = 0
 

Creates a KWindowInfo with the specified parent.

Definition at line 20 of file kwindowinfo.cpp.

Referenced by showMessage().

KWindowInfo::~KWindowInfo   [virtual]
 

Cleans up.

Definition at line 25 of file kwindowinfo.cpp.


Member Function Documentation

bool KWindowInfo::autoDelete   const [inline]
 

Returns true iff the object should delete itself when it resets.

Definition at line 58 of file kwindowinfo.h.

void KWindowInfo::setAutoDelete bool    enable [inline]
 

Set to true if you want the object to delete itself when the message timeout occurs.

Definition at line 64 of file kwindowinfo.h.

void KWindowInfo::showMessage QWidget   window,
const QString   text,
int    timeout = -1
[static]
 

Utility method to display a title bar message for the specified window.

Definition at line 29 of file kwindowinfo.cpp.

References autoDel, KWindowInfo(), and message().

void KWindowInfo::showMessage QWidget   window,
const QString   text,
const QPixmap   pix,
int    timeout = -1
[static]
 

Utility method to display a title bar message and icon for the specified window.

Definition at line 38 of file kwindowinfo.cpp.

References autoDel, KWindowInfo(), and message().

void KWindowInfo::message const QString   text [slot]
 

Shows the specified text in the window title.

Definition at line 45 of file kwindowinfo.cpp.

Referenced by message(), and showMessage().

void KWindowInfo::message const QString   text,
const QPixmap   pix
[slot]
 

Shows the specified text in the window title, and sets the window icon.

Definition at line 50 of file kwindowinfo.cpp.

References message().

void KWindowInfo::message const QString   text,
int    timeout
[slot]
 

Shows the specified text in the window title for the specified time.

Definition at line 55 of file kwindowinfo.cpp.

References message().

void KWindowInfo::message const QString   text,
const QPixmap   pix,
int    timeout
[slot]
 

Shows the specified icon and text in the window title and WM icon, for the specified time.

The time is a delay specified in milliseconds, or one of the two special values. The special values are -1 which means the default timeout should be used, and 0 which means the message is permanent.

Definition at line 60 of file kwindowinfo.cpp.

References display(), restore(), save(), and QTimer::singleShot().

void KWindowInfo::permanent const QString   text [slot]
 

Shows the specified text in the window title with no timeout.

Definition at line 73 of file kwindowinfo.cpp.

References KWin::icon(), QPixmap::isNull(), and QWidget::winId().

void KWindowInfo::permanent const QString   text,
const QPixmap   pix
[slot]
 

Shows the specified text and icon in the window title with no timeout.

Definition at line 83 of file kwindowinfo.cpp.

References display(), QString::isNull(), and QObject::queryList().

void KWindowInfo::display const QString   text,
const QPixmap   pix
[protected, virtual]
 

Displays the message in the titlebar/icon.

Definition at line 101 of file kwindowinfo.cpp.

References QToolTip::add(), QPixmap::isNull(), QPixmap::load(), QWidget::setCaption(), QWidget::setIcon(), KWin::setIcons(), QLabel::setPixmap(), and QWidget::winId().

Referenced by message(), and permanent().

void KWindowInfo::save   [protected, virtual, slot]
 

Saves the window title and icon.

Definition at line 121 of file kwindowinfo.cpp.

References QWidget::caption(), QWidget::icon(), KWin::icon(), QPixmap::isNull(), QString::isNull(), QLabel::pixmap(), QPixmap::resize(), QToolTip::textFor(), and QWidget::winId().

Referenced by message().

void KWindowInfo::restore   [protected, virtual, slot]
 

Resets the window title and icon to the saved values.

If auto-delete is enabled then the object is deleted.

Definition at line 148 of file kwindowinfo.cpp.

References QToolTip::add(), QWidget::setCaption(), QWidget::setIcon(), KWin::setIcons(), QLabel::setPixmap(), and QWidget::winId().

Referenced by message().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:08 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001