Implements filtering in bindings editor
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / searchbar.h
1 #pragma once
2
3 #include <gtkmm/entry.h>
4 #include <string>
5
6 namespace Gtkmm2ext {
7
8 class SearchBar : public Gtk::Entry
9 {
10 public:
11         SearchBar(const std::string& placeholder_text = "Search...", bool icon_click_resets = true);
12
13         void reset ();
14         // emitted when the filter has been updated
15         sigc::signal<void, const std::string&> signal_search_string_updated () { return sig_search_string_updated; }
16 protected:
17         bool focus_in_event (GdkEventFocus*);
18         bool focus_out_event (GdkEventFocus*);
19
20         bool key_press_event (GdkEventKey*);
21         void icon_clicked_event (Gtk::EntryIconPosition, const GdkEventButton*);
22
23         const std::string placeholder_text;
24         sigc::signal<void, const std::string&> sig_search_string_updated;
25 private:
26         void search_string_changed () const;
27
28         Glib::RefPtr<Gdk::Pixbuf> icon;
29         bool icon_click_resets;
30 };
31
32 }