Blender V2.61 - r43446

GlutMouseManager.cpp

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