7 #include <tqobjectlist.h>
10 #include <tqtooltip.h>
11 #include <ksystemtray.h>
14 #include "twindowinfo.h"
15 #include "twindowinfo.moc"
17 static const int UNSPECIFIED_TIMEOUT = -1;
18 static const int DEFAULT_MESSAGE_TIMEOUT = 3000;
21 : TQObject( parent, name ), win( parent ), autoDel( false )
42 info->
message( text, pix, timeout );
47 message( text, TQPixmap(), UNSPECIFIED_TIMEOUT );
52 message( text, pix, UNSPECIFIED_TIMEOUT );
57 message( text, TQPixmap(), timeout );
68 timeout = DEFAULT_MESSAGE_TIMEOUT;
70 TQTimer::singleShot( timeout,
this, TQ_SLOT(
restore() ) );
76 oldMiniIcon =
KWin::icon( win->winId(), 16, 16,
true );
77 oldIcon =
KWin::icon( win->winId(), 34, 34,
false );
78 if ( oldIcon.isNull() )
79 oldIcon =
KWin::icon( win->winId(), 32, 32,
true );
87 if ( !oldText.isNull() ) {
88 TQObjectList *l = queryList(
"TQTimer" );
89 TQObjectListIt it( *l );
92 while ( (obj = it.current()) != 0 ) {
99 oldText = TQString::null;
107 icon.load(
"bell.png" );
111 if ( win->inherits(
"KSystemTray" ) ) {
114 TQToolTip::add( tray, text );
118 win->setCaption( text );
119 win->setIcon( icon );
127 if ( !oldText.isNull() )
130 if ( win->inherits(
"KSystemTray" ) ) {
132 oldIcon = *(tray->pixmap());
133 oldText = TQToolTip::textFor( tray );
137 oldText = win->caption();
139 oldMiniIcon =
KWin::icon( win->winId(), 16, 16,
true );
140 oldIcon =
KWin::icon( win->winId(), 34, 34,
false );
141 if ( oldIcon.isNull() )
142 oldIcon =
KWin::icon( win->winId(), 32, 32,
true );
145 if ( oldIcon.isNull() ) {
146 const TQPixmap *px = win->icon();
150 oldIcon.resize( 0, 0 );
156 if ( win->inherits(
"KSystemTray" ) ) {
159 TQToolTip::add( tray, oldText );
160 oldText = TQString::null;
164 win->setIcon( oldIcon );
168 win->setCaption( oldText );
169 oldText = TQString::null;
KDE System Tray Window class
virtual void setPixmap(const TQPixmap &icon)
Changes the tray's icon.
static TQPixmap icon(WId win, int width=-1, int height=-1, bool scale=false)
static void setIcons(WId win, const TQPixmap &icon, const TQPixmap &miniIcon)
Displays messages in the window icon and title.
void message(const TQString &text)
Shows the specified text in the window title.
void permanent(const TQString &text)
Shows the specified text in the window title with no timeout.
virtual ~KWindowInfo()
Cleans up.
static void showMessage(TQWidget *window, const TQString &text, int timeout=-1)
Utility method to display a title bar message for the specified window.
virtual void display(const TQString &text, const TQPixmap &pix)
Displays the message in the titlebar/icon.
virtual void restore()
Resets the window title and icon to the saved values.
KWindowInfo(TQWidget *parent, const char *name=0)
Creates a KWindowInfo with the specified parent.
virtual void save()
Saves the window title and icon.