00001 // *************************************************************************** 00002 // This program is free software; you can redistribute it and/or modify 00003 // it under the terms of the GNU General Public License as published by 00004 // the Free Software Foundation; either version 2 of the License, or 00005 // (at your option) any later version. 00006 // 00007 // This program is distributed in the hope that it will be useful, 00008 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 // GNU General Public License for more details. 00011 // 00012 // You should have received a copy of the GNU General Public License 00013 // along with this program; if not, write to the Free Software 00014 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00015 // 00016 // (C) Copyright 2000-2002 Morgan Leborgne 00017 // 00018 // Contact: http://morgan.leborgne.free.fr 00019 // mailto: morgan.leborgne@free.fr 00020 // *************************************************************************** 00021 #ifndef _SORENDERAREA_H_ 00022 #define _SORENDERAREA_H_ 00023 00024 class SoTempPath; 00025 #include <Inventor/nodes/SoNode.h> 00026 #include <Inventor/SoSceneManager.h> 00027 #include <Inventor/actions/SoGLRenderAction.h> 00028 #include <Inventor/events/SoMouseButtonEvent.h> 00029 #include <Inventor/events/SoKeyboardEvent.h> 00030 #include <Inventor/events/SoLocation2Event.h> 00031 00032 //The SoWheelEvent class contains parameters that describe a mouse wheel event. 00033 class SoWheelEvent : public SoEvent 00034 { 00035 SO_EVENT_HEADER(); 00036 public: 00037 SoWheelEvent(){} 00038 00039 void setDelta(int delta){ m_delta = delta; } 00040 int getDelta() const{ return m_delta; } 00041 private: 00042 int m_delta; 00043 }; 00044 00045 class SoRenderArea 00046 { 00047 public: 00048 SoRenderArea(); 00049 virtual ~SoRenderArea(); 00050 00052 void setTransparencyType(SoGLRenderAction::TransparencyType a_type); 00053 00055 virtual void setSceneGraph(SoNode * a_new_scene); 00056 00058 virtual SoNode * getSceneGraph(){ return m_p_scene_manager->getSceneGraph();} 00059 00061 virtual void setBackgroundColor(const SbColor & a_color){ m_p_scene_manager->setBackgroundColor(a_color); } 00062 00064 const SbColor & getBackgroundColor() const { return m_p_scene_manager->getBackgroundColor(); } 00065 00067 SoSceneManager * getSceneManager(){ return m_p_scene_manager; } 00068 00070 void setViewportRegion(const SbViewportRegion & a_region) { m_p_scene_manager->getGLRenderAction()->setViewportRegion(a_region); } 00071 00073 const SbViewportRegion & getViewportRegion() const { return m_p_scene_manager->getGLRenderAction()->getViewportRegion(); } 00074 00075 protected: 00076 virtual void soKeyPressEvent( SoKeyboardEvent * e); 00077 virtual void soKeyReleaseEvent( SoKeyboardEvent * e ); 00078 virtual void soMouseMoveEvent( SoLocation2Event * e ); 00079 virtual void soMousePressEvent( SoMouseButtonEvent * e ); 00080 virtual void soMouseReleaseEvent( SoMouseButtonEvent * e ); 00081 virtual void soWheelEvent( SoWheelEvent * e ); 00082 virtual void soRenderCallback() = 0; 00083 virtual void soResizeEvent(int width, int height); 00084 virtual void soPaintEvent(); 00085 00086 SoSceneManager * m_p_scene_manager; 00087 SoKeyboardEvent * m_keyboard_event; 00088 SoMouseButtonEvent * m_mouse_button_event; 00089 SoLocation2Event * m_location_event; 00090 SoWheelEvent * m_wheel_event; 00091 00092 static void renderCallback(void *userData, SoSceneManager *mgr); 00093 }; 00094 00095 #endif // _SORENDERAREA_H_