fshake3d
0.0.1
FreeformDensity3DSurfaceEditor
|
00001 #include "ui_App.hpp" 00002 00003 App::App() 00004 : mpCaptureMouseMotionTarget(0) 00005 , mCaptureMouseMotionButton(0) 00006 { } 00007 00008 void App::captureMouseMotion(EventTarget* pEventTarget, int button) 00009 { 00010 mpCaptureMouseMotionTarget = pEventTarget; 00011 mCaptureMouseMotionButton = button; 00012 } 00013 00014 void App::releaseMouseMotion() 00015 { 00016 mpCaptureMouseMotionTarget = 0; 00017 } 00018 /* 00019 00020 void App::display() 00021 { 00022 getFrame()->onEvent( Event::makeDisplayEvent() ); 00023 } 00024 00025 void App::mouse(int mouse, int button, int x, int y) 00026 { 00027 getFrame()->onEvent( Event::makeMouseEvent() ); 00028 } 00029 00030 void App::motion(int x, int y) 00031 { 00032 if (mpCaptureMouseMotionView) 00033 { 00034 mpCaptureMouseMotionView->onEvent( Event::makeMotionEvent(x,y) ); 00035 } 00036 } 00037 00038 void App::keyboard(unsigned char ch, int x, int y) 00039 { 00040 onEvent(ch,x,y); 00041 } 00042 00043 Frame* App::newFrame() 00044 { 00045 int winid = glutCreateWindow(""); 00046 glutDisplayFunc(display); 00047 glutReshapeFunc(reshape); 00048 glutMouseFunc(mouse); 00049 glutKeyboardFunc(keyboard); 00050 Frame* pFrame = new Frame(winid); 00051 mFrameMap[winid] = pFrame; 00052 return pFrame; 00053 } 00054 */ 00055 00056 void App::onEvent(Event& e) 00057 { 00058 if (mpCaptureMouseMotionTarget) 00059 { 00060 switch(e.getType()) 00061 { 00062 00063 case EVENT_BUTTONUP: 00064 if ( e.getButton() == mCaptureMouseMotionButton ) releaseMouseMotion(); 00065 case EVENT_MOUSEMOTION: 00066 e.setEventTarget(mpCaptureMouseMotionTarget); 00067 break; 00068 00069 default: 00070 break; 00071 } 00072 e.getEventTarget()->onEvent(e); 00073 } 00074 }