00001 //--------------------------------------------------------------------------- 00002 /// \file CATCursor_Win32.cpp 00003 /// \brief Cursor class for GUI (win32) 00004 /// \ingroup CATGUI 00005 /// 00006 /// Copyright (c) 2003-2008 by Michael Ellison. 00007 /// See COPYING.txt for the \ref gaslicense License (MIT License). 00008 /// 00009 // $Author: mikeellison $ 00010 // $Date: 2008-01-23 01:43:25 -0600 (Wed, 23 Jan 2008) $ 00011 // $Revision: $ 00012 // $NoKeywords: $ 00013 //--------------------------------------------------------------------------- 00014 #include "CATInternal.h" 00015 #include "CATCursor.h" 00016 00017 CATCursor::CATCursor(CATCURSORTYPE type) 00018 { 00019 fHidden = false; 00020 this->fType = type; 00021 } 00022 00023 CATCursor::~CATCursor() 00024 { 00025 } 00026 00027 void CATCursor::SetType(CATCURSORTYPE type) 00028 { 00029 this->fType = type; 00030 } 00031 00032 CATCURSORTYPE CATCursor::GetType() 00033 { 00034 return fType; 00035 } 00036 00037 CATOSCURSOR CATCursor::GetOSCursor() 00038 { 00039 CATWChar* winCursor = 0; 00040 00041 // Select win32 cursor that matches our cursor 00042 switch (fType) 00043 { 00044 case CATCURSOR_NOACTION: winCursor = IDC_NO; break; 00045 case CATCURSOR_WAIT: winCursor = IDC_WAIT; break; 00046 case CATCURSOR_TEXT: winCursor = IDC_IBEAM; break; 00047 case CATCURSOR_HAND: winCursor = IDC_HAND; break; 00048 case CATCURSOR_LEFTRIGHT: winCursor = IDC_SIZEWE; break; 00049 case CATCURSOR_TOPBOTTOM: winCursor = IDC_SIZENS; break; 00050 case CATCURSOR_SIZE: winCursor = IDC_SIZENWSE; break; 00051 case CATCURSOR_MOVE: winCursor = IDC_SIZEALL; break; 00052 00053 default: 00054 case CATCURSOR_ARROW: winCursor = IDC_ARROW; 00055 } 00056 00057 // Loaded cursors do not need to be tracked or deleted under windows when LoadCursor is used. 00058 return ::LoadCursor(NULL,winCursor); 00059 } 00060 00061 void CATCursor::HideCursor() 00062 { 00063 if (!fHidden) 00064 { 00065 ::ShowCursor(FALSE); 00066 fHidden = true; 00067 CATTRACE("Cursor hidden"); 00068 } 00069 } 00070 00071 void CATCursor::ShowCursor() 00072 { 00073 if (fHidden) 00074 { 00075 ::ShowCursor(TRUE); 00076 fHidden = false; 00077 CATTRACE("Cursor shown."); 00078 } 00079 } 00080