pause_indicator.cpp

Go to the documentation of this file.
00001 #ifndef PAUSE_INDICATOR_IMPLEMENTATION_FILE
00002 #define PAUSE_INDICATOR_IMPLEMENTATION_FILE
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : pause_indicator                                                   *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 2003-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #include "pause_indicator.h"
00019 
00020 #include <basis/portable.h>
00021 
00022 #ifdef __XWINDOWS__
00023   #include <X11/cursorfont.h>
00024 #endif
00025 
00026 pause_indicator::pause_indicator(window_handle wingo)
00027 : _win(wingo),
00028   _watch(NIL)
00029 {
00030 #ifdef __UNIX__
00031   _watch = (void *)XCreateFontCursor(XtDisplay(_win), XC_watch);
00032   XDefineCursor(XtDisplay(_win), XtWindow(_win), (Cursor)_watch);
00033   XmUpdateDisplay(_win);
00034 #elif defined(__WIN32__)
00035   HCURSOR curse = ::LoadCursor(NULL, IDC_WAIT);
00036   ::SetCursor(curse);
00037 #else
00038   #error "no pause indicator exists for this platform."
00039 #endif
00040 }
00041 
00042 pause_indicator::~pause_indicator()
00043 {
00044 #ifdef __UNIX__
00045   XUndefineCursor(XtDisplay(_win), XtWindow(_win));
00046   XmUpdateDisplay(_win);
00047 #elif defined(__WIN32__)
00048   HCURSOR curse = ::LoadCursor(NULL, IDC_ARROW);
00049   ::SetCursor(curse);
00050 #else
00051   #error "no pause indicator exists for this platform."
00052 #endif
00053 }
00054 
00055 void pause_indicator::reassert()
00056 {
00057 #ifdef __UNIX__
00058   XDefineCursor(XtDisplay(_win), XtWindow(_win), (Cursor)_watch);
00059   XmUpdateDisplay(_win);
00060 #elif defined(__WIN32__)
00061   HCURSOR curse = ::LoadCursor(NULL, IDC_WAIT);
00062   ::SetCursor(curse);
00063 #else
00064   #error "no pause indicator exists for this platform."
00065 #endif
00066 }
00067 
00068 
00069 #endif //PAUSE_INDICATOR_IMPLEMENTATION_FILE
00070 

Generated on Fri Nov 28 04:29:00 2008 for HOOPLE Libraries by  doxygen 1.5.1