(Source List) RegionFactory should return an empty region here.
[ardour.git] / libs / widgets / widgets / searchbar.h
1 #pragma once
2
3 #include <gtkmm/entry.h>
4 #include <string>
5
6 #include "widgets/visibility.h"
7
8 namespace ArdourWidgets {
9
10 class LIBWIDGETS_API SearchBar : public Gtk::Entry
11 {
12 public:
13         SearchBar (
14                 const std::string& placeholder_text = "Search...",
15                 bool icon_click_resets = true);
16
17         /** resets the searchbar to the initial state */
18         void reset ();
19
20         /* emitted when the filter has been updated */
21         sigc::signal<void, const std::string&> signal_search_string_updated () { return sig_search_string_updated; }
22
23 protected:
24         bool focus_in_event (GdkEventFocus*);
25         bool focus_out_event (GdkEventFocus*);
26
27         bool key_press_event (GdkEventKey*);
28         void icon_clicked_event (Gtk::EntryIconPosition, const GdkEventButton*);
29
30         const std::string placeholder_text;
31         sigc::signal<void, const std::string&> sig_search_string_updated;
32
33 private:
34         void search_string_changed () const;
35
36         Glib::RefPtr<Gdk::Pixbuf> icon;
37         bool icon_click_resets;
38 };
39
40 } /* end namespace */