1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
/*
* copyright : (C) 2001-2002 by Richard Moore
* License : This file is released under the terms of the LGPL, version 2.
* email : [email protected]
*/
#ifndef KWINDOWINFO_H
#define KWINDOWINFO_H
#include <tqobject.h>
#include <tqpixmap.h>
#include <tqstring.h>
#include <tdelibs_export.h>
/**
* 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:
* \code
* KWindowInfo::showMessage( this, i18n("Message Body") );
* \endcode
* 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.
* \code
* TQPixmap px;
* px.load( "lo16-app-logtracker.png" );
* KWindowInfo::showMessage( this, i18n("Message Body"), px, 1000 );
* \endcode
* If the parent window inherits KSystemTray then KWindowInfo changes the
* pixmap and tooltip of the system window to display the message.
*
* @author Richard Moore, [email protected]
* @since 3.1
*/
class TDEUI_EXPORT KWindowInfo : public TQObject
{
Q_OBJECT
public:
/**
* Creates a KWindowInfo with the specified parent.
*/
KWindowInfo( TQWidget *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( TQWidget *window, const TQString &text, int timeout = -1 );
/**
* Utility method to display a title bar message and icon for the
* specified window.
*/
static void showMessage( TQWidget *window, const TQString &text,
const TQPixmap &pix, int timeout = -1 );
public slots:
/**
* Shows the specified text in the window title.
*/
void message( const TQString &text );
/**
* Shows the specified text in the window title, and sets the window icon.
*/
void message( const TQString &text, const TQPixmap &pix );
/**
* Shows the specified text in the window title for the specified time.
*/
void message( const TQString &text, int timeout );
/**
* 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.
*/
void message( const TQString &text, const TQPixmap &pix, int timeout );
/**
* Shows the specified text in the window title with no timeout.
*/
void permanent( const TQString &text );
/**
* Shows the specified text and icon in the window title with no timeout.
*/
void permanent( const TQString &text, const TQPixmap &pix );
protected:
/**
* Displays the message in the titlebar/icon.
*/
virtual void display( const TQString &text, const TQPixmap &pix );
protected slots:
/**
* Saves the window title and icon.
*/
virtual void save();
/**
* Resets the window title and icon to the saved values. If
* auto-delete is enabled then the object is deleted.
*/
virtual void restore();
private:
TQWidget *win;
TQPixmap oldIcon;
TQPixmap oldMiniIcon;
TQString oldText;
bool autoDel;
/* @internal */
class Private *d;
};
#endif // KWINDOWINFO_H
|