diff --git a/modules/gfx/pymod/CMakeLists.txt b/modules/gfx/pymod/CMakeLists.txt index 71c9ac3d7ceb3e1b1f63aa5b255ea63170eac414..9cf5614851a11d7eb449e88f2a5b075352d9a6c5 100644 --- a/modules/gfx/pymod/CMakeLists.txt +++ b/modules/gfx/pymod/CMakeLists.txt @@ -10,6 +10,7 @@ set(OST_GFX_PYMOD_SOURCES export_scene_observer.cc export_render_options.cc export_color_ops.cc + export_glwin_base.cc ) if (ENABLE_IMG) diff --git a/modules/gfx/pymod/export_glwin_base.cc b/modules/gfx/pymod/export_glwin_base.cc new file mode 100644 index 0000000000000000000000000000000000000000..d19983bce346616ab868938e3bd399d5186deeca --- /dev/null +++ b/modules/gfx/pymod/export_glwin_base.cc @@ -0,0 +1,39 @@ +//------------------------------------------------------------------------------ +// This file is part of the OpenStructure project <www.openstructure.org> +// +// Copyright (C) 2008-2010 by the OpenStructure authors +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License as published by the Free +// Software Foundation; either version 3.0 of the License, or (at your option) +// any later version. +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +// details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this library; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +//------------------------------------------------------------------------------ +#include <boost/python.hpp> + +#include <ost/gfx/glwin_base.hh> + +#include "glwin_base_proxy.hh" + +using namespace boost::python; + +using namespace ost; +using namespace ost::gfx; + +void export_GLWinBase() +{ + class_<GLWinBase, GLWinBaseProxy, boost::noncopyable>("GLWinBase", no_init) + .def("DoRefresh",&GLWinBase::DoRefresh) + .def("StatusMessage",&GLWinBase::StatusMessage) + ; +} + + + diff --git a/modules/gfx/pymod/glwin_base_proxy.hh b/modules/gfx/pymod/glwin_base_proxy.hh new file mode 100644 index 0000000000000000000000000000000000000000..9db17b5450a69bdf17451e6351c46772abadefdf --- /dev/null +++ b/modules/gfx/pymod/glwin_base_proxy.hh @@ -0,0 +1,36 @@ +#ifndef OST_GFX_GLWIN_BASE_PROXY_HH +#define OST_GFX_GLWIN_BASE_PROXY_HH + +#include <boost/python.hpp> +#include <boost/python/register_ptr_to_python.hpp> + +using namespace boost::python; + +#include <ost/gfx/glwin_base.hh> + +using namespace ost; +using namespace ost::gfx; + +namespace { + +class GLWinBaseProxy: public GLWinBase { +public: + GLWinBaseProxy(PyObject *p) : + self(p) { + } + + virtual void DoRefresh() { + call_method<void>(self, "DoRefresh"); + } + + virtual void StatusMessage(const String& m) { + call_method<void, const String>(self, "StatusMessage", m); + } + +private: + PyObject* self; +}; + +} + +#endif diff --git a/modules/gfx/pymod/wrap_gfx.cc b/modules/gfx/pymod/wrap_gfx.cc index fe43b8d9c2502afd7edff625a297c81c7d474aac..974d780707d0576e7e9cd0377c1bd8e637411dee 100644 --- a/modules/gfx/pymod/wrap_gfx.cc +++ b/modules/gfx/pymod/wrap_gfx.cc @@ -42,6 +42,8 @@ extern void export_RenderOptions(); extern void export_ColorOps(); +extern void export_GLWinBase(); + using namespace ost; using namespace ost::gfx; @@ -77,6 +79,7 @@ BOOST_PYTHON_MODULE(_gfx) export_SymmetryNode(); export_SceneObserver(); export_ColorOps(); + export_GLWinBase(); enum_<RenderMode::Type>("RenderMode") .value("SIMPLE",RenderMode::SIMPLE)