Fix boost signals (portability)
[ladish.git] / src / Widget.hpp
blob6888318881f0b3f963ab1e17bfeee380b8d79449
1 /* This file is part of Patchage
2 * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
3 *
4 * Patchage is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License as published by the Free
6 * Software Foundation, either version 3 of the License, or (at your option)
7 * any later version.
9 * Patchage is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with Patchage. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef PATCHAGE_WIDGET_HPP
19 #define PATCHAGE_WIDGET_HPP
21 #include <string>
22 #include <boost/utility.hpp>
24 template <typename W>
25 class Widget : public boost::noncopyable {
26 public:
27 Widget(Glib::RefPtr<Gnome::Glade::Xml> xml, const std::string& name) {
28 init(xml, name);
31 Widget()
33 _me = 0;
36 void init(Glib::RefPtr<Gnome::Glade::Xml> xml, const std::string& name)
38 xml->get_widget(name.c_str(), _me);
41 void destroy() { delete _me; }
43 W* get() { return _me; }
44 const W* get() const { return _me; }
45 W* operator->() { return _me; }
46 const W* operator->() const { return _me; }
47 W& operator*() { return *_me; }
48 const W& operator*() const { return *_me; }
50 private:
51 W* _me;
55 #endif // PATCHAGE_WIDGET_HPP