kcursorsaver.h
00001 // taken from kmail/, moved to Akregator namespace to avoid clashes 00002 00003 #ifndef kcursorsaver_h 00004 #define kcursorsaver_h 00005 00006 #include <tqcursor.h> 00007 #include <tqapplication.h> 00008 00009 namespace Akregator { 00010 00017 class KCursorSaver : public TQt 00018 { 00019 public: 00021 KCursorSaver(TQt::CursorShape shape) { 00022 TQApplication::setOverrideCursor( TQCursor(shape) ); 00023 inited = true; 00024 } 00025 00027 KCursorSaver( const KCursorSaver &rhs ) { 00028 *this = rhs; 00029 } 00030 00032 ~KCursorSaver() { 00033 if (inited) 00034 TQApplication::restoreOverrideCursor(); 00035 } 00036 00038 inline void restoreCursor(void) { 00039 TQApplication::restoreOverrideCursor(); 00040 inited = false; 00041 } 00042 00043 protected: 00044 void operator=( const KCursorSaver &rhs ) { 00045 inited = rhs.inited; 00046 rhs.inited = false; 00047 } 00048 00049 private: 00050 mutable bool inited; 00051 }; 00052 00056 namespace KBusyPtr { 00057 inline KCursorSaver idle() { 00058 return KCursorSaver(TQCursor::ArrowCursor); 00059 } 00060 inline KCursorSaver busy() { 00061 return KCursorSaver(TQCursor::WaitCursor); 00062 } 00063 } 00064 00065 } // namespace Akregator 00066 00067 #endif /*kbusyptr_h_*/