Salome HOME
sources v1.2
[modules/kernel.git] / src / SALOMEGUI / QAD_WaitCursor.h
1 //  SALOME SALOMEGUI : implementation of desktop and GUI kernel
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : QAD_WaitCursor.h
8 //  Author : Vadim SANDLER
9 //  Module : SALOME
10 //  $Header$
11
12 #ifndef QAD_WAITCURSOR_H
13 #define QAD_WAITCURSOR_H
14
15 #include <qapplication.h>
16 #include "QAD.h"
17
18 class QAD_EXPORT QAD_WaitCursor {
19  public:
20 // constructor
21      QAD_WaitCursor() : myStarted(false) { start(); }
22 // destructor
23      ~QAD_WaitCursor()   { stop();  }
24
25 // sets WAIT cursor if not set yet
26      void    start()     { if (!myStarted) { QApplication::setOverrideCursor(Qt::waitCursor); myStarted = true; } }
27 // clears WAIT cursor if set
28      void    stop()      { if (myStarted)  { QApplication::restoreOverrideCursor(); myStarted = false; } } 
29 // returns true if WAIT cursor is active
30      bool    isStarted() { return myStarted; }
31
32  private:
33      bool  myStarted;
34 };
35
36 #endif