Blender  V2.59
GlutMouseManager.cpp
Go to the documentation of this file.
00001 
00029 #include "GlutMouseManager.h"
00030 #include "MT_assert.h"
00031 
00032 MEM_SmartPtr<GlutMouseManager> GlutMouseManager::m_s_instance = MEM_SmartPtr<GlutMouseManager>();
00033 
00034 
00035         GlutMouseManager *
00036 GlutMouseManager::
00037 Instance(
00038 ){
00039         if (m_s_instance == NULL) {
00040                 m_s_instance = new GlutMouseManager();
00041         }
00042 
00043         return m_s_instance;
00044 }       
00045 
00046 // these are the functions you should pass to GLUT      
00047 
00048         void
00049 GlutMouseManager::
00050 ButtonUp(
00051         GHOST_IWindow * window,
00052         GHOST_TButtonMask button_mask,
00053         int x,
00054         int y
00055 ){
00056         GlutMouseManager *manager = GlutMouseManager::Instance();
00057 
00058         if (manager->m_handler != NULL) {
00059                 manager->m_handler->ButtonUp(window,button_mask,x,y);
00060         }
00061 }
00062 
00063         void
00064 GlutMouseManager::
00065 ButtonDown(
00066         GHOST_IWindow * window,
00067         GHOST_TButtonMask button_mask,
00068         int x,
00069         int y
00070 ){
00071         GlutMouseManager *manager = GlutMouseManager::Instance();
00072 
00073         if (manager->m_handler != NULL) {
00074                 manager->m_handler->ButtonDown(window,button_mask,x,y);
00075         }
00076 }
00077 
00078 
00079 
00080         void
00081 GlutMouseManager::
00082 Motion(
00083         GHOST_IWindow * window,
00084         int x,
00085         int y
00086 ){
00087         GlutMouseManager *manager = GlutMouseManager::Instance();
00088 
00089         if (manager->m_handler != NULL) {
00090                 manager->m_handler->Motion(window,x,y);
00091         }
00092 }
00093 
00094         void
00095 GlutMouseManager::
00096 InstallHandler(
00097         GlutMouseHandler *handler
00098 ){
00099 
00100         MT_assert(m_handler == NULL);
00101         m_handler = handler;
00102 }
00103 
00104         void
00105 GlutMouseManager::
00106 ReleaseHandler(
00107 ){
00108         m_handler = NULL;
00109 }
00110 
00111 GlutMouseManager::
00112 ~GlutMouseManager(
00113 ){
00114 
00115         delete(m_handler);
00116 }
00117 
00118