SoRenderArea.h

Go to the documentation of this file.
00001 /*
00002 _______________________________________________________________________
00003 __________________________ G E O M E T R Y ____________________________
00004 |
00005 | THIS FILE IS PART OF THE SOVIEWER LIBRARY.
00006 | USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     
00007 | GOVERNED BY A BSD-STYLE SOURCE LICENSE.
00008 | PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       
00009 _______________________________________________________________________
00010 _______________________________________________________________________
00011 */
00012 #ifndef _SORENDERAREA_H_
00013 #define _SORENDERAREA_H_
00014 
00015 #ifdef _WIN32
00016 #  ifdef SOVIEWER_DLL
00017 #     define SOVIEWER_API __declspec(dllexport)
00018 #  else
00019 #     define SOVIEWER_API __declspec(dllimport)
00020 #endif
00021 #else
00022 #   define SOVIEWER_API 
00023 #endif
00024 
00025 class SoTempPath;
00026 #include <Inventor/nodes/SoNode.h>
00027 #include <Inventor/SoSceneManager.h> 
00028 #include <Inventor/actions/SoGLRenderAction.h>
00029 #include <Inventor/events/SoMouseButtonEvent.h>
00030 #include <Inventor/events/SoKeyboardEvent.h>
00031 #include <Inventor/events/SoLocation2Event.h> 
00032 
00033 //The SoWheelEvent class contains parameters that describe a mouse wheel event.
00034 class SOVIEWER_API SoWheelEvent : public SoEvent
00035 {
00036     SO_EVENT_HEADER();
00037 public:
00038     SoWheelEvent(){}
00039 
00040     void setDelta(int delta){ m_delta = delta; }
00041     int getDelta() const{ return m_delta; }
00042 private:
00043     int m_delta;
00044 };
00045 
00046 class SOVIEWER_API SoRenderArea
00047 {
00048 public:
00049     SoRenderArea();
00050     virtual ~SoRenderArea();
00051 
00053     void setTransparencyType(SoGLRenderAction::TransparencyType a_type);
00054 
00056     virtual void setSceneGraph(SoNode * a_new_scene);
00057 
00059     virtual SoNode * getSceneGraph(){ return m_p_scene_manager->getSceneGraph();}
00060 
00062     virtual void setBackgroundColor(const SbColor & a_color){ m_p_scene_manager->setBackgroundColor(a_color); }
00063 
00065     const SbColor & getBackgroundColor() const { return m_p_scene_manager->getBackgroundColor(); }
00066 
00068     SoSceneManager * getSceneManager(){ return m_p_scene_manager; }
00069 
00071     void setViewportRegion(const SbViewportRegion & a_region) { m_p_scene_manager->getGLRenderAction()->setViewportRegion(a_region); }
00072 
00074     const SbViewportRegion & getViewportRegion() const { return m_p_scene_manager->getGLRenderAction()->getViewportRegion(); }
00075 
00076 protected:
00077     virtual void soKeyPressEvent( SoKeyboardEvent * e);
00078     virtual void soKeyReleaseEvent( SoKeyboardEvent * e );
00079     virtual void soMouseMoveEvent( SoLocation2Event * e );
00080     virtual void soMousePressEvent( SoMouseButtonEvent * e );
00081     virtual void soMouseReleaseEvent( SoMouseButtonEvent * e );
00082     virtual void soWheelEvent( SoWheelEvent * e );
00083     virtual void soRenderCallback() = 0; 
00084     virtual void soResizeEvent(int width, int height);
00085     virtual void soPaintEvent();
00086 
00087     SoSceneManager     * m_p_scene_manager;
00088     SoKeyboardEvent    * m_keyboard_event;
00089     SoMouseButtonEvent * m_mouse_button_event;
00090     SoLocation2Event   * m_location_event;
00091     SoWheelEvent           * m_wheel_event;
00092 
00093     static void renderCallback(void *userData, SoSceneManager *mgr);
00094 };
00095 
00096 #endif // _SORENDERAREA_H_

Generated on Thu May 8 14:30:09 2008 for OpenInventorViewer by  doxygen 1.5.1