00001 /*************************************************************************** 00002 * Copyright (C) 2008 by Rick L. Vinyard, Jr. * 00003 * rvinyard@cs.nmsu.edu * 00004 * * 00005 * This file is part of the osgGTK library. * 00006 * * 00007 * The osgGTK library is free software; you can redistribute it and/or * 00008 * modify it under the terms of the GNU General Public License * 00009 * version 3 as published by the Free Software Foundation. * 00010 * * 00011 * The osgGTK library is distributed in the hope that it will be * 00012 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * 00013 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this software. If not see <http://www.gnu.org/licenses/>. * 00018 ***************************************************************************/ 00019 #ifndef OSGVIEWERVIEWERGTKMM_H 00020 #define OSGVIEWERVIEWERGTKMM_H 00021 00022 #include <osgViewer/Viewer> 00023 #include <osgGtkmm/GraphicsWindowGtkmm.h> 00024 00079 namespace osgViewer 00080 { 00081 00092 class ViewerGtkmm : public Viewer 00093 { 00094 public: 00095 ViewerGtkmm(); 00096 00097 ViewerGtkmm ( osg::ArgumentParser& arguments ); 00098 00099 ViewerGtkmm ( const osgViewer::Viewer& viewer, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY ); 00100 00102 virtual ~ViewerGtkmm(); 00103 00104 virtual bool isSameKindAs(const osg::Object* object) const; 00105 00106 virtual const char* libraryName() const; 00107 00108 virtual const char* className() const; 00109 00111 GraphicsWindowGtkmm* setup_viewer_in_gtkmm_window(int width, int height); 00112 00118 virtual int run(); 00119 00121 int run_to_frame(int frame_num); 00122 00124 int run_frames(int frames); 00125 00127 virtual void stop(); 00128 00130 bool is_running(); 00131 00133 double fps(); 00134 00145 void set_fps(double fps); 00146 00148 unsigned frame_interval_ms(); 00149 00151 void set_frame_interval_ms(unsigned interval); 00152 00154 int run_priority(); 00155 00157 void set_run_priority( int priority ); 00158 00164 double running_frame_step_rate(); 00165 00167 void set_running_frame_step_rate(double frame_rate); 00168 00170 int get_run_to_frame_number(); 00171 00172 protected: 00173 bool m_is_running; 00174 unsigned m_frame_interval; 00175 int m_run_priority; 00176 double m_frame_step_rate; 00177 int m_run_to_frame_number; 00178 sigc::connection m_timer_connection; 00179 00180 bool on_graphics_window_expose_event(GdkEventExpose* event); 00181 00182 virtual int on_run_step(); 00183 00184 void connect_timer(); 00185 00186 virtual int run_implementation(); 00187 00188 private: 00189 00191 int on_run_step_proxy(); 00192 00193 }; 00194 00195 } 00196 00197 #endif