13
0

Adds a tooltip to the icon

This commit is contained in:
Mathias Buhr 2016-03-08 09:14:50 +01:00 committed by Paul Davis
parent 1375c454fb
commit 720c68d7e1
3 changed files with 12 additions and 8 deletions

View File

@ -68,7 +68,7 @@ KeyEditor::KeyEditor ()
: ArdourWindow (_("Key Bindings")) : ArdourWindow (_("Key Bindings"))
, unbind_button (_("Remove shortcut")) , unbind_button (_("Remove shortcut"))
, unbind_box (BUTTONBOX_END) , unbind_box (BUTTONBOX_END)
, filter_entry (_("Search...")) , filter_entry (_("Search..."), true)
, filter_string("") , filter_string("")
, sort_column(0) , sort_column(0)
, sort_type(Gtk::SORT_ASCENDING) , sort_type(Gtk::SORT_ASCENDING)
@ -80,6 +80,7 @@ KeyEditor::KeyEditor ()
Glib::RefPtr<Gdk::Pixbuf> icon = ARDOUR_UI_UTILS::get_icon ("search"); Glib::RefPtr<Gdk::Pixbuf> icon = ARDOUR_UI_UTILS::get_icon ("search");
filter_entry.set_icon_from_pixbuf (icon); filter_entry.set_icon_from_pixbuf (icon);
filter_entry.set_icon_tooltip_text (_("Click to reset search string"));
filter_entry.signal_search_string_updated ().connect (sigc::mem_fun (*this, &KeyEditor::search_string_updated)); filter_entry.signal_search_string_updated ().connect (sigc::mem_fun (*this, &KeyEditor::search_string_updated));
vpacker.pack_start (filter_entry, false, false); vpacker.pack_start (filter_entry, false, false);

View File

@ -8,8 +8,11 @@ namespace Gtkmm2ext {
class SearchBar : public Gtk::Entry class SearchBar : public Gtk::Entry
{ {
public: public:
SearchBar(const std::string& placeholder_text = "Search...", bool icon_click_resets = true); SearchBar(
const std::string& placeholder_text = "Search...",
bool icon_click_resets = true);
// resets the searchbar to the initial state
void reset (); void reset ();
// emitted when the filter has been updated // emitted when the filter has been updated
sigc::signal<void, const std::string&> signal_search_string_updated () { return sig_search_string_updated; } sigc::signal<void, const std::string&> signal_search_string_updated () { return sig_search_string_updated; }

View File

@ -64,12 +64,12 @@ SearchBar::key_press_event (GdkEventKey* ev)
void void
SearchBar::icon_clicked_event (Gtk::EntryIconPosition, const GdkEventButton*) SearchBar::icon_clicked_event (Gtk::EntryIconPosition, const GdkEventButton*)
{ {
if (icon_click_resets) { if (icon_click_resets) {
reset (); reset ();
} }
else { else {
search_string_changed (); search_string_changed ();
} }
} }
void void