-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cursor.cpp
46 lines (36 loc) · 1.12 KB
/
Cursor.cpp
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
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Cursor.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
TCursorManager::TCursorManager( TCursor Cursor )
: restored_( false ), oldCursor_( Set( Cursor ) )
{
}
//---------------------------------------------------------------------------
TCursorManager::~TCursorManager()
{
try {
if ( !restored_ )
Restore();
}
catch ( ... ) {
}
}
//---------------------------------------------------------------------------
TCursor TCursorManager::Set( TCursor Cursor )
{
TCursor const CurrentCursor( Screen->Cursor );
Screen->Cursor = Cursor;
restored_ = false;
return CurrentCursor;
}
//---------------------------------------------------------------------------
void TCursorManager::Restore()
{
Screen->Cursor = oldCursor_;
restored_ = false;
}
//---------------------------------------------------------------------------