public StatusIcon (StatusBar bar) : base (CGRect.Empty) { imageView = new NSImageView (CGRect.Empty); AddSubview (imageView); var trackingArea = new NSTrackingArea (CGRect.Empty, NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.InVisibleRect | NSTrackingAreaOptions.MouseEnteredAndExited, this, null); AddTrackingArea (trackingArea); this.bar = bar; }
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 CreateStatusBarToolbarItem () { var bar = new StatusBar (); viewCache.Add (bar); var item = new NSToolbarItem (StatusBarId) { View = bar, // Place some temporary values in there. MinSize = new CGSize (360, 22), MaxSize = new CGSize (360, 22), }; Action<NSNotification> resizeAction = notif => DispatchService.GuiDispatch (() => { // Skip updates with a null Window. Only crashes on Mavericks. // The View gets updated once again when the window resize finishes. if (bar.Window == null) return; // We're getting notified about all windows in the application (for example, NSPopovers) that change size when really we only care about // the window the bar is in. if (notif.Object != bar.Window) return; double maxSize = Math.Round (bar.Window.Frame.Width * 0.30f); double minSize = Math.Round (bar.Window.Frame.Width * 0.25f); item.MinSize = new CGSize ((nfloat)Math.Max (220, minSize), 22); item.MaxSize = new CGSize ((nfloat)Math.Min (700, maxSize), 22); bar.RepositionStatusLayers (); }); NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, resizeAction); NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidEndLiveResizeNotification, resizeAction); return item; }
public StatusIcon (StatusBar bar, CALayer layer, NSTrackingArea trackingArea) { this.bar = bar; this.layer = layer; TrackingArea = trackingArea; }
NSToolbarItem CreateStatusBarToolbarItem () { var bar = new StatusBar (); viewCache.Add (bar); var item = new NSToolbarItem (StatusBarId) { View = bar, // Place some temporary values in there. MinSize = new CGSize (360, 22), MaxSize = new CGSize (360, 22), }; NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notif => DispatchService.GuiDispatch (() => { // Skip updates with a null Window. Only crashes on Mavericks. // The View gets updated once again when the window resize finishes. if (bar.Window == null) return; double maxSize = Math.Round (bar.Window.Frame.Width * 0.30f); double minSize = Math.Round (bar.Window.Frame.Width * 0.25f); item.MinSize = new CGSize ((nfloat)Math.Max (280, minSize), 22); item.MaxSize = new CGSize ((nfloat)Math.Min (700, maxSize), 22); bar.RepositionStatusLayers (); })); return item; }
public override void MouseUp(NSEvent theEvent) { NotifyClicked(StatusBar.NSEventButtonToXwt(theEvent)); }
public StatusIcon(StatusBar bar, CALayer layer, NSTrackingArea trackingArea) { this.bar = bar; this.layer = layer; TrackingArea = trackingArea; }