diff options
author | David Robillard <d@drobilla.net> | 2015-03-28 09:47:19 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-03-28 09:47:19 +0000 |
commit | c0da1cf368b7d43c9c886b81768b4a62a07fae3f (patch) | |
tree | 83b651a2b680e32b990dd1e1909156aee475a181 /src/gui/URIEntry.hpp | |
parent | d0b4376df39e95cb9389f5c42fc1c2333e8c0c97 (diff) | |
download | ingen-c0da1cf368b7d43c9c886b81768b4a62a07fae3f.tar.gz ingen-c0da1cf368b7d43c9c886b81768b4a62a07fae3f.tar.bz2 ingen-c0da1cf368b7d43c9c886b81768b4a62a07fae3f.zip |
Unify value widgets in properties dialog.
This shows the fancy URI selector for URI properties, and can show
numeric controls for the property-to-add. The ontologies need some
work, along with smarter widget creation, before the latter will
actually be useful.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5648 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui/URIEntry.hpp')
-rw-r--r-- | src/gui/URIEntry.hpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/gui/URIEntry.hpp b/src/gui/URIEntry.hpp new file mode 100644 index 00000000..d8f830d0 --- /dev/null +++ b/src/gui/URIEntry.hpp @@ -0,0 +1,70 @@ +/* + This file is part of Ingen. + Copyright 2015 David Robillard <http://drobilla.net/> + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen 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 Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef INGEN_GUI_URI_ENTRY_HPP +#define INGEN_GUI_URI_ENTRY_HPP + +#include <gtkmm/box.h> +#include <gtkmm/button.h> +#include <gtkmm/entry.h> +#include <gtkmm/menu.h> + +#include "lilv/lilv.h" + +namespace Ingen { +namespace GUI { + +class App; + +class URIEntry : public Gtk::HBox { +public: + /** Create a widget for entering URIs. + * + * If `types` is given, then a menu button will be shown which pops up a + * enu for easily choosing known values with valid types. + */ + URIEntry(App* app, + const std::set<Raul::URI>& types, + const std::string& value); + + std::string get_text() { return _entry->get_text(); } + Glib::SignalProxy0<void> signal_changed() { return _entry->signal_changed(); } + +private: + Gtk::Menu* build_value_menu(); + Gtk::Menu* build_subclass_menu(const LilvNode* klass); + + void add_leaf_menu_item(Gtk::Menu* menu, + const LilvNode* klass, + const std::string& label); + + void add_class_menu_item(Gtk::Menu* menu, + const LilvNode* klass, + const std::string& label); + + void uri_chosen(const std::string& uri); + bool menu_button_event(GdkEvent* ev); + + App* _app; + const std::set<Raul::URI> _types; + Gtk::Button* _menu_button; + Gtk::Entry* _entry; +}; + +} // namespace GUI +} // namespace Ingen + +#endif // INGEN_GUI_URI_ENTRY_HPP |