Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkImageViewerWindow.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkImageViewerWindow.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/10/17 01:54:56 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012   Portions of this code are covered under the VTK copyright.
00013   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
00014 
00015      This software is distributed WITHOUT ANY WARRANTY; without even 
00016      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00017      PURPOSE.  See the above copyright notices for more information.
00018 
00019 =========================================================================*/
00020 #ifndef __itkImageViewerWindow_h
00021 #define __itkImageViewerWindow_h
00022 
00023 #include "itkGlutMaster.h"
00024 
00025 namespace itk
00026 {
00027 
00028 
00029   
00030 
00037 class ImageViewerWindow : public GlutWindow {
00038 public:
00039 
00040    ImageViewerWindow( int setWidth, 
00041                       int setHeight,
00042                       int setInitPositionX, 
00043                       int setInitPositionY,
00044                       const char * title);
00045 
00046    virtual ~ImageViewerWindow();
00047 
00048    virtual void CallBackDisplayFunc(void);
00049    virtual void CallBackReshapeFunc(int w, int h);   
00050    virtual void CallBackKeyboardFunc(unsigned char key, int x, int y);
00051    virtual void CallBackMouseFunc(int button, int state, int x, int y);
00052 
00053    virtual void SetBufferSize( int w, int h );
00054    virtual void SetWindowSize( int w, int h );
00055    virtual void SetWindowPosition( int x, int y );
00056    virtual void SetWindowTitle( const char * title );
00057 
00060    static void StartInteraction();
00061 
00062    typedef unsigned char BufferPixelType;
00063 
00064    BufferPixelType * GetBuffer();
00065 
00066    unsigned char GetLastKeyPressed()    const;
00067    int           GetLastKeyModifiers()  const;
00068    int           GetLastMouseButton()   const;
00069    int           GetLastMouseState()    const;
00070    int           GetLastMousePositionX() const;
00071    int           GetLastMousePositionY() const;
00072 
00074   itkEventMacro( UserInteractionEvent  , AnyEvent );
00075   itkEventMacro( KeyPressedEvent       , UserInteractionEvent );
00076   itkEventMacro( MouseEvent            , UserInteractionEvent );
00077   itkEventMacro( ResizeWindowEvent     , UserInteractionEvent );
00078 
00080   unsigned long AddObserver(const EventObject & event, Command *);
00081 
00082 private:
00083 
00084   int  m_Width;
00085   int  m_Height;
00086   int  m_InitialPositionX;
00087   int  m_InitialPositionY;
00088 
00089   static GlutMaster::Pointer  m_GlutMaster; // singleton
00090 
00091   BufferPixelType * m_Buffer;
00092 
00093   // Helper class for invoking events. This is needed because
00094   // ImageViewerWindow itself does not derives from an itk::Object.
00095   Object::Pointer   m_Notifier;
00096 
00097   
00098   // State variables to be queried by the viewer after callbacks.
00099   unsigned char     m_LastKeyPressed;
00100   int               m_LastKeyModifiers;
00101   int               m_LastMouseButton;
00102   int               m_LastMouseState;
00103   int               m_LastMousePositionX;
00104   int               m_LastMousePositionY;
00105   
00106 };
00107 
00108 } // end namespace itk
00109 
00110 
00111 #endif

Generated at Fri May 21 01:14:57 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000