Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkGLWindow.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 #ifndef __mitkGLWindow_h
00011 #define __mitkGLWindow_h
00012 
00013 #include "mitkRCPtr.h"
00014 #include "mitkSceneBase.h"
00015 #include "mitkImplementor.h"
00016 
00017 #ifdef MITK_OS_LINUX
00018 #include <X11/Xlib.h>
00019 #include <X11/Xutil.h>
00020 #endif
00021 
00022 
00043 class mitkScene;
00044 class mitkImageScene;
00045 class MITK_VISUALIZATION_API mitkGLWindow : public mitkSceneContainer
00046 {
00047 public:
00048     MITK_TYPE(mitkGLWindow,mitkSceneContainer)
00049 
00050     virtual void PrintSelf(ostream& os);
00051 
00052     mitkGLWindow();
00053 
00054     friend class mitkWin32Implementor;
00055     friend class mitkXImplementor;
00056 
00061     void* GetWindowId() ;
00062     
00067     void* GetParent() {return m_Imp->GetParent();}
00068     
00073     void* GetApplicationId() {return m_Imp->GetApplicationId();}
00074     
00079     void* GetDeviceContext() {return m_Imp->GetDeviceContext();}
00080     
00085     void* GetRenderContext() {return m_Imp->GetRenderContext();}
00086     
00094     void SetParent(void *parentId);
00095     
00101     const int *GetPosition() {return m_Position;}
00102     
00107     int GetLeft() {return m_Position[0];}
00108     
00113     int GetTop() {return m_Position[1];}
00114     
00120     void SetPosition(int leftPos,int topPos);
00121     
00127     void SetPosition(int a[2]);
00128     
00133     void SetLeft(int leftPos);
00134     
00139     void SetTop(int topPos);
00140     
00144     int GetTitleBar() {return m_HaveTitleBar;}
00145     
00149     void SetTitleBar(int titleBar);
00150     
00154     void SetTitleBarOn();
00155     
00159     void SetTitleBarOff();
00160     
00166     const int *GetSize();
00167     
00172     int GetWidth(); 
00173     
00178     int GetHeight();
00179     
00185     void SetSize(int widthSize, int heightSize);
00186     
00192     void SetSize(int a[2]);
00193     
00198     void SetWidth(int widthSize);
00199     
00204     void SetHeight(int heightSize);
00205 
00209     const char *GetWindowName();
00210     
00214     void SetWindowName(const char * winName);    
00215     
00220     void Show();
00221     
00225     void Hide();
00226     
00230     void Update();
00231     
00235     void MakeCurrent();
00236     
00240     void SwapBuffers();
00241 
00249     bool HasUnprocessedMouseMessage();
00250 
00256     void MoveMouseTo(int x, int y);
00257 
00262     double GetFrameSpeed() { return 1.0 / m_RenderTime; }
00263 
00268     double GetRenderTime() { return m_RenderTime; }
00269     
00275     void EnableCalculateFrameSpeed() { m_CalcFrameSpeed = true; }
00276         
00282     void DisableCalculateFrameSpeed() { m_CalcFrameSpeed = false; }
00283 
00284     void SetScene(mitkSceneBase *scene);
00285     mitkSceneBase* GetScene();
00286 
00287     mitkScene* CreateScene();
00288     mitkImageScene* CreateImageScene();
00289 
00290     static mitkGLWindow* GetWindowFromId(void *windowId);
00291 
00293     #ifdef MITK_OS_LINUX
00294     static void SetDefaultDisplayId(Display* displayId);
00295     static Display* GetDefaultDisplayId();
00296     static bool HandleXEvent(XEvent *event);    
00297     #endif
00298 
00299 
00300 protected:
00301     virtual ~mitkGLWindow();
00302     void OnCreate();
00303     void OnDestroy();
00304     void OnSize(int newX, int newY);
00305     void OnDraw();
00306     void OnMouseDown(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00307     void OnMouseUp(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00308     void OnMouseMove(bool ctrlDown, bool shiftDown, int xPos, int yPos);
00309     void OnMouseWheel(bool ctrlDown, bool shiftDown, int xPos, int yPos, int delta);
00310 
00311     static void RegisterWindow(void *windowId,mitkGLWindow* window);
00312     static void UnregisterWindow(void *windowId);
00313 
00314     mitkRCPtr<mitkImplementor> m_Imp;   
00315     mitkRCPtr<mitkSceneBase> m_Scene;
00316     
00317     mitkString *m_WindowName;
00318     int m_Size[2];
00319     int m_Position[2];
00320     int m_HaveTitleBar;
00321 
00322     double m_RenderTime;
00323     bool m_CalcFrameSpeed;
00324 
00325 private:
00326     void _initScene();
00327     void _removeScene();
00328     mitkGLWindow(const mitkGLWindow&);
00329     void operator = (const mitkGLWindow&);
00330 
00331 
00332 };
00333 
00334 
00335 #endif
00336 

Generated on Tue Feb 25 15:00:37 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3