IvfWin32Window.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 
00025 #ifndef _CIvfWin32Window_h_
00026 #define _CIvfWin32Window_h_
00027 
00028 #include <windows.h>
00029 #include <gl\gl.h>
00030 #include <gl\glu.h>
00031 #include <gl\glaux.h>
00032 
00033 #include <ivfwidget/IvfWidgetBase.h>
00034 
00035 IvfSmartPointer(CIvfWin32Window);
00036 
00042 class IVFWIN32_API CIvfWin32Window : public CIvfWidgetBase {
00043 private:
00044         HDC                     m_hDC;          
00045         HGLRC           m_hRC;          
00046         HWND            m_hWnd;         
00047         HINSTANCE       m_hInstance;            
00048 
00049         int                     m_size[2];
00050         int                     m_pos[2];
00051         int                     m_colorBits;
00052 
00053         LARGE_INTEGER m_countsPerSec;
00054         double          m_elapsedTime;
00055         double          m_zeroTime;
00056 
00057         bool            m_fullscreen;
00058         bool            m_active;
00059 
00060         bool            m_created;
00061 
00062         static int      m_classRegistered;
00063 
00064         static CIvfWin32Window* m_self;
00065 
00066         std::string m_caption;
00067 
00068         bool createWindow();
00069         void destroyWindow();
00070 
00071         LRESULT CALLBACK WndProc(       HWND    hWnd,                   
00072                                                                                 UINT    uMsg,                   
00073                                                                                 WPARAM  wParam,                 
00074                                                                                 LPARAM  lParam);
00075 
00076         double largeToDouble(LARGE_INTEGER &value);
00077 public:
00079         CIvfWin32Window(int X, int Y, int W, int H);
00080 
00082         ~CIvfWin32Window();
00083 
00085         void show();
00086 
00088         void setCaption(const char* caption);
00089 
00091         void setFullscreen(bool flag);
00092 
00094         void setColorBits(int bits);
00095 
00097         HWND getHandle();
00098 
00100         HDC getDC();
00101 
00103         HGLRC getRC();
00104 
00106         void setActive(bool flag);
00107 
00108         virtual void doDestroy();
00109         virtual void doRedraw();
00110         virtual void doEnableTimeout(float time, int nbr);
00111         virtual void doDisableTimeout(int nbr);
00112         virtual void doDisableIdleProcessing();
00113         virtual void doEnableIdleProcessing();
00114         virtual double doElapsedTime();
00115 };
00116 
00117 #endif

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