IvfMfcWindow.h

00001 //
00002 // Copyright 1999-2006 by Structural Mechanics, Lund University.
00003 //
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Library General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Library General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Library General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017 // USA.
00018 //
00019 // Please report all bugs and problems to "ivf@byggmek.lth.se".
00020 //
00021 //
00022 // Written by Jonas Lindemann
00023 //
00024 // Based on code from from the smotri.h example
00025 //
00026 // smotri - Simple MFC, C++, OpenGL Tutorial Program
00027 // by:          Joel Parris
00028 // date:        10/9/2000
00029 
00030 #include <afxwin.h>
00031 #include <GL/gl.h>              // OpenGL include file
00032 #include <GL/glu.h>             // OpenGL Utilities include file
00033 #include <cmath>
00034 
00035 #include <ivfwidget/IvfWidgetBase.h>
00036 
00037 #include <ivfmfc/IvfMfcApplication.h>
00038 
00039 IvfSmartPointer(CIvfMfcWindow);
00040 
00049 class CIvfMfcWindow: public CFrameWnd, public CIvfWidgetBase {
00050 private:
00051     HDC         m_hgldc;                // GDI Device Context
00052     HGLRC       m_hglRC;                // Rendering Context
00053 
00054         LARGE_INTEGER m_countsPerSec;
00055         double          m_elapsedTime;
00056         double          m_zeroTime;
00057 
00058         int             m_size[2];
00059         int             m_pos[2];
00060         int             m_colorBits;
00061 
00062         int             m_mousePos[2];
00063 
00064         CIvfMfcApplicationBase* m_application;
00065 
00066         double largeToDouble(LARGE_INTEGER &value);
00067 public:
00076         CIvfMfcWindow(int X, int Y, int W, int H);
00077 
00079         virtual ~CIvfMfcWindow();
00080 
00082         void setApplication(CIvfMfcApplicationBase* app);
00083 
00085     BOOL SetPixelformat(HDC hdc);
00086 
00088     virtual BOOL PreCreateWindow( CREATESTRUCT& cs );
00089 
00090         virtual void doInit(int width, int height);
00091         virtual void doDestroy();
00092         virtual void doRedraw();
00093         virtual void doEnableTimeout(float time, int nbr);
00094         virtual void doDisableTimeout(int nbr);
00095         virtual void doDisableIdleProcessing();
00096         virtual void doEnableIdleProcessing();
00097         virtual double doElapsedTime();
00098         virtual void doSetPosition(int x, int y);
00099         virtual void doSetSize(int w, int h);
00100 
00101 protected:
00102 
00103     afx_msg void OnPaint();
00104     afx_msg int  OnCreate(LPCREATESTRUCT lpCreateStruct);
00105     afx_msg void OnSize(UINT nType, int cx, int cy );
00106     afx_msg BOOL OnEraseBkgnd( CDC* pDC );
00107         afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00108         afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);    
00109         afx_msg void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
00110         afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
00111         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00112         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00113         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00114         afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
00115         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00116         afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
00117         afx_msg void OnClose();
00118         afx_msg void OnTimer(UINT nIDEvent);
00119 
00120         DECLARE_MESSAGE_MAP()
00121 };

Generated on Fri Sep 1 15:36:47 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO