3 using bytex64.WebThing;
5 public class QuickSearch : WebThingPlugin {
9 public override void Init(WebThing wt) {
10 SearchEntry = new Gtk.Entry();
11 SearchEntry.KeyPressEvent += SearchEntry_KeyPress;
12 SearchEntry.Changed += SearchEntry_Changed;
13 SearchEntry.Activated += SearchEntry_Activated;
14 wt.AttachWidget(SearchEntry, AttachPoint.S, AttachOptions.Fill, AttachOptions.Shrink);
16 wt.Window.KeyPressEvent += Window_KeyPress;
20 private void Window_KeyPress(object o, Gtk.KeyPressEventArgs e) {
21 if (e.Event.State == Gdk.ModifierType.None &&
22 e.Event.Key == Gdk.Key.slash) {
24 SearchEntry.GrabFocus();
28 private void SearchEntry_Changed(object o, EventArgs e) {
29 Console.WriteLine("Search {0}", SearchEntry.Text);
30 wt.WebView.SearchText(SearchEntry.Text, false, true, true);
33 private void SearchEntry_Activated(object o, EventArgs e) {
35 wt.WebView.GrabFocus();
38 private void SearchEntry_KeyPress(object o, Gtk.KeyPressEventArgs e) {
39 if ((e.Event.State & Gdk.ModifierType.ControlMask) != 0) {
42 wt.WebView.SearchText(SearchEntry.Text, false, true, true);
50 wt.WebView.GrabFocus();