summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext/gtk_ui.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-09 00:50:24 +0000
committerDavid Robillard <d@drobilla.net>2010-02-09 00:50:24 +0000
commitb5148d93d5a9e6949f82f8685cab50cb772f2b9d (patch)
treedc83d91573d30819adb9bb2dd91ff13d0a20addf /libs/gtkmm2ext/gtk_ui.cc
parent535d60237486e2227d22e5febbcfbf868abb11e3 (diff)
Add keyboard shortcut to tooltip text where possible.
git-svn-id: svn://localhost/ardour2/branches/3.0@6657 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext/gtk_ui.cc')
-rw-r--r--libs/gtkmm2ext/gtk_ui.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc
index 318dedd1fc..f7fbd04459 100644
--- a/libs/gtkmm2ext/gtk_ui.cc
+++ b/libs/gtkmm2ext/gtk_ui.cc
@@ -38,6 +38,7 @@
#include <gtkmm2ext/popup.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/window_title.h>
+#include <gtkmm2ext/actions.h>
#include "i18n.h"
@@ -298,16 +299,39 @@ UI::touch_display (Touchable *display)
}
void
+UI::set_tip (Widget &w, const gchar *tip)
+{
+ set_tip(&w, tip, "");
+}
+
+void
+UI::set_tip (Widget &w, const std::string& tip)
+{
+ set_tip(&w, tip.c_str(), "");
+}
+
+void
UI::set_tip (Widget *w, const gchar *tip, const gchar *hlp)
{
UIRequest *req = get_request (SetTip);
+ std::string msg(tip);
+
+ Glib::RefPtr<Gtk::Action> action = w->get_action();
+ if (action) {
+ Gtk::AccelKey key;
+ bool has_key = ActionManager::lookup_entry(action->get_accel_path(), key);
+ if (has_key && key.get_abbrev() != "") {
+ msg.append("\n\n Key: ").append(key.get_abbrev());
+ }
+ }
+
if (req == 0) {
return;
}
req->widget = w;
- req->msg = tip;
+ req->msg = msg.c_str();
req->msg2 = hlp;
send_request (req);