akregator/src

kcursorsaver.h
1// taken from kmail/, moved to Akregator namespace to avoid clashes
2
3#ifndef kcursorsaver_h
4#define kcursorsaver_h
5
6#include <tqcursor.h>
7#include <tqapplication.h>
8
9namespace Akregator {
10
17class KCursorSaver : public TQt
18{
19public:
21 KCursorSaver(TQt::CursorShape shape) {
22 TQApplication::setOverrideCursor( TQCursor(shape) );
23 inited = true;
24 }
25
27 KCursorSaver( const KCursorSaver &rhs ) {
28 *this = rhs;
29 }
30
33 if (inited)
34 TQApplication::restoreOverrideCursor();
35 }
36
38 inline void restoreCursor(void) {
39 TQApplication::restoreOverrideCursor();
40 inited = false;
41 }
42
43protected:
44 void operator=( const KCursorSaver &rhs ) {
45 inited = rhs.inited;
46 rhs.inited = false;
47 }
48
49private:
50 mutable bool inited;
51};
52
56namespace KBusyPtr {
57 inline KCursorSaver idle() {
58 return KCursorSaver(TQCursor::ArrowCursor);
59 }
60 inline KCursorSaver busy() {
61 return KCursorSaver(TQCursor::WaitCursor);
62 }
63}
64
65} // namespace Akregator
66
67#endif /*kbusyptr_h_*/
sets a cursor and makes sure it's restored on destruction Create a KCursorSaver object when you want ...
Definition: kcursorsaver.h:18
~KCursorSaver()
restore the cursor
Definition: kcursorsaver.h:32
KCursorSaver(TQt::CursorShape shape)
constructor taking TQCursor shapes
Definition: kcursorsaver.h:21
KCursorSaver(const KCursorSaver &rhs)
copy constructor. The right side won't restore the cursor
Definition: kcursorsaver.h:27
void restoreCursor(void)
call this to explitly restore the cursor
Definition: kcursorsaver.h:38