public StatusBarIcon ShowStatusIcon(Xwt.Drawing.Image pixbuf) { nfloat right = layerToStatus.Count == 0 ? Layer.Frame.Width : Layer.Sublayers.Last(i => i.Name != null && i.Name.StartsWith(StatusIconPrefixId, StringComparison.Ordinal)).Frame.Left; right -= (nfloat)pixbuf.Width + 6; var layer = CALayer.Create(); layer.Name = StatusIconPrefixId + (++statusCounter); layer.Bounds = new CGRect(0, 0, (nfloat)pixbuf.Width, (nfloat)pixbuf.Height); layer.Frame = new CGRect(right, 3, (nfloat)pixbuf.Width, (nfloat)pixbuf.Height); var area = new NSTrackingArea(layer.Frame, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveInKeyWindow, this, null); AddTrackingArea(area); var statusIcon = new StatusIcon(this, layer, area) { Image = pixbuf, }; layerToStatus [layer.Name] = statusIcon; Layer.AddSublayer(layer); textField.SetFrameSize(new CGSize(right - 6 - textField.Frame.Left, Frame.Height)); return(statusIcon); }
internal void RemoveStatusIcon(StatusIcon icon) { statusIcons.Remove(icon); icon.Entered -= ShowPopoverForIcon; icon.Exited -= DestroyPopover; icon.Clicked -= DestroyPopover; RepositionStatusIcons(); }
internal void RemoveStatusIcon(StatusIcon icon) { statusIcons.Remove(icon); icon.Entered -= ShowPopoverForIcon; icon.Exited -= DestroyPopover; icon.Clicked -= DestroyPopover; if (!popoverForStatus && popover != null) { DestroyPopover(null, null); } RepositionStatusIcons(); }
public StatusBarIcon ShowStatusIcon(Xwt.Drawing.Image pixbuf) { var layer = CALayer.Create(); layer.Name = StatusIconPrefixId + (++statusCounter); layer.Bounds = new CGRect(0, 0, (nfloat)pixbuf.Width, (nfloat)pixbuf.Height); var statusIcon = new StatusIcon(this, layer, null) { Image = pixbuf, }; layerToStatus [layer.Name] = statusIcon; Layer.AddSublayer(layer); RepositionStatusLayers(); return(statusIcon); }
public StatusBarIcon ShowStatusIcon(Xwt.Drawing.Image pixbuf) { var statusIcon = new StatusIcon(this) { Image = pixbuf, }; statusIcons.Add(statusIcon); statusIcon.Entered += ShowPopoverForIcon; statusIcon.Exited += DestroyPopover; // We need to destroy the popover otherwise the window doesn't come up correctly statusIcon.Clicked += DestroyPopover; AddSubview(statusIcon); RepositionStatusIcons(); return(statusIcon); }
public StatusBarIcon ShowStatusIcon (Xwt.Drawing.Image pixbuf) { var statusIcon = new StatusIcon (this) { Image = pixbuf, }; statusIcons.Add (statusIcon); statusIcon.Entered += ShowPopoverForIcon; statusIcon.Exited += DestroyPopover; // We need to destroy the popover otherwise the window doesn't come up correctly statusIcon.Clicked += DestroyPopover; AddSubview (statusIcon); RepositionStatusIcons (); return statusIcon; }
internal void RemoveStatusIcon (StatusIcon icon) { statusIcons.Remove (icon); icon.Entered -= ShowPopoverForIcon; icon.Exited -= DestroyPopover; icon.Clicked -= DestroyPopover; RepositionStatusIcons (); }
public StatusBarIcon ShowStatusIcon (Xwt.Drawing.Image pixbuf) { nfloat right = layerToStatus.Count == 0 ? Layer.Frame.Width : Layer.Sublayers.Last (i => i.Name != null && i.Name.StartsWith (StatusIconPrefixId, StringComparison.Ordinal)).Frame.Left; right -= (nfloat)pixbuf.Width + 6; var layer = CALayer.Create (); layer.Name = StatusIconPrefixId + (++statusCounter); layer.Bounds = new CGRect (0, 0, (nfloat)pixbuf.Width, (nfloat)pixbuf.Height); layer.Frame = new CGRect (right, 3, (nfloat)pixbuf.Width, (nfloat)pixbuf.Height); var area = new NSTrackingArea (layer.Frame, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveInKeyWindow, this, null); AddTrackingArea (area); var statusIcon = new StatusIcon (this, layer, area) { Image = pixbuf, }; layerToStatus [layer.Name] = statusIcon; Layer.AddSublayer (layer); textField.SetFrameSize (new CGSize (right - 6 - textField.Frame.Left, Frame.Height)); return statusIcon; }
public StatusBarIcon ShowStatusIcon (Xwt.Drawing.Image pixbuf) { var layer = CALayer.Create (); layer.Name = StatusIconPrefixId + (++statusCounter); layer.Bounds = new CGRect (0, 0, (nfloat)pixbuf.Width, (nfloat)pixbuf.Height); var statusIcon = new StatusIcon (this, layer, null) { Image = pixbuf, }; layerToStatus [layer.Name] = statusIcon; Layer.AddSublayer (layer); RepositionStatusLayers (); return statusIcon; }