$search
00001 #ifndef WX_OGRE_RENDER_WINDOW_OGRE_RENDER_WINDOW_H_ 00002 #define WX_OGRE_RENDER_WINDOW_OGRE_RENDER_WINDOW_H_ 00003 00004 #include "wx/wx.h" 00005 00006 #include <boost/function.hpp> 00007 00008 namespace Ogre 00009 { 00010 class Root; 00011 class RenderWindow; 00012 class Viewport; 00013 class Camera; 00014 } 00015 00016 namespace ogre_tools 00017 { 00018 00026 class wxOgreRenderWindow : public wxControl { 00027 DECLARE_CLASS (wxOgreRenderWindow) 00028 DECLARE_EVENT_TABLE (); 00029 00030 // Attributes ------------------------------------------------------------------ 00031 protected: 00033 Ogre::RenderWindow* render_window_; 00034 00036 Ogre::Root* ogre_root_; 00037 00039 Ogre::Viewport* viewport_; 00040 00042 static unsigned int sm_NextRenderWindowId; 00043 00044 // Methods --------------------------------------------------------------------- 00045 public: 00054 wxOgreRenderWindow (Ogre::Root* ogre_root, wxWindow* parent, wxWindowID id = wxID_ANY, 00055 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, 00056 long style = wxSUNKEN_BORDER, const wxValidator &validator = wxDefaultValidator, bool create_render_window = true); 00057 00060 virtual ~wxOgreRenderWindow (); 00061 00066 virtual void setPreRenderCallback( boost::function<void ()> func ); 00071 virtual void setPostRenderCallback( boost::function<void ()> func ); 00072 00077 virtual wxSize DoGetBestSize () const; 00078 00082 Ogre::RenderWindow* getRenderWindow () const; 00083 00087 Ogre::Viewport* getViewport() const; 00088 00091 void setCamera( Ogre::Camera* camera ); 00092 00097 void setOrthoScale( float scale ); 00098 00102 void setAutoRender(bool auto_render) { auto_render_ = auto_render; } 00103 00106 virtual void createRenderWindow (); 00107 00111 virtual std::string getOgreHandle () const; 00112 00113 protected: 00117 virtual void onPaint (wxPaintEvent &evt); 00118 00122 virtual void onSize (wxSizeEvent &evt); 00123 00129 virtual void onMouseEvents (wxMouseEvent &evt); 00130 00131 virtual void onMove(wxMoveEvent& evt); 00132 00133 virtual bool Reparent(wxWindowBase* new_parent); 00134 00138 void setCameraAspectRatio(); 00139 00140 boost::function<void ()> pre_render_callback_; 00141 boost::function<void ()> post_render_callback_; 00142 00143 float ortho_scale_; 00144 bool auto_render_; 00145 }; 00146 00147 } // namespace ogre_tools 00148 00149 #endif /*OGRE_RENDER_WINDOW_H_*/