Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

SoEventCallback.h

00001 /**************************************************************************\ 00002 * 00003 * This file is part of the Coin 3D visualization library. 00004 * Copyright (C) 1998-2003 by Systems in Motion. All rights reserved. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * version 2.1 as published by the Free Software Foundation. See the 00009 * file LICENSE.LGPL at the root directory of the distribution for 00010 * more details. 00011 * 00012 * If you want to use Coin for applications not compatible with the 00013 * LGPL, please contact SIM to acquire a Professional Edition license. 00014 * 00015 * Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY 00016 * http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097 00017 * 00018 \**************************************************************************/ 00019 00020 #ifndef COIN_SOEVENTCALLBACK_H 00021 #define COIN_SOEVENTCALLBACK_H 00022 00023 #include <Inventor/nodes/SoSubNode.h> 00024 #include <Inventor/lists/SbList.h> 00025 00026 #ifndef COIN_INTERNAL 00027 // Added for Inventor compliance 00028 #include <Inventor/actions/SoHandleEventAction.h> 00029 #endif // !COIN_INTERNAL 00030 00031 00032 class SoEventCallback; 00033 class SoPath; 00034 class SoEvent; 00035 class SoPickedPoint; 00036 class SoHandleEventAction; 00037 00038 typedef void SoEventCallbackCB(void * userdata, SoEventCallback * node); 00039 00040 00041 class COIN_DLL_API SoEventCallback : public SoNode { 00042 typedef SoNode inherited; 00043 00044 SO_NODE_HEADER(SoEventCallback); 00045 00046 public: 00047 static void initClass(void); 00048 SoEventCallback(void); 00049 00050 void setPath(SoPath * path); 00051 const SoPath * getPath(void); 00052 00053 void addEventCallback(SoType eventtype, SoEventCallbackCB * f, 00054 void * userdata = NULL); 00055 void removeEventCallback(SoType eventtype, SoEventCallbackCB * f, 00056 void * userdata = NULL); 00057 00058 SoHandleEventAction * getAction(void) const; 00059 const SoEvent * getEvent(void) const; 00060 const SoPickedPoint * getPickedPoint(void) const; 00061 00062 void setHandled(void); 00063 SbBool isHandled(void) const; 00064 00065 void grabEvents(void); 00066 void releaseEvents(void); 00067 00068 protected: 00069 virtual ~SoEventCallback(); 00070 00071 virtual void handleEvent(SoHandleEventAction * action); 00072 00073 private: 00074 00075 struct CallbackInfo { 00076 SoEventCallbackCB * func; 00077 SoType eventtype; 00078 void * userdata; 00079 00080 // AIX native compiler xlC needs equality and inequality operators 00081 // to compile templates where these operators are referenced (even 00082 // if they are actually never used). 00083 00084 SbBool operator==(const CallbackInfo & cbi) { 00085 return this->func == cbi.func && this->eventtype == cbi.eventtype && this->userdata == cbi.userdata; 00086 } 00087 SbBool operator!=(const CallbackInfo & cbi) { 00088 return !(*this == cbi); 00089 } 00090 }; 00091 00092 SbList<CallbackInfo> callbacks; 00093 SoHandleEventAction * heaction; 00094 SoPath * path; 00095 00096 }; 00097 00098 #endif // !COIN_SOEVENTCALLBACK_H

Generated on Tue Jul 27 23:53:01 2004 for Coin by doxygen 1.3.7