From c961b6eba7ceae26a181abb619402ee46bfcbcb2 Mon Sep 17 00:00:00 2001 From: stefan <stefan@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Thu, 11 Mar 2010 13:51:41 +0000 Subject: [PATCH] boost export for glwin_base git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1810 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- modules/gfx/pymod/CMakeLists.txt | 1 + modules/gfx/pymod/export_glwin_base.cc | 39 ++++++++++++++++++++++++++ modules/gfx/pymod/glwin_base_proxy.hh | 36 ++++++++++++++++++++++++ modules/gfx/pymod/wrap_gfx.cc | 3 ++ 4 files changed, 79 insertions(+) create mode 100644 modules/gfx/pymod/export_glwin_base.cc create mode 100644 modules/gfx/pymod/glwin_base_proxy.hh diff --git a/modules/gfx/pymod/CMakeLists.txt b/modules/gfx/pymod/CMakeLists.txt index 71c9ac3d7..9cf561485 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 000000000..d19983bce --- /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 000000000..9db17b545 --- /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 fe43b8d9c..974d78070 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) -- GitLab