summaryrefslogtreecommitdiffstats
path: root/src/Widget.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-12-20 02:04:55 +0000
committerDavid Robillard <d@drobilla.net>2007-12-20 02:04:55 +0000
commit07115ad5e6fa4af82b4efd06ce1d3f60cc2d07bb (patch)
tree7b9ddcdb3491f6e9332eb5a561afbdfe60361f13 /src/Widget.hpp
parent46452c287cdc4b12c30589a8f877f3ab7359265b (diff)
downloadpatchage-07115ad5e6fa4af82b4efd06ce1d3f60cc2d07bb.tar.gz
patchage-07115ad5e6fa4af82b4efd06ce1d3f60cc2d07bb.tar.bz2
patchage-07115ad5e6fa4af82b4efd06ce1d3f60cc2d07bb.zip
Use fancy Widget class for Glade widgets.
Somewhat consistently rename glade widgets. Fix about dialog program name, icon (when run from source tree), and close button. git-svn-id: http://svn.drobilla.net/lad/patchage@989 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/Widget.hpp')
-rw-r--r--src/Widget.hpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/Widget.hpp b/src/Widget.hpp
new file mode 100644
index 0000000..ea8a218
--- /dev/null
+++ b/src/Widget.hpp
@@ -0,0 +1,42 @@
+/* This file is part of Patchage
+ * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
+ *
+ * Patchage is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * Patchage 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 General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with Patchage. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef WIDGET_HPP
+#define WIDGET_HPP
+
+#include <string>
+#include <boost/utility.hpp>
+
+template <typename W>
+class Widget : public boost::noncopyable {
+public:
+ Widget(Glib::RefPtr<Gnome::Glade::Xml> xml, const std::string& name) {
+ xml->get_widget(name.c_str(), _me);
+ }
+
+ W* get() { return _me; }
+ const W* get() const { return _me; }
+ W* operator->() { return _me; }
+ const W* operator->() const { return _me; }
+ W& operator*() { return *_me; }
+ const W& operator*() const { return *_me; }
+
+private:
+ W* _me;
+};
+
+#endif // WIDGET_HPP