00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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;
00090
00091 BufferPixelType * m_Buffer;
00092
00093
00094
00095 Object::Pointer m_Notifier;
00096
00097
00098
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 }
00109
00110
00111 #endif