void AttachToolbarEvents (SearchBar bar) { bar.Changed += (o, e) => { if (SearchEntryChanged != null) SearchEntryChanged (o, e); }; bar.KeyPressed += (o, e) => { if (SearchEntryKeyPressed != null) SearchEntryKeyPressed (o, e); }; bar.LostFocus += (o, e) => { if (SearchEntryLostFocus != null) SearchEntryLostFocus (o, e); }; bar.SelectionActivated += (o, e) => { if (SearchEntryActivated != null) SearchEntryActivated (o, e); }; }
public AwesomeBar () { RunButton = new RunButton (); AddSubview (RunButton); SelectorView = new SelectorView (); SelectorView.SizeChanged += (object sender, EventArgs e) => UpdateLayout (); AddSubview (SelectorView); ButtonBarContainer = new ButtonBarContainer (); ButtonBarContainer.SizeChanged += (object sender, EventArgs e) => UpdateLayout (); AddSubview (ButtonBarContainer); StatusBar = new StatusBar (); AddSubview (StatusBar); SearchBar = new SearchBar (); AddSubview (SearchBar); }
NSToolbarItem CreateSearchBarToolbarItem () { var bar = new SearchBar (); // Remove the focus from the Gtk system when Cocoa has focus // Fixes BXC #29601 bar.GainedFocus += (o, e) => IdeApp.Workbench.RootWindow.Focus = null; viewCache.Add (bar); var item = new NSToolbarItem (SearchBarId) { View = bar, MinSize = new CGSize (150, bar.FittingSize.Height), MaxSize = new CGSize (270, bar.FittingSize.Height), }; AttachToolbarEvents (bar); return item; }
void AttachToolbarEvents (SearchBar bar) { if (bar.EventsAttached) return; bar.Changed += (o, e) => { bar.LogMessage("Text changed"); if (SearchEntryChanged != null) SearchEntryChanged (o, e); }; bar.KeyPressed += (o, e) => { if (SearchEntryKeyPressed != null) SearchEntryKeyPressed (o, e); }; bar.LostFocus += (o, e) => { if (SearchEntryLostFocus != null) SearchEntryLostFocus (o, e); }; bar.SelectionActivated += (o, e) => { if (SearchEntryActivated != null) SearchEntryActivated (o, e); }; bar.EventsAttached = true; }
NSToolbarItem CreateSearchBarToolbarItem () { var bar = new SearchBar (); viewCache.Add (bar); var menuBar = new SearchBar { Frame = new CGRect (0, 0, 180, bar.FittingSize.Height), }; var item = new NSToolbarItem (SearchBarId) { View = bar, MenuFormRepresentation = new NSMenuItem { View = menuBar, }, MinSize = new CGSize (180, bar.FittingSize.Height), MaxSize = new CGSize (270, bar.FittingSize.Height), }; AttachToolbarEvents (bar); return item; }