Blender  V2.59
GlutMouseManager.h
Go to the documentation of this file.
00001 
00029 #ifndef NAN_INCLUDED_GlutMouseManager_h
00030 #define NAN_INCLUDED_GlutMouseManager_h
00031 
00032 #include "MEM_NonCopyable.h"
00033 #include "MEM_SmartPtr.h"
00034 
00035 class GlutMouseHandler {
00036 public :
00037 
00038         virtual         
00039                 void
00040         Mouse(
00041                 int button,
00042                 int state,
00043                 int x,
00044                 int y
00045         ) = 0;
00046 
00047         virtual
00048                 void
00049         Motion(
00050                 int x,
00051                 int y
00052         ) = 0;
00053 
00054         virtual 
00055         ~GlutMouseHandler(
00056         ){};            
00057 };
00058 
00059 class GlutMouseManager : public MEM_NonCopyable{
00060 
00061 public :
00062 
00063         static
00064                 GlutMouseManager *
00065         Instance(
00066         );
00067 
00068         // these are the functions you should pass to GLUT      
00069 
00070         static
00071                 void
00072         Mouse(
00073                 int button,
00074                 int state,
00075                 int x,
00076                 int y
00077         );
00078 
00079         static
00080                 void
00081         Motion(
00082                 int x,
00083                 int y
00084         );
00085 
00086                 void
00087         InstallHandler(
00088                 GlutMouseHandler *
00089         );
00090 
00091                 void
00092         ReleaseHandler(
00093         );
00094 
00095         ~GlutMouseManager(
00096         );
00097 
00098 private :
00099 
00100         GlutMouseManager (
00101         ) :
00102                 m_handler (0)
00103         {
00104         };
00105         
00106         GlutMouseHandler * m_handler;
00107 
00108         static MEM_SmartPtr<GlutMouseManager> m_s_instance;
00109 };      
00110 
00111 #endif
00112